From 1f0b6c1f895d189fea6999d0c07a7fee936a4baa Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Fri, 31 Oct 1997 06:07:47 +0000 Subject: [PATCH] Many files: Rename new error codes to have _ET_ in them for consistency. --- lib/ext2fs/ChangeLog | 4 ++++ lib/ext2fs/alloc.c | 6 +++--- lib/ext2fs/bmove.c | 2 +- lib/ext2fs/brel_ma.c | 8 ++++---- lib/ext2fs/closefs.c | 2 +- lib/ext2fs/dblist.c | 2 +- lib/ext2fs/fileio.c | 4 ++-- lib/ext2fs/get_pathname.c | 2 +- lib/ext2fs/icount.c | 24 ++++++++++++------------ lib/ext2fs/initialize.c | 4 ++-- lib/ext2fs/inode.c | 2 +- lib/ext2fs/irel_ma.c | 16 ++++++++-------- lib/ext2fs/llseek.c | 2 +- lib/ext2fs/lookup.c | 2 +- lib/ext2fs/mkdir.c | 4 ++-- lib/ext2fs/openfs.c | 2 +- lib/ext2fs/rs_bitmap.c | 6 +++--- lib/ext2fs/test_io.c | 2 +- 18 files changed, 49 insertions(+), 45 deletions(-) diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog index 9102d0bc..60086a0a 100644 --- a/lib/ext2fs/ChangeLog +++ b/lib/ext2fs/ChangeLog @@ -1,3 +1,7 @@ +Thu Oct 30 11:33:57 1997 Theodore Ts'o + + * Rename new error codes to _ET_ in them for consistency. + Sat Oct 25 00:06:58 1997 Theodore Ts'o * [all files, basically]: Added definition of ext2fs_get_mem, diff --git a/lib/ext2fs/alloc.c b/lib/ext2fs/alloc.c index 104d4685..123860c9 100644 --- a/lib/ext2fs/alloc.c +++ b/lib/ext2fs/alloc.c @@ -65,7 +65,7 @@ errcode_t ext2fs_new_inode(ext2_filsys fs, ino_t dir, int mode, } while (i != start_inode); if (ext2fs_test_inode_bitmap(map, i)) - return EXT2_INODE_ALLOC_FAIL; + return EXT2_ET_INODE_ALLOC_FAIL; *ret = i; return 0; } @@ -97,7 +97,7 @@ errcode_t ext2fs_new_block(ext2_filsys fs, blk_t goal, if (i >= fs->super->s_blocks_count) i = fs->super->s_first_data_block; } while (i != goal); - return EXT2_BLOCK_ALLOC_FAIL; + return EXT2_ET_BLOCK_ALLOC_FAIL; } /* @@ -175,6 +175,6 @@ errcode_t ext2fs_get_free_blocks(ext2_filsys fs, blk_t start, blk_t finish, } b++; } while (b != finish); - return EXT2_BLOCK_ALLOC_FAIL; + return EXT2_ET_BLOCK_ALLOC_FAIL; } diff --git a/lib/ext2fs/bmove.c b/lib/ext2fs/bmove.c index 48408213..69722579 100644 --- a/lib/ext2fs/bmove.c +++ b/lib/ext2fs/bmove.c @@ -53,7 +53,7 @@ static int process_block(ext2_filsys fs, blk_t *block_nr, if (++block >= fs->super->s_blocks_count) block = fs->super->s_first_data_block; if (block == orig) { - pb->error = EXT2_BLOCK_ALLOC_FAIL; + pb->error = EXT2_ET_BLOCK_ALLOC_FAIL; return BLOCK_ABORT; } } while (ext2fs_test_block_bitmap(pb->reserve, block) || diff --git a/lib/ext2fs/brel_ma.c b/lib/ext2fs/brel_ma.c index ba44ce24..3f82a29d 100644 --- a/lib/ext2fs/brel_ma.c +++ b/lib/ext2fs/brel_ma.c @@ -109,7 +109,7 @@ static errcode_t bma_put(ext2_brel brel, blk_t old, ma = brel->private; if (old > ma->max_block) - return EXT2_INVALID_ARGUMENT; + return EXT2_ET_INVALID_ARGUMENT; ma->entries[(unsigned)old] = *ent; return 0; } @@ -121,7 +121,7 @@ static errcode_t bma_get(ext2_brel brel, blk_t old, ma = brel->private; if (old > ma->max_block) - return EXT2_INVALID_ARGUMENT; + return EXT2_ET_INVALID_ARGUMENT; if (ma->entries[(unsigned)old].new == 0) return ENOENT; *ent = ma->entries[old]; @@ -157,7 +157,7 @@ static errcode_t bma_move(ext2_brel brel, blk_t old, blk_t new) ma = brel->private; if ((old > ma->max_block) || (new > ma->max_block)) - return EXT2_INVALID_ARGUMENT; + return EXT2_ET_INVALID_ARGUMENT; if (ma->entries[(unsigned)old].new == 0) return ENOENT; ma->entries[(unsigned)new] = ma->entries[old]; @@ -171,7 +171,7 @@ static errcode_t bma_delete(ext2_brel brel, blk_t old) ma = brel->private; if (old > ma->max_block) - return EXT2_INVALID_ARGUMENT; + return EXT2_ET_INVALID_ARGUMENT; if (ma->entries[(unsigned)old].new == 0) return ENOENT; ma->entries[(unsigned)old].new = 0; diff --git a/lib/ext2fs/closefs.c b/lib/ext2fs/closefs.c index 6ef9706c..4a880e8a 100644 --- a/lib/ext2fs/closefs.c +++ b/lib/ext2fs/closefs.c @@ -70,7 +70,7 @@ errcode_t ext2fs_flush(ext2_filsys fs) fs->super->s_wtime = time(NULL); if (fs->flags & EXT2_FLAG_SWAP_BYTES) { - retval = EXT2_NO_MEMORY; + retval = EXT2_ET_NO_MEMORY; retval = ext2fs_get_mem(SUPERBLOCK_SIZE, (void **) &super_shadow); if (retval) diff --git a/lib/ext2fs/dblist.c b/lib/ext2fs/dblist.c index dd4993ab..cdf1bef2 100644 --- a/lib/ext2fs/dblist.c +++ b/lib/ext2fs/dblist.c @@ -191,7 +191,7 @@ errcode_t ext2fs_set_dir_block(ext2_dblist dblist, ino_t ino, blk_t blk, dblist->sorted = 0; return 0; } - return EXT2_DB_NOT_FOUND; + return EXT2_ET_DB_NOT_FOUND; } /* diff --git a/lib/ext2fs/fileio.c b/lib/ext2fs/fileio.c index 9165826d..ffb11ef8 100644 --- a/lib/ext2fs/fileio.c +++ b/lib/ext2fs/fileio.c @@ -212,7 +212,7 @@ errcode_t ext2fs_file_write(ext2_file_t file, void *buf, fs = file->fs; if (!(file->flags & EXT2_FILE_WRITE)) - return EXT2_FILE_RO; + return EXT2_ET_FILE_RO; again: b = file->pos / fs->blocksize; @@ -274,7 +274,7 @@ errcode_t ext2fs_file_llseek(ext2_file_t file, ext2_off_t offset, else if (whence == EXT2_SEEK_END) file->pos = file->inode.i_size + offset; else - return EXT2_INVALID_ARGUMENT; + return EXT2_ET_INVALID_ARGUMENT; if (ret_pos) *ret_pos = file->pos; diff --git a/lib/ext2fs/get_pathname.c b/lib/ext2fs/get_pathname.c index 9b5ce261..baa9af88 100644 --- a/lib/ext2fs/get_pathname.c +++ b/lib/ext2fs/get_pathname.c @@ -57,7 +57,7 @@ static int get_pathname_proc(struct ext2_dir_entry *dirent, retval = ext2fs_get_mem(dirent->name_len + 1, (void **) &gp->name); if (!gp->name) { - gp->errcode = EXT2_NO_MEMORY; + gp->errcode = EXT2_ET_NO_MEMORY; return DIRENT_ABORT; } strncpy(gp->name, dirent->name, dirent->name_len); diff --git a/lib/ext2fs/icount.c b/lib/ext2fs/icount.c index f321e68c..56e50139 100644 --- a/lib/ext2fs/icount.c +++ b/lib/ext2fs/icount.c @@ -280,14 +280,14 @@ errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *out) if (icount->count > icount->size) { fprintf(out, "%s: count > size\n", bad); - return EXT2_INVALID_ARGUMENT; + return EXT2_ET_INVALID_ARGUMENT; } for (i=1; i < icount->count; i++) { if (icount->list[i-1].ino >= icount->list[i].ino) { fprintf(out, "%s: list[%d].ino=%ld, list[%d].ino=%ld\n", bad, i-1, icount->list[i-1].ino, i, icount->list[i].ino); - ret = EXT2_INVALID_ARGUMENT; + ret = EXT2_ET_INVALID_ARGUMENT; } } return ret; @@ -300,7 +300,7 @@ errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ino_t ino, __u16 *ret) EXT2_CHECK_MAGIC(icount, EXT2_ET_MAGIC_ICOUNT); if (!ino || (ino > icount->num_inodes)) - return EXT2_INVALID_ARGUMENT; + return EXT2_ET_INVALID_ARGUMENT; if (ext2fs_test_inode_bitmap(icount->single, ino)) { *ret = 1; @@ -328,7 +328,7 @@ errcode_t ext2fs_icount_increment(ext2_icount_t icount, ino_t ino, EXT2_CHECK_MAGIC(icount, EXT2_ET_MAGIC_ICOUNT); if (!ino || (ino > icount->num_inodes)) - return EXT2_INVALID_ARGUMENT; + return EXT2_ET_INVALID_ARGUMENT; if (ext2fs_test_inode_bitmap(icount->single, ino)) { /* @@ -337,7 +337,7 @@ errcode_t ext2fs_icount_increment(ext2_icount_t icount, ino_t ino, */ el = get_icount_el(icount, ino, 1); if (!el) - return EXT2_NO_MEMORY; + return EXT2_ET_NO_MEMORY; ext2fs_unmark_inode_bitmap(icount->single, ino); el->count = 2; } else if (icount->multiple) { @@ -350,7 +350,7 @@ errcode_t ext2fs_icount_increment(ext2_icount_t icount, ino_t ino, if (ext2fs_test_inode_bitmap(icount->multiple, ino)) { el = get_icount_el(icount, ino, 1); if (!el) - return EXT2_NO_MEMORY; + return EXT2_ET_NO_MEMORY; el->count++; } else { /* @@ -375,7 +375,7 @@ errcode_t ext2fs_icount_increment(ext2_icount_t icount, ino_t ino, } el = get_icount_el(icount, ino, 1); if (!el) - return EXT2_NO_MEMORY; + return EXT2_ET_NO_MEMORY; el->count++; } if (icount->multiple) @@ -391,7 +391,7 @@ errcode_t ext2fs_icount_decrement(ext2_icount_t icount, ino_t ino, struct ext2_icount_el *el; if (!ino || (ino > icount->num_inodes)) - return EXT2_INVALID_ARGUMENT; + return EXT2_ET_INVALID_ARGUMENT; EXT2_CHECK_MAGIC(icount, EXT2_ET_MAGIC_ICOUNT); @@ -411,11 +411,11 @@ errcode_t ext2fs_icount_decrement(ext2_icount_t icount, ino_t ino, if (icount->multiple && !ext2fs_test_inode_bitmap(icount->multiple, ino)) - return EXT2_INVALID_ARGUMENT; + return EXT2_ET_INVALID_ARGUMENT; el = get_icount_el(icount, ino, 0); if (!el || el->count == 0) - return EXT2_INVALID_ARGUMENT; + return EXT2_ET_INVALID_ARGUMENT; el->count--; if (el->count == 1) @@ -434,7 +434,7 @@ errcode_t ext2fs_icount_store(ext2_icount_t icount, ino_t ino, struct ext2_icount_el *el; if (!ino || (ino > icount->num_inodes)) - return EXT2_INVALID_ARGUMENT; + return EXT2_ET_INVALID_ARGUMENT; EXT2_CHECK_MAGIC(icount, EXT2_ET_MAGIC_ICOUNT); @@ -465,7 +465,7 @@ errcode_t ext2fs_icount_store(ext2_icount_t icount, ino_t ino, */ el = get_icount_el(icount, ino, 1); if (!el) - return EXT2_NO_MEMORY; + return EXT2_ET_NO_MEMORY; el->count = count; ext2fs_unmark_inode_bitmap(icount->single, ino); if (icount->multiple) diff --git a/lib/ext2fs/initialize.c b/lib/ext2fs/initialize.c index 5c7fb324..1fcff190 100644 --- a/lib/ext2fs/initialize.c +++ b/lib/ext2fs/initialize.c @@ -70,7 +70,7 @@ errcode_t ext2fs_initialize(const char *name, int flags, char *buf; if (!param || !param->s_blocks_count) - return EXT2_INVALID_ARGUMENT; + return EXT2_ET_INVALID_ARGUMENT; retval = ext2fs_get_mem(sizeof(struct struct_ext2_filsys), (void **) &fs); @@ -139,7 +139,7 @@ errcode_t ext2fs_initialize(const char *name, int flags, super->s_blocks_count = param->s_blocks_count; super->s_r_blocks_count = param->s_r_blocks_count; if (super->s_r_blocks_count >= param->s_blocks_count) { - retval = EXT2_INVALID_ARGUMENT; + retval = EXT2_ET_INVALID_ARGUMENT; goto cleanup; } diff --git a/lib/ext2fs/inode.c b/lib/ext2fs/inode.c index cec4341e..8695ff06 100644 --- a/lib/ext2fs/inode.c +++ b/lib/ext2fs/inode.c @@ -648,7 +648,7 @@ errcode_t ext2fs_check_directory(ext2_filsys fs, ino_t ino) if (retval) return retval; if (!LINUX_S_ISDIR(inode.i_mode)) - return EXT2_NO_DIRECTORY; + return EXT2_ET_NO_DIRECTORY; return 0; } diff --git a/lib/ext2fs/irel_ma.c b/lib/ext2fs/irel_ma.c index be29853d..6ff816b4 100644 --- a/lib/ext2fs/irel_ma.c +++ b/lib/ext2fs/irel_ma.c @@ -145,7 +145,7 @@ static errcode_t ima_put(ext2_irel irel, ino_t old, ma = irel->private; if (old > ma->max_inode) - return EXT2_INVALID_ARGUMENT; + return EXT2_ET_INVALID_ARGUMENT; /* * Force the orig field to the correct value; the application @@ -180,7 +180,7 @@ static errcode_t ima_get(ext2_irel irel, ino_t old, ma = irel->private; if (old > ma->max_inode) - return EXT2_INVALID_ARGUMENT; + return EXT2_ET_INVALID_ARGUMENT; if (ma->entries[(unsigned) old].new == 0) return ENOENT; *ent = ma->entries[(unsigned) old]; @@ -195,7 +195,7 @@ static errcode_t ima_get_by_orig(ext2_irel irel, ino_t orig, ino_t *old, ma = irel->private; if (orig > ma->max_inode) - return EXT2_INVALID_ARGUMENT; + return EXT2_ET_INVALID_ARGUMENT; ino = ma->orig_map[(unsigned) orig]; if (ino == 0) return ENOENT; @@ -238,7 +238,7 @@ static errcode_t ima_add_ref(ext2_irel irel, ino_t ino, ma = irel->private; if (ino > ma->max_inode) - return EXT2_INVALID_ARGUMENT; + return EXT2_ET_INVALID_ARGUMENT; ref_ent = ma->ref_entries + (unsigned) ino; ent = ma->entries + (unsigned) ino; @@ -257,7 +257,7 @@ static errcode_t ima_add_ref(ext2_irel irel, ino_t ino, } if (ref_ent->num >= ent->max_refs) - return EXT2_TOO_MANY_REFS; + return EXT2_ET_TOO_MANY_REFS; ref_ent->refs[(unsigned) ref_ent->num++] = *ref; return 0; @@ -269,7 +269,7 @@ static errcode_t ima_start_iter_ref(ext2_irel irel, ino_t ino) ma = irel->private; if (ino > ma->max_inode) - return EXT2_INVALID_ARGUMENT; + return EXT2_ET_INVALID_ARGUMENT; if (ma->entries[(unsigned) ino].new == 0) return ENOENT; ma->ref_current = ino; @@ -304,7 +304,7 @@ static errcode_t ima_move(ext2_irel irel, ino_t old, ino_t new) ma = irel->private; if ((old > ma->max_inode) || (new > ma->max_inode)) - return EXT2_INVALID_ARGUMENT; + return EXT2_ET_INVALID_ARGUMENT; if (ma->entries[(unsigned) old].new == 0) return ENOENT; @@ -327,7 +327,7 @@ static errcode_t ima_delete(ext2_irel irel, ino_t old) ma = irel->private; if (old > ma->max_inode) - return EXT2_INVALID_ARGUMENT; + return EXT2_ET_INVALID_ARGUMENT; if (ma->entries[(unsigned) old].new == 0) return ENOENT; diff --git a/lib/ext2fs/llseek.c b/lib/ext2fs/llseek.c index 46b82e70..9829444c 100644 --- a/lib/ext2fs/llseek.c +++ b/lib/ext2fs/llseek.c @@ -114,7 +114,7 @@ ext2_loff_t ext2fs_llseek (int fd, ext2_loff_t offset, int origin) { if ((sizeof(off_t) < sizeof(ext2_loff_t)) && (offset >= ((ext2_loff_t) 1 << ((sizeof(off_t)*8) -1)))) { - errno = EXT2_INVALID_ARGUMENT; + errno = EXT2_ET_INVALID_ARGUMENT; return -1; } return lseek (fd, (off_t) offset, origin); diff --git a/lib/ext2fs/lookup.c b/lib/ext2fs/lookup.c index 7f17afa2..364f2a2a 100644 --- a/lib/ext2fs/lookup.c +++ b/lib/ext2fs/lookup.c @@ -65,7 +65,7 @@ errcode_t ext2fs_lookup(ext2_filsys fs, ino_t dir, const char *name, if (retval) return retval; - return (ls.found) ? 0 : EXT2_FILE_NOT_FOUND; + return (ls.found) ? 0 : EXT2_ET_FILE_NOT_FOUND; } diff --git a/lib/ext2fs/mkdir.c b/lib/ext2fs/mkdir.c index 72d1942c..9348cb7c 100644 --- a/lib/ext2fs/mkdir.c +++ b/lib/ext2fs/mkdir.c @@ -107,11 +107,11 @@ errcode_t ext2fs_mkdir(ext2_filsys fs, ino_t parent, ino_t inum, retval = ext2fs_lookup(fs, parent, name, strlen(name), 0, &scratch_ino); if (!retval) { - retval = EXT2_DIR_EXISTS; + retval = EXT2_ET_DIR_EXISTS; name = 0; goto cleanup; } - if (retval != EXT2_FILE_NOT_FOUND) + if (retval != EXT2_ET_FILE_NOT_FOUND) goto cleanup; retval = ext2fs_link(fs, parent, name, ino, 0); if (retval) diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c index 582af195..26c7f7b2 100644 --- a/lib/ext2fs/openfs.c +++ b/lib/ext2fs/openfs.c @@ -82,7 +82,7 @@ errcode_t ext2fs_open(const char *name, int flags, int superblock, */ if (superblock) { if (!block_size) { - retval = EXT2_INVALID_ARGUMENT; + retval = EXT2_ET_INVALID_ARGUMENT; goto cleanup; } io_channel_set_blksize(fs->io, block_size); diff --git a/lib/ext2fs/rs_bitmap.c b/lib/ext2fs/rs_bitmap.c index 60d03073..aee47259 100644 --- a/lib/ext2fs/rs_bitmap.c +++ b/lib/ext2fs/rs_bitmap.c @@ -36,7 +36,7 @@ errcode_t ext2fs_resize_generic_bitmap(__u32 new_end, __u32 new_real_end, __u32 bitno; if (!bmap) - return EXT2_INVALID_ARGUMENT; + return EXT2_ET_INVALID_ARGUMENT; EXT2_CHECK_MAGIC(bmap, EXT2_ET_MAGIC_GENERIC_BITMAP); @@ -76,7 +76,7 @@ errcode_t ext2fs_resize_inode_bitmap(__u32 new_end, __u32 new_real_end, errcode_t retval; if (!bmap) - return EXT2_INVALID_ARGUMENT; + return EXT2_ET_INVALID_ARGUMENT; EXT2_CHECK_MAGIC(bmap, EXT2_ET_MAGIC_INODE_BITMAP); @@ -93,7 +93,7 @@ errcode_t ext2fs_resize_block_bitmap(__u32 new_end, __u32 new_real_end, errcode_t retval; if (!bmap) - return EXT2_INVALID_ARGUMENT; + return EXT2_ET_INVALID_ARGUMENT; EXT2_CHECK_MAGIC(bmap, EXT2_ET_MAGIC_BLOCK_BITMAP); diff --git a/lib/ext2fs/test_io.c b/lib/ext2fs/test_io.c index 9c1126c0..e2fe1ccc 100644 --- a/lib/ext2fs/test_io.c +++ b/lib/ext2fs/test_io.c @@ -94,7 +94,7 @@ static errcode_t test_open(const char *name, int flags, io_channel *channel) retval = ext2fs_get_mem(sizeof(struct test_private_data), (void **) &data); if (retval) { - retval = EXT2_NO_MEMORY; + retval = EXT2_ET_NO_MEMORY; goto cleanup; } io->manager = test_io_manager;