diff options
author | Tim Riker | 2006-01-25 00:08:53 +0000 |
---|---|---|
committer | Tim Riker | 2006-01-25 00:08:53 +0000 |
commit | c1ef7bdd8d002ae0889efcf883d0e1b7faa938d4 (patch) | |
tree | 5f329b7d0c7f20ecced0dc7581a9ba6dc720d965 /e2fsprogs/ext2fs | |
parent | f64ff682a3d58dbb627e760e6fe1ec21d9ccdf61 (diff) | |
download | busybox-c1ef7bdd8d002ae0889efcf883d0e1b7faa938d4.zip busybox-c1ef7bdd8d002ae0889efcf883d0e1b7faa938d4.tar.gz |
just whitespace
Diffstat (limited to 'e2fsprogs/ext2fs')
69 files changed, 660 insertions, 660 deletions
diff --git a/e2fsprogs/ext2fs/alloc.c b/e2fsprogs/ext2fs/alloc.c index 7385123..d56ef25 100644 --- a/e2fsprogs/ext2fs/alloc.c +++ b/e2fsprogs/ext2fs/alloc.c @@ -7,7 +7,7 @@ * This file may be redistributed under the terms of the GNU Public * License. * %End-Header% - * + * */ #include <stdio.h> @@ -32,7 +32,7 @@ * * Should have a special policy for directories. */ -errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, +errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, int mode EXT2FS_ATTR((unused)), ext2fs_inode_bitmap map, ext2_ino_t *ret) { @@ -41,13 +41,13 @@ errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, ext2_ino_t start_inode; EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - + if (!map) map = fs->inode_map; if (!map) return EXT2_ET_NO_INODE_BITMAP; - - if (dir > 0) + + if (dir > 0) dir_group = (dir - 1) / EXT2_INODES_PER_GROUP(fs->super); start_inode = (dir_group * EXT2_INODES_PER_GROUP(fs->super)) + 1; @@ -62,7 +62,7 @@ errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, if (i > fs->super->s_inodes_count) i = EXT2_FIRST_INODE(fs->super); } while (i != start_inode); - + if (ext2fs_test_inode_bitmap(map, i)) return EXT2_ET_INODE_ALLOC_FAIL; *ret = i; @@ -131,7 +131,7 @@ errcode_t ext2fs_alloc_block(ext2_filsys fs, blk_t goal, retval = io_channel_write_blk(fs->io, block, 1, block_buf); if (retval) goto fail; - + ext2fs_block_alloc_stats(fs, block, +1); *ret = block; return 0; diff --git a/e2fsprogs/ext2fs/alloc_sb.c b/e2fsprogs/ext2fs/alloc_sb.c index ef40b93..aa2cd05 100644 --- a/e2fsprogs/ext2fs/alloc_sb.c +++ b/e2fsprogs/ext2fs/alloc_sb.c @@ -1,5 +1,5 @@ /* - * alloc_sb.c --- Allocate the superblock and block group descriptors for a + * alloc_sb.c --- Allocate the superblock and block group descriptors for a * newly initialized filesystem. Used by mke2fs when initializing a filesystem * * Copyright (C) 1994, 1995, 1996, 2003 Theodore Ts'o. @@ -27,20 +27,20 @@ #include "ext2_fs.h" #include "ext2fs.h" -int ext2fs_reserve_super_and_bgd(ext2_filsys fs, +int ext2fs_reserve_super_and_bgd(ext2_filsys fs, dgrp_t group, ext2fs_block_bitmap bmap) { blk_t super_blk, old_desc_blk, new_desc_blk; int j, old_desc_blocks, num_blocks; - num_blocks = ext2fs_super_and_bgd_loc(fs, group, &super_blk, + num_blocks = ext2fs_super_and_bgd_loc(fs, group, &super_blk, &old_desc_blk, &new_desc_blk, 0); if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) old_desc_blocks = fs->super->s_first_meta_bg; else - old_desc_blocks = + old_desc_blocks = fs->desc_blocks + fs->super->s_reserved_gdt_blocks; if (super_blk || (group == 0)) diff --git a/e2fsprogs/ext2fs/alloc_stats.c b/e2fsprogs/ext2fs/alloc_stats.c index 4088f7b..32aa0b6 100644 --- a/e2fsprogs/ext2fs/alloc_stats.c +++ b/e2fsprogs/ext2fs/alloc_stats.c @@ -7,7 +7,7 @@ * This file may be redistributed under the terms of the GNU Public * License. * %End-Header% - * + * */ #include <stdio.h> diff --git a/e2fsprogs/ext2fs/alloc_tables.c b/e2fsprogs/ext2fs/alloc_tables.c index 0326321..10f1f95 100644 --- a/e2fsprogs/ext2fs/alloc_tables.c +++ b/e2fsprogs/ext2fs/alloc_tables.c @@ -36,14 +36,14 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group, group_blk = fs->super->s_first_data_block + (group * fs->super->s_blocks_per_group); - + last_blk = group_blk + fs->super->s_blocks_per_group; if (last_blk >= fs->super->s_blocks_count) last_blk = fs->super->s_blocks_count - 1; if (!bmap) bmap = fs->block_map; - + /* * Allocate the block and inode bitmaps, if necessary */ @@ -59,7 +59,7 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group, if (!fs->group_desc[group].bg_block_bitmap) { retval = ext2fs_get_free_blocks(fs, start_blk, last_blk, 1, bmap, &new_blk); - if (retval == EXT2_ET_BLOCK_ALLOC_FAIL) + if (retval == EXT2_ET_BLOCK_ALLOC_FAIL) retval = ext2fs_get_free_blocks(fs, group_blk, last_blk, 1, bmap, &new_blk); if (retval) @@ -71,7 +71,7 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group, if (!fs->group_desc[group].bg_inode_bitmap) { retval = ext2fs_get_free_blocks(fs, start_blk, last_blk, 1, bmap, &new_blk); - if (retval == EXT2_ET_BLOCK_ALLOC_FAIL) + if (retval == EXT2_ET_BLOCK_ALLOC_FAIL) retval = ext2fs_get_free_blocks(fs, group_blk, last_blk, 1, bmap, &new_blk); if (retval) @@ -96,11 +96,11 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group, fs->group_desc[group].bg_inode_table = new_blk; } - + return 0; } - + errcode_t ext2fs_allocate_tables(ext2_filsys fs) { diff --git a/e2fsprogs/ext2fs/badblocks.c b/e2fsprogs/ext2fs/badblocks.c index 4b76ef0..d820411 100644 --- a/e2fsprogs/ext2fs/badblocks.c +++ b/e2fsprogs/ext2fs/badblocks.c @@ -1,6 +1,6 @@ /* * badblocks.c --- routines to manipulate the bad block structure - * + * * Copyright (C) 1994, 1995, 1996 Theodore Ts'o. * * %Begin-Header% @@ -34,7 +34,7 @@ static errcode_t make_u32_list(int size, int num, __u32 *list, { ext2_u32_list bb; errcode_t retval; - + retval = ext2fs_get_mem(sizeof(struct ext2_struct_u32_list), &bb); if (retval) return retval; @@ -54,7 +54,7 @@ static errcode_t make_u32_list(int size, int num, __u32 *list, *ret = bb; return 0; } - + /* * This procedure creates an empty u32 list. @@ -79,7 +79,7 @@ errcode_t ext2fs_badblocks_list_create(ext2_badblocks_list *ret, int size) errcode_t ext2fs_u32_copy(ext2_u32_list src, ext2_u32_list *dest) { errcode_t retval; - + retval = make_u32_list(src->size, src->num, src->list, dest); if (retval) return retval; @@ -271,11 +271,11 @@ int ext2fs_u32_list_iterate(ext2_u32_iterate iter, __u32 *blk) if (bb->magic != EXT2_ET_MAGIC_BADBLOCKS_LIST) return 0; - + if (iter->ptr < bb->num) { *blk = bb->list[iter->ptr++]; return 1; - } + } *blk = 0; return 0; } diff --git a/e2fsprogs/ext2fs/bb_compat.c b/e2fsprogs/ext2fs/bb_compat.c index 40f7343..5a158b3 100644 --- a/e2fsprogs/ext2fs/bb_compat.c +++ b/e2fsprogs/ext2fs/bb_compat.c @@ -1,6 +1,6 @@ /* * bb_compat.c --- compatibility badblocks routines - * + * * Copyright (C) 1997 Theodore Ts'o. * * %Begin-Header% diff --git a/e2fsprogs/ext2fs/bb_inode.c b/e2fsprogs/ext2fs/bb_inode.c index dd8e7c3..9af117d 100644 --- a/e2fsprogs/ext2fs/bb_inode.c +++ b/e2fsprogs/ext2fs/bb_inode.c @@ -1,12 +1,12 @@ /* * bb_inode.c --- routines to update the bad block inode. - * + * * WARNING: This routine modifies a lot of state in the filesystem; if * this routine returns an error, the bad block inode may be in an * inconsistent state. - * + * * Copyright (C) 1994, 1995 Theodore Ts'o. - * + * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public * License. @@ -49,7 +49,7 @@ static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr, e2_blkcnt_t blockcnt, blk_t ref_block, int ref_offset, void *priv_data); - + /* * Given a bad blocks bitmap, update the bad blocks inode to reflect * the map. @@ -57,14 +57,14 @@ static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr, errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list) { errcode_t retval; - struct set_badblock_record rec; + struct set_badblock_record rec; struct ext2_inode inode; - + EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); if (!fs->block_map) return EXT2_ET_NO_BLOCK_BITMAP; - + rec.bad_block_count = 0; rec.ind_blocks_size = rec.ind_blocks_ptr = 0; rec.max_ind_blocks = 10; @@ -78,9 +78,9 @@ errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list) goto cleanup; memset(rec.block_buf, 0, fs->blocksize); rec.err = 0; - + /* - * First clear the old bad blocks (while saving the indirect blocks) + * First clear the old bad blocks (while saving the indirect blocks) */ retval = ext2fs_block_iterate2(fs, EXT2_BAD_INO, BLOCK_FLAG_DEPTH_TRAVERSE, 0, @@ -91,7 +91,7 @@ errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list) retval = rec.err; goto cleanup; } - + /* * Now set the bad blocks! * @@ -108,22 +108,22 @@ errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list) BLOCK_FLAG_APPEND, 0, set_bad_block_proc, &rec); ext2fs_badblocks_list_iterate_end(rec.bb_iter); - if (retval) + if (retval) goto cleanup; if (rec.err) { retval = rec.err; goto cleanup; } } - + /* * Update the bad block inode's mod time and block count - * field. + * field. */ retval = ext2fs_read_inode(fs, EXT2_BAD_INO, &inode); if (retval) goto cleanup; - + inode.i_atime = inode.i_mtime = time(0); if (!inode.i_ctime) inode.i_ctime = time(0); @@ -133,7 +133,7 @@ errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list) retval = ext2fs_write_inode(fs, EXT2_BAD_INO, &inode); if (retval) goto cleanup; - + cleanup: ext2fs_free_mem(&rec.ind_blocks); ext2fs_free_mem(&rec.block_buf); @@ -158,7 +158,7 @@ static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr, struct set_badblock_record *rec = (struct set_badblock_record *) priv_data; errcode_t retval; - unsigned long old_size; + unsigned long old_size; if (!*block_nr) return 0; @@ -176,7 +176,7 @@ static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr, if (rec->ind_blocks_size >= rec->max_ind_blocks) { old_size = rec->max_ind_blocks * sizeof(blk_t); rec->max_ind_blocks += 10; - retval = ext2fs_resize_mem(old_size, + retval = ext2fs_resize_mem(old_size, rec->max_ind_blocks * sizeof(blk_t), &rec->ind_blocks); if (retval) { @@ -192,12 +192,12 @@ static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr, * Mark the block as unused, and update accounting information */ ext2fs_block_alloc_stats(fs, *block_nr, -1); - + *block_nr = 0; return BLOCK_CHANGED; } - + /* * Helper function for update_bb_inode() * @@ -250,12 +250,12 @@ static int set_bad_block_proc(ext2_filsys fs, blk_t *block_nr, return BLOCK_ABORT; } } - + /* * Update block counts */ ext2fs_block_alloc_stats(fs, blk, +1); - + *block_nr = blk; return BLOCK_CHANGED; } diff --git a/e2fsprogs/ext2fs/bitmaps.c b/e2fsprogs/ext2fs/bitmaps.c index 7edd28d..932c345 100644 --- a/e2fsprogs/ext2fs/bitmaps.c +++ b/e2fsprogs/ext2fs/bitmaps.c @@ -35,7 +35,7 @@ static errcode_t make_bitmap(__u32 start, __u32 end, __u32 real_end, errcode_t retval; size_t size; - retval = ext2fs_get_mem(sizeof(struct ext2fs_struct_generic_bitmap), + retval = ext2fs_get_mem(sizeof(struct ext2fs_struct_generic_bitmap), &bitmap); if (retval) return retval; @@ -106,7 +106,7 @@ void ext2fs_set_bitmap_padding(ext2fs_generic_bitmap map) ext2fs_set_bit(j, map->bitmap); return; -} +} errcode_t ext2fs_allocate_inode_bitmap(ext2_filsys fs, const char *descr, @@ -128,11 +128,11 @@ errcode_t ext2fs_allocate_inode_bitmap(ext2_filsys fs, descr, &bitmap); if (retval) return retval; - + bitmap->magic = EXT2_ET_MAGIC_INODE_BITMAP; bitmap->fs = fs; bitmap->base_error_code = EXT2_ET_BAD_INODE_MARK; - + *ret = bitmap; return 0; } @@ -151,9 +151,9 @@ errcode_t ext2fs_allocate_block_bitmap(ext2_filsys fs, start = fs->super->s_first_data_block; end = fs->super->s_blocks_count-1; - real_end = (EXT2_BLOCKS_PER_GROUP(fs->super) + real_end = (EXT2_BLOCKS_PER_GROUP(fs->super) * fs->group_desc_count)-1 + start; - + retval = ext2fs_allocate_generic_bitmap(start, end, real_end, descr, &bitmap); if (retval) @@ -162,7 +162,7 @@ errcode_t ext2fs_allocate_block_bitmap(ext2_filsys fs, bitmap->magic = EXT2_ET_MAGIC_BLOCK_BITMAP; bitmap->fs = fs; bitmap->base_error_code = EXT2_ET_BAD_BLOCK_MARK; - + *ret = bitmap; return 0; } @@ -171,7 +171,7 @@ errcode_t ext2fs_fudge_inode_bitmap_end(ext2fs_inode_bitmap bitmap, ext2_ino_t end, ext2_ino_t *oend) { EXT2_CHECK_MAGIC(bitmap, EXT2_ET_MAGIC_INODE_BITMAP); - + if (end > bitmap->real_end) return EXT2_ET_FUDGE_INODE_BITMAP_END; if (oend) @@ -184,7 +184,7 @@ errcode_t ext2fs_fudge_block_bitmap_end(ext2fs_block_bitmap bitmap, blk_t end, blk_t *oend) { EXT2_CHECK_MAGIC(bitmap, EXT2_ET_MAGIC_BLOCK_BITMAP); - + if (end > bitmap->real_end) return EXT2_ET_FUDGE_BLOCK_BITMAP_END; if (oend) diff --git a/e2fsprogs/ext2fs/bitops.c b/e2fsprogs/ext2fs/bitops.c index 207c44d..e44e10c 100644 --- a/e2fsprogs/ext2fs/bitops.c +++ b/e2fsprogs/ext2fs/bitops.c @@ -1,7 +1,7 @@ /* * bitops.c --- Bitmap frobbing code. See bitops.h for the inlined - * routines. - * + * routines. + * * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. * * %Begin-Header% diff --git a/e2fsprogs/ext2fs/bitops.h b/e2fsprogs/ext2fs/bitops.h index b6446ef..4dba050 100644 --- a/e2fsprogs/ext2fs/bitops.h +++ b/e2fsprogs/ext2fs/bitops.h @@ -1,14 +1,14 @@ /* * bitops.h --- Bitmap frobbing code. The byte swapping routines are - * also included here. - * + * also included here. + * * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public * License. * %End-Header% - * + * * i386 bitops operations taken from <asm/bitops.h>, Copyright 1992, * Linus Torvalds. */ diff --git a/e2fsprogs/ext2fs/block.c b/e2fsprogs/ext2fs/block.c index 7685680..18be2a5 100644 --- a/e2fsprogs/ext2fs/block.c +++ b/e2fsprogs/ext2fs/block.c @@ -1,6 +1,6 @@ /* * block.c --- iterate over all blocks in an inode - * + * * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. * * %Begin-Header% @@ -59,7 +59,7 @@ static int block_iterate_ind(blk_t *ind_block, blk_t ref_block, ret |= BLOCK_ERROR; return ret; } - ctx->errcode = ext2fs_read_ind_block(ctx->fs, *ind_block, + ctx->errcode = ext2fs_read_ind_block(ctx->fs, *ind_block, ctx->ind_buf); if (ctx->errcode) { ret |= BLOCK_ERROR; @@ -71,7 +71,7 @@ static int block_iterate_ind(blk_t *ind_block, blk_t ref_block, if (ctx->flags & BLOCK_FLAG_APPEND) { for (i = 0; i < limit; i++, ctx->bcount++, block_nr++) { flags = (*ctx->func)(ctx->fs, block_nr, ctx->bcount, - *ind_block, offset, + *ind_block, offset, ctx->priv_data); changed |= flags; if (flags & BLOCK_ABORT) { @@ -85,7 +85,7 @@ static int block_iterate_ind(blk_t *ind_block, blk_t ref_block, if (*block_nr == 0) continue; flags = (*ctx->func)(ctx->fs, block_nr, ctx->bcount, - *ind_block, offset, + *ind_block, offset, ctx->priv_data); changed |= flags; if (flags & BLOCK_ABORT) { @@ -109,7 +109,7 @@ static int block_iterate_ind(blk_t *ind_block, blk_t ref_block, ref_offset, ctx->priv_data); return ret; } - + static int block_iterate_dind(blk_t *dind_block, blk_t ref_block, int ref_offset, struct block_context *ctx) { @@ -133,7 +133,7 @@ static int block_iterate_dind(blk_t *dind_block, blk_t ref_block, ret |= BLOCK_ERROR; return ret; } - ctx->errcode = ext2fs_read_ind_block(ctx->fs, *dind_block, + ctx->errcode = ext2fs_read_ind_block(ctx->fs, *dind_block, ctx->dind_buf); if (ctx->errcode) { ret |= BLOCK_ERROR; @@ -185,7 +185,7 @@ static int block_iterate_dind(blk_t *dind_block, blk_t ref_block, ref_offset, ctx->priv_data); return ret; } - + static int block_iterate_tind(blk_t *tind_block, blk_t ref_block, int ref_offset, struct block_context *ctx) { @@ -209,7 +209,7 @@ static int block_iterate_tind(blk_t *tind_block, blk_t ref_block, ret |= BLOCK_ERROR; return ret; } - ctx->errcode = ext2fs_read_ind_block(ctx->fs, *tind_block, + ctx->errcode = ext2fs_read_ind_block(ctx->fs, *tind_block, ctx->tind_buf); if (ctx->errcode) { ret |= BLOCK_ERROR; @@ -259,10 +259,10 @@ static int block_iterate_tind(blk_t *tind_block, blk_t ref_block, ret |= (*ctx->func)(ctx->fs, tind_block, BLOCK_COUNT_TIND, ref_block, ref_offset, ctx->priv_data); - + return ret; } - + errcode_t ext2fs_block_iterate2(ext2_filsys fs, ext2_ino_t ino, int flags, @@ -338,7 +338,7 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs, goto abort_exit; } } - + /* * Iterate over normal data blocks */ @@ -427,7 +427,7 @@ errcode_t ext2fs_block_iterate(ext2_filsys fs, void *priv_data) { struct xlate xl; - + xl.real_private = priv_data; xl.func = func; diff --git a/e2fsprogs/ext2fs/bmap.c b/e2fsprogs/ext2fs/bmap.c index e840044..45d49f9 100644 --- a/e2fsprogs/ext2fs/bmap.c +++ b/e2fsprogs/ext2fs/bmap.c @@ -25,14 +25,14 @@ #endif extern errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, - struct ext2_inode *inode, + struct ext2_inode *inode, char *block_buf, int bmap_flags, blk_t block, blk_t *phys_blk); #define inode_bmap(inode, nr) ((inode)->i_block[(nr)]) -static _BMAP_INLINE_ errcode_t block_ind_bmap(ext2_filsys fs, int flags, - blk_t ind, char *block_buf, +static _BMAP_INLINE_ errcode_t block_ind_bmap(ext2_filsys fs, int flags, + blk_t ind, char *block_buf, int *blocks_alloc, blk_t nr, blk_t *ret_blk) { @@ -95,17 +95,17 @@ static _BMAP_INLINE_ errcode_t block_ind_bmap(ext2_filsys fs, int flags, } static _BMAP_INLINE_ errcode_t block_dind_bmap(ext2_filsys fs, int flags, - blk_t dind, char *block_buf, + blk_t dind, char *block_buf, int *blocks_alloc, blk_t nr, blk_t *ret_blk) { blk_t b; errcode_t retval; blk_t addr_per_block; - + addr_per_block = (blk_t) fs->blocksize >> 2; - retval = block_ind_bmap(fs, flags & ~BMAP_SET, dind, block_buf, + retval = block_ind_bmap(fs, flags & ~BMAP_SET, dind, block_buf, blocks_alloc, nr / addr_per_block, &b); if (retval) return retval; @@ -115,17 +115,17 @@ static _BMAP_INLINE_ errcode_t block_dind_bmap(ext2_filsys fs, int flags, } static _BMAP_INLINE_ errcode_t block_tind_bmap(ext2_filsys fs, int flags, - blk_t tind, char *block_buf, + blk_t tind, char *block_buf, int *blocks_alloc, blk_t nr, blk_t *ret_blk) { blk_t b; errcode_t retval; blk_t addr_per_block; - + addr_per_block = (blk_t) fs->blocksize >> 2; - retval = block_dind_bmap(fs, flags & ~BMAP_SET, tind, block_buf, + retval = block_dind_bmap(fs, flags & ~BMAP_SET, tind, block_buf, blocks_alloc, nr / addr_per_block, &b); if (retval) return retval; @@ -179,7 +179,7 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, *phys_blk = inode_bmap(inode, block); b = block ? inode_bmap(inode, block-1) : 0; - + if ((*phys_blk == 0) && (bmap_flags & BMAP_ALLOC)) { retval = ext2fs_alloc_block(fs, b, block_buf, &b); if (retval) @@ -190,7 +190,7 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, } goto done; } - + /* Indirect block */ block -= EXT2_NDIR_BLOCKS; if (block < addr_per_block) { @@ -203,17 +203,17 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, } b = inode_bmap(inode, EXT2_IND_BLOCK-1); - retval = ext2fs_alloc_block(fs, b, block_buf, &b); + retval = ext2fs_alloc_block(fs, b, block_buf, &b); if (retval) goto done; inode_bmap(inode, EXT2_IND_BLOCK) = b; blocks_alloc++; } - retval = block_ind_bmap(fs, bmap_flags, b, block_buf, + retval = block_ind_bmap(fs, bmap_flags, b, block_buf, &blocks_alloc, block, phys_blk); goto done; } - + /* Doubly indirect block */ block -= addr_per_block; if (block < addr_per_block * addr_per_block) { @@ -226,13 +226,13 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, } b = inode_bmap(inode, EXT2_IND_BLOCK); - retval = ext2fs_alloc_block(fs, b, block_buf, &b); + retval = ext2fs_alloc_block(fs, b, block_buf, &b); if (retval) goto done; inode_bmap(inode, EXT2_DIND_BLOCK) = b; blocks_alloc++; } - retval = block_dind_bmap(fs, bmap_flags, b, block_buf, + retval = block_dind_bmap(fs, bmap_flags, b, block_buf, &blocks_alloc, block, phys_blk); goto done; } @@ -254,7 +254,7 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, inode_bmap(inode, EXT2_TIND_BLOCK) = b; blocks_alloc++; } - retval = block_tind_bmap(fs, bmap_flags, b, block_buf, + retval = block_tind_bmap(fs, bmap_flags, b, block_buf, &blocks_alloc, block, phys_blk); done: if (buf) diff --git a/e2fsprogs/ext2fs/bmove.c b/e2fsprogs/ext2fs/bmove.c index 0b2ebb1..fb319f8 100644 --- a/e2fsprogs/ext2fs/bmove.c +++ b/e2fsprogs/ext2fs/bmove.c @@ -1,6 +1,6 @@ /* * bmove.c --- Move blocks around to make way for a particular - * filesystem structure. + * filesystem structure. * * Copyright (C) 1997 Theodore Ts'o. This file may be redistributed * under the terms of the GNU Public License. @@ -44,7 +44,7 @@ static int process_block(ext2_filsys fs, blk_t *block_nr, pb = (struct process_block_struct *) priv_data; block = orig = *block_nr; ret = 0; - + /* * Let's see if this is one which we need to relocate */ @@ -98,7 +98,7 @@ errcode_t ext2fs_move_blocks(ext2_filsys fs, struct process_block_struct pb; ext2_inode_scan scan; char *block_buf; - + retval = ext2fs_open_inode_scan(fs, 0, &scan); if (retval) return retval; @@ -107,7 +107,7 @@ errcode_t ext2fs_move_blocks(ext2_filsys fs, pb.error = 0; pb.alloc_map = alloc_map ? alloc_map : fs->block_map; pb.flags = flags; - + retval = ext2fs_get_mem(fs->blocksize * 4, &block_buf); if (retval) return retval; @@ -131,12 +131,12 @@ errcode_t ext2fs_move_blocks(ext2_filsys fs, retval = ext2fs_get_next_inode(scan, &ino, &inode); if (retval) return retval; - + while (ino) { if ((inode.i_links_count == 0) || !ext2fs_inode_has_valid_blocks(&inode)) goto next; - + pb.ino = ino; pb.inode = &inode; diff --git a/e2fsprogs/ext2fs/brel.h b/e2fsprogs/ext2fs/brel.h index be97243..a7f9776 100644 --- a/e2fsprogs/ext2fs/brel.h +++ b/e2fsprogs/ext2fs/brel.h @@ -1,6 +1,6 @@ /* * brel.h - * + * * Copyright (C) 1996, 1997 Theodore Ts'o. * * %Begin-Header% @@ -47,7 +47,7 @@ struct ext2_block_relocation_table { * Initialize for iterating over the block relocation entries. */ errcode_t (*start_iter)(ext2_brel brel); - + /* * The iterator function for the inode relocation entries. * Returns an inode number of 0 when out of entries. diff --git a/e2fsprogs/ext2fs/brel_ma.c b/e2fsprogs/ext2fs/brel_ma.c index d422bb2..4dcfded 100644 --- a/e2fsprogs/ext2fs/brel_ma.c +++ b/e2fsprogs/ext2fs/brel_ma.c @@ -1,6 +1,6 @@ /* * brel_ma.c - * + * * Copyright (C) 1996, 1997 Theodore Ts'o. * * TODO: rewrite to not use a direct array!!! (Fortunately this @@ -48,7 +48,7 @@ errcode_t ext2fs_brel_memarray_create(char *name, blk_t max_block, { ext2_brel brel = 0; errcode_t retval; - struct brel_ma *ma = 0; + struct brel_ma *ma = 0; size_t size; *new_brel = 0; @@ -61,18 +61,18 @@ errcode_t ext2fs_brel_memarray_create(char *name, blk_t max_block, if (retval) goto errout; memset(brel, 0, sizeof(struct ext2_block_relocation_table)); - + retval = ext2fs_get_mem(strlen(name)+1, &brel->name); if (retval) goto errout; strcpy(brel->name, name); - + retval = ext2fs_get_mem(sizeof(struct brel_ma), &ma); if (retval) goto errout; memset(ma, 0, sizeof(struct brel_ma)); brel->priv_data = ma; - + size = (size_t) (sizeof(struct ext2_block_relocate_entry) * (max_block+1)); retval = ext2fs_get_mem(size, &ma->entries); @@ -91,7 +91,7 @@ errcode_t ext2fs_brel_memarray_create(char *name, blk_t max_block, brel->move = bma_move; brel->delete = bma_delete; brel->free = bma_free; - + *new_brel = brel; return 0; @@ -103,7 +103,7 @@ errout: static errcode_t bma_put(ext2_brel brel, blk_t old, struct ext2_block_relocate_entry *ent) { - struct brel_ma *ma; + struct brel_ma *ma; ma = brel->priv_data; if (old > ma->max_block) @@ -115,7 +115,7 @@ static errcode_t bma_put(ext2_brel brel, blk_t old, static errcode_t bma_get(ext2_brel brel, blk_t old, struct ext2_block_relocate_entry *ent) { - struct brel_ma *ma; + struct brel_ma *ma; ma = brel->priv_data; if (old > ma->max_block) @@ -135,7 +135,7 @@ static errcode_t bma_start_iter(ext2_brel brel) static errcode_t bma_next(ext2_brel brel, blk_t *old, struct ext2_block_relocate_entry *ent) { - struct brel_ma *ma; + struct brel_ma *ma; ma = brel->priv_data; while (++brel->current < ma->max_block) { @@ -151,7 +151,7 @@ static errcode_t bma_next(ext2_brel brel, blk_t *old, static errcode_t bma_move(ext2_brel brel, blk_t old, blk_t new) { - struct brel_ma *ma; + struct brel_ma *ma; ma = brel->priv_data; if ((old > ma->max_block) || (new > ma->max_block)) @@ -165,7 +165,7 @@ static errcode_t bma_move(ext2_brel brel, blk_t old, blk_t new) static errcode_t bma_delete(ext2_brel brel, blk_t old) { - struct brel_ma *ma; + struct brel_ma *ma; ma = brel->priv_data; if (old > ma->max_block) @@ -178,7 +178,7 @@ static errcode_t bma_delete(ext2_brel brel, blk_t old) static errcode_t bma_free(ext2_brel brel) { - struct brel_ma *ma; + struct brel_ma *ma; if (!brel) return 0; diff --git a/e2fsprogs/ext2fs/check_desc.c b/e2fsprogs/ext2fs/check_desc.c index 2a754c7..eab8c7b 100644 --- a/e2fsprogs/ext2fs/check_desc.c +++ b/e2fsprogs/ext2fs/check_desc.c @@ -1,6 +1,6 @@ /* * check_desc.c --- Check the group descriptors of an ext2 filesystem - * + * * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. * * %Begin-Header% @@ -61,7 +61,7 @@ errcode_t ext2fs_check_desc(ext2_filsys fs) ((fs->group_desc[i].bg_inode_table + fs->inode_blocks_per_group) >= next)) return EXT2_ET_GDESC_BAD_INODE_TABLE; - + block = next; } return 0; diff --git a/e2fsprogs/ext2fs/closefs.c b/e2fsprogs/ext2fs/closefs.c index 23e6332..da0016b 100644 --- a/e2fsprogs/ext2fs/closefs.c +++ b/e2fsprogs/ext2fs/closefs.c @@ -1,6 +1,6 @@ /* * closefs.c --- close an ext2 filesystem - * + * * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. * * %Begin-Header% @@ -45,7 +45,7 @@ int ext2fs_bg_has_super(ext2_filsys fs, int group_block) return 0; } -int ext2fs_super_and_bgd_loc(ext2_filsys fs, +int ext2fs_super_and_bgd_loc(ext2_filsys fs, dgrp_t group, blk_t *ret_super_blk, blk_t *ret_old_desc_blk, @@ -63,7 +63,7 @@ int ext2fs_super_and_bgd_loc(ext2_filsys fs, if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) old_desc_blocks = fs->super->s_first_meta_bg; else - old_desc_blocks = + old_desc_blocks = fs->desc_blocks + fs->super->s_reserved_gdt_blocks; if (group == fs->group_desc_count-1) { @@ -100,7 +100,7 @@ int ext2fs_super_and_bgd_loc(ext2_filsys fs, numblocks--; } } - + numblocks -= 2 + fs->inode_blocks_per_group; if (ret_super_blk) @@ -188,7 +188,7 @@ static errcode_t write_backup_super(ext2_filsys fs, dgrp_t group, struct ext2_super_block *super_shadow) { dgrp_t sgrp = group; - + if (sgrp > ((1 << 16) - 1)) sgrp = (1 << 16) - 1; #ifdef EXT2FS_ENABLE_SWAPFS @@ -198,7 +198,7 @@ static errcode_t write_backup_super(ext2_filsys fs, dgrp_t group, #endif fs->super->s_block_group_nr = sgrp; - return io_channel_write_blk(fs->io, group_block, -SUPERBLOCK_SIZE, + return io_channel_write_blk(fs->io, group_block, -SUPERBLOCK_SIZE, super_shadow); } @@ -217,7 +217,7 @@ errcode_t ext2fs_flush(ext2_filsys fs) dgrp_t j; struct ext2_group_desc *s, *t; #endif - + EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); fs_state = fs->super->s_state; @@ -252,7 +252,7 @@ errcode_t ext2fs_flush(ext2_filsys fs) super_shadow = fs->super; group_shadow = fs->group_desc; #endif - + /* * If this is an external journal device, don't write out the * block group descriptors or any of the backup superblocks @@ -289,7 +289,7 @@ errcode_t ext2fs_flush(ext2_filsys fs) blk_t super_blk, old_desc_blk, new_desc_blk; int meta_bg; - ext2fs_super_and_bgd_loc(fs, i, &super_blk, &old_desc_blk, + ext2fs_super_and_bgd_loc(fs, i, &super_blk, &old_desc_blk, &new_desc_blk, &meta_bg); if (!(fs->flags & EXT2_FLAG_MASTER_SB_ONLY) &&i && super_blk) { @@ -300,7 +300,7 @@ errcode_t ext2fs_flush(ext2_filsys fs) } if (fs->flags & EXT2_FLAG_SUPER_ONLY) continue; - if ((old_desc_blk) && + if ((old_desc_blk) && (!(fs->flags & EXT2_FLAG_MASTER_SB_ONLY) || (i == 0))) { retval = io_channel_write_blk(fs->io, old_desc_blk, old_desc_blocks, group_ptr); @@ -365,7 +365,7 @@ errout: errcode_t ext2fs_close(ext2_filsys fs) { errcode_t retval; - + EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); if (fs->flags & EXT2_FLAG_DIRTY) { diff --git a/e2fsprogs/ext2fs/cmp_bitmaps.c b/e2fsprogs/ext2fs/cmp_bitmaps.c index 51cc3d0..fa45a43 100644 --- a/e2fsprogs/ext2fs/cmp_bitmaps.c +++ b/e2fsprogs/ext2fs/cmp_bitmaps.c @@ -30,7 +30,7 @@ errcode_t ext2fs_compare_block_bitmap(ext2fs_block_bitmap bm1, ext2fs_block_bitmap bm2) { blk_t i; - + EXT2_CHECK_MAGIC(bm1, EXT2_ET_MAGIC_BLOCK_BITMAP); EXT2_CHECK_MAGIC(bm2, EXT2_ET_MAGIC_BLOCK_BITMAP); @@ -52,7 +52,7 @@ errcode_t ext2fs_compare_inode_bitmap(ext2fs_inode_bitmap bm1, ext2fs_inode_bitmap bm2) { ext2_ino_t i; - + EXT2_CHECK_MAGIC(bm1, EXT2_ET_MAGIC_INODE_BITMAP); EXT2_CHECK_MAGIC(bm2, EXT2_ET_MAGIC_INODE_BITMAP); diff --git a/e2fsprogs/ext2fs/dblist.c b/e2fsprogs/ext2fs/dblist.c index d5833d7..0cf5698 100644 --- a/e2fsprogs/ext2fs/dblist.c +++ b/e2fsprogs/ext2fs/dblist.c @@ -1,13 +1,13 @@ /* * dblist.c -- directory block list functions - * + * * Copyright 1997 by Theodore Ts'o - * + * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public * License. * %End-Header% - * + * */ #include <stdio.h> @@ -33,7 +33,7 @@ errcode_t ext2fs_get_num_dirs(ext2_filsys fs, ext2_ino_t *ret_num_dirs) ext2_ino_t num_dirs, max_dirs; EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - + num_dirs = 0; max_dirs = fs->super->s_inodes_per_group; for (i = 0; i < fs->group_desc_count; i++) { @@ -88,7 +88,7 @@ static errcode_t make_dblist(ext2_filsys fs, ext2_ino_t size, ext2_ino_t count, retval = ext2fs_get_mem(len, &dblist->list); if (retval) goto cleanup; - + if (list) memcpy(dblist->list, list, len); else @@ -155,10 +155,10 @@ errcode_t ext2fs_copy_dblist(ext2_dblist src, ext2_dblist *dest) errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ext2_ino_t ino, blk_t blk, int blockcnt) { - struct ext2_db_entry *new_entry; + struct ext2_db_entry *new_entry; errcode_t retval; unsigned long old_size; - + EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST); if (dblist->count >= dblist->size) { @@ -189,7 +189,7 @@ errcode_t ext2fs_set_dir_block(ext2_dblist dblist, ext2_ino_t ino, blk_t blk, int blockcnt) { dgrp_t i; - + EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST); for (i=0; i < dblist->count; i++) { @@ -225,7 +225,7 @@ errcode_t ext2fs_dblist_iterate(ext2_dblist dblist, { ext2_ino_t i; int ret; - + EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST); if (!dblist->sorted) @@ -247,7 +247,7 @@ static EXT2_QSORT_TYPE dir_block_cmp(const void *a, const void *b) if (db_a->blk != db_b->blk) return (int) (db_a->blk - db_b->blk); - + if (db_a->ino != db_b->ino) return (int) (db_a->ino - db_b->ino); diff --git a/e2fsprogs/ext2fs/dblist_dir.c b/e2fsprogs/ext2fs/dblist_dir.c index f2e17a6..20b1cde 100644 --- a/e2fsprogs/ext2fs/dblist_dir.c +++ b/e2fsprogs/ext2fs/dblist_dir.c @@ -2,12 +2,12 @@ * dblist_dir.c --- iterate by directory entry * * Copyright 1997 by Theodore Ts'o - * + * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public * License. * %End-Header% - * + * */ #include <stdio.h> @@ -54,7 +54,7 @@ errcode_t ext2fs_dblist_dir_iterate(ext2_dblist dblist, ctx.errcode = 0; retval = ext2fs_dblist_iterate(dblist, db_dir_proc, &ctx); - + if (!block_buf) ext2fs_free_mem(&ctx.buf); if (retval) @@ -69,7 +69,7 @@ static int db_dir_proc(ext2_filsys fs, struct ext2_db_entry *db_info, ctx = (struct dir_context *) priv_data; ctx->dir = db_info->ino; - + return ext2fs_process_dir_block(fs, &db_info->blk, db_info->blockcnt, 0, 0, priv_data); } diff --git a/e2fsprogs/ext2fs/dir_iterate.c b/e2fsprogs/ext2fs/dir_iterate.c index 003c0a3..df820fe 100644 --- a/e2fsprogs/ext2fs/dir_iterate.c +++ b/e2fsprogs/ext2fs/dir_iterate.c @@ -1,6 +1,6 @@ /* * dir_iterate.c --- ext2fs directory iteration operations - * + * * Copyright (C) 1993, 1994, 1994, 1995, 1996, 1997 Theodore Ts'o. * * %Begin-Header% @@ -32,7 +32,7 @@ static int ext2fs_validate_entry(char *buf, int offset, int final_offset) { struct ext2_dir_entry *dirent; - + while (offset < final_offset) { dirent = (struct ext2_dir_entry *)(buf + offset); offset += dirent->rec_len; @@ -59,13 +59,13 @@ errcode_t ext2fs_dir_iterate2(ext2_filsys fs, { struct dir_context ctx; errcode_t retval; - + EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); retval = ext2fs_check_directory(fs, dir); if (retval) return retval; - + ctx.dir = dir; ctx.flags = flags; if (block_buf) @@ -106,7 +106,7 @@ static int xlate_func(ext2_ino_t dir EXT2FS_ATTR((unused)), return (*xl->func)(dirent, offset, blocksize, buf, xl->real_private); } -extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, +extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, ext2_ino_t dir, int flags, char *block_buf, @@ -118,7 +118,7 @@ extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, void *priv_data) { struct xlate xl; - + xl.real_private = priv_data; xl.func = func; @@ -151,7 +151,7 @@ int ext2fs_process_dir_block(ext2_filsys fs, return 0; entry = blockcnt ? DIRENT_OTHER_FILE : DIRENT_DOT_FILE; - + ctx->errcode = ext2fs_read_dir_block(fs, *blocknr, ctx->buf); if (ctx->errcode) return BLOCK_ABORT; @@ -177,18 +177,18 @@ int ext2fs_process_dir_block(ext2_filsys fs, ctx->priv_data); if (entry < DIRENT_OTHER_FILE) entry++; - + if (ret & DIRENT_CHANGED) changed++; if (ret & DIRENT_ABORT) { do_abort++; break; } -next: - if (next_real_entry == offset) +next: + if (next_real_entry == offset) next_real_entry += dirent->rec_len; - - if (ctx->flags & DIRENT_FLAG_INCLUDE_REMOVED) { + + if (ctx->flags & DIRENT_FLAG_INCLUDE_REMOVED) { size = ((dirent->name_len & 0xFF) + 11) & ~3; if (dirent->rec_len != size) { diff --git a/e2fsprogs/ext2fs/dirblock.c b/e2fsprogs/ext2fs/dirblock.c index 5d66ad1..9f82b50 100644 --- a/e2fsprogs/ext2fs/dirblock.c +++ b/e2fsprogs/ext2fs/dirblock.c @@ -1,6 +1,6 @@ /* * dirblock.c --- directory block routines. - * + * * Copyright (C) 1995, 1996 Theodore Ts'o. * * %Begin-Header% @@ -28,9 +28,9 @@ errcode_t ext2fs_read_dir_block2(ext2_filsys fs, blk_t block, unsigned int name_len, rec_len; #ifdef EXT2FS_ENABLE_SWAPFS unsigned int do_swap; -#endif +#endif - retval = io_channel_read_blk(fs->io, block, 1, buf); + retval = io_channel_read_blk(fs->io, block, 1, buf); if (retval) return retval; #ifdef EXT2FS_ENABLE_SWAPFS @@ -110,16 +110,16 @@ errcode_t ext2fs_write_dir_block2(ext2_filsys fs, blk_t block, dirent->rec_len = ext2fs_swab16(dirent->rec_len); dirent->name_len = ext2fs_swab16(dirent->name_len); } -#ifdef WORDS_BIGENDIAN +#ifdef WORDS_BIGENDIAN if (flags & EXT2_DIRBLOCK_V2_STRUCT) dirent->name_len = ext2fs_swab16(dirent->name_len); #endif } - retval = io_channel_write_blk(fs->io, block, 1, buf); + retval = io_channel_write_blk(fs->io, block, 1, buf); ext2fs_free_mem(&buf); return retval; #else - return io_channel_write_blk(fs->io, block, 1, (char *) inbuf); + return io_channel_write_blk(fs->io, block, 1, (char *) inbuf); #endif } diff --git a/e2fsprogs/ext2fs/dirhash.c b/e2fsprogs/ext2fs/dirhash.c index 4d18593..39678a6 100644 --- a/e2fsprogs/ext2fs/dirhash.c +++ b/e2fsprogs/ext2fs/dirhash.c @@ -2,7 +2,7 @@ * dirhash.c -- Calculate the hash of a directory entry * * Copyright (c) 2001 Daniel Phillips - * + * * Copyright (c) 2002 Theodore Ts'o. * * %Begin-Header% @@ -25,7 +25,7 @@ * (see Applied Cryptography, 2nd edition, p448). * * Jeremy Fitzhardinge <jeremy@zip.com.au> 1998 - * + * * This code is made available under the terms of the GPL */ #define DELTA 0x9E3779B9 @@ -37,10 +37,10 @@ static void TEA_transform(__u32 buf[4], __u32 const in[]) __u32 a = in[0], b = in[1], c = in[2], d = in[3]; int n = 16; - do { - sum += DELTA; - b0 += ((b1 << 4)+a) ^ (b1+sum) ^ ((b1 >> 5)+b); - b1 += ((b0 << 4)+c) ^ (b0+sum) ^ ((b0 >> 5)+d); + do { + sum += DELTA; + b0 += ((b1 << 4)+a) ^ (b1+sum) ^ ((b1 >> 5)+b); + b1 += ((b0 << 4)+c) ^ (b0+sum) ^ ((b0 >> 5)+d); } while(--n); buf[0] += b0; @@ -121,7 +121,7 @@ static ext2_dirhash_t dx_hack_hash (const char *name, int len) __u32 hash0 = 0x12a3fe2d, hash1 = 0x37abe8f9; while (len--) { __u32 hash = hash1 + (hash0 ^ (*name++ * 7152373)); - + if (hash & 0x80000000) hash -= 0x7fffffff; hash1 = hash0; hash0 = hash; @@ -160,11 +160,11 @@ static void str2hashbuf(const char *msg, int len, __u32 *buf, int num) * Returns the hash of a filename. If len is 0 and name is NULL, then * this function can be used to test whether or not a hash version is * supported. - * + * * The seed is an 4 longword (32 bits) "secret" which can be used to * uniquify a hash. If the seed is all zero's, then some default seed * may be used. - * + * * A particular hash version specifies whether or not the seed is * represented, and whether or not the returned hash is 32 bits or 64 * bits. 32 bit hashes will return 0 for the minor hash. @@ -178,7 +178,7 @@ errcode_t ext2fs_dirhash(int version, const char *name, int len, __u32 minor_hash = 0; const char *p; int i; - __u32 in[8], buf[4]; + __u32 in[8], buf[4]; /* Initialize the default seed for the hash checksum functions */ buf[0] = 0x67452301; @@ -195,7 +195,7 @@ errcode_t ext2fs_dirhash(int version, const char *name, int len, if (i < 4) memcpy(buf, seed, sizeof(buf)); } - + switch (version) { case EXT2_HASH_LEGACY: hash = dx_hack_hash(name, len); diff --git a/e2fsprogs/ext2fs/dupfs.c b/e2fsprogs/ext2fs/dupfs.c index f8919c2..2009ef7 100644 --- a/e2fsprogs/ext2fs/dupfs.c +++ b/e2fsprogs/ext2fs/dupfs.c @@ -1,6 +1,6 @@ /* * dupfs.c --- duplicate a ext2 filesystem handle - * + * * Copyright (C) 1997, 1998, 2001, 2003, 2005 by Theodore Ts'o. * * %Begin-Header% @@ -25,7 +25,7 @@ errcode_t ext2fs_dup_handle(ext2_filsys src, ext2_filsys *dest) errcode_t retval; EXT2_CHECK_MAGIC(src, EXT2_ET_MAGIC_EXT2FS_FILSYS); - + retval = ext2fs_get_mem(sizeof(struct struct_ext2_filsys), &fs); if (retval) return retval; @@ -91,6 +91,6 @@ errcode_t ext2fs_dup_handle(ext2_filsys src, ext2_filsys *dest) errout: ext2fs_free(fs); return retval; - + } diff --git a/e2fsprogs/ext2fs/e2image.h b/e2fsprogs/ext2fs/e2image.h index e12b7d6..c05d43e 100644 --- a/e2fsprogs/ext2fs/e2image.h +++ b/e2fsprogs/ext2fs/e2image.h @@ -1,10 +1,10 @@ /* * e2image.h --- header file describing the ext2 image format - * + * * Copyright (C) 2000 Theodore Ts'o. * * Note: this uses the POSIX IO interfaces, unlike most of the other - * functions in this library. So sue me. + * functions in this library. So sue me. * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public @@ -24,7 +24,7 @@ struct ext2_image_hdr { char fs_uuid[16]; /* UUID of filesystem */ __u32 fs_blocksize; /* Block size of the filesystem */ __u32 fs_reserved[8]; - + __u32 image_device; /* Device number of image file */ __u32 image_inode; /* Inode number of image file */ __u32 image_time; /* Time of image creation */ @@ -37,15 +37,15 @@ struct ext2_image_hdr { __u32 offset_reserved[8]; }; - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/e2fsprogs/ext2fs/expanddir.c b/e2fsprogs/ext2fs/expanddir.c index 10a5149..c148b93 100644 --- a/e2fsprogs/ext2fs/expanddir.c +++ b/e2fsprogs/ext2fs/expanddir.c @@ -1,6 +1,6 @@ /* * expand.c --- expand an ext2fs directory - * + * * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999 Theodore Ts'o. * * %Begin-Header% @@ -36,7 +36,7 @@ static int expand_dir_proc(ext2_filsys fs, static blk_t last_blk = 0; char *block; errcode_t retval; - + if (*blocknr) { last_blk = *blocknr; return 0; @@ -62,7 +62,7 @@ static int expand_dir_proc(ext2_filsys fs, } memset(block, 0, fs->blocksize); retval = io_channel_write_blk(fs->io, new_blk, 1, block); - } + } if (retval) { es->err = retval; return BLOCK_ABORT; @@ -83,7 +83,7 @@ errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir) errcode_t retval; struct expand_dir_struct es; struct ext2_inode inode; - + EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); if (!(fs->flags & EXT2_FLAG_RW)) @@ -95,11 +95,11 @@ errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir) retval = ext2fs_check_directory(fs, dir); if (retval) return retval; - + es.done = 0; es.err = 0; es.newblocks = 0; - + retval = ext2fs_block_iterate2(fs, dir, BLOCK_FLAG_APPEND, 0, expand_dir_proc, &es); @@ -114,7 +114,7 @@ errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir) retval = ext2fs_read_inode(fs, dir, &inode); if (retval) return retval; - + inode.i_size += fs->blocksize; inode.i_blocks += (fs->blocksize / 512) * es.newblocks; diff --git a/e2fsprogs/ext2fs/ext2_fs.h b/e2fsprogs/ext2fs/ext2_fs.h index 7a98903..4005873 100644 --- a/e2fsprogs/ext2fs/ext2_fs.h +++ b/e2fsprogs/ext2fs/ext2_fs.h @@ -231,9 +231,9 @@ struct ext2_dx_countlimit { #define EXT2_IMAGIC_FL 0x00002000 #define EXT3_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */ #define EXT2_NOTAIL_FL 0x00008000 /* file tail should not be merged */ -#define EXT2_DIRSYNC_FL 0x00010000 /* Synchronous directory modifications */ +#define EXT2_DIRSYNC_FL 0x00010000 /* Synchronous directory modifications */ #define EXT2_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ -#define EXT3_EXTENTS_FL 0x00080000 /* Inode uses extents */ +#define EXT3_EXTENTS_FL 0x00080000 /* Inode uses extents */ #define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ #define EXT2_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ @@ -501,12 +501,12 @@ struct ext2_super_block { __u32 s_last_orphan; /* start of list of inodes to delete */ __u32 s_hash_seed[4]; /* HTREE hash seed */ __u8 s_def_hash_version; /* Default hash version to use */ - __u8 s_jnl_backup_type; /* Default type of journal backup */ + __u8 s_jnl_backup_type; /* Default type of journal backup */ __u16 s_reserved_word_pad; __u32 s_default_mount_opts; __u32 s_first_meta_bg; /* First metablock group */ __u32 s_mkfs_time; /* When the filesystem was created */ - __u32 s_jnl_blocks[17]; /* Backup of the journal inode */ + __u32 s_jnl_blocks[17]; /* Backup of the journal inode */ __u32 s_reserved[172]; /* Padding to the end of the block */ }; @@ -585,7 +585,7 @@ struct ext2_super_block { #define EXT2_DEFM_XATTR_USER 0x0004 #define EXT2_DEFM_ACL 0x0008 #define EXT2_DEFM_UID16 0x0010 -#define EXT3_DEFM_JMODE 0x0060 +#define EXT3_DEFM_JMODE 0x0060 #define EXT3_DEFM_JMODE_DATA 0x0020 #define EXT3_DEFM_JMODE_ORDERED 0x0040 #define EXT3_DEFM_JMODE_WBACK 0x0060 diff --git a/e2fsprogs/ext2fs/ext2fs.h b/e2fsprogs/ext2fs/ext2fs.h index e2e8657..7d2a436 100644 --- a/e2fsprogs/ext2fs/ext2fs.h +++ b/e2fsprogs/ext2fs/ext2fs.h @@ -1,6 +1,6 @@ /* * ext2fs.h --- ext2fs - * + * * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. * * %Begin-Header% @@ -46,7 +46,7 @@ extern "C" { * 1032 bytes long). */ #define SUPERBLOCK_OFFSET 1024 -#define SUPERBLOCK_SIZE 1024 +#define SUPERBLOCK_SIZE 1024 /* * The last ext2fs revision level that this version of the library is @@ -87,7 +87,7 @@ typedef struct struct_ext2_filsys *ext2_filsys; struct ext2fs_struct_generic_bitmap { errcode_t magic; - ext2_filsys fs; + ext2_filsys fs; __u32 start, end; __u32 real_end; char * description; @@ -96,8 +96,8 @@ struct ext2fs_struct_generic_bitmap { __u32 reserved[7]; }; -#define EXT2FS_MARK_ERROR 0 -#define EXT2FS_UNMARK_ERROR 1 +#define EXT2FS_MARK_ERROR 0 +#define EXT2FS_UNMARK_ERROR 1 #define EXT2FS_TEST_ERROR 2 typedef struct ext2fs_struct_generic_bitmap *ext2fs_generic_bitmap; @@ -194,7 +194,7 @@ struct struct_ext2_filsys { io_channel io; int flags; char * device_name; - struct ext2_super_block * super; + struct ext2_super_block * super; unsigned int blocksize; int fragsize; dgrp_t group_desc_count; @@ -250,7 +250,7 @@ struct struct_ext2_filsys { * This is used by ext2fs_expand_dir() to be able to add a new block * to an inode. It can also be used for programs that want to be able * to deal with files that contain "holes". - * + * * BLOCK_FLAG_TRAVERSE indicates that the iterator function for the * indirect, doubly indirect, etc. blocks should be called after all * of the blocks containined in the indirect blocks are processed. @@ -282,7 +282,7 @@ struct struct_ext2_filsys { /* * Flags for ext2fs_move_blocks */ -#define EXT2_BMOVE_GET_DBLIST 0x0001 +#define EXT2_BMOVE_GET_DBLIST 0x0001 #define EXT2_BMOVE_DEBUG 0x0002 #endif @@ -457,7 +457,7 @@ extern errcode_t ext2fs_alloc_block(ext2_filsys fs, blk_t goal, char *block_buf, blk_t *ret); /* alloc_sb.c */ -extern int ext2fs_reserve_super_and_bgd(ext2_filsys fs, +extern int ext2fs_reserve_super_and_bgd(ext2_filsys fs, dgrp_t group, ext2fs_block_bitmap bmap); @@ -567,7 +567,7 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs, /* bmap.c */ extern errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, - struct ext2_inode *inode, + struct ext2_inode *inode, char *block_buf, int bmap_flags, blk_t block, blk_t *phys_blk); @@ -587,7 +587,7 @@ extern errcode_t ext2fs_check_desc(ext2_filsys fs); extern errcode_t ext2fs_close(ext2_filsys fs); extern errcode_t ext2fs_flush(ext2_filsys fs); extern int ext2fs_bg_has_super(ext2_filsys fs, int group_block); -extern int ext2fs_super_and_bgd_loc(ext2_filsys fs, +extern int ext2fs_super_and_bgd_loc(ext2_filsys fs, dgrp_t group, blk_t *ret_super_blk, blk_t *ret_old_desc_blk, @@ -652,7 +652,7 @@ extern errcode_t ext2fs_dirhash(int version, const char *name, int len, /* dir_iterate.c */ -extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, +extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, ext2_ino_t dir, int flags, char *block_buf, @@ -662,7 +662,7 @@ extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, char *buf, void *priv_data), void *priv_data); -extern errcode_t ext2fs_dir_iterate2(ext2_filsys fs, +extern errcode_t ext2fs_dir_iterate2(ext2_filsys fs, ext2_ino_t dir, int flags, char *block_buf, @@ -751,10 +751,10 @@ extern errcode_t ext2fs_initialize(const char *name, int flags, /* icount.c */ extern void ext2fs_free_icount(ext2_icount_t icount); -extern errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, +extern errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, unsigned int size, ext2_icount_t hint, ext2_icount_t *ret); -extern errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, +extern errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, unsigned int size, ext2_icount_t *ret); extern errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ext2_ino_t ino, @@ -770,9 +770,9 @@ errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *); /* inode.c */ extern errcode_t ext2fs_flush_icache(ext2_filsys fs); -extern errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, +extern errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, ext2_ino_t *ino, - struct ext2_inode *inode, + struct ext2_inode *inode, int bufsize); extern errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks, ext2_inode_scan *ret_scan); @@ -791,12 +791,12 @@ extern void ext2fs_set_inode_callback extern int ext2fs_inode_scan_flags(ext2_inode_scan scan, int set_flags, int clear_flags); extern errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino, - struct ext2_inode * inode, + struct ext2_inode * inode, int bufsize); extern errcode_t ext2fs_read_inode (ext2_filsys fs, ext2_ino_t ino, struct ext2_inode * inode); extern errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino, - struct ext2_inode * inode, + struct ext2_inode * inode, int bufsize); extern errcode_t ext2fs_write_inode(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode * inode); @@ -807,12 +807,12 @@ extern errcode_t ext2fs_check_directory(ext2_filsys fs, ext2_ino_t ino); /* inode_io.c */ extern io_manager inode_io_manager; -extern errcode_t ext2fs_inode_io_intern(ext2_filsys fs, ext2_ino_t ino, +extern errcode_t ext2fs_inode_io_intern(ext2_filsys fs, ext2_ino_t ino, char **name); extern errcode_t ext2fs_inode_io_intern2(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, char **name); - + /* ismounted.c */ extern errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags); extern errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags, @@ -852,11 +852,11 @@ extern errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size, extern errcode_t ext2fs_open(const char *name, int flags, int superblock, unsigned int block_size, io_manager manager, ext2_filsys *ret_fs); -extern errcode_t ext2fs_open2(const char *name, const char *io_options, - int flags, int superblock, +extern errcode_t ext2fs_open2(const char *name, const char *io_options, + int flags, int superblock, unsigned int block_size, io_manager manager, ext2_filsys *ret_fs); -extern blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block, +extern blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block, dgrp_t i); errcode_t ext2fs_get_data_io(ext2_filsys fs, io_channel *old_io); errcode_t ext2fs_set_data_io(ext2_filsys fs, io_channel new_io); @@ -877,14 +877,14 @@ extern errcode_t ext2fs_read_bb_inode(ext2_filsys fs, ext2_badblocks_list *bb_list); /* read_bb_file.c */ -extern errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f, +extern errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f, ext2_badblocks_list *bb_list, void *priv_data, void (*invalid)(ext2_filsys fs, blk_t blk, char *badstr, void *priv_data)); -extern errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f, +extern errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f, ext2_badblocks_list *bb_list, void (*invalid)(ext2_filsys fs, blk_t blk)); @@ -904,7 +904,7 @@ extern errcode_t ext2fs_copy_bitmap(ext2fs_generic_bitmap src, ext2fs_generic_bitmap *dest); /* swapfs.c */ -extern void ext2fs_swap_ext_attr(char *to, char *from, int bufsize, +extern void ext2fs_swap_ext_attr(char *to, char *from, int bufsize, int has_header); extern void ext2fs_swap_super(struct ext2_super_block * super); extern void ext2fs_swap_group_desc(struct ext2_group_desc *gdp); diff --git a/e2fsprogs/ext2fs/ext2fsP.h b/e2fsprogs/ext2fs/ext2fsP.h index eea32d6..90b0812 100644 --- a/e2fsprogs/ext2fs/ext2fsP.h +++ b/e2fsprogs/ext2fs/ext2fsP.h @@ -1,6 +1,6 @@ /* * ext2fsP.h --- private header file for ext2 library - * + * * Copyright (C) 1997 Theodore Ts'o. * * %Begin-Header% @@ -78,7 +78,7 @@ struct ext2_inode_cache_ent { /* Function prototypes */ -extern int ext2fs_process_dir_block(ext2_filsys fs, +extern int ext2fs_process_dir_block(ext2_filsys fs, blk_t *blocknr, e2_blkcnt_t blockcnt, blk_t ref_block, diff --git a/e2fsprogs/ext2fs/ext2fs_inline.c b/e2fsprogs/ext2fs/ext2fs_inline.c index f14e7b2..2fa9a9e 100644 --- a/e2fsprogs/ext2fs/ext2fs_inline.c +++ b/e2fsprogs/ext2fs/ext2fs_inline.c @@ -1,6 +1,6 @@ /* * ext2fs.h --- ext2fs - * + * * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. * * %Begin-Header% @@ -36,7 +36,7 @@ errcode_t ext2fs_free_mem(void *ptr) *pp = 0; return 0; } - + /* * Resize memory */ @@ -154,7 +154,7 @@ blk_t ext2fs_inode_data_blocks(ext2_filsys fs, struct ext2_inode *inode) { return inode->i_blocks - - (inode->i_file_acl ? fs->blocksize >> 9 : 0); + (inode->i_file_acl ? fs->blocksize >> 9 : 0); } @@ -179,7 +179,7 @@ __u32 ext2fs_swab32(__u32 val) int ext2fs_find_first_bit_set(void * addr, unsigned size) { char *cp = (unsigned char *) addr; - int res = 0, d0; + int res = 0, d0; if (!size) return 0; @@ -191,7 +191,7 @@ int ext2fs_find_first_bit_set(void * addr, unsigned size) d0 = ffs(*cp); if (d0 == 0) return size; - + return res + d0 - 1; } @@ -199,10 +199,10 @@ int ext2fs_find_next_bit_set (void * addr, int size, int offset) { unsigned char * p; int set = 0, bit = offset & 7, res = 0, d0; - + res = offset >> 3; p = ((unsigned char *) addr) + res; - + if (bit) { set = ffs(*p & ~((1 << bit) - 1)); if (set) @@ -245,35 +245,35 @@ int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap, int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block) { - return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, + return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, block); } int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block) { - return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, + return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, block); } int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode) { - return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, + return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode); } int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode) { - return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, + return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode); } int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode) { - return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, + return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode); } @@ -286,7 +286,7 @@ void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap, bitmap->description); return; } -#endif +#endif ext2fs_set_bit(block - bitmap->start, bitmap->bitmap); } @@ -415,7 +415,7 @@ void ext2fs_mark_block_bitmap_range(ext2fs_block_bitmap bitmap, blk_t block, int num) { int i; - + if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block, bitmap->description); @@ -429,14 +429,14 @@ void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap, blk_t block, int num) { int i; - + #ifdef EXT2FS_DEBUG_FAST_OPS if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block, bitmap->description); return; } -#endif +#endif for (i=0; i < num; i++) ext2fs_set_bit(block + i - bitmap->start, bitmap->bitmap); } @@ -445,7 +445,7 @@ void ext2fs_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap, blk_t block, int num) { int i; - + if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block, bitmap->description); @@ -459,14 +459,14 @@ void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap, blk_t block, int num) { int i; - + #ifdef EXT2FS_DEBUG_FAST_OPS if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block, bitmap->description); return; } -#endif +#endif for (i=0; i < num; i++) ext2fs_clear_bit(block + i - bitmap->start, bitmap->bitmap); } diff --git a/e2fsprogs/ext2fs/ext_attr.c b/e2fsprogs/ext2fs/ext_attr.c index 08211c3..10b8bfd 100644 --- a/e2fsprogs/ext2fs/ext_attr.c +++ b/e2fsprogs/ext2fs/ext_attr.c @@ -1,6 +1,6 @@ /* * ext_attr.c --- extended attribute blocks - * + * * Copyright (C) 2001 Andreas Gruenbacher, <a.gruenbacher@computer.org> * * Copyright (C) 2002 Theodore Ts'o. @@ -27,7 +27,7 @@ errcode_t ext2fs_read_ext_attr(ext2_filsys fs, blk_t block, void *buf) { errcode_t retval; - retval = io_channel_read_blk(fs->io, block, 1, buf); + retval = io_channel_read_blk(fs->io, block, 1, buf); if (retval) return retval; #ifdef EXT2FS_ENABLE_SWAPFS @@ -55,7 +55,7 @@ errcode_t ext2fs_write_ext_attr(ext2_filsys fs, blk_t block, void *inbuf) } else #endif write_buf = (char *) inbuf; - retval = io_channel_write_blk(fs->io, block, 1, write_buf); + retval = io_channel_write_blk(fs->io, block, 1, write_buf); if (buf) ext2fs_free_mem(&buf); if (!retval) diff --git a/e2fsprogs/ext2fs/fileio.c b/e2fsprogs/ext2fs/fileio.c index 3e42cbc..669e80c 100644 --- a/e2fsprogs/ext2fs/fileio.c +++ b/e2fsprogs/ext2fs/fileio.c @@ -1,6 +1,6 @@ /* * fileio.c --- Simple file I/O routines - * + * * Copyright (C) 1997 Theodore Ts'o. * * %Begin-Header% @@ -20,14 +20,14 @@ struct ext2_file { errcode_t magic; - ext2_filsys fs; + ext2_filsys fs; ext2_ino_t ino; struct ext2_inode inode; - int flags; + int flags; __u64 pos; blk_t blockno; blk_t physblock; - char *buf; + char *buf; }; #define BMAP_BUFFER (file->buf + fs->blocksize) @@ -36,7 +36,7 @@ errcode_t ext2fs_file_open2(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, int flags, ext2_file_t *ret) { - ext2_file_t file; + ext2_file_t file; errcode_t retval; /* @@ -50,7 +50,7 @@ errcode_t ext2fs_file_open2(ext2_filsys fs, ext2_ino_t ino, retval = ext2fs_get_mem(sizeof(struct ext2_file), &file); if (retval) return retval; - + memset(file, 0, sizeof(struct ext2_file)); file->magic = EXT2_ET_MAGIC_EXT2_FILE; file->fs = fs; @@ -64,14 +64,14 @@ errcode_t ext2fs_file_open2(ext2_filsys fs, ext2_ino_t ino, if (retval) goto fail; } - + retval = ext2fs_get_mem(fs->blocksize * 3, &file->buf); if (retval) goto fail; *ret = file; return 0; - + fail: if (file->buf) ext2fs_free_mem(&file->buf); @@ -103,7 +103,7 @@ errcode_t ext2fs_file_flush(ext2_file_t file) { errcode_t retval; ext2_filsys fs; - + EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE); fs = file->fs; @@ -176,7 +176,7 @@ static errcode_t load_buffer(ext2_file_t file, int dontfill) if (!dontfill) { if (file->physblock) { retval = io_channel_read_blk(fs->io, - file->physblock, + file->physblock, 1, file->buf); if (retval) return retval; @@ -187,16 +187,16 @@ static errcode_t load_buffer(ext2_file_t file, int dontfill) } return 0; } - + errcode_t ext2fs_file_close(ext2_file_t file) { errcode_t retval; - + EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE); retval = ext2fs_file_flush(file); - + if (file->buf) ext2fs_free_mem(&file->buf); ext2fs_free_mem(&file); @@ -232,14 +232,14 @@ errcode_t ext2fs_file_read(ext2_file_t file, void *buf, left = EXT2_I_SIZE(&file->inode) - file->pos ; if (c > left) c = left; - + memcpy(ptr, file->buf+start, c); file->pos += c; ptr += c; count += c; wanted -= c; } - + fail: if (got) *got = count; @@ -265,7 +265,7 @@ errcode_t ext2fs_file_write(ext2_file_t file, const void *buf, retval = sync_buffer_position(file); if (retval) goto fail; - + start = file->pos % fs->blocksize; c = fs->blocksize - start; if (c > nbytes) @@ -286,7 +286,7 @@ errcode_t ext2fs_file_write(ext2_file_t file, const void *buf, count += c; nbytes -= c; } - + fail: if (written) *written = count; @@ -318,7 +318,7 @@ errcode_t ext2fs_file_lseek(ext2_file_t file, ext2_off_t offset, { __u64 loffset, ret_loffset; errcode_t retval; - + loffset = offset; retval = ext2fs_file_llseek(file, loffset, whence, &ret_loffset); if (ret_pos) @@ -354,14 +354,14 @@ ext2_off_t ext2fs_file_get_size(ext2_file_t file) /* * This function sets the size of the file, truncating it if necessary - * + * * XXX still need to call truncate */ errcode_t ext2fs_file_set_size(ext2_file_t file, ext2_off_t size) { errcode_t retval; EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE); - + file->inode.i_size = size; file->inode.i_size_high = 0; if (file->ino) { @@ -370,7 +370,7 @@ errcode_t ext2fs_file_set_size(ext2_file_t file, ext2_off_t size) return retval; } - /* + /* * XXX truncate inode if necessary */ diff --git a/e2fsprogs/ext2fs/finddev.c b/e2fsprogs/ext2fs/finddev.c index c459c08..552aa79 100644 --- a/e2fsprogs/ext2fs/finddev.c +++ b/e2fsprogs/ext2fs/finddev.c @@ -1,7 +1,7 @@ /* * finddev.c -- this routine attempts to find a particular device in - * /dev - * + * /dev + * * Copyright (C) 2000 Theodore Ts'o. * * %Begin-Header% @@ -124,7 +124,7 @@ char *ext2fs_find_block_device(dev_t device) add_to_dirlist("/devices", &list); add_to_dirlist("/devfs", &list); add_to_dirlist("/dev", &list); - + while (list) { current = list; list = list->next; @@ -150,7 +150,7 @@ char *ext2fs_find_block_device(dev_t device) return ret_path; } - + #ifdef DEBUG int main(int argc, char** argv) { @@ -194,5 +194,5 @@ int main(int argc, char** argv) } return 0; } - + #endif diff --git a/e2fsprogs/ext2fs/flushb.c b/e2fsprogs/ext2fs/flushb.c index 1882795..9f04647 100644 --- a/e2fsprogs/ext2fs/flushb.c +++ b/e2fsprogs/ext2fs/flushb.c @@ -1,7 +1,7 @@ /* * flushb.c --- Hides system-dependent information for both syncing a - * device to disk and to flush any buffers from disk cache. - * + * device to disk and to flush any buffers from disk cache. + * * Copyright (C) 2000 Theodore Ts'o. * * %Begin-Header% @@ -29,7 +29,7 @@ #include "ext2fs.h" /* - * For Linux, define BLKFLSBUF and FDFLUSH if necessary, since + * For Linux, define BLKFLSBUF and FDFLUSH if necessary, since * not all portable header file does so for us. This really should be * fixed in the glibc header files. (Recent glibcs appear to define * BLKFLSBUF in sys/mount.h, but FDFLUSH still doesn't seem to be diff --git a/e2fsprogs/ext2fs/freefs.c b/e2fsprogs/ext2fs/freefs.c index 029ffaa..3fd51f2 100644 --- a/e2fsprogs/ext2fs/freefs.c +++ b/e2fsprogs/ext2fs/freefs.c @@ -1,6 +1,6 @@ /* * freefs.c --- free an ext2 filesystem - * + * * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. * * %Begin-Header% @@ -52,7 +52,7 @@ void ext2fs_free(ext2_filsys fs) if (fs->icache) ext2fs_free_inode_cache(fs->icache); - + fs->magic = 0; ext2fs_free_mem(&fs); diff --git a/e2fsprogs/ext2fs/gen_bitmap.c b/e2fsprogs/ext2fs/gen_bitmap.c index 700affa..3f15ce6 100644 --- a/e2fsprogs/ext2fs/gen_bitmap.c +++ b/e2fsprogs/ext2fs/gen_bitmap.c @@ -1,6 +1,6 @@ /* * gen_bitmap.c --- Generic bitmap routines that used to be inlined. - * + * * Copyright (C) 2001 Theodore Ts'o. * * %Begin-Header% diff --git a/e2fsprogs/ext2fs/get_pathname.c b/e2fsprogs/ext2fs/get_pathname.c index 23f593f..594090d 100644 --- a/e2fsprogs/ext2fs/get_pathname.c +++ b/e2fsprogs/ext2fs/get_pathname.c @@ -1,6 +1,6 @@ /* * get_pathname.c --- do directry/inode -> name translation - * + * * Copyright (C) 1993, 1994, 1995 Theodore Ts'o. * * %Begin-Header% @@ -8,14 +8,14 @@ * License. * %End-Header% * - * ext2fs_get_pathname(fs, dir, ino, name) + * ext2fs_get_pathname(fs, dir, ino, name) + * + * This function translates takes two inode numbers into a + * string, placing the result in <name>. <dir> is the containing + * directory inode, and <ino> is the inode number itself. If + * <ino> is zero, then ext2fs_get_pathname will return pathname + * of the the directory <dir>. * - * This function translates takes two inode numbers into a - * string, placing the result in <name>. <dir> is the containing - * directory inode, and <ino> is the inode number itself. If - * <ino> is zero, then ext2fs_get_pathname will return pathname - * of the the directory <dir>. - * */ #include <stdio.h> @@ -65,8 +65,8 @@ static int get_pathname_proc(struct ext2_dir_entry *dirent, return 0; } -static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir, - ext2_ino_t ino, int maxdepth, +static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir, + ext2_ino_t ino, int maxdepth, char *buf, char **name) { struct get_pathname_struct gp; @@ -93,7 +93,7 @@ static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir, gp.parent = 0; gp.name = 0; gp.errcode = 0; - + retval = ext2fs_dir_iterate(fs, dir, 0, buf, get_pathname_proc, &gp); if (retval) goto cleanup; @@ -110,15 +110,15 @@ static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir, *name = parent_name; return 0; } - - if (gp.name) + + if (gp.name) retval = ext2fs_get_mem(strlen(parent_name)+strlen(gp.name)+2, &ret); else retval = ext2fs_get_mem(strlen(parent_name)+5, &ret); if (retval) goto cleanup; - + ret[0] = 0; if (parent_name[1]) strcat(ret, parent_name); @@ -130,7 +130,7 @@ static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir, *name = ret; ext2fs_free_mem(&parent_name); retval = 0; - + cleanup: if (gp.name) ext2fs_free_mem(&gp.name); @@ -153,5 +153,5 @@ errcode_t ext2fs_get_pathname(ext2_filsys fs, ext2_ino_t dir, ext2_ino_t ino, retval = ext2fs_get_pathname_int(fs, dir, ino, 32, buf, name); ext2fs_free_mem(&buf); return retval; - + } diff --git a/e2fsprogs/ext2fs/getsectsize.c b/e2fsprogs/ext2fs/getsectsize.c index 77a9e3d..b561660 100644 --- a/e2fsprogs/ext2fs/getsectsize.c +++ b/e2fsprogs/ext2fs/getsectsize.c @@ -1,6 +1,6 @@ /* * getsectsize.c --- get the sector size of a device. - * + * * Copyright (C) 1995, 1995 Theodore Ts'o. * Copyright (C) 2003 VMware, Inc. * diff --git a/e2fsprogs/ext2fs/getsize.c b/e2fsprogs/ext2fs/getsize.c index 036d926..bfafdf2 100644 --- a/e2fsprogs/ext2fs/getsize.c +++ b/e2fsprogs/ext2fs/getsize.c @@ -1,11 +1,11 @@ /* * getsize.c --- get the size of a partition. - * + * * Copyright (C) 1995, 1995 Theodore Ts'o. * Copyright (C) 2003 VMware, Inc. * * Windows version of ext2fs_get_device_size by Chris Li, VMware. - * + * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public * License. @@ -75,10 +75,10 @@ errcode_t ext2fs_get_device_size(const char *file, int blocksize, DWORD filesize; #endif /* HAVE_GET_FILE_SIZE_EX */ - dev = CreateFile(file, GENERIC_READ, + dev = CreateFile(file, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE , - NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - + NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (dev == INVALID_HANDLE_VALUE) return EBADF; if (DeviceIoControl(dev, IOCTL_DISK_GET_PARTITION_INFO, @@ -87,7 +87,7 @@ errcode_t ext2fs_get_device_size(const char *file, int blocksize, &retbytes, NULL)) { *retblocks = pi.PartitionLength.QuadPart / blocksize; - + } else if (DeviceIoControl(dev, IOCTL_DISK_GET_DRIVE_GEOMETRY, &gi, sizeof(DISK_GEOMETRY), &gi, sizeof(DISK_GEOMETRY), @@ -137,7 +137,7 @@ errcode_t ext2fs_get_device_size(const char *file, int blocksize, int fd; int valid_blkgetsize64 = 1; #ifdef __linux__ - struct utsname ut; + struct utsname ut; #endif unsigned long long size64; unsigned long size; @@ -272,7 +272,7 @@ int main(int argc, char **argv) { blk_t blocks; int retval; - + if (argc < 2) { fprintf(stderr, "Usage: %s device\n", argv[0]); exit(1); diff --git a/e2fsprogs/ext2fs/icount.c b/e2fsprogs/ext2fs/icount.c index 5997792..0167777 100644 --- a/e2fsprogs/ext2fs/icount.c +++ b/e2fsprogs/ext2fs/icount.c @@ -81,19 +81,19 @@ errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, unsigned int size, if (hint->size > size) size = (size_t) hint->size; } - + retval = ext2fs_get_mem(sizeof(struct ext2_icount), &icount); if (retval) return retval; memset(icount, 0, sizeof(struct ext2_icount)); - retval = ext2fs_allocate_inode_bitmap(fs, 0, + retval = ext2fs_allocate_inode_bitmap(fs, 0, &icount->single); if (retval) goto errout; if (flags & EXT2_ICOUNT_OPT_INCREMENT) { - retval = ext2fs_allocate_inode_bitmap(fs, 0, + retval = ext2fs_allocate_inode_bitmap(fs, 0, &icount->multiple); if (retval) goto errout; @@ -113,7 +113,7 @@ errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, unsigned int size, goto errout; icount->size += fs->super->s_inodes_count / 50; } - + bytes = (size_t) (icount->size * sizeof(struct ext2_icount_el)); #if 0 printf("Icount allocated %d entries, %d bytes.\n", @@ -148,7 +148,7 @@ errout: return(retval); } -errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, +errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, unsigned int size, ext2_icount_t *ret) { @@ -157,12 +157,12 @@ errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, /* * insert_icount_el() --- Insert a new entry into the sorted list at a - * specified position. + * specified position. */ static struct ext2_icount_el *insert_icount_el(ext2_icount_t icount, ext2_ino_t ino, int pos) { - struct ext2_icount_el *el; + struct ext2_icount_el *el; errcode_t retval; ext2_ino_t new_size = 0; int num; @@ -170,14 +170,14 @@ static struct ext2_icount_el *insert_icount_el(ext2_icount_t icount, if (icount->count >= icount->size) { if (icount->count) { new_size = icount->list[(unsigned)icount->count-1].ino; - new_size = (ext2_ino_t) (icount->count * + new_size = (ext2_ino_t) (icount->count * ((float) icount->num_inodes / new_size)); } if (new_size < (icount->size + 100)) new_size = icount->size + 100; #if 0 printf("Reallocating icount %d entries...\n", new_size); -#endif +#endif retval = ext2fs_resize_mem((size_t) icount->size * sizeof(struct ext2_icount_el), (size_t) new_size * @@ -203,8 +203,8 @@ static struct ext2_icount_el *insert_icount_el(ext2_icount_t icount, /* * get_icount_el() --- given an inode number, try to find icount - * information in the sorted list. If the create flag is set, - * and we can't find an entry, create one in the sorted list. + * information in the sorted list. If the create flag is set, + * and we can't find an entry, create one in the sorted list. */ static struct ext2_icount_el *get_icount_el(ext2_icount_t icount, ext2_ino_t ino, int create) @@ -222,7 +222,7 @@ static struct ext2_icount_el *get_icount_el(ext2_icount_t icount, } if (icount->count == 0) return 0; - + if (icount->cursor >= icount->count) icount->cursor = 0; if (ino == icount->list[icount->cursor].ino) @@ -247,7 +247,7 @@ static struct ext2_icount_el *get_icount_el(ext2_icount_t icount, range = 0; else if (ino > highval) range = 1; - else + else range = ((float) (ino - lowval)) / (highval - lowval); mid = low + ((int) (range * (high-low))); @@ -276,7 +276,7 @@ errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *out) errcode_t ret = 0; unsigned int i; const char *bad = "bad icount"; - + EXT2_CHECK_MAGIC(icount, EXT2_ET_MAGIC_ICOUNT); if (icount->count > icount->size) { @@ -297,7 +297,7 @@ errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *out) errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ext2_ino_t ino, __u16 *ret) { struct ext2_icount_el *el; - + EXT2_CHECK_MAGIC(icount, EXT2_ET_MAGIC_ICOUNT); if (!ino || (ino > icount->num_inodes)) @@ -413,7 +413,7 @@ errcode_t ext2fs_icount_decrement(ext2_icount_t icount, ext2_ino_t ino, if (icount->multiple && !ext2fs_test_inode_bitmap(icount->multiple, ino)) return EXT2_ET_INVALID_ARGUMENT; - + el = get_icount_el(icount, ino, 0); if (!el || el->count == 0) return EXT2_ET_INVALID_ARGUMENT; diff --git a/e2fsprogs/ext2fs/imager.c b/e2fsprogs/ext2fs/imager.c index 3f2826b..00eb717 100644 --- a/e2fsprogs/ext2fs/imager.c +++ b/e2fsprogs/ext2fs/imager.c @@ -1,11 +1,11 @@ /* * image.c --- writes out the critical parts of the filesystem as a - * flat file. + * flat file. * * Copyright (C) 2000 Theodore Ts'o. * * Note: this uses the POSIX IO interfaces, unlike most of the other - * functions in this library. So sue me. + * functions in this library. So sue me. * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public @@ -67,7 +67,7 @@ errcode_t ext2fs_image_inode_write(ext2_filsys fs, int fd, int flags) errcode_t retval; buf = xmalloc(fs->blocksize * BUF_BLOCKS); - + for (group = 0; group < fs->group_desc_count; group++) { blk = fs->group_desc[(unsigned)group].bg_inode_table; if (!blk) @@ -127,7 +127,7 @@ errout: /* * Read in the inode table and stuff it into place */ -errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd, +errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd, int flags EXT2FS_ATTR((unused))) { unsigned int group, c, left; @@ -137,7 +137,7 @@ errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd, errcode_t retval; buf = xmalloc(fs->blocksize * BUF_BLOCKS); - + for (group = 0; group < fs->group_desc_count; group++) { blk = fs->group_desc[(unsigned)group].bg_inode_table; if (!blk) { @@ -161,7 +161,7 @@ errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd, retval = io_channel_write_blk(fs->io, blk, c, buf); if (retval) goto errout; - + blk += c; left -= c; } @@ -176,7 +176,7 @@ errout: /* * Write out superblock and group descriptors */ -errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd, +errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd, int flags EXT2FS_ATTR((unused))) { char *buf, *cp; @@ -213,7 +213,7 @@ errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd, retval = EXT2_ET_SHORT_WRITE; goto errout; } - + retval = 0; errout: @@ -224,7 +224,7 @@ errout: /* * Read the superblock and group descriptors and overwrite them. */ -errcode_t ext2fs_image_super_read(ext2_filsys fs, int fd, +errcode_t ext2fs_image_super_read(ext2_filsys fs, int fd, int flags EXT2FS_ATTR((unused))) { char *buf; @@ -368,7 +368,7 @@ errcode_t ext2fs_image_bitmap_read(ext2_filsys fs, int fd, int flags) goto errout; } memcpy(ptr, buf, size); - + retval = 0; errout: if (buf) diff --git a/e2fsprogs/ext2fs/ind_block.c b/e2fsprogs/ext2fs/ind_block.c index c9fd86a..3e6cdc1 100644 --- a/e2fsprogs/ext2fs/ind_block.c +++ b/e2fsprogs/ext2fs/ind_block.c @@ -1,8 +1,8 @@ /* * ind_block.c --- indirect block I/O routines - * - * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - * 2001, 2002, 2003, 2004, 2005 by Theodore Ts'o. + * + * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, + * 2001, 2002, 2003, 2004, 2005 by Theodore Ts'o. * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public diff --git a/e2fsprogs/ext2fs/initialize.c b/e2fsprogs/ext2fs/initialize.c index 82cd9f1..3d326b5 100644 --- a/e2fsprogs/ext2fs/initialize.c +++ b/e2fsprogs/ext2fs/initialize.c @@ -1,9 +1,9 @@ /* * initialize.c --- initialize a filesystem handle given superblock - * parameters. Used by mke2fs when initializing a filesystem. - * + * parameters. Used by mke2fs when initializing a filesystem. + * * Copyright (C) 1994, 1995, 1996 Theodore Ts'o. - * + * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public * License. @@ -36,7 +36,7 @@ #if defined(__FreeBSD__) && defined(EXT2_OS_FREEBSD) #define CREATOR_OS EXT2_OS_FREEBSD #else -#if defined(LITES) && defined(EXT2_OS_LITES) +#if defined(LITES) && defined(EXT2_OS_LITES) #define CREATOR_OS EXT2_OS_LITES #else #define CREATOR_OS EXT2_OS_LINUX /* by default */ @@ -44,13 +44,13 @@ #endif /* defined(__FreeBSD__) && defined(EXT2_OS_FREEBSD) */ #endif /* defined(__GNU__) && defined(EXT2_OS_HURD) */ #endif /* defined(__linux__) && defined(EXT2_OS_LINUX) */ - + /* * Note we override the kernel include file's idea of what the default * check interval (never) should be. It's a good idea to check at * least *occasionally*, specially since servers will never rarely get * to reboot, since Linux is so robust these days. :-) - * + * * 180 days (six months) seems like a good value. */ #ifdef EXT2_DFL_CHECKINTERVAL @@ -108,11 +108,11 @@ errcode_t ext2fs_initialize(const char *name, int flags, if (!param || !param->s_blocks_count) return EXT2_ET_INVALID_ARGUMENT; - + retval = ext2fs_get_mem(sizeof(struct struct_ext2_filsys), &fs); if (retval) return retval; - + memset(fs, 0, sizeof(struct struct_ext2_filsys)); fs->magic = EXT2_ET_MAGIC_EXT2FS_FILSYS; fs->flags = flags | EXT2_FLAG_RW; @@ -181,7 +181,7 @@ errcode_t ext2fs_initialize(const char *name, int flags, if (super->s_blocks_per_group > EXT2_MAX_BLOCKS_PER_GROUP(super)) super->s_blocks_per_group = EXT2_MAX_BLOCKS_PER_GROUP(super); super->s_frags_per_group = super->s_blocks_per_group * frags_per_block; - + 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) { @@ -222,7 +222,7 @@ retry: */ if (super->s_inodes_count < EXT2_FIRST_INODE(super)+1) super->s_inodes_count = EXT2_FIRST_INODE(super)+1; - + /* * There should be at least as many inodes as the user * requested. Figure out how many inodes per group that @@ -332,12 +332,12 @@ retry: retval = ext2fs_get_mem(strlen(fs->device_name) + 80, &buf); if (retval) goto cleanup; - + sprintf(buf, "block bitmap for %s", fs->device_name); retval = ext2fs_allocate_block_bitmap(fs, buf, &fs->block_map); if (retval) goto cleanup; - + sprintf(buf, "inode bitmap for %s", fs->device_name); retval = ext2fs_allocate_inode_bitmap(fs, buf, &fs->inode_map); if (retval) @@ -369,14 +369,14 @@ retry: fs->group_desc[i].bg_free_inodes_count = fs->super->s_inodes_per_group; fs->group_desc[i].bg_used_dirs_count = 0; - + group_block += super->s_blocks_per_group; } - + ext2fs_mark_super_dirty(fs); ext2fs_mark_bb_dirty(fs); ext2fs_mark_ib_dirty(fs); - + io_channel_set_blksize(fs->io, fs->blocksize); *ret_fs = fs; diff --git a/e2fsprogs/ext2fs/inline.c b/e2fsprogs/ext2fs/inline.c index 5833b1d..9c3a6c0 100644 --- a/e2fsprogs/ext2fs/inline.c +++ b/e2fsprogs/ext2fs/inline.c @@ -1,8 +1,8 @@ /* * inline.c --- Includes the inlined functions defined in the header - * files as standalone functions, in case the application program - * is compiled with inlining turned off. - * + * files as standalone functions, in case the application program + * is compiled with inlining turned off. + * * Copyright (C) 1993, 1994 Theodore Ts'o. * * %Begin-Header% 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) diff --git a/e2fsprogs/ext2fs/inode_io.c b/e2fsprogs/ext2fs/inode_io.c index b5c08b9..deaa955 100644 --- a/e2fsprogs/ext2fs/inode_io.c +++ b/e2fsprogs/ext2fs/inode_io.c @@ -1,6 +1,6 @@ /* * inode_io.c --- This is allows an inode in an ext2 filesystem image - * to be accessed via the I/O manager interface. + * to be accessed via the I/O manager interface. * * Copyright (C) 2002 Theodore Ts'o. * @@ -35,7 +35,7 @@ struct inode_private_data { char name[32]; ext2_file_t file; ext2_filsys fs; - ext2_ino_t ino; + ext2_ino_t ino; struct ext2_inode inode; int flags; struct inode_private_data *next; @@ -75,7 +75,7 @@ errcode_t ext2fs_inode_io_intern2(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, char **name) { - struct inode_private_data *data; + struct inode_private_data *data; errcode_t retval; if ((retval = ext2fs_get_mem(sizeof(struct inode_private_data), @@ -150,7 +150,7 @@ static errcode_t inode_open(const char *name, int flags, io_channel *channel) &data->file); if (retval) goto cleanup; - + *channel = io; return 0; @@ -176,7 +176,7 @@ static errcode_t inode_close(io_channel channel) return 0; retval = ext2fs_file_close(data->file); - + ext2fs_free_mem(&channel->private_data); if (channel->name) ext2fs_free_mem(&channel->name); @@ -255,12 +255,12 @@ static errcode_t inode_write_byte(io_channel channel, unsigned long offset, } /* - * Flush data buffers to disk. + * Flush data buffers to disk. */ static errcode_t inode_flush(io_channel channel) { struct inode_private_data *data; - + EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); data = (struct inode_private_data *) channel->private_data; EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_INODE_IO_CHANNEL); diff --git a/e2fsprogs/ext2fs/io_manager.c b/e2fsprogs/ext2fs/io_manager.c index e50d7e4..3d0987b 100644 --- a/e2fsprogs/ext2fs/io_manager.c +++ b/e2fsprogs/ext2fs/io_manager.c @@ -61,8 +61,8 @@ errcode_t io_channel_write_byte(io_channel channel, unsigned long offset, { EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); - if (channel->manager->write_byte) - return channel->manager->write_byte(channel, offset, + if (channel->manager->write_byte) + return channel->manager->write_byte(channel, offset, count, data); return EXT2_ET_UNIMPLEMENTED; diff --git a/e2fsprogs/ext2fs/irel.h b/e2fsprogs/ext2fs/irel.h index 9b943ce..45e031b 100644 --- a/e2fsprogs/ext2fs/irel.h +++ b/e2fsprogs/ext2fs/irel.h @@ -1,6 +1,6 @@ /* * irel.h - * + * * Copyright (C) 1996, 1997 Theodore Ts'o. * * %Begin-Header% diff --git a/e2fsprogs/ext2fs/irel_ma.c b/e2fsprogs/ext2fs/irel_ma.c index eedbe55..d9e73f7 100644 --- a/e2fsprogs/ext2fs/irel_ma.c +++ b/e2fsprogs/ext2fs/irel_ma.c @@ -1,6 +1,6 @@ /* * irel_ma.c - * + * * Copyright (C) 1996, 1997 Theodore Ts'o. * * %Begin-Header% @@ -64,7 +64,7 @@ errcode_t ext2fs_irel_memarray_create(char *name, ext2_ino_t max_inode, { ext2_irel irel = 0; errcode_t retval; - struct irel_ma *ma = 0; + struct irel_ma *ma = 0; size_t size; *new_irel = 0; @@ -77,18 +77,18 @@ errcode_t ext2fs_irel_memarray_create(char *name, ext2_ino_t max_inode, if (retval) goto errout; memset(irel, 0, sizeof(struct ext2_inode_relocation_table)); - + retval = ext2fs_get_mem(strlen(name)+1, &irel->name); if (retval) goto errout; strcpy(irel->name, name); - + retval = ext2fs_get_mem(sizeof(struct irel_ma), &ma); if (retval) goto errout; memset(ma, 0, sizeof(struct irel_ma)); irel->priv_data = ma; - + size = (size_t) (sizeof(ext2_ino_t) * (max_inode+1)); retval = ext2fs_get_mem(size, &ma->orig_map); if (retval) @@ -124,7 +124,7 @@ errcode_t ext2fs_irel_memarray_create(char *name, ext2_ino_t max_inode, irel->move = ima_move; irel->delete = ima_delete; irel->free = ima_free; - + *new_irel = irel; return 0; @@ -137,7 +137,7 @@ static errcode_t ima_put(ext2_irel irel, ext2_ino_t old, struct ext2_inode_relocate_entry *ent) { struct inode_reference_entry *ref_ent; - struct irel_ma *ma; + struct irel_ma *ma; errcode_t retval; size_t size, old_size; @@ -153,7 +153,7 @@ static errcode_t ima_put(ext2_irel irel, ext2_ino_t old, ent->orig = old; else ent->orig = ma->entries[(unsigned) old].orig; - + /* * If max_refs has changed, reallocate the refs array */ @@ -176,7 +176,7 @@ static errcode_t ima_put(ext2_irel irel, ext2_ino_t old, static errcode_t ima_get(ext2_irel irel, ext2_ino_t old, struct ext2_inode_relocate_entry *ent) { - struct irel_ma *ma; + struct irel_ma *ma; ma = irel->priv_data; if (old > ma->max_inode) @@ -190,7 +190,7 @@ static errcode_t ima_get(ext2_irel irel, ext2_ino_t old, static errcode_t ima_get_by_orig(ext2_irel irel, ext2_ino_t orig, ext2_ino_t *old, struct ext2_inode_relocate_entry *ent) { - struct irel_ma *ma; + struct irel_ma *ma; ext2_ino_t ino; ma = irel->priv_data; @@ -213,7 +213,7 @@ static errcode_t ima_start_iter(ext2_irel irel) static errcode_t ima_next(ext2_irel irel, ext2_ino_t *old, struct ext2_inode_relocate_entry *ent) { - struct irel_ma *ma; + struct irel_ma *ma; ma = irel->priv_data; while (++irel->current < ma->max_inode) { @@ -230,7 +230,7 @@ static errcode_t ima_next(ext2_irel irel, ext2_ino_t *old, static errcode_t ima_add_ref(ext2_irel irel, ext2_ino_t ino, struct ext2_inode_reference *ref) { - struct irel_ma *ma; + struct irel_ma *ma; size_t size; struct inode_reference_entry *ref_ent; struct ext2_inode_relocate_entry *ent; @@ -242,12 +242,12 @@ static errcode_t ima_add_ref(ext2_irel irel, ext2_ino_t ino, ref_ent = ma->ref_entries + (unsigned) ino; ent = ma->entries + (unsigned) ino; - + /* * If the inode reference array doesn't exist, create it. */ if (ref_ent->refs == 0) { - size = (size_t) ((sizeof(struct ext2_inode_reference) * + size = (size_t) ((sizeof(struct ext2_inode_reference) * ent->max_refs)); retval = ext2fs_get_mem(size, &ref_ent->refs); if (retval) @@ -265,7 +265,7 @@ static errcode_t ima_add_ref(ext2_irel irel, ext2_ino_t ino, static errcode_t ima_start_iter_ref(ext2_irel irel, ext2_ino_t ino) { - struct irel_ma *ma; + struct irel_ma *ma; ma = irel->priv_data; if (ino > ma->max_inode) @@ -280,11 +280,11 @@ static errcode_t ima_start_iter_ref(ext2_irel irel, ext2_ino_t ino) static errcode_t ima_next_ref(ext2_irel irel, struct ext2_inode_reference *ref) { - struct irel_ma *ma; + struct irel_ma *ma; struct inode_reference_entry *ref_ent; ma = irel->priv_data; - + ref_ent = ma->ref_entries + ma->ref_current; if ((ref_ent->refs == NULL) || @@ -300,19 +300,19 @@ static errcode_t ima_next_ref(ext2_irel irel, static errcode_t ima_move(ext2_irel irel, ext2_ino_t old, ext2_ino_t new) { - struct irel_ma *ma; + struct irel_ma *ma; ma = irel->priv_data; if ((old > ma->max_inode) || (new > ma->max_inode)) return EXT2_ET_INVALID_ARGUMENT; if (ma->entries[(unsigned) old].new == 0) return ENOENT; - + ma->entries[(unsigned) new] = ma->entries[(unsigned) old]; if (ma->ref_entries[(unsigned) new].refs) ext2fs_free_mem(&ma->ref_entries[(unsigned) new].refs); ma->ref_entries[(unsigned) new] = ma->ref_entries[(unsigned) old]; - + ma->entries[(unsigned) old].new = 0; ma->ref_entries[(unsigned) old].num = 0; ma->ref_entries[(unsigned) old].refs = 0; @@ -323,19 +323,19 @@ static errcode_t ima_move(ext2_irel irel, ext2_ino_t old, ext2_ino_t new) static errcode_t ima_delete(ext2_irel irel, ext2_ino_t old) { - struct irel_ma *ma; + struct irel_ma *ma; ma = irel->priv_data; if (old > ma->max_inode) return EXT2_ET_INVALID_ARGUMENT; if (ma->entries[(unsigned) old].new == 0) return ENOENT; - + ma->entries[old].new = 0; if (ma->ref_entries[(unsigned) old].refs) ext2fs_free_mem(&ma->ref_entries[(unsigned) old].refs); ma->orig_map[ma->entries[(unsigned) old].orig] = 0; - + ma->ref_entries[(unsigned) old].num = 0; ma->ref_entries[(unsigned) old].refs = 0; return 0; @@ -343,7 +343,7 @@ static errcode_t ima_delete(ext2_irel irel, ext2_ino_t old) static errcode_t ima_free(ext2_irel irel) { - struct irel_ma *ma; + struct irel_ma *ma; ext2_ino_t ino; if (!irel) diff --git a/e2fsprogs/ext2fs/ismounted.c b/e2fsprogs/ext2fs/ismounted.c index 3f2241d..2395cca 100644 --- a/e2fsprogs/ext2fs/ismounted.c +++ b/e2fsprogs/ext2fs/ismounted.c @@ -1,6 +1,6 @@ /* * ismounted.c --- Check to see if the filesystem was mounted - * + * * Copyright (C) 1995,1996,1997,1998,1999,2000 Theodore Ts'o. * * %Begin-Header% @@ -38,17 +38,17 @@ /* * Helper function which checks a file in /etc/mtab format to see if a * filesystem is mounted. Returns an error if the file doesn't exist - * or can't be opened. + * or can't be opened. */ -static errcode_t check_mntent_file(const char *mtab_file, const char *file, +static errcode_t check_mntent_file(const char *mtab_file, const char *file, int *mount_flags, char *mtpt, int mtlen) { - struct mntent *mnt; + struct mntent *mnt; struct stat st_buf; errcode_t retval = 0; dev_t file_dev=0, file_rdev=0; ino_t file_ino=0; - FILE *f; + FILE *f; int fd; *mount_flags = 0; @@ -103,7 +103,7 @@ static errcode_t check_mntent_file(const char *mtab_file, const char *file, } #ifndef __GNU__ /* The GNU hurd is deficient; what else is new? */ /* Validate the entry in case /etc/mtab is out of date */ - /* + /* * We need to be paranoid, because some broken distributions * (read: Slackware) don't initialize /etc/mtab before checking * all of the non-root filesystems on the disk. @@ -128,7 +128,7 @@ static errcode_t check_mntent_file(const char *mtab_file, const char *file, } #endif /* __GNU__ */ *mount_flags = EXT2_MF_MOUNTED; - + #ifdef MNTOPT_RO /* Check to see if the ro option is set */ if (hasmntopt(mnt, MNTOPT_RO)) @@ -145,7 +145,7 @@ static errcode_t check_mntent_file(const char *mtab_file, const char *file, */ if (!strcmp(mnt->mnt_dir, "/")) { is_root: -#define TEST_FILE "/.ismount-test-file" +#define TEST_FILE "/.ismount-test-file" *mount_flags |= EXT2_MF_ISROOT; fd = open(TEST_FILE, O_RDWR|O_CREAT); if (fd < 0) { @@ -184,7 +184,7 @@ static errcode_t check_mntent(const char *file, int *mount_flags, #endif /* MOUNTED */ retval = check_mntent_file(MOUNTED, file, mount_flags, mtpt, mtlen); return retval; -#else +#else *mount_flags = 0; return 0; #endif /* defined(MOUNTED) || defined(_PATH_MOUNTED) */ @@ -197,31 +197,31 @@ static errcode_t check_getmntinfo(const char *file, int *mount_flags, char *mtpt, int mtlen) { struct statfs *mp; - int len, n; - const char *s1; + int len, n; + const char *s1; char *s2; - n = getmntinfo(&mp, MNT_NOWAIT); - if (n == 0) + n = getmntinfo(&mp, MNT_NOWAIT); + if (n == 0) return errno; - len = sizeof(_PATH_DEV) - 1; - s1 = file; - if (strncmp(_PATH_DEV, s1, len) == 0) - s1 += len; - + len = sizeof(_PATH_DEV) - 1; + s1 = file; + if (strncmp(_PATH_DEV, s1, len) == 0) + s1 += len; + *mount_flags = 0; - while (--n >= 0) { - s2 = mp->f_mntfromname; - if (strncmp(_PATH_DEV, s2, len) == 0) { - s2 += len - 1; - *s2 = 'r'; - } - if (strcmp(s1, s2) == 0 || strcmp(s1, &s2[1]) == 0) { + while (--n >= 0) { + s2 = mp->f_mntfromname; + if (strncmp(_PATH_DEV, s2, len) == 0) { + s2 += len - 1; + *s2 = 'r'; + } + if (strcmp(s1, s2) == 0 || strcmp(s1, &s2[1]) == 0) { *mount_flags = EXT2_MF_MOUNTED; break; } - ++mp; + ++mp; } if (mtpt) strncpy(mtpt, mp->f_mntonname, mtlen); @@ -270,7 +270,7 @@ static int is_swap_device(const char *file) ret++; break; } -#endif /* __GNU__ */ +#endif /* __GNU__ */ } fclose(f); return ret; @@ -296,7 +296,7 @@ errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags, } #ifdef HAVE_MNTENT_H return check_mntent(device, mount_flags, mtpt, mtlen); -#else +#else #ifdef HAVE_GETMNTINFO return check_getmntinfo(device, mount_flags, mtpt, mtlen); #else @@ -312,7 +312,7 @@ errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags, /* * ext2fs_check_if_mounted() sets the mount_flags EXT2_MF_MOUNTED, * EXT2_MF_READONLY, and EXT2_MF_ROOT - * + * */ errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags) { @@ -324,7 +324,7 @@ int main(int argc, char **argv) { int retval, mount_flags; char mntpt[80]; - + if (argc < 2) { fprintf(stderr, "Usage: %s device\n", argv[0]); exit(1); @@ -347,12 +347,12 @@ int main(int argc, char **argv) if (mount_flags & EXT2_MF_READONLY) printf("\t%s is read-only.\n", argv[1]); - + if (mount_flags & EXT2_MF_ISROOT) printf("\t%s is the root filesystem.\n", argv[1]); if (mntpt[0]) printf("\t%s is mounted on %s.\n", argv[1], mntpt); - + exit(0); } #endif /* DEBUG */ diff --git a/e2fsprogs/ext2fs/jfs_dat.h b/e2fsprogs/ext2fs/jfs_dat.h index d6ad9c4..8ec5d38 100644 --- a/e2fsprogs/ext2fs/jfs_dat.h +++ b/e2fsprogs/ext2fs/jfs_dat.h @@ -1,6 +1,6 @@ /* * jfs_dat.h --- stripped down header file which only contains the JFS - * on-disk data structures + * on-disk data structures */ #define JFS_MAGIC_NUMBER 0xc03b3998U /* The first 4 bytes of /dev/random! */ @@ -9,7 +9,7 @@ * On-disk structures */ -/* +/* * Descriptor block types: */ @@ -28,8 +28,8 @@ typedef struct journal_header_s } journal_header_t; -/* - * The block tag: used to describe a single buffer in the journal +/* + * The block tag: used to describe a single buffer in the journal */ typedef struct journal_block_tag_s { @@ -55,10 +55,10 @@ typedef struct journal_superblock_s __u32 s_blocksize; /* journal device blocksize */ __u32 s_maxlen; /* total blocks in journal file */ __u32 s_first; /* first block of log information */ - + /* Dynamic information describing the current state of the log */ __u32 s_sequence; /* first commit ID expected in log */ __u32 s_start; /* blocknr of start of log */ - + } journal_superblock_t; diff --git a/e2fsprogs/ext2fs/kernel-jbd.h b/e2fsprogs/ext2fs/kernel-jbd.h index d0efdb3..8a5de5e 100644 --- a/e2fsprogs/ext2fs/kernel-jbd.h +++ b/e2fsprogs/ext2fs/kernel-jbd.h @@ -1,6 +1,6 @@ /* * linux/include/linux/jbd.h - * + * * Written by Stephen C. Tweedie <sct@redhat.com> * * Copyright 1998-2000 Red Hat, Inc --- All Rights Reserved @@ -51,7 +51,7 @@ extern int journal_enable_debug; if ((n) <= journal_enable_debug) { \ printk (KERN_DEBUG "(%s, %d): %s: ", \ __FILE__, __LINE__, __FUNCTION__); \ - printk (f, ## a); \ + printk (f, ## a); \ } \ } while (0) #else @@ -59,7 +59,7 @@ extern int journal_enable_debug; #define jbd_debug(f, a...) /**/ #else #define jbd_debug(f, ...) /**/ -#endif +#endif #endif #else #define jbd_debug(x) /* AIX doesn't do STDC */ @@ -88,7 +88,7 @@ typedef struct journal_s journal_t; /* Journal control structure */ * On-disk structures */ -/* +/* * Descriptor block types: */ @@ -109,8 +109,8 @@ typedef struct journal_header_s } journal_header_t; -/* - * The block tag: used to describe a single buffer in the journal +/* + * The block tag: used to describe a single buffer in the journal */ typedef struct journal_block_tag_s { @@ -118,9 +118,9 @@ typedef struct journal_block_tag_s __u32 t_flags; /* See below */ } journal_block_tag_t; -/* +/* * The revoke descriptor: used on disk to describe a series of blocks to - * be revoked from the log + * be revoked from the log */ typedef struct journal_revoke_header_s { @@ -149,7 +149,7 @@ typedef struct journal_superblock_s __u32 s_blocksize; /* journal device blocksize */ __u32 s_maxlen; /* total blocks in journal file */ __u32 s_first; /* first block of log information */ - + /* 0x0018 */ /* Dynamic information describing the current state of the log */ __u32 s_sequence; /* first commit ID expected in log */ @@ -161,17 +161,17 @@ typedef struct journal_superblock_s /* 0x0024 */ /* Remaining fields are only valid in a version-2 superblock */ - __u32 s_feature_compat; /* compatible feature set */ - __u32 s_feature_incompat; /* incompatible feature set */ - __u32 s_feature_ro_compat; /* readonly-compatible feature set */ + __u32 s_feature_compat; /* compatible feature set */ + __u32 s_feature_incompat; /* incompatible feature set */ + __u32 s_feature_ro_compat; /* readonly-compatible feature set */ /* 0x0030 */ __u8 s_uuid[16]; /* 128-bit uuid for journal */ /* 0x0040 */ __u32 s_nr_users; /* Nr of filesystems sharing log */ - + __u32 s_dynsuper; /* Blocknr of dynamic superblock copy*/ - + /* 0x0048 */ __u32 s_max_transaction; /* Limit of journal blocks per trans.*/ __u32 s_max_trans_data; /* Limit of data blocks per trans. */ @@ -276,7 +276,7 @@ struct jbd_revoke_table_s; * the transaction, so that at all times we know how many buffers the * outstanding updates on a transaction might possibly touch. */ -struct handle_s +struct handle_s { /* Which compound transaction is this update a part of? */ transaction_t * h_transaction; @@ -314,14 +314,14 @@ struct handle_s * flushed to home for finished transactions. */ -struct transaction_s +struct transaction_s { /* Pointer to the journal for this transaction. */ journal_t * t_journal; - + /* Sequence number for this transaction */ tid_t t_tid; - + /* Transaction's current state */ enum { T_RUNNING, @@ -329,74 +329,74 @@ struct transaction_s T_RUNDOWN, T_FLUSH, T_COMMIT, - T_FINISHED + T_FINISHED } t_state; /* Where in the log does this transaction's commit start? */ unsigned long t_log_start; - + /* Doubly-linked circular list of all inodes owned by this - transaction */ /* AKPM: unused */ + transaction */ /* AKPM: unused */ struct inode * t_ilist; - + /* Number of buffers on the t_buffers list */ int t_nr_buffers; - + /* Doubly-linked circular list of all buffers reserved but not - yet modified by this transaction */ + yet modified by this transaction */ struct journal_head * t_reserved_list; - + /* Doubly-linked circular list of all metadata buffers owned by this - transaction */ + transaction */ struct journal_head * t_buffers; - + /* * Doubly-linked circular list of all data buffers still to be * flushed before this transaction can be committed. * Protected by journal_datalist_lock. */ struct journal_head * t_sync_datalist; - + /* * Doubly-linked circular list of all writepage data buffers * still to be written before this transaction can be committed. * Protected by journal_datalist_lock. */ struct journal_head * t_async_datalist; - + /* Doubly-linked circular list of all forget buffers (superceded - buffers which we can un-checkpoint once this transaction - commits) */ + buffers which we can un-checkpoint once this transaction + commits) */ struct journal_head * t_forget; - + /* * Doubly-linked circular list of all buffers still to be * flushed before this transaction can be checkpointed. */ /* Protected by journal_datalist_lock */ struct journal_head * t_checkpoint_list; - + /* Doubly-linked circular list of temporary buffers currently - undergoing IO in the log */ + undergoing IO in the log */ struct journal_head * t_iobuf_list; - + /* Doubly-linked circular list of metadata buffers being - shadowed by log IO. The IO buffers on the iobuf list and the - shadow buffers on this list match each other one for one at - all times. */ + shadowed by log IO. The IO buffers on the iobuf list and the + shadow buffers on this list match each other one for one at + all times. */ struct journal_head * t_shadow_list; - + /* Doubly-linked circular list of control buffers being written - to the log. */ + to the log. */ struct journal_head * t_log_list; - + /* Number of outstanding updates running on this transaction */ int t_updates; /* Number of buffers reserved for use by all handles in this * transaction handle but not yet modified. */ int t_outstanding_credits; - + /* * Forward and backward links for the circular list of all * transactions awaiting checkpoint. @@ -415,7 +415,7 @@ struct transaction_s /* The journal_t maintains all of the journaling state information for a * single filesystem. It is linked to from the fs superblock structure. - * + * * We use the journal_t to keep track of all outstanding transaction * activity on the filesystem, and to manage the state of the log * writing process. */ @@ -428,7 +428,7 @@ struct journal_s /* Is there an outstanding uncleared error on the journal (from * a prior abort)? */ int j_errno; - + /* The superblock buffer */ struct buffer_head * j_sb_buffer; journal_superblock_t * j_superblock; @@ -438,49 +438,49 @@ struct journal_s /* Number of processes waiting to create a barrier lock */ int j_barrier_count; - + /* The barrier lock itself */ struct semaphore j_barrier; - + /* Transactions: The current running transaction... */ transaction_t * j_running_transaction; - + /* ... the transaction we are pushing to disk ... */ transaction_t * j_committing_transaction; - + /* ... and a linked circular list of all transactions waiting * for checkpointing. */ /* Protected by journal_datalist_lock */ transaction_t * j_checkpoint_transactions; /* Wait queue for waiting for a locked transaction to start - committing, or for a barrier lock to be released */ + committing, or for a barrier lock to be released */ wait_queue_head_t j_wait_transaction_locked; - + /* Wait queue for waiting for checkpointing to complete */ wait_queue_head_t j_wait_logspace; - + /* Wait queue for waiting for commit to complete */ wait_queue_head_t j_wait_done_commit; - + /* Wait queue to trigger checkpointing */ wait_queue_head_t j_wait_checkpoint; - + /* Wait queue to trigger commit */ wait_queue_head_t j_wait_commit; - + /* Wait queue to wait for updates to complete */ wait_queue_head_t j_wait_updates; /* Semaphore for locking against concurrent checkpoints */ - struct semaphore j_checkpoint_sem; + struct semaphore j_checkpoint_sem; /* The main journal lock, used by lock_journal() */ struct semaphore j_sem; - + /* Journal head: identifies the first unused block in the journal. */ unsigned long j_head; - + /* Journal tail: identifies the oldest still-used block in the * journal. */ unsigned long j_tail; @@ -546,12 +546,12 @@ struct journal_s struct list_head j_all_journals; /* The revoke table: maintains the list of revoked blocks in the - current transaction. */ + current transaction. */ struct jbd_revoke_table_s *j_revoke; }; -/* - * Journal flag definitions +/* + * Journal flag definitions */ #define JFS_UNMOUNT 0x001 /* Journal thread is being destroyed */ #define JFS_ABORT 0x002 /* Journaling has been aborted for errors. */ @@ -559,7 +559,7 @@ struct journal_s #define JFS_FLUSHED 0x008 /* The journal superblock has been flushed */ #define JFS_LOADED 0x010 /* The journal superblock has been loaded */ -/* +/* * Function declarations for the journaling transaction and buffer * management */ @@ -589,7 +589,7 @@ extern void journal_insert_checkpoint(struct journal_head *, transaction_t *); extern void __journal_insert_checkpoint(struct journal_head *,transaction_t *); /* Buffer IO */ -extern int +extern int journal_write_metadata_buffer(transaction_t *transaction, struct journal_head *jh_in, struct journal_head **jh_out, @@ -603,7 +603,7 @@ extern void __wait_on_journal (journal_t *); * * We need to lock the journal during transaction state changes so that * nobody ever tries to take a handle on the running transaction while - * we are in the middle of moving it to the commit phase. + * we are in the middle of moving it to the commit phase. * * Note that the locking is completely interrupt unsafe. We never touch * journal structures from interrupts. @@ -637,7 +637,7 @@ static inline handle_t *journal_current_handle(void) /* The journaling code user interface: * * Create and destroy handles - * Register buffer modifications against the current transaction. + * Register buffer modifications against the current transaction. */ extern handle_t *journal_start(journal_t *, int nblocks); @@ -665,11 +665,11 @@ extern journal_t * journal_init_dev(kdev_t dev, kdev_t fs_dev, int start, int len, int bsize); extern journal_t * journal_init_inode (struct inode *); extern int journal_update_format (journal_t *); -extern int journal_check_used_features +extern int journal_check_used_features (journal_t *, unsigned long, unsigned long, unsigned long); -extern int journal_check_available_features +extern int journal_check_available_features (journal_t *, unsigned long, unsigned long, unsigned long); -extern int journal_set_features +extern int journal_set_features (journal_t *, unsigned long, unsigned long, unsigned long); extern int journal_create (journal_t *); extern int journal_load (journal_t *journal); @@ -747,7 +747,7 @@ do { \ * bit, when set, indicates that we have had a fatal error somewhere, * either inside the journaling layer or indicated to us by the client * (eg. ext3), and that we and should not commit any further - * transactions. + * transactions. */ static inline int is_journal_aborted(journal_t *journal) @@ -770,7 +770,7 @@ static inline void journal_abort_handle(handle_t *handle) /* Not all architectures define BUG() */ #ifndef BUG #define BUG() do { \ - printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ + printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ * ((char *) 0) = 0; \ } while (0) #endif /* BUG */ @@ -826,7 +826,7 @@ extern int journal_blocks_per_page(struct inode *inode); #define BJ_LogCtl 7 /* Buffer contains log descriptors */ #define BJ_Reserved 8 /* Buffer is reserved for access by journal */ #define BJ_Types 9 - + extern int jbd_blocks_per_page(struct inode *inode); #ifdef __KERNEL__ diff --git a/e2fsprogs/ext2fs/kernel-list.h b/e2fsprogs/ext2fs/kernel-list.h index 24e6ab4..fa62ff1 100644 --- a/e2fsprogs/ext2fs/kernel-list.h +++ b/e2fsprogs/ext2fs/kernel-list.h @@ -29,7 +29,7 @@ struct list_head { #endif /* - * Insert a new entry between two known consecutive entries. + * Insert a new entry between two known consecutive entries. * * This is only for internal list manipulation where we know * the prev/next entries already! @@ -107,6 +107,6 @@ static __inline__ void list_splice(struct list_head *list, struct list_head *hea ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) #define list_for_each(pos, head) \ - for (pos = (head)->next; pos != (head); pos = pos->next) + for (pos = (head)->next; pos != (head); pos = pos->next) #endif diff --git a/e2fsprogs/ext2fs/link.c b/e2fsprogs/ext2fs/link.c index 5e0f4f3..281ad06 100644 --- a/e2fsprogs/ext2fs/link.c +++ b/e2fsprogs/ext2fs/link.c @@ -1,6 +1,6 @@ /* * link.c --- create links in a ext2fs directory - * + * * Copyright (C) 1993, 1994 Theodore Ts'o. * * %Begin-Header% @@ -25,7 +25,7 @@ struct link_struct { int flags; int done; struct ext2_super_block *sb; -}; +}; static int link_proc(struct ext2_dir_entry *dirent, int offset, @@ -94,7 +94,7 @@ static int link_proc(struct ext2_dir_entry *dirent, #ifdef __TURBOC__ #pragma argsused #endif -errcode_t ext2fs_link(ext2_filsys fs, ext2_ino_t dir, const char *name, +errcode_t ext2fs_link(ext2_filsys fs, ext2_ino_t dir, const char *name, ext2_ino_t ino, int flags) { errcode_t retval; diff --git a/e2fsprogs/ext2fs/lookup.c b/e2fsprogs/ext2fs/lookup.c index 1745f33..9cb97f1 100644 --- a/e2fsprogs/ext2fs/lookup.c +++ b/e2fsprogs/ext2fs/lookup.c @@ -1,6 +1,6 @@ /* * lookup.c --- ext2fs directory lookup operations - * + * * Copyright (C) 1993, 1994, 1994, 1995 Theodore Ts'o. * * %Begin-Header% @@ -23,7 +23,7 @@ struct lookup_struct { int len; ext2_ino_t *inode; int found; -}; +}; #ifdef __TURBOC__ #pragma argsused diff --git a/e2fsprogs/ext2fs/mkdir.c b/e2fsprogs/ext2fs/mkdir.c index 81e7aea..bf46e50 100644 --- a/e2fsprogs/ext2fs/mkdir.c +++ b/e2fsprogs/ext2fs/mkdir.c @@ -1,6 +1,6 @@ /* * mkdir.c --- make a directory in the filesystem - * + * * Copyright (C) 1994, 1995 Theodore Ts'o. * * %Begin-Header% @@ -94,7 +94,7 @@ errcode_t ext2fs_mkdir(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t inum, retval = ext2fs_write_dir_block(fs, blk, block); if (retval) goto cleanup; - retval = ext2fs_write_new_inode(fs, ino, &inode); + retval = ext2fs_write_new_inode(fs, ino, &inode); if (retval) goto cleanup; @@ -125,7 +125,7 @@ errcode_t ext2fs_mkdir(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t inum, if (retval) goto cleanup; } - + /* * Update accounting.... */ diff --git a/e2fsprogs/ext2fs/mkjournal.c b/e2fsprogs/ext2fs/mkjournal.c index b748918..0a9ae7a 100644 --- a/e2fsprogs/ext2fs/mkjournal.c +++ b/e2fsprogs/ext2fs/mkjournal.c @@ -2,7 +2,7 @@ * mkjournal.c --- make a journal for a filesystem * * Copyright (C) 2000 Theodore Ts'o. - * + * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public * License. @@ -155,7 +155,7 @@ static int mkjournal_proc(ext2_filsys fs, blk_t new_blk; static blk_t last_blk = 0; errcode_t retval; - + if (*blocknr) { last_blk = *blocknr; return 0; @@ -186,7 +186,7 @@ static int mkjournal_proc(ext2_filsys fs, return (BLOCK_CHANGED | BLOCK_ABORT); else return BLOCK_CHANGED; - + } /* @@ -202,7 +202,7 @@ static errcode_t write_journal_inode(ext2_filsys fs, ext2_ino_t journal_ino, if ((retval = ext2fs_create_journal_superblock(fs, size, flags, &buf))) return retval; - + if ((retval = ext2fs_read_bitmaps(fs))) return retval; @@ -227,7 +227,7 @@ static errcode_t write_journal_inode(ext2_filsys fs, ext2_ino_t journal_ino, if ((retval = ext2fs_read_inode(fs, journal_ino, &inode))) goto errout; - inode.i_size += fs->blocksize * size; + inode.i_size += fs->blocksize * size; inode.i_blocks += (fs->blocksize / 512) * es.newblocks; inode.i_mtime = inode.i_ctime = time(0); inode.i_links_count = 1; @@ -262,7 +262,7 @@ errcode_t ext2fs_add_journal_device(ext2_filsys fs, ext2_filsys journal_dev) /* Make sure the device exists and is a block device */ if (stat(journal_dev->device_name, &st) < 0) return errno; - + if (!S_ISBLK(st.st_mode)) return EXT2_ET_JOURNAL_NOT_BLOCK; /* Must be a block device */ @@ -297,7 +297,7 @@ errcode_t ext2fs_add_journal_device(ext2_filsys fs, ext2_filsys journal_dev) /* Writeback the journal superblock */ if ((retval = io_channel_write_blk(journal_dev->io, start, -1024, buf))) return retval; - + fs->super->s_journal_inum = 0; fs->super->s_journal_dev = st.st_rdev; memcpy(fs->super->s_journal_uuid, jsb->s_uuid, @@ -328,7 +328,7 @@ errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size, int flags) strcat(jfile, "/.journal"); /* - * If .../.journal already exists, make sure any + * If .../.journal already exists, make sure any * immutable or append-only flags are cleared. */ #if defined(HAVE_CHFLAGS) && defined(UF_NODUMP) @@ -350,7 +350,7 @@ errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size, int flags) if ((retval = write_journal_file(fs, jfile, size, flags))) goto errout; - + /* Get inode number of the journal file */ if (fstat(fd, &st) < 0) goto errout; @@ -365,7 +365,7 @@ errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size, int flags) #endif if (retval) goto errout; - + close(fd); journal_ino = st.st_ino; } else { @@ -374,7 +374,7 @@ errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size, int flags) size, flags))) return retval; } - + fs->super->s_journal_inum = journal_ino; fs->super->s_journal_dev = 0; memset(fs->super->s_journal_uuid, 0, @@ -393,14 +393,14 @@ main(int argc, char **argv) { errcode_t retval; char *device_name; - ext2_filsys fs; + ext2_filsys fs; if (argc < 2) { fprintf(stderr, "Usage: %s filesystem\n", argv[0]); exit(1); } device_name = argv[1]; - + retval = ext2fs_open (device_name, EXT2_FLAG_RW, 0, 0, unix_io_manager, &fs); if (retval) { @@ -420,6 +420,6 @@ main(int argc, char **argv) } ext2fs_close(fs); exit(0); - + } #endif diff --git a/e2fsprogs/ext2fs/namei.c b/e2fsprogs/ext2fs/namei.c index 13d13ad..6ce4bb3 100644 --- a/e2fsprogs/ext2fs/namei.c +++ b/e2fsprogs/ext2fs/namei.c @@ -1,6 +1,6 @@ /* * namei.c --- ext2fs directory lookup operations - * + * * Copyright (C) 1993, 1994, 1994, 1995 Theodore Ts'o. * * %Begin-Header% @@ -36,7 +36,7 @@ static errcode_t follow_link(ext2_filsys fs, ext2_ino_t root, ext2_ino_t dir, #ifdef NAMEI_DEBUG printf("follow_link: root=%lu, dir=%lu, inode=%lu, lc=%d\n", root, dir, inode, link_count); - + #endif retval = ext2fs_read_inode (fs, inode, &ei); if (retval) return retval; @@ -85,12 +85,12 @@ static errcode_t dir_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t dir, errcode_t retval; if ((c = *pathname) == '/') { - dir = root; + dir = root; pathname++; pathlen--; } while (1) { - thisname = pathname; + thisname = pathname; for (len=0; --pathlen >= 0;len++) { c = *(pathname++); if (c == '/') @@ -100,10 +100,10 @@ static errcode_t dir_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t dir, break; retval = ext2fs_lookup (fs, dir, thisname, len, buf, &inode); if (retval) return retval; - retval = follow_link (fs, root, dir, inode, + retval = follow_link (fs, root, dir, inode, link_count, buf, &dir); - if (retval) return retval; - } + if (retval) return retval; + } *name = thisname; *namelen = len; *res_inode = dir; @@ -152,13 +152,13 @@ errcode_t ext2fs_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd, { char *buf; errcode_t retval; - + EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); retval = ext2fs_get_mem(fs->blocksize, &buf); if (retval) return retval; - + retval = open_namei(fs, root, cwd, name, strlen(name), 0, 0, buf, inode); @@ -171,13 +171,13 @@ errcode_t ext2fs_namei_follow(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd, { char *buf; errcode_t retval; - + EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); retval = ext2fs_get_mem(fs->blocksize, &buf); if (retval) return retval; - + retval = open_namei(fs, root, cwd, name, strlen(name), 1, 0, buf, inode); @@ -190,7 +190,7 @@ errcode_t ext2fs_follow_link(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd, { char *buf; errcode_t retval; - + EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); retval = ext2fs_get_mem(fs->blocksize, &buf); diff --git a/e2fsprogs/ext2fs/newdir.c b/e2fsprogs/ext2fs/newdir.c index 3904d91..27c718e 100644 --- a/e2fsprogs/ext2fs/newdir.c +++ b/e2fsprogs/ext2fs/newdir.c @@ -1,6 +1,6 @@ /* * newdir.c --- create a new directory block - * + * * Copyright (C) 1994, 1995 Theodore Ts'o. * * %Begin-Header% @@ -28,7 +28,7 @@ errcode_t ext2fs_new_dir_block(ext2_filsys fs, ext2_ino_t dir_ino, ext2_ino_t parent_ino, char **block) { - struct ext2_dir_entry *dir = NULL; + struct ext2_dir_entry *dir = NULL; errcode_t retval; char *buf; int rec_len; @@ -65,7 +65,7 @@ errcode_t ext2fs_new_dir_block(ext2_filsys fs, ext2_ino_t dir_ino, dir->name_len = 2 | filetype; dir->name[0] = '.'; dir->name[1] = '.'; - + } *block = buf; return 0; diff --git a/e2fsprogs/ext2fs/openfs.c b/e2fsprogs/ext2fs/openfs.c index e8f1649..aa60333 100644 --- a/e2fsprogs/ext2fs/openfs.c +++ b/e2fsprogs/ext2fs/openfs.c @@ -1,8 +1,8 @@ /* * openfs.c --- open an ext2 filesystem - * + * * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. - * + * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public * License. @@ -42,7 +42,7 @@ blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block, dgrp_t i) bg = (fs->blocksize / sizeof (struct ext2_group_desc)) * i; if (ext2fs_bg_has_super(fs, bg)) has_super = 1; - ret_blk = (fs->super->s_first_data_block + has_super + + ret_blk = (fs->super->s_first_data_block + has_super + (bg * fs->super->s_blocks_per_group)); /* * If group_block is not the normal value, we're trying to use @@ -60,27 +60,27 @@ blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block, dgrp_t i) } errcode_t ext2fs_open(const char *name, int flags, int superblock, - unsigned int block_size, io_manager manager, + unsigned int block_size, io_manager manager, ext2_filsys *ret_fs) { - return ext2fs_open2(name, 0, flags, superblock, block_size, + return ext2fs_open2(name, 0, flags, superblock, block_size, manager, ret_fs); } /* * Note: if superblock is non-zero, block-size must also be non-zero. - * Superblock and block_size can be zero to use the default size. + * Superblock and block_size can be zero to use the default size. * * Valid flags for ext2fs_open() - * - * EXT2_FLAG_RW - Open the filesystem for read/write. - * EXT2_FLAG_FORCE - Open the filesystem even if some of the + * + * EXT2_FLAG_RW - Open the filesystem for read/write. + * EXT2_FLAG_FORCE - Open the filesystem even if some of the * features aren't supported. * EXT2_FLAG_JOURNAL_DEV_OK - Open an ext3 journal device */ errcode_t ext2fs_open2(const char *name, const char *io_options, int flags, int superblock, - unsigned int block_size, io_manager manager, + unsigned int block_size, io_manager manager, ext2_filsys *ret_fs) { ext2_filsys fs; @@ -93,13 +93,13 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, int j; struct ext2_group_desc *gdp; #endif - + EXT2_CHECK_MAGIC(manager, EXT2_ET_MAGIC_IO_MANAGER); retval = ext2fs_get_mem(sizeof(struct struct_ext2_filsys), &fs); if (retval) return retval; - + memset(fs, 0, sizeof(struct struct_ext2_filsys)); fs->magic = EXT2_ET_MAGIC_EXT2FS_FILSYS; fs->flags = flags; @@ -113,13 +113,13 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, *cp++ = 0; io_options = cp; } - - retval = manager->open(fs->device_name, + + retval = manager->open(fs->device_name, (flags & EXT2_FLAG_RW) ? IO_FLAG_RW : 0, &fs->io); if (retval) goto cleanup; - if (io_options && + if (io_options && (retval = io_channel_set_options(fs->io, io_options))) goto cleanup; fs->image_io = fs->io; @@ -183,7 +183,7 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, ext2fs_swap_super(fs->super); } #endif - + if (fs->super->s_magic != EXT2_SUPER_MAGIC) { retval = EXT2_ET_BAD_MAGIC; goto cleanup; @@ -215,7 +215,7 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, goto cleanup; } } - + fs->blocksize = EXT2_BLOCK_SIZE(fs->super); if (fs->blocksize == 0) { retval = EXT2_ET_CORRUPT_SUPERBLOCK; @@ -247,7 +247,7 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, *ret_fs = fs; return 0; } - + /* * Read group descriptors */ @@ -296,7 +296,7 @@ cleanup: /* * Set/get the filesystem data I/O channel. - * + * * These functions are only valid if EXT2_FLAG_IMAGE_FILE is true. */ errcode_t ext2fs_get_data_io(ext2_filsys fs, io_channel *old_io) @@ -322,7 +322,7 @@ errcode_t ext2fs_rewrite_to_io(ext2_filsys fs, io_channel new_io) if ((fs->flags & EXT2_FLAG_IMAGE_FILE) == 0) return EXT2_ET_NOT_IMAGE_FILE; fs->io = fs->image_io = new_io; - fs->flags |= EXT2_FLAG_DIRTY | EXT2_FLAG_RW | + fs->flags |= EXT2_FLAG_DIRTY | EXT2_FLAG_RW | EXT2_FLAG_BB_DIRTY | EXT2_FLAG_IB_DIRTY; fs->flags &= ~EXT2_FLAG_IMAGE_FILE; return 0; diff --git a/e2fsprogs/ext2fs/read_bb.c b/e2fsprogs/ext2fs/read_bb.c index c717adc..226c537 100644 --- a/e2fsprogs/ext2fs/read_bb.c +++ b/e2fsprogs/ext2fs/read_bb.c @@ -38,16 +38,16 @@ struct read_bb_record { #pragma argsused #endif static int mark_bad_block(ext2_filsys fs, blk_t *block_nr, - e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)), + e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)), blk_t ref_block EXT2FS_ATTR((unused)), - int ref_offset EXT2FS_ATTR((unused)), + int ref_offset EXT2FS_ATTR((unused)), void *priv_data) { struct read_bb_record *rb = (struct read_bb_record *) priv_data; - + if (blockcnt < 0) return 0; - + if ((*block_nr < fs->super->s_first_data_block) || (*block_nr >= fs->super->s_blocks_count)) return 0; /* Ignore illegal blocks */ diff --git a/e2fsprogs/ext2fs/read_bb_file.c b/e2fsprogs/ext2fs/read_bb_file.c index 40c34ee..f7851f1 100644 --- a/e2fsprogs/ext2fs/read_bb_file.c +++ b/e2fsprogs/ext2fs/read_bb_file.c @@ -29,7 +29,7 @@ /* * Reads a list of bad blocks from a FILE * */ -errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f, +errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f, ext2_badblocks_list *bb_list, void *priv_data, void (*invalid)(ext2_filsys fs, @@ -72,7 +72,7 @@ errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f, } static void call_compat_invalid(ext2_filsys fs, blk_t blk, - char *badstr EXT2FS_ATTR((unused)), + char *badstr EXT2FS_ATTR((unused)), void *priv_data) { void (*invalid)(ext2_filsys, blk_t); @@ -86,7 +86,7 @@ static void call_compat_invalid(ext2_filsys fs, blk_t blk, /* * Reads a list of bad blocks from a FILE * */ -errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f, +errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f, ext2_badblocks_list *bb_list, void (*invalid)(ext2_filsys fs, blk_t blk)) { diff --git a/e2fsprogs/ext2fs/rs_bitmap.c b/e2fsprogs/ext2fs/rs_bitmap.c index 46653f0..c2e51e0 100644 --- a/e2fsprogs/ext2fs/rs_bitmap.c +++ b/e2fsprogs/ext2fs/rs_bitmap.c @@ -53,7 +53,7 @@ errcode_t ext2fs_resize_generic_bitmap(__u32 new_end, __u32 new_real_end, bmap->end = new_end; return 0; } - + size = ((bmap->real_end - bmap->start) / 8) + 1; new_size = ((new_real_end - bmap->start) / 8) + 1; @@ -74,7 +74,7 @@ errcode_t ext2fs_resize_inode_bitmap(__u32 new_end, __u32 new_real_end, ext2fs_inode_bitmap bmap) { errcode_t retval; - + if (!bmap) return EXT2_ET_INVALID_ARGUMENT; @@ -91,7 +91,7 @@ errcode_t ext2fs_resize_block_bitmap(__u32 new_end, __u32 new_real_end, ext2fs_block_bitmap bmap) { errcode_t retval; - + if (!bmap) return EXT2_ET_INVALID_ARGUMENT; diff --git a/e2fsprogs/ext2fs/rw_bitmaps.c b/e2fsprogs/ext2fs/rw_bitmaps.c index b67a925..ae7b6e0 100644 --- a/e2fsprogs/ext2fs/rw_bitmaps.c +++ b/e2fsprogs/ext2fs/rw_bitmaps.c @@ -45,7 +45,7 @@ static void ext2fs_swap_bitmap(ext2_filsys fs, char *bitmap, int nbytes) { __u32 *p = (__u32 *) bitmap; int n; - + for (n = nbytes / sizeof(__u32); n > 0; --n, ++p) *p = ext2fs_swab32(*p); } @@ -53,7 +53,7 @@ static void ext2fs_swap_bitmap(ext2_filsys fs, char *bitmap, int nbytes) errcode_t ext2fs_write_inode_bitmap(ext2_filsys fs) { - dgrp_t i; + dgrp_t i; size_t nbytes; errcode_t retval; char * inode_bitmap = fs->inode_map->bitmap; @@ -67,7 +67,7 @@ errcode_t ext2fs_write_inode_bitmap(ext2_filsys fs) if (!inode_bitmap) return 0; nbytes = (size_t) ((EXT2_INODES_PER_GROUP(fs->super)+7) / 8); - + retval = ext2fs_get_mem(fs->blocksize, &bitmap_block); if (retval) return retval; @@ -95,7 +95,7 @@ errcode_t ext2fs_write_inode_bitmap(ext2_filsys fs) errcode_t ext2fs_write_block_bitmap (ext2_filsys fs) { - dgrp_t i; + dgrp_t i; unsigned int j; int nbytes; unsigned int nbits; @@ -195,7 +195,7 @@ static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block) if (block_bitmap) { blk = (fs->image_header->offset_blockmap / fs->blocksize); - retval = io_channel_read_blk(fs->image_io, blk, + retval = io_channel_read_blk(fs->image_io, blk, -(block_nbytes * fs->group_desc_count), block_bitmap); if (retval) @@ -243,7 +243,7 @@ static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block) } } return 0; - + cleanup: if (do_block) { ext2fs_free_mem(&fs->block_map); @@ -296,5 +296,5 @@ errcode_t ext2fs_write_bitmaps(ext2_filsys fs) return retval; } return 0; -} +} diff --git a/e2fsprogs/ext2fs/swapfs.c b/e2fsprogs/ext2fs/swapfs.c index 8a08995..af8b6eb 100644 --- a/e2fsprogs/ext2fs/swapfs.c +++ b/e2fsprogs/ext2fs/swapfs.c @@ -1,6 +1,6 @@ /* * swapfs.c --- swap ext2 filesystem data structures - * + * * Copyright (C) 1995, 1996, 2002 Theodore Ts'o. * * %Begin-Header% @@ -23,7 +23,7 @@ #ifdef EXT2FS_ENABLE_SWAPFS void ext2fs_swap_super(struct ext2_super_block * sb) { - int i; + int i; sb->s_inodes_count = ext2fs_swab32(sb->s_inodes_count); sb->s_blocks_count = ext2fs_swab32(sb->s_blocks_count); sb->s_r_blocks_count = ext2fs_swab32(sb->s_r_blocks_count); @@ -108,11 +108,11 @@ void ext2fs_swap_ext_attr(char *to, char *from, int bufsize, int has_header) } while ((char *)from_entry < from_end && *(__u32 *)from_entry) { - to_entry->e_value_offs = + to_entry->e_value_offs = ext2fs_swab16(from_entry->e_value_offs); - to_entry->e_value_block = + to_entry->e_value_block = ext2fs_swab32(from_entry->e_value_block); - to_entry->e_value_size = + to_entry->e_value_size = ext2fs_swab32(from_entry->e_value_size); from_entry = EXT2_EXT_ATTR_NEXT(from_entry); to_entry = EXT2_EXT_ATTR_NEXT(to_entry); diff --git a/e2fsprogs/ext2fs/test_io.c b/e2fsprogs/ext2fs/test_io.c index 6a3b248..d4b3653 100644 --- a/e2fsprogs/ext2fs/test_io.c +++ b/e2fsprogs/ext2fs/test_io.c @@ -32,7 +32,7 @@ #define EXT2_CHECK_MAGIC(struct, code) \ if ((struct)->magic != (code)) return (code) - + struct test_private_data { int magic; io_channel real; @@ -56,7 +56,7 @@ static errcode_t test_write_blk(io_channel channel, unsigned long block, static errcode_t test_flush(io_channel channel); static errcode_t test_write_byte(io_channel channel, unsigned long offset, int count, const void *buf); -static errcode_t test_set_option(io_channel channel, const char *option, +static errcode_t test_set_option(io_channel channel, const char *option, const char *arg); static struct struct_io_manager struct_test_manager = { @@ -172,10 +172,10 @@ static errcode_t test_open(const char *name, int flags, io_channel *channel) goto cleanup; } else data->real = 0; - data->read_blk = test_io_cb_read_blk; - data->write_blk = test_io_cb_write_blk; - data->set_blksize = test_io_cb_set_blksize; - data->write_byte = test_io_cb_write_byte; + data->read_blk = test_io_cb_read_blk; + data->write_blk = test_io_cb_write_blk; + data->set_blksize = test_io_cb_set_blksize; + data->write_byte = test_io_cb_write_byte; data->outfile = NULL; if ((value = getenv("TEST_IO_LOGFILE")) != NULL) @@ -186,7 +186,7 @@ static errcode_t test_open(const char *name, int flags, io_channel *channel) data->flags = 0; if ((value = getenv("TEST_IO_FLAGS")) != NULL) data->flags = strtoul(value, NULL, 0); - + data->block = 0; if ((value = getenv("TEST_IO_BLOCK")) != NULL) data->block = strtoul(value, NULL, 0); @@ -198,7 +198,7 @@ static errcode_t test_open(const char *name, int flags, io_channel *channel) data->write_abort_count = 0; if ((value = getenv("TEST_IO_WRITE_ABORT")) != NULL) data->write_abort_count = strtoul(value, NULL, 0); - + *channel = io; return 0; @@ -221,13 +221,13 @@ static errcode_t test_close(io_channel channel) if (--channel->refcount > 0) return 0; - + if (data->real) retval = io_channel_close(data->real); if (data->outfile && data->outfile != stderr) fclose(data->outfile); - + ext2fs_free_mem(&channel->private_data); if (channel->name) ext2fs_free_mem(&channel->name); @@ -280,7 +280,7 @@ static errcode_t test_read_blk(io_channel channel, unsigned long block, test_dump_block(channel, data, block, buf); if (--data->read_abort_count == 0) test_abort(channel, block); - } + } return retval; } @@ -339,22 +339,22 @@ static errcode_t test_flush(io_channel channel) { struct test_private_data *data; errcode_t retval = 0; - + EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); data = (struct test_private_data *) channel->private_data; EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_TEST_IO_CHANNEL); if (data->real) retval = io_channel_flush(data->real); - + if (data->flags & TEST_FLAG_FLUSH) fprintf(data->outfile, "Test_io: flush() returned %s\n", retval ? error_message(retval) : "OK"); - + return retval; } -static errcode_t test_set_option(io_channel channel, const char *option, +static errcode_t test_set_option(io_channel channel, const char *option, const char *arg) { struct test_private_data *data; @@ -366,10 +366,10 @@ static errcode_t test_set_option(io_channel channel, const char *option, if (data->flags & TEST_FLAG_SET_OPTION) - fprintf(data->outfile, "Test_io: set_option(%s, %s) ", + fprintf(data->outfile, "Test_io: set_option(%s, %s) ", option, arg); if (data->real && data->real->manager->set_option) { - retval = (data->real->manager->set_option)(data->real, + retval = (data->real->manager->set_option)(data->real, option, arg); if (data->flags & TEST_FLAG_SET_OPTION) fprintf(data->outfile, "returned %s\n", diff --git a/e2fsprogs/ext2fs/unix_io.c b/e2fsprogs/ext2fs/unix_io.c index 5bc7a6a..36b2225 100644 --- a/e2fsprogs/ext2fs/unix_io.c +++ b/e2fsprogs/ext2fs/unix_io.c @@ -1,13 +1,13 @@ /* * unix_io.c --- This is the Unix (well, really POSIX) implementation - * of the I/O manager. + * of the I/O manager. * * Implements a one-block write-through cache. * - * Includes support for Windows NT support under Cygwin. + * Includes support for Windows NT support under Cygwin. * * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, - * 2002 by Theodore Ts'o. + * 2002 by Theodore Ts'o. * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public @@ -79,7 +79,7 @@ static errcode_t unix_write_blk(io_channel channel, unsigned long block, static errcode_t unix_flush(io_channel channel); static errcode_t unix_write_byte(io_channel channel, unsigned long offset, int size, const void *data); -static errcode_t unix_set_option(io_channel channel, const char *option, +static errcode_t unix_set_option(io_channel channel, const char *option, const char *arg); static void reuse_cache(io_channel channel, struct unix_private_data *data, @@ -140,7 +140,7 @@ static errcode_t raw_read_blk(io_channel channel, goto error_out; } return 0; - + error_out: memset((char *) buf+actual, 0, size-actual); if (channel->read_error) @@ -168,7 +168,7 @@ static errcode_t raw_read_blk(io_channel channel, location = ((ext2_loff_t) block * channel->block_size) + data->offset; #ifdef DEBUG printf("count=%d, size=%d, block=%d, blk_size=%d, location=%lx\n", - count, size, block, channel->block_size, location); + count, size, block, channel->block_size, location); #endif if (ext2fs_llseek(data->dev, location, SEEK_SET) != location) { retval = errno ? errno : EXT2_ET_LLSEEK_FAILED; @@ -227,14 +227,14 @@ static errcode_t raw_write_blk(io_channel channel, retval = errno ? errno : EXT2_ET_LLSEEK_FAILED; goto error_out; } - + actual = write(data->dev, buf, size); if (actual != size) { retval = EXT2_ET_SHORT_WRITE; goto error_out; } return 0; - + error_out: if (channel->write_error) retval = (channel->write_error)(channel, block, count, buf, @@ -254,7 +254,7 @@ static errcode_t alloc_cache(io_channel channel, errcode_t retval; struct unix_cache *cache; int i; - + data->access_time = 0; for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) { cache->block = 0; @@ -273,7 +273,7 @@ static void free_cache(struct unix_private_data *data) { struct unix_cache *cache; int i; - + data->access_time = 0; for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) { cache->block = 0; @@ -298,7 +298,7 @@ static struct unix_cache *find_cached_block(struct unix_private_data *data, { struct unix_cache *cache, *unused_cache, *oldest_cache; int i; - + unused_cache = oldest_cache = 0; for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) { if (!cache->in_use) { @@ -345,18 +345,18 @@ static errcode_t flush_cached_blocks(io_channel channel, struct unix_cache *cache; errcode_t retval, retval2; int i; - + retval2 = 0; for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) { if (!cache->in_use) continue; - + if (invalidate) cache->in_use = 0; - + if (!cache->dirty) continue; - + retval = raw_write_blk(channel, data, cache->block, 1, cache->buf); if (retval) @@ -376,7 +376,7 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel) int open_flags; struct stat st; #ifdef __linux__ - struct utsname ut; + struct utsname ut; #endif if (name == 0) @@ -431,7 +431,7 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel) * block devices are wrongly getting hit by the filesize * limit. This workaround isn't perfect, since it won't work * if glibc wasn't built against 2.2 header files. (Sigh.) - * + * */ if ((flags & IO_FLAG_RW) && (uname(&ut) == 0) && @@ -442,7 +442,7 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel) (fstat(data->dev, &st) == 0) && (S_ISBLK(st.st_mode))) { struct rlimit rlim; - + rlim.rlim_cur = rlim.rlim_max = (unsigned long) RLIM_INFINITY; setrlimit(RLIMIT_FSIZE, &rlim); getrlimit(RLIMIT_FSIZE, &rlim); @@ -507,7 +507,7 @@ static errcode_t unix_set_blksize(io_channel channel, int blksize) if ((retval = flush_cached_blocks(channel, data, 0))) return retval; #endif - + channel->block_size = blksize; free_cache(data); if ((retval = alloc_cache(channel, data))) @@ -568,7 +568,7 @@ static errcode_t unix_read_blk(io_channel channel, unsigned long block, #endif if ((retval = raw_read_blk(channel, data, block, i, cp))) return retval; - + /* Save the results in the cache */ for (j=0; j < i; j++) { count--; @@ -597,7 +597,7 @@ static errcode_t unix_write_blk(io_channel channel, unsigned long block, #ifdef NO_IO_CACHE return raw_write_blk(channel, data, block, count, buf); -#else +#else /* * If we're doing an odd-sized write or a very large write, * flush out the cache completely and then do a direct write. @@ -616,7 +616,7 @@ static errcode_t unix_write_blk(io_channel channel, unsigned long block, writethrough = channel->flags & CHANNEL_FLAGS_WRITETHROUGH; if (writethrough) retval = raw_write_blk(channel, data, block, count, buf); - + cp = buf; while (count > 0) { cache = find_cached_block(data, block, &reuse); @@ -655,7 +655,7 @@ static errcode_t unix_write_byte(io_channel channel, unsigned long offset, if (lseek(data->dev, offset + data->offset, SEEK_SET) < 0) return errno; - + actual = write(data->dev, buf, size); if (actual != size) return EXT2_ET_SHORT_WRITE; @@ -664,13 +664,13 @@ static errcode_t unix_write_byte(io_channel channel, unsigned long offset, } /* - * Flush data buffers to disk. + * Flush data buffers to disk. */ static errcode_t unix_flush(io_channel channel) { struct unix_private_data *data; errcode_t retval = 0; - + EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); data = (struct unix_private_data *) channel->private_data; EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL); @@ -682,7 +682,7 @@ static errcode_t unix_flush(io_channel channel) return retval; } -static errcode_t unix_set_option(io_channel channel, const char *option, +static errcode_t unix_set_option(io_channel channel, const char *option, const char *arg) { struct unix_private_data *data; diff --git a/e2fsprogs/ext2fs/unlink.c b/e2fsprogs/ext2fs/unlink.c index e7b2182..a6ab53a 100644 --- a/e2fsprogs/ext2fs/unlink.c +++ b/e2fsprogs/ext2fs/unlink.c @@ -1,6 +1,6 @@ /* * unlink.c --- delete links in a ext2fs directory - * + * * Copyright (C) 1993, 1994, 1997 Theodore Ts'o. * * %Begin-Header% @@ -25,7 +25,7 @@ struct link_struct { int flags; struct ext2_dir_entry *prev; int done; -}; +}; #ifdef __TURBOC__ #pragma argsused @@ -56,7 +56,7 @@ static int unlink_proc(struct ext2_dir_entry *dirent, return 0; } - if (prev) + if (prev) prev->rec_len += dirent->rec_len; else dirent->inode = 0; @@ -89,7 +89,7 @@ errcode_t ext2fs_unlink(ext2_filsys fs, ext2_ino_t dir, ls.done = 0; ls.prev = 0; - retval = ext2fs_dir_iterate(fs, dir, DIRENT_FLAG_INCLUDE_EMPTY, + retval = ext2fs_dir_iterate(fs, dir, DIRENT_FLAG_INCLUDE_EMPTY, 0, unlink_proc, &ls); if (retval) return retval; diff --git a/e2fsprogs/ext2fs/valid_blk.c b/e2fsprogs/ext2fs/valid_blk.c index 29ff27a..d0367e7 100644 --- a/e2fsprogs/ext2fs/valid_blk.c +++ b/e2fsprogs/ext2fs/valid_blk.c @@ -2,12 +2,12 @@ * valid_blk.c --- does the inode have valid blocks? * * Copyright 1997 by Theodore Ts'o - * + * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public * License. * %End-Header% - * + * */ #include <stdio.h> @@ -33,7 +33,7 @@ int ext2fs_inode_has_valid_blocks(struct ext2_inode *inode) if (!LINUX_S_ISDIR(inode->i_mode) && !LINUX_S_ISREG(inode->i_mode) && !LINUX_S_ISLNK(inode->i_mode)) return 0; - + /* * If the symbolic link is a "fast symlink", then the symlink * target is stored in the block entries. |