diff options
Diffstat (limited to 'e2fsprogs/ext2fs/inode.c')
-rw-r--r-- | e2fsprogs/ext2fs/inode.c | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/e2fsprogs/ext2fs/inode.c b/e2fsprogs/ext2fs/inode.c index 30580bf..e50bece 100644 --- a/e2fsprogs/ext2fs/inode.c +++ b/e2fsprogs/ext2fs/inode.c @@ -1,6 +1,6 @@ /* * inode.c --- utility routines to read and write inodes - * + * * Copyright (C) 1993, 1994, 1995, 1996, 1997 Theodore Ts'o. * * %Begin-Header% @@ -59,7 +59,7 @@ struct ext2_struct_inode_scan { errcode_t ext2fs_flush_icache(ext2_filsys fs) { int i; - + if (!fs->icache) return 0; @@ -73,7 +73,7 @@ errcode_t ext2fs_flush_icache(ext2_filsys fs) static errcode_t create_icache(ext2_filsys fs) { errcode_t retval; - + if (fs->icache) return 0; retval = ext2fs_get_mem(sizeof(struct ext2_inode_cache), &fs->icache); @@ -146,7 +146,7 @@ errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks, group_desc[scan->current_group].bg_inode_table; scan->inodes_left = EXT2_INODES_PER_GROUP(scan->fs->super); scan->blocks_left = scan->fs->inode_blocks_per_group; - retval = ext2fs_get_mem((size_t) (scan->inode_buffer_blocks * + retval = ext2fs_get_mem((size_t) (scan->inode_buffer_blocks * fs->blocksize), &scan->inode_buffer); scan->done_group = 0; @@ -172,7 +172,7 @@ void ext2fs_close_inode_scan(ext2_inode_scan scan) { if (!scan || (scan->magic != EXT2_ET_MAGIC_INODE_SCAN)) return; - + ext2fs_free_mem(&scan->inode_buffer); scan->inode_buffer = NULL; ext2fs_free_mem(&scan->temp_buffer); @@ -190,7 +190,7 @@ void ext2fs_set_inode_callback(ext2_inode_scan scan, { if (!scan || (scan->magic != EXT2_ET_MAGIC_INODE_SCAN)) return; - + scan->done_group = done_group; scan->done_group_data = done_group_data; } @@ -217,7 +217,7 @@ static errcode_t get_next_blockgroup(ext2_inode_scan scan) { scan->current_group++; scan->groups_left--; - + scan->current_block = scan->fs-> group_desc[scan->current_group].bg_inode_table; @@ -335,7 +335,7 @@ static errcode_t get_next_blocks(ext2_inode_scan scan) if (retval) return retval; } - + if ((scan->scan_flags & EXT2_SF_BAD_INODE_BLK) || (scan->current_block == 0)) { memset(scan->inode_buffer, 0, @@ -367,7 +367,7 @@ static errcode_t get_next_blocks(ext2_inode_scan scan) static inline int is_empty_scan(ext2_inode_scan scan) { int i; - + if (scan->bytes_left == 0) return 0; @@ -383,7 +383,7 @@ errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, ext2_ino_t *ino, { errcode_t retval; int extra_bytes = 0; - + EXT2_CHECK_MAGIC(scan, EXT2_ET_MAGIC_INODE_SCAN); /* @@ -416,7 +416,7 @@ errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, ext2_ino_t *ino, } else return EXT2_ET_MISSING_INODE_TABLE; } - + /* * Have we run out of space in the inode buffer? If so, we @@ -449,9 +449,9 @@ errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, ext2_ino_t *ino, #ifdef EXT2FS_ENABLE_SWAPFS if ((scan->fs->flags & EXT2_FLAG_SWAP_BYTES) || (scan->fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) - ext2fs_swap_inode_full(scan->fs, + ext2fs_swap_inode_full(scan->fs, (struct ext2_inode_large *) inode, - (struct ext2_inode_large *) scan->temp_buffer, + (struct ext2_inode_large *) scan->temp_buffer, 0, bufsize); else #endif @@ -463,7 +463,7 @@ errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, ext2_ino_t *ino, #ifdef EXT2FS_ENABLE_SWAPFS if ((scan->fs->flags & EXT2_FLAG_SWAP_BYTES) || (scan->fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) - ext2fs_swap_inode_full(scan->fs, + ext2fs_swap_inode_full(scan->fs, (struct ext2_inode_large *) inode, (struct ext2_inode_large *) scan->ptr, 0, bufsize); @@ -495,10 +495,10 @@ errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ext2_ino_t *ino, errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode * inode, int bufsize) { - unsigned long group, block, block_nr, offset; - char *ptr; + unsigned long group, block, block_nr, offset; + char *ptr; errcode_t retval; - int clen, i, inodes_per_block, length; + int clen, i, inodes_per_block, length; io_channel io; EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); @@ -541,7 +541,7 @@ errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino, block = offset >> EXT2_BLOCK_SIZE_BITS(fs->super); if (!fs->group_desc[(unsigned)group].bg_inode_table) return EXT2_ET_MISSING_INODE_TABLE; - block_nr = fs->group_desc[(unsigned)group].bg_inode_table + + block_nr = fs->group_desc[(unsigned)group].bg_inode_table + block; io = fs->io; } @@ -577,8 +577,8 @@ errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino, #ifdef EXT2FS_ENABLE_SWAPFS if ((fs->flags & EXT2_FLAG_SWAP_BYTES) || (fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) - ext2fs_swap_inode_full(fs, (struct ext2_inode_large *) inode, - (struct ext2_inode_large *) inode, + ext2fs_swap_inode_full(fs, (struct ext2_inode_large *) inode, + (struct ext2_inode_large *) inode, 0, length); #endif @@ -587,7 +587,7 @@ errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino, fs->icache->cache_size; fs->icache->cache[fs->icache->cache_last].ino = ino; fs->icache->cache[fs->icache->cache_last].inode = *inode; - + return 0; } @@ -629,7 +629,7 @@ errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino, if (retval) return retval; } - + if (!(fs->flags & EXT2_FLAG_RW)) return EXT2_ET_RO_FILSYS; @@ -649,13 +649,13 @@ errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino, #ifdef EXT2FS_ENABLE_SWAPFS if ((fs->flags & EXT2_FLAG_SWAP_BYTES) || (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE)) - ext2fs_swap_inode_full(fs, w_inode, - (struct ext2_inode_large *) inode, + ext2fs_swap_inode_full(fs, w_inode, + (struct ext2_inode_large *) inode, 1, bufsize); else #endif memcpy(w_inode, inode, bufsize); - + group = (ino - 1) / EXT2_INODES_PER_GROUP(fs->super); offset = ((ino - 1) % EXT2_INODES_PER_GROUP(fs->super)) * EXT2_INODE_SIZE(fs->super); @@ -685,11 +685,11 @@ errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino, fs->icache->buffer_blk = block_nr; } - - memcpy((char *) fs->icache->buffer + (unsigned) offset, + + memcpy((char *) fs->icache->buffer + (unsigned) offset, ptr, clen); - retval = io_channel_write_blk(fs->io, block_nr, 1, + retval = io_channel_write_blk(fs->io, block_nr, 1, fs->icache->buffer); if (retval) goto errout; @@ -699,7 +699,7 @@ errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino, length -= clen; block_nr++; } - + fs->flags |= EXT2_FLAG_CHANGED; errout: if (w_inode && w_inode != &temp_inode) @@ -714,7 +714,7 @@ errcode_t ext2fs_write_inode(ext2_filsys fs, ext2_ino_t ino, sizeof(struct ext2_inode)); } -/* +/* * This function should be called when writing a new inode. It makes * sure that extra part of large inodes is initialized properly. */ @@ -722,7 +722,7 @@ errcode_t ext2fs_write_new_inode(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode) { struct ext2_inode *buf; - int size = EXT2_INODE_SIZE(fs->super); + int size = EXT2_INODE_SIZE(fs->super); struct ext2_inode_large *large_inode; if (size == sizeof(struct ext2_inode)) @@ -735,19 +735,19 @@ errcode_t ext2fs_write_new_inode(ext2_filsys fs, ext2_ino_t ino, *buf = *inode; large_inode = (struct ext2_inode_large *) buf; - large_inode->i_extra_isize = sizeof(struct ext2_inode_large) - + large_inode->i_extra_isize = sizeof(struct ext2_inode_large) - EXT2_GOOD_OLD_INODE_SIZE; return ext2fs_write_inode_full(fs, ino, buf, size); } - + errcode_t ext2fs_get_blocks(ext2_filsys fs, ext2_ino_t ino, blk_t *blocks) { struct ext2_inode inode; int i; errcode_t retval; - + EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); if (ino > fs->super->s_inodes_count) @@ -769,7 +769,7 @@ errcode_t ext2fs_check_directory(ext2_filsys fs, ext2_ino_t ino) { struct ext2_inode inode; errcode_t retval; - + EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); if (ino > fs->super->s_inodes_count) |