mirror of
https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
synced 2024-12-11 10:53:26 +08:00
Many files:
Rename new error codes to have _ET_ in them for consistency.
This commit is contained in:
parent
7b4e4534f9
commit
1f0b6c1f89
@ -1,3 +1,7 @@
|
||||
Thu Oct 30 11:33:57 1997 Theodore Ts'o <tytso@rsts-11.mit.edu>
|
||||
|
||||
* Rename new error codes to _ET_ in them for consistency.
|
||||
|
||||
Sat Oct 25 00:06:58 1997 Theodore Ts'o <tytso@rsts-11.mit.edu>
|
||||
|
||||
* [all files, basically]: Added definition of ext2fs_get_mem,
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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) ||
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user