From efc6f628e15de95bcd13e4f0ee223cb42115d520 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Wed, 27 Aug 2008 23:07:54 -0400 Subject: Remove trailing whitespace for the entire source tree Signed-off-by: "Theodore Ts'o" --- debugfs/debugfs.c | 134 +++++++++++++++++++------------------- debugfs/debugfs.h | 2 +- debugfs/dump.c | 22 +++---- debugfs/htree.c | 28 ++++---- debugfs/icheck.c | 8 +-- debugfs/logdump.c | 180 +++++++++++++++++++++++++-------------------------- debugfs/ls.c | 8 +-- debugfs/lsdel.c | 26 ++++---- debugfs/ncheck.c | 12 ++-- debugfs/set_fields.c | 26 ++++---- debugfs/unused.c | 4 +- debugfs/util.c | 14 ++-- 12 files changed, 232 insertions(+), 232 deletions(-) (limited to 'debugfs') diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c index 8b2f31e5..8b0965ec 100644 --- a/debugfs/debugfs.c +++ b/debugfs/debugfs.c @@ -4,7 +4,7 @@ * * Copyright (C) 1993 Theodore Ts'o. This file may be redistributed * under the terms of the GNU Public License. - * + * * Modifications by Robert Sanders */ @@ -16,7 +16,7 @@ #include #ifdef HAVE_GETOPT_H #include -#else +#else extern int optind; extern char *optarg; #endif @@ -46,7 +46,7 @@ ext2_filsys current_fs = NULL; ext2_ino_t root, cwd; static void open_filesystem(char *device, int open_flags, blk_t superblock, - blk_t blocksize, int catastrophic, + blk_t blocksize, int catastrophic, char *data_filename) { int retval; @@ -60,7 +60,7 @@ static void open_filesystem(char *device, int open_flags, blk_t superblock, if (data_filename) { if ((open_flags & EXT2_FLAG_IMAGE_FILE) == 0) { - com_err(device, 0, + com_err(device, 0, "The -d option is only valid when reading an e2image file"); current_fs = NULL; return; @@ -78,7 +78,7 @@ static void open_filesystem(char *device, int open_flags, blk_t superblock, "opening read-only because of catastrophic mode"); open_flags &= ~EXT2_FLAG_RW; } - + retval = ext2fs_open(device, open_flags, superblock, blocksize, unix_io_manager, ¤t_fs); if (retval) { @@ -105,7 +105,7 @@ static void open_filesystem(char *device, int open_flags, blk_t superblock, if (data_io) { retval = ext2fs_set_data_io(current_fs, data_io); if (retval) { - com_err(device, retval, + com_err(device, retval, "while setting data source"); goto errout; } @@ -129,7 +129,7 @@ void do_open_filesys(int argc, char **argv) blk_t blocksize = 0; int open_flags = EXT2_FLAG_SOFTSUPP_FEATURES; char *data_filename = 0; - + reset_getopt(); while ((c = getopt (argc, argv, "iwfecb:s:d:")) != EOF) { switch (c) { @@ -173,7 +173,7 @@ void do_open_filesys(int argc, char **argv) if (check_fs_not_open(argv[0])) return; open_filesystem(argv[optind], open_flags, - superblock, blocksize, catastrophic, + superblock, blocksize, catastrophic, data_filename); return; @@ -200,7 +200,7 @@ void do_lcd(int argc, char **argv) static void close_filesystem(NOARGS) { int retval; - + if (current_fs->flags & EXT2_FLAG_IB_DIRTY) { retval = ext2fs_write_inode_bitmap(current_fs); if (retval) @@ -230,7 +230,7 @@ void do_init_filesys(int argc, char **argv) struct ext2_super_block param; errcode_t retval; int err; - + if (common_args_process(argc, argv, 3, 3, "initialize", " ", CHECK_FS_NOTOPEN)) return; @@ -315,12 +315,12 @@ void do_show_super_stats(int argc, char *argv[]) for (i=0; i < current_fs->group_desc_count; i++) numdirs += current_fs->group_desc[i].bg_used_dirs_count; fprintf(out, "Directories: %d\n", numdirs); - + if (header_only) { close_pager(out); return; } - + gdp = ¤t_fs->group_desc[0]; for (i = 0; i < current_fs->group_desc_count; i++, gdp++) { fprintf(out, " Group %2d: block bitmap at %u, " @@ -361,7 +361,7 @@ print_usage: fprintf(stderr, "%s: Usage: show_super [-h]\n", argv[0]); } -void do_dirty_filesys(int argc EXT2FS_ATTR((unused)), +void do_dirty_filesys(int argc EXT2FS_ATTR((unused)), char **argv EXT2FS_ATTR((unused))) { if (check_fs_open(argv[0])) @@ -402,10 +402,10 @@ static void finish_range(struct list_blocks_struct *lb) lb->first_block = 0; } -static int list_blocks_proc(ext2_filsys fs EXT2FS_ATTR((unused)), - blk_t *blocknr, e2_blkcnt_t blockcnt, +static int list_blocks_proc(ext2_filsys fs EXT2FS_ATTR((unused)), + blk_t *blocknr, e2_blkcnt_t blockcnt, blk_t ref_block EXT2FS_ATTR((unused)), - int ref_offset EXT2FS_ATTR((unused)), + int ref_offset EXT2FS_ATTR((unused)), void *private) { struct list_blocks_struct *lb = (struct list_blocks_struct *) private; @@ -451,7 +451,7 @@ static void dump_xattr_string(FILE *out, const char *str, int len) { int printable = 0; int i; - + /* check: is string "printable enough?" */ for (i = 0; i < len; i++) if (isprint(str[i])) @@ -468,9 +468,9 @@ static void dump_xattr_string(FILE *out, const char *str, int len) fprintf(out, "%02x ", (unsigned char)str[i]); } -static void internal_dump_inode_extra(FILE *out, +static void internal_dump_inode_extra(FILE *out, const char *prefix EXT2FS_ATTR((unused)), - ext2_ino_t inode_num EXT2FS_ATTR((unused)), + ext2_ino_t inode_num EXT2FS_ATTR((unused)), struct ext2_inode_large *inode) { struct ext2_ext_attr_entry *entry; @@ -504,7 +504,7 @@ static void internal_dump_inode_extra(FILE *out, return; } fprintf(out, " "); - dump_xattr_string(out, EXT2_EXT_ATTR_NAME(entry), + dump_xattr_string(out, EXT2_EXT_ATTR_NAME(entry), entry->e_name_len); fprintf(out, " = \""); dump_xattr_string(out, start + entry->e_value_offs, @@ -559,11 +559,11 @@ void internal_dump_inode(FILE *out, const char *prefix, fprintf(out, "%sMode: %04o Flags: 0x%x\n", prefix, inode->i_mode & 0777, inode->i_flags); if (is_large_inode && large_inode->i_extra_isize >= 24) { - fprintf(out, "%sGeneration: %u Version: 0x%08x:%08x\n", + fprintf(out, "%sGeneration: %u Version: 0x%08x:%08x\n", prefix, inode->i_generation, large_inode->i_version_hi, inode->osd1.linux1.l_i_version); } else { - fprintf(out, "%sGeneration: %u Version: 0x%08x\n", prefix, + fprintf(out, "%sGeneration: %u Version: 0x%08x\n", prefix, inode->i_generation, inode->osd1.linux1.l_i_version); } fprintf(out, "%sUser: %5d Group: %5d Size: ", @@ -585,11 +585,11 @@ void internal_dump_inode(FILE *out, const char *prefix, fprintf(out, "%sFile ACL: %d Directory ACL: %d\n", prefix, inode->i_file_acl, LINUX_S_ISDIR(inode->i_mode) ? inode->i_dir_acl : 0); - if (os == EXT2_OS_LINUX) + if (os == EXT2_OS_LINUX) fprintf(out, "%sLinks: %d Blockcount: %llu\n", - prefix, inode->i_links_count, - (((unsigned long long) - inode->osd2.linux2.l_i_blocks_hi << 32)) + + prefix, inode->i_links_count, + (((unsigned long long) + inode->osd2.linux2.l_i_blocks_hi << 32)) + inode->i_blocks); else fprintf(out, "%sLinks: %d Blockcount: %u\n", @@ -605,10 +605,10 @@ void internal_dump_inode(FILE *out, const char *prefix, fprintf(out, "%sFragment: Address: %d Number: %d Size: %d\n", prefix, inode->i_faddr, frag, fsize); if (is_large_inode && large_inode->i_extra_isize >= 24) { - fprintf(out, "%s ctime: 0x%08x:%08x -- %s", prefix, + fprintf(out, "%s ctime: 0x%08x:%08x -- %s", prefix, inode->i_ctime, large_inode->i_ctime_extra, time_to_string(inode->i_ctime)); - fprintf(out, "%s atime: 0x%08x:%08x -- %s", prefix, + fprintf(out, "%s atime: 0x%08x:%08x -- %s", prefix, inode->i_atime, large_inode->i_atime_extra, time_to_string(inode->i_atime)); fprintf(out, "%s mtime: 0x%08x:%08x -- %s", prefix, @@ -625,7 +625,7 @@ void internal_dump_inode(FILE *out, const char *prefix, fprintf(out, "%smtime: 0x%08x -- %s", prefix, inode->i_mtime, time_to_string(inode->i_mtime)); } - if (inode->i_dtime) + if (inode->i_dtime) fprintf(out, "%sdtime: 0x%08x -- %s", prefix, inode->i_dtime, time_to_string(inode->i_dtime)); if (EXT2_INODE_SIZE(current_fs->super) > EXT2_GOOD_OLD_INODE_SIZE) @@ -644,11 +644,11 @@ void internal_dump_inode(FILE *out, const char *prefix, devnote = ""; } else { major = (inode->i_block[1] & 0xfff00) >> 8; - minor = ((inode->i_block[1] & 0xff) | + minor = ((inode->i_block[1] & 0xff) | ((inode->i_block[1] >> 12) & 0xfff00)); devnote = "(New-style) "; } - fprintf(out, "%sDevice major/minor number: %02d:%02d (hex %02x:%02x)\n", + fprintf(out, "%sDevice major/minor number: %02d:%02d (hex %02x:%02x)\n", devnote, major, minor, major, minor); } else if (do_dump_blocks) @@ -658,7 +658,7 @@ void internal_dump_inode(FILE *out, const char *prefix, static void dump_inode(ext2_ino_t inode_num, struct ext2_inode *inode) { FILE *out; - + out = open_pager(); internal_dump_inode(out, "", inode_num, inode, 1); close_pager(out); @@ -900,7 +900,7 @@ void do_modify_inode(int argc, char *argv[]) const char *octal_format = "0%o"; const char *decimal_format = "%d"; const char *unsignedlong_format = "%lu"; - + if (common_inode_args_process(argc, argv, &inode_num, CHECK_FS_RW)) return; @@ -908,7 +908,7 @@ void do_modify_inode(int argc, char *argv[]) if (debugfs_read_inode(inode_num, &inode, argv[1])) return; - + modify_u16(argv[0], "Mode", octal_format, &inode.i_mode); modify_u16(argv[0], "User ID", decimal_format, &inode.i_uid); modify_u16(argv[0], "Group ID", decimal_format, &inode.i_gid); @@ -919,7 +919,7 @@ void do_modify_inode(int argc, char *argv[]) modify_u32(argv[0], "Deletion time", decimal_format, &inode.i_dtime); modify_u16(argv[0], "Link count", decimal_format, &inode.i_links_count); if (os == EXT2_OS_LINUX) - modify_u16(argv[0], "Block count high", unsignedlong_format, + modify_u16(argv[0], "Block count high", unsignedlong_format, &inode.osd2.linux2.l_i_blocks_hi); modify_u32(argv[0], "Block count", unsignedlong_format, &inode.i_blocks); modify_u32(argv[0], "File flags", hex_format, &inode.i_flags); @@ -936,7 +936,7 @@ void do_modify_inode(int argc, char *argv[]) if (os == EXT2_OS_HURD) modify_u32(argv[0], "Translator Block", decimal_format, &inode.osd1.hurd1.h_i_translator); - + modify_u32(argv[0], "Fragment address", decimal_format, &inode.i_faddr); switch (os) { case EXT2_OS_HURD: @@ -956,7 +956,7 @@ void do_modify_inode(int argc, char *argv[]) modify_u32(argv[0], buf, decimal_format, &inode.i_block[i]); } modify_u32(argv[0], "Indirect Block", decimal_format, - &inode.i_block[EXT2_IND_BLOCK]); + &inode.i_block[EXT2_IND_BLOCK]); modify_u32(argv[0], "Double Indirect Block", decimal_format, &inode.i_block[EXT2_DIND_BLOCK]); modify_u32(argv[0], "Triple Indirect Block", decimal_format, @@ -969,7 +969,7 @@ void do_change_working_dir(int argc, char *argv[]) { ext2_ino_t inode; int retval; - + if (common_inode_args_process(argc, argv, &inode, 0)) return; @@ -986,7 +986,7 @@ void do_print_working_directory(int argc, char *argv[]) { int retval; char *pathname = NULL; - + if (common_args_process(argc, argv, 1, 1, "print_working_directory", "", 0)) return; @@ -1026,22 +1026,22 @@ static int ext2_file_type(unsigned int mode) if (LINUX_S_ISDIR(mode)) return EXT2_FT_DIR; - + if (LINUX_S_ISCHR(mode)) return EXT2_FT_CHRDEV; - + if (LINUX_S_ISBLK(mode)) return EXT2_FT_BLKDEV; - + if (LINUX_S_ISLNK(mode)) return EXT2_FT_SYMLINK; if (LINUX_S_ISFIFO(mode)) return EXT2_FT_FIFO; - + if (LINUX_S_ISSOCK(mode)) return EXT2_FT_SOCK; - + return 0; } @@ -1066,7 +1066,7 @@ static void make_link(char *sourcename, char *destname) base_name = sourcename; /* * Figure out the destination. First see if it exists and is - * a directory. + * a directory. */ if (! (retval=ext2fs_namei(current_fs, root, cwd, destname, &dir))) dest = base_name; @@ -1090,8 +1090,8 @@ static void make_link(char *sourcename, char *destname) if (debugfs_read_inode(ino, &inode, sourcename)) return; - - retval = ext2fs_link(current_fs, dir, dest, ino, + + retval = ext2fs_link(current_fs, dir, dest, ino, ext2_file_type(inode.i_mode)); if (retval) com_err("make_link", retval, 0); @@ -1109,7 +1109,7 @@ void do_link(int argc, char *argv[]) } static int mark_blocks_proc(ext2_filsys fs, blk_t *blocknr, - int blockcnt EXT2FS_ATTR((unused)), + int blockcnt EXT2FS_ATTR((unused)), void *private EXT2FS_ATTR((unused))) { blk_t block; @@ -1143,7 +1143,7 @@ void do_undel(int argc, char *argv[]) /* * XXX this function doesn't handle changing the links count on the - * parent directory when undeleting a directory. + * parent directory when undeleting a directory. */ inode.i_links_count = LINUX_S_ISDIR(inode.i_mode) ? 2 : 1; inode.i_dtime = 0; @@ -1165,7 +1165,7 @@ static void unlink_file_by_name(char *filename) int retval; ext2_ino_t dir; char *base_name; - + base_name = strrchr(filename, '/'); if (base_name) { *base_name++ = '\0'; @@ -1197,7 +1197,7 @@ void do_find_free_block(int argc, char *argv[]) int count; errcode_t retval; char *tmp; - + if ((argc > 3) || (argc==2 && *argv[1] == '?')) { com_err(argv[0], 0, "Usage: find_free_block [count [goal]]"); return; @@ -1225,7 +1225,7 @@ void do_find_free_block(int argc, char *argv[]) goal = current_fs->super->s_first_data_block; printf("Free blocks found: "); - free_blk = goal - 1; + free_blk = goal - 1; while (count-- > 0) { retval = ext2fs_new_block(current_fs, free_blk + 1, 0, &free_blk); @@ -1249,7 +1249,7 @@ void do_find_free_inode(int argc, char *argv[]) int mode; int retval; char *tmp; - + if (argc > 3 || (argc>1 && *argv[1] == '?')) { com_err(argv[0], 0, "Usage: find_free_inode [dir] [mode]"); return; @@ -1383,11 +1383,11 @@ void do_write(int argc, char *argv[]) ext2fs_inode_alloc_stats2(current_fs, newfile, +1, 0); memset(&inode, 0, sizeof(inode)); inode.i_mode = (statbuf.st_mode & ~LINUX_S_IFMT) | LINUX_S_IFREG; - inode.i_atime = inode.i_ctime = inode.i_mtime = + inode.i_atime = inode.i_ctime = inode.i_mtime = current_fs->now ? current_fs->now : time(0); inode.i_links_count = 1; inode.i_size = statbuf.st_size; - if (current_fs->super->s_feature_incompat & + if (current_fs->super->s_feature_incompat & EXT3_FEATURE_INCOMPAT_EXTENTS) inode.i_flags |= EXT4_EXTENTS_FL; if (debugfs_write_new_inode(newfile, &inode, argv[0])) { @@ -1474,7 +1474,7 @@ void do_mknod(int argc, char *argv[]) ext2fs_mark_ib_dirty(current_fs); memset(&inode, 0, sizeof(inode)); inode.i_mode = mode; - inode.i_atime = inode.i_ctime = inode.i_mtime = + inode.i_atime = inode.i_ctime = inode.i_mtime = current_fs->now ? current_fs->now : time(0); if ((major < 256) && (minor < 256)) { inode.i_block[0] = major*256+minor; @@ -1531,7 +1531,7 @@ try_again: } static int release_blocks_proc(ext2_filsys fs, blk_t *blocknr, - int blockcnt EXT2FS_ATTR((unused)), + int blockcnt EXT2FS_ATTR((unused)), void *private EXT2FS_ATTR((unused))) { blk_t block; @@ -1631,7 +1631,7 @@ static int rmdir_proc(ext2_ino_t dir EXT2FS_ATTR((unused)), rds->empty = 0; return 0; } - + void do_rmdir(int argc, char *argv[]) { int retval; @@ -1688,7 +1688,7 @@ void do_rmdir(int argc, char *argv[]) } } -void do_show_debugfs_params(int argc EXT2FS_ATTR((unused)), +void do_show_debugfs_params(int argc EXT2FS_ATTR((unused)), char *argv[] EXT2FS_ATTR((unused))) { FILE *out = stdout; @@ -1717,7 +1717,7 @@ void do_expand_dir(int argc, char *argv[]) void do_features(int argc, char *argv[]) { int i; - + if (check_fs_open(argv[0])) return; @@ -1740,7 +1740,7 @@ void do_bmap(int argc, char *argv[]) blk_t blk, pblk; int err; errcode_t errcode; - + if (common_args_process(argc, argv, 3, 3, argv[0], " logical_blk", 0)) return; @@ -1780,7 +1780,7 @@ void do_imap(int argc, char *argv[]) group); return; } - block_nr = current_fs->group_desc[(unsigned)group].bg_inode_table + + block_nr = current_fs->group_desc[(unsigned)group].bg_inode_table + block; offset &= (EXT2_BLOCK_SIZE(current_fs->super) - 1); @@ -1929,7 +1929,7 @@ int main(int argc, char **argv) blk_t blocksize = 0; int catastrophic = 0; char *data_filename = 0; - + if (debug_prog_name == 0) debug_prog_name = "debugfs"; @@ -1955,11 +1955,11 @@ int main(int argc, char **argv) open_flags |= EXT2_FLAG_RW; break; case 'b': - blocksize = parse_ulong(optarg, argv[0], + blocksize = parse_ulong(optarg, argv[0], "block size", 0); break; case 's': - superblock = parse_ulong(optarg, argv[0], + superblock = parse_ulong(optarg, argv[0], "superblock number", 0); break; case 'c': @@ -1979,7 +1979,7 @@ int main(int argc, char **argv) open_filesystem(argv[optind], open_flags, superblock, blocksize, catastrophic, data_filename); - + sci_idx = ss_create_invocation(debug_prog_name, "0.0", (char *) NULL, &debug_cmds, &retval); if (retval) { @@ -2014,7 +2014,7 @@ int main(int argc, char **argv) if (current_fs) close_filesystem(); - + remove_error_table(&et_ext2_error_table); return exit_status; } diff --git a/debugfs/debugfs.h b/debugfs/debugfs.h index 003c19ad..3c0f0166 100644 --- a/debugfs/debugfs.h +++ b/debugfs/debugfs.h @@ -84,7 +84,7 @@ extern void do_set_block_group_descriptor(int argc, char **); extern void do_dump_unused(int argc, char **argv); /* debugfs.c */ -extern void internal_dump_inode(FILE *, const char *, ext2_ino_t, +extern void internal_dump_inode(FILE *, const char *, ext2_ino_t, struct ext2_inode *, int); extern void do_dirty_filesys(int argc, char **argv); diff --git a/debugfs/dump.c b/debugfs/dump.c index 2cfe623a..39a41668 100644 --- a/debugfs/dump.c +++ b/debugfs/dump.c @@ -1,6 +1,6 @@ /* * dump.c --- dump the contents of an inode out to a file - * + * * Copyright (C) 1994 Theodore Ts'o. This file may be redistributed * under the terms of the GNU Public License. */ @@ -22,7 +22,7 @@ #include #ifdef HAVE_GETOPT_H #include -#else +#else extern int optind; extern char *optarg; #endif @@ -51,7 +51,7 @@ static struct { { LINUX_S_IXOTH, S_IXOTH }, { 0, 0 } }; - + static mode_t mode_xlate(__u16 lmode) { mode_t mode = 0; @@ -106,7 +106,7 @@ static void dump_file(const char *cmdname, ext2_ino_t ino, int fd, ext2_file_t e2_file; int nbytes; unsigned int got; - + if (debugfs_read_inode(ino, &inode, cmdname)) return; @@ -117,7 +117,7 @@ static void dump_file(const char *cmdname, ext2_ino_t ino, int fd, } while (1) { retval = ext2fs_file_read(e2_file, buf, sizeof(buf), &got); - if (retval) + if (retval) com_err(cmdname, retval, "while reading ext2 file"); if (got == 0) break; @@ -130,12 +130,12 @@ static void dump_file(const char *cmdname, ext2_ino_t ino, int fd, com_err(cmdname, retval, "while closing ext2 file"); return; } - + if (preserve) fix_perms("dump_file", &inode, fd, outname); else if (fd != 1) close(fd); - + return; } @@ -147,7 +147,7 @@ void do_dump(int argc, char **argv) int preserve = 0; const char *dump_usage = "Usage: dump_inode [-p] "; char *in_fn, *out_fn; - + reset_getopt(); while ((c = getopt (argc, argv, "p")) != EOF) { switch (c) { @@ -171,7 +171,7 @@ void do_dump(int argc, char **argv) out_fn = argv[optind+1]; inode = string_to_inode(in_fn); - if (!inode) + if (!inode) return; fd = open(out_fn, O_CREAT | O_WRONLY | O_TRUNC | O_LARGEFILE, 0666); @@ -289,7 +289,7 @@ errout: free(fullname); } -static int rdump_dirent(struct ext2_dir_entry *dirent, +static int rdump_dirent(struct ext2_dir_entry *dirent, int offset EXT2FS_ATTR((unused)), int blocksize EXT2FS_ATTR((unused)), char *buf EXT2FS_ATTR((unused)), void *private) @@ -360,7 +360,7 @@ void do_cat(int argc, char **argv) fflush(stdout); fflush(stderr); - dump_file(argv[0], inode, 1, 0, argv[2]); + dump_file(argv[0], inode, 1, 0, argv[2]); return; } diff --git a/debugfs/htree.c b/debugfs/htree.c index 1659b63f..983dc9a2 100644 --- a/debugfs/htree.c +++ b/debugfs/htree.c @@ -1,6 +1,6 @@ /* * htree.c --- hash tree routines - * + * * Copyright (C) 2002 Theodore Ts'o. This file may be redistributed * under the terms of the GNU Public License. */ @@ -17,7 +17,7 @@ #include #ifdef HAVE_GETOPT_H #include -#else +#else extern int optind; extern char *optarg; #endif @@ -40,7 +40,7 @@ static void htree_dump_leaf_node(ext2_filsys fs, ext2_ino_t ino, blk_t pblk; ext2_dirhash_t hash, minor_hash; int rec_len, hash_alg; - + errcode = ext2fs_bmap(fs, ino, inode, buf, 0, blk, &pblk); if (errcode) { com_err("htree_dump_leaf_node", errcode, @@ -105,13 +105,13 @@ static void htree_dump_int_block(ext2_filsys fs, ext2_ino_t ino, static void htree_dump_int_node(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, struct ext2_dx_root_info * rootnode, - struct ext2_dx_entry *ent, + struct ext2_dx_entry *ent, char *buf, int level) { struct ext2_dx_countlimit limit; struct ext2_dx_entry e; int hash, i; - + limit = *((struct ext2_dx_countlimit *) ent); limit.count = ext2fs_le16_to_cpu(limit.count); @@ -159,7 +159,7 @@ static void htree_dump_int_block(ext2_filsys fs, ext2_ino_t ino, fprintf(pager, "Couldn't allocate child block.\n"); return; } - + errcode = ext2fs_bmap(fs, ino, inode, buf, 0, blk, &pblk); if (errcode) { com_err("htree_dump_int_block", errcode, @@ -232,7 +232,7 @@ void do_htree_dump(int argc, char *argv[]) com_err(argv[0], 0, "Not a directory"); goto errout; } - + if ((inode.i_flags & EXT2_BTREE_FL) == 0) { com_err(argv[0], 0, "Not a hash-indexed directory"); goto errout; @@ -251,7 +251,7 @@ void do_htree_dump(int argc, char *argv[]) goto errout; } - errcode = io_channel_read_blk(current_fs->io, blk, + errcode = io_channel_read_blk(current_fs->io, blk, 1, buf); if (errcode) { com_err(argv[0], errcode, "Error reading root node"); @@ -290,7 +290,7 @@ void do_dx_hash(int argc, char *argv[]) int c; int hash_version = 0; __u32 hash_seed[4]; - + hash_seed[0] = hash_seed[1] = hash_seed[2] = hash_seed[3] = 0; reset_getopt(); @@ -330,14 +330,14 @@ struct process_block_struct { }; static int search_dir_block(ext2_filsys fs, blk_t *blocknr, - e2_blkcnt_t blockcnt, blk_t ref_blk, + e2_blkcnt_t blockcnt, blk_t ref_blk, int ref_offset, void *priv_data); void do_dirsearch(int argc, char *argv[]) { ext2_ino_t inode; struct process_block_struct pb; - + if (check_fs_open(argv[0])) return; @@ -357,7 +357,7 @@ void do_dirsearch(int argc, char *argv[]) } pb.search_name = argv[2]; pb.len = strlen(pb.search_name); - + ext2fs_block_iterate2(current_fs, inode, BLOCK_FLAG_READ_ONLY, 0, search_dir_block, &pb); @@ -366,7 +366,7 @@ void do_dirsearch(int argc, char *argv[]) static int search_dir_block(ext2_filsys fs, blk_t *blocknr, - e2_blkcnt_t blockcnt, + e2_blkcnt_t blockcnt, blk_t ref_blk EXT2FS_ATTR((unused)), int ref_offset EXT2FS_ATTR((unused)), void *priv_data) @@ -394,7 +394,7 @@ static int search_dir_block(ext2_filsys fs, blk_t *blocknr, rec_len = (dirent->rec_len || fs->blocksize < 65536) ? dirent->rec_len : 65536; if (dirent->inode && - p->len == (dirent->name_len & 0xFF) && + p->len == (dirent->name_len & 0xFF) && strncmp(p->search_name, dirent->name, p->len) == 0) { printf("Entry found at logical block %lld, " diff --git a/debugfs/icheck.c b/debugfs/icheck.c index 01c78bcb..2f880c05 100644 --- a/debugfs/icheck.c +++ b/debugfs/icheck.c @@ -1,6 +1,6 @@ /* * icheck.c --- given a list of blocks, generate a list of inodes - * + * * Copyright (C) 1994 Theodore Ts'o. This file may be redistributed * under the terms of the GNU Public License. */ @@ -48,7 +48,7 @@ static int icheck_proc(ext2_filsys fs EXT2FS_ATTR((unused)), } if (!bw->blocks_left) return BLOCK_ABORT; - + return 0; } @@ -62,7 +62,7 @@ void do_icheck(int argc, char **argv) struct ext2_inode inode; errcode_t retval; char *block_buf; - + if (argc < 2) { com_err(argv[0], 0, "Usage: icheck ..."); return; @@ -104,7 +104,7 @@ void do_icheck(int argc, char **argv) com_err("icheck", retval, "while starting inode scan"); goto error_out; } - + while (ino) { if (!inode.i_links_count) goto next; diff --git a/debugfs/logdump.c b/debugfs/logdump.c index 08e58f7d..fed98380 100644 --- a/debugfs/logdump.c +++ b/debugfs/logdump.c @@ -1,11 +1,11 @@ /* * logdump.c --- dump the contents of the journal out to a file - * + * * Authro: Stephen C. Tweedie, 2001 * Copyright (C) 2001 Red Hat, Inc. - * Based on portions Copyright (C) 1994 Theodore Ts'o. + * Based on portions Copyright (C) 1994 Theodore Ts'o. * - * This file may be redistributed under the terms of the GNU Public + * This file may be redistributed under the terms of the GNU Public * License. */ @@ -24,7 +24,7 @@ #include #ifdef HAVE_GETOPT_H #include -#else +#else extern int optind; extern char *optarg; #endif @@ -43,7 +43,7 @@ blk_t block_to_dump, bitmap_to_dump, inode_block_to_dump; unsigned int group_to_dump, inode_offset_to_dump; ext2_ino_t inode_to_dump; -struct journal_source +struct journal_source { enum journal_location where; int fd; @@ -60,7 +60,7 @@ static void dump_revoke_block(FILE *, char *, journal_superblock_t *, unsigned int, int, tid_t); static void dump_metadata_block(FILE *, struct journal_source *, - journal_superblock_t*, + journal_superblock_t*, unsigned int, unsigned int, int, tid_t); static void do_hexdump (FILE *, char *, int); @@ -76,7 +76,7 @@ void do_logdump(int argc, char **argv) int retval; char *out_fn; FILE *out_file; - + char *inode_spec = NULL; char *journal_fn = NULL; int journal_fd = 0; @@ -87,7 +87,7 @@ void do_logdump(int argc, char **argv) char *tmp; struct journal_source journal_source; struct ext2_super_block *es = NULL; - + journal_source.where = 0; journal_source.fd = 0; journal_source.file = 0; @@ -98,7 +98,7 @@ void do_logdump(int argc, char **argv) bitmap_to_dump = -1; inode_block_to_dump = ANY_BLOCK; inode_to_dump = -1; - + reset_getopt(); while ((c = getopt (argc, argv, "ab:ci:f:s")) != EOF) { switch (c) { @@ -152,11 +152,11 @@ void do_logdump(int argc, char **argv) / es->s_inodes_per_group); group_offset = ((inode_to_dump - 1) % es->s_inodes_per_group); - inodes_per_block = (current_fs->blocksize + inodes_per_block = (current_fs->blocksize / sizeof(struct ext2_inode)); - - inode_block_to_dump = - current_fs->group_desc[inode_group].bg_inode_table + + + inode_block_to_dump = + current_fs->group_desc[inode_group].bg_inode_table + (group_offset / inodes_per_block); inode_offset_to_dump = ((group_offset % inodes_per_block) * sizeof(struct ext2_inode)); @@ -178,7 +178,7 @@ void do_logdump(int argc, char **argv) } if (block_to_dump != ANY_BLOCK && current_fs != NULL) { - group_to_dump = ((block_to_dump - + group_to_dump = ((block_to_dump - es->s_first_data_block) / es->s_blocks_per_group); bitmap_to_dump = current_fs->group_desc[group_to_dump].bg_block_bitmap; @@ -195,7 +195,7 @@ void do_logdump(int argc, char **argv) journal_fn); goto errout; } - + journal_source.where = JOURNAL_IS_EXTERNAL; journal_source.fd = journal_fd; } else if ((journal_inum = es->s_journal_inum)) { @@ -206,17 +206,17 @@ void do_logdump(int argc, char **argv) goto errout; } memset(&journal_inode, 0, sizeof(struct ext2_inode)); - memcpy(&journal_inode.i_block[0], es->s_jnl_blocks, + memcpy(&journal_inode.i_block[0], es->s_jnl_blocks, EXT2_N_BLOCKS*4); journal_inode.i_size = es->s_jnl_blocks[16]; journal_inode.i_links_count = 1; journal_inode.i_mode = LINUX_S_IFREG | 0600; } else { - if (debugfs_read_inode(journal_inum, &journal_inode, + if (debugfs_read_inode(journal_inum, &journal_inode, argv[0])) goto errout; } - + retval = ext2fs_file_open2(current_fs, journal_inum, &journal_inode, 0, &journal_file); if (retval) { @@ -227,7 +227,7 @@ void do_logdump(int argc, char **argv) journal_source.file = journal_file; } else { char uuid[37]; - + uuid_unparse(es->s_journal_uuid, uuid); journal_fn = blkid_get_devname(NULL, "UUID", uuid); if (!journal_fn) @@ -269,12 +269,12 @@ print_usage: } -static int read_journal_block(const char *cmd, struct journal_source *source, +static int read_journal_block(const char *cmd, struct journal_source *source, off_t offset, char *buf, int size, unsigned int *got) { int retval; - + if (source->where == JOURNAL_IS_EXTERNAL) { if (lseek(source->fd, offset, SEEK_SET) < 0) { retval = errno; @@ -288,23 +288,23 @@ static int read_journal_block(const char *cmd, struct journal_source *source, } else retval = errno; } else { - retval = ext2fs_file_lseek(source->file, offset, + retval = ext2fs_file_lseek(source->file, offset, EXT2_SEEK_SET, NULL); if (retval) { com_err(cmd, retval, "while seeking in reading journal"); return retval; } - + retval = ext2fs_file_read(source->file, buf, size, got); } - + if (retval) com_err(cmd, retval, "while while reading journal"); else if (*got != (unsigned int) size) { com_err(cmd, 0, "short read (read %d, expected %d) while while reading journal", *got, size); retval = -1; } - + return retval; } @@ -326,7 +326,7 @@ static const char *type_to_name(int btype) } -static void dump_journal(char *cmdname, FILE *out_file, +static void dump_journal(char *cmdname, FILE *out_file, struct journal_source *source) { struct ext2_super_block *sb; @@ -338,12 +338,12 @@ static void dump_journal(char *cmdname, FILE *out_file, int retval; __u32 magic, sequence, blocktype; journal_header_t *header; - + tid_t transaction; unsigned int blocknr = 0; - + /* First, check to see if there's an ext2 superblock header */ - retval = read_journal_block(cmdname, source, 0, + retval = read_journal_block(cmdname, source, 0, buf, 2048, &got); if (retval) return; @@ -351,10 +351,10 @@ static void dump_journal(char *cmdname, FILE *out_file, jsb = (journal_superblock_t *) buf; sb = (struct ext2_super_block *) (buf+1024); #ifdef WORDS_BIGENDIAN - if (sb->s_magic == ext2fs_swab16(EXT2_SUPER_MAGIC)) + if (sb->s_magic == ext2fs_swab16(EXT2_SUPER_MAGIC)) ext2fs_swap_super(sb); #endif - + if ((be32_to_cpu(jsb->s_header.h_magic) != JFS_MAGIC_NUMBER) && (sb->s_magic == EXT2_SUPER_MAGIC) && (sb->s_feature_incompat & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)) { @@ -369,10 +369,10 @@ static void dump_journal(char *cmdname, FILE *out_file, (unsigned long) sb->s_blocks_count); } } - + /* Next, read the journal superblock */ - retval = read_journal_block(cmdname, source, blocknr*blocksize, + retval = read_journal_block(cmdname, source, blocknr*blocksize, jsb_buffer, 1024, &got); if (retval) return; @@ -393,29 +393,29 @@ static void dump_journal(char *cmdname, FILE *out_file, if (!blocknr) /* Empty journal, nothing to do. */ return; - + while (1) { - retval = read_journal_block(cmdname, source, + retval = read_journal_block(cmdname, source, blocknr*blocksize, buf, blocksize, &got); if (retval || got != blocksize) return; - + header = (journal_header_t *) buf; magic = be32_to_cpu(header->h_magic); sequence = be32_to_cpu(header->h_sequence); blocktype = be32_to_cpu(header->h_blocktype); - + if (magic != JFS_MAGIC_NUMBER) { fprintf (out_file, "No magic number at block %u: " "end of journal.\n", blocknr); return; } - + if (sequence != transaction) { fprintf (out_file, "Found sequence %u (not %u) at " - "block %u: end of journal.\n", + "block %u: end of journal.\n", sequence, transaction, blocknr); return; } @@ -423,13 +423,13 @@ static void dump_journal(char *cmdname, FILE *out_file, if (dump_descriptors) { fprintf (out_file, "Found expected sequence %u, " "type %u (%s) at block %u\n", - sequence, blocktype, + sequence, blocktype, type_to_name(blocktype), blocknr); } - + switch (blocktype) { case JFS_DESCRIPTOR_BLOCK: - dump_descriptor_block(out_file, source, buf, jsb, + dump_descriptor_block(out_file, source, buf, jsb, &blocknr, blocksize, transaction); continue; @@ -439,10 +439,10 @@ static void dump_journal(char *cmdname, FILE *out_file, blocknr++; WRAP(jsb, blocknr); continue; - + case JFS_REVOKE_BLOCK: dump_revoke_block(out_file, buf, jsb, - blocknr, blocksize, + blocknr, blocksize, transaction); blocknr++; WRAP(jsb, blocknr); @@ -457,10 +457,10 @@ static void dump_journal(char *cmdname, FILE *out_file, } -static void dump_descriptor_block(FILE *out_file, - struct journal_source *source, +static void dump_descriptor_block(FILE *out_file, + struct journal_source *source, char *buf, - journal_superblock_t *jsb, + journal_superblock_t *jsb, unsigned int *blockp, int blocksize, tid_t transaction) { @@ -470,20 +470,20 @@ static void dump_descriptor_block(FILE *out_file, unsigned int blocknr; __u32 tag_block; __u32 tag_flags; - + offset = sizeof(journal_header_t); blocknr = *blockp; - if (dump_all) + if (dump_all) fprintf(out_file, "Dumping descriptor block, sequence %u, at " "block %u:\n", transaction, blocknr); - + ++blocknr; WRAP(jsb, blocknr); - + do { - /* Work out the location of the current tag, and skip to + /* Work out the location of the current tag, and skip to * the next one... */ tagp = &buf[offset]; tag = (journal_block_tag_t *) tagp; @@ -493,40 +493,40 @@ static void dump_descriptor_block(FILE *out_file, end of this block. */ if (offset > blocksize) break; - + tag_block = be32_to_cpu(tag->t_blocknr); tag_flags = be32_to_cpu(tag->t_flags); if (!(tag_flags & JFS_FLAG_SAME_UUID)) offset += 16; - dump_metadata_block(out_file, source, jsb, - blocknr, tag_block, blocksize, + dump_metadata_block(out_file, source, jsb, + blocknr, tag_block, blocksize, transaction); ++blocknr; WRAP(jsb, blocknr); - + } while (!(tag_flags & JFS_FLAG_LAST_TAG)); - + *blockp = blocknr; } static void dump_revoke_block(FILE *out_file, char *buf, - journal_superblock_t *jsb EXT2FS_ATTR((unused)), - unsigned int blocknr, + journal_superblock_t *jsb EXT2FS_ATTR((unused)), + unsigned int blocknr, int blocksize EXT2FS_ATTR((unused)), tid_t transaction) { int offset, max; journal_revoke_header_t *header; unsigned int *entry, rblock; - - if (dump_all) + + if (dump_all) fprintf(out_file, "Dumping revoke block, sequence %u, at " "block %u:\n", transaction, blocknr); - + header = (journal_revoke_header_t *) buf; offset = sizeof(journal_revoke_header_t); max = be32_to_cpu(header->r_count); @@ -551,7 +551,7 @@ static void show_extent(FILE *out_file, int start_extent, int end_extent, __u32 first_block) { if (start_extent >= 0 && first_block != 0) - fprintf(out_file, "(%d+%u): %u ", + fprintf(out_file, "(%d+%u): %u ", start_extent, end_extent-start_extent, first_block); } @@ -564,79 +564,79 @@ static void show_indirect(FILE *out_file, const char *name, __u32 where) static void dump_metadata_block(FILE *out_file, struct journal_source *source, journal_superblock_t *jsb EXT2FS_ATTR((unused)), - unsigned int log_blocknr, - unsigned int fs_blocknr, + unsigned int log_blocknr, + unsigned int fs_blocknr, int blocksize, tid_t transaction) { unsigned int got; int retval; char buf[8192]; - + if (!(dump_all || (fs_blocknr == block_to_dump) || (fs_blocknr == inode_block_to_dump) || (fs_blocknr == bitmap_to_dump))) return; - + fprintf(out_file, " FS block %u logged at ", fs_blocknr); - if (!dump_all) + if (!dump_all) fprintf(out_file, "sequence %u, ", transaction); fprintf(out_file, "journal block %u\n", log_blocknr); - + /* There are two major special cases to parse: - * + * * If this block is a block * bitmap block, we need to give it special treatment so that we * can log any allocates and deallocates which affect the - * block_to_dump query block. - * + * block_to_dump query block. + * * If the block is an inode block for the inode being searched * for, then we need to dump the contents of that inode - * structure symbolically. + * structure symbolically. */ - + if (!(dump_contents && dump_all) && fs_blocknr != block_to_dump - && fs_blocknr != bitmap_to_dump + && fs_blocknr != bitmap_to_dump && fs_blocknr != inode_block_to_dump) return; - - retval = read_journal_block("logdump", source, + + retval = read_journal_block("logdump", source, blocksize * log_blocknr, buf, blocksize, &got); if (retval) return; - + if (fs_blocknr == bitmap_to_dump) { struct ext2_super_block *super; int offset; - + super = current_fs->super; offset = ((fs_blocknr - super->s_first_data_block) % super->s_blocks_per_group); - + fprintf(out_file, " (block bitmap for block %u: " - "block is %s)\n", + "block is %s)\n", block_to_dump, ext2fs_test_bit(offset, buf) ? "SET" : "CLEAR"); } - + if (fs_blocknr == inode_block_to_dump) { struct ext2_inode *inode; int first, prev, this, start_extent, i; - + fprintf(out_file, " (inode block for inode %u):\n", inode_to_dump); - + inode = (struct ext2_inode *) (buf + inode_offset_to_dump); internal_dump_inode(out_file, " ", inode_to_dump, inode, 0); - + /* Dump out the direct/indirect blocks here: * internal_dump_inode can only dump them from the main * on-disk inode, not from the journaled copy of the * inode. */ - + fprintf (out_file, " Blocks: "); first = prev = start_extent = -1; @@ -655,13 +655,13 @@ static void dump_metadata_block(FILE *out_file, struct journal_source *source, show_indirect(out_file, "IND", inode->i_block[i++]); show_indirect(out_file, "DIND", inode->i_block[i++]); show_indirect(out_file, "TIND", inode->i_block[i++]); - + fprintf(out_file, "\n"); } if (dump_contents) do_hexdump(out_file, buf, blocksize); - + } static void do_hexdump (FILE *out_file, char *buf, int blocksize) @@ -670,10 +670,10 @@ static void do_hexdump (FILE *out_file, char *buf, int blocksize) int *intp; char *charp; unsigned char c; - + intp = (int *) buf; charp = (char *) buf; - + for (i=0; i #ifdef HAVE_GETOPT_H #include -#else +#else extern int optind; extern char *optarg; #endif @@ -40,7 +40,7 @@ struct list_dir_struct { static const char *monstr[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; - + static int list_dir_proc(ext2_ino_t dir EXT2FS_ATTR((unused)), int entry, struct ext2_dir_entry *dirent, @@ -127,7 +127,7 @@ void do_list_dir(int argc, char *argv[]) int c; int flags; struct list_dir_struct ls; - + ls.options = 0; if (check_fs_open(argv[0])) return; diff --git a/debugfs/lsdel.c b/debugfs/lsdel.c index f703c6b3..265753b4 100644 --- a/debugfs/lsdel.c +++ b/debugfs/lsdel.c @@ -1,6 +1,6 @@ /* * lsdel.c --- routines to try to help a user recover a deleted file. - * + * * Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 * Theodore Ts'o. This file may be redistributed under the terms of * the GNU Public License. @@ -85,7 +85,7 @@ void do_lsdel(int argc, char **argv) char *tmp; time_t now; FILE *out; - + if (common_args_process(argc, argv, 1, 2, "ls_deleted_inodes", "[secs]", 0)) return; @@ -129,7 +129,7 @@ void do_lsdel(int argc, char **argv) "while starting inode scan"); goto error_out; } - + while (ino) { if ((inode.i_dtime == 0) || (secs && ((unsigned) abs(now - secs) > inode.i_dtime))) @@ -139,7 +139,7 @@ void do_lsdel(int argc, char **argv) lsd.num_blocks = 0; lsd.free_blocks = 0; lsd.bad_blocks = 0; - + retval = ext2fs_block_iterate2(current_fs, ino, BLOCK_FLAG_READ_ONLY, block_buf, lsdel_proc, &lsd); @@ -160,20 +160,20 @@ void do_lsdel(int argc, char **argv) exit(1); } } - + delarray[num_delarray].ino = ino; delarray[num_delarray].mode = inode.i_mode; delarray[num_delarray].uid = inode_uid(inode); delarray[num_delarray].size = inode.i_size; if (!LINUX_S_ISDIR(inode.i_mode)) - delarray[num_delarray].size |= + delarray[num_delarray].size |= ((__u64) inode.i_size_high << 32); delarray[num_delarray].dtime = inode.i_dtime; delarray[num_delarray].num_blocks = lsd.num_blocks; delarray[num_delarray].free_blocks = lsd.free_blocks; num_delarray++; } - + next: do { retval = ext2fs_get_next_inode(scan, &ino, &inode); @@ -186,22 +186,22 @@ void do_lsdel(int argc, char **argv) } out = open_pager(); - + fprintf(out, " Inode Owner Mode Size Blocks Time deleted\n"); - + qsort(delarray, num_delarray, sizeof(struct deleted_info), deleted_info_compare); - + for (i = 0; i < num_delarray; i++) { - fprintf(out, "%6u %6d %6o %6llu %6lld/%6lld %s", + fprintf(out, "%6u %6d %6o %6llu %6lld/%6lld %s", delarray[i].ino, delarray[i].uid, delarray[i].mode, delarray[i].size, - delarray[i].free_blocks, delarray[i].num_blocks, + delarray[i].free_blocks, delarray[i].num_blocks, time_to_string(delarray[i].dtime)); } fprintf(out, "%d deleted inodes found.\n", num_delarray); close_pager(out); - + error_out: free(block_buf); free(delarray); diff --git a/debugfs/ncheck.c b/debugfs/ncheck.c index bb7f5244..3381dd97 100644 --- a/debugfs/ncheck.c +++ b/debugfs/ncheck.c @@ -1,6 +1,6 @@ /* * ncheck.c --- given a list of inodes, generate a list of names - * + * * Copyright (C) 1994 Theodore Ts'o. This file may be redistributed * under the terms of the GNU Public License. */ @@ -52,7 +52,7 @@ static int ncheck_proc(struct ext2_dir_entry *dirent, } if (!iw->inodes_left) return DIRENT_ABORT; - + return 0; } @@ -66,7 +66,7 @@ void do_ncheck(int argc, char **argv) struct ext2_inode inode; errcode_t retval; char *tmp; - + if (argc < 2) { com_err(argv[0], 0, "Usage: ncheck ..."); return; @@ -105,7 +105,7 @@ void do_ncheck(int argc, char **argv) com_err("ncheck", retval, "while starting inode scan"); goto error_out; } - + while (ino) { if (!inode.i_links_count) goto next; @@ -121,7 +121,7 @@ void do_ncheck(int argc, char **argv) iw.position = 0; iw.parent = ino; - + retval = ext2fs_dir_iterate(current_fs, ino, 0, 0, ncheck_proc, &iw); if (retval) { @@ -155,7 +155,7 @@ void do_ncheck(int argc, char **argv) "while resolving pathname for inode %d (%d)", iinfo->parent, iinfo->ino); } - + printf("Inode\tPathname\n"); for (i=0, iinfo = iw.iarray; i < iw.num_inodes; i++, iinfo++) { if (iinfo->parent == 0) { diff --git a/debugfs/set_fields.c b/debugfs/set_fields.c index 25343f0e..f36943a2 100644 --- a/debugfs/set_fields.c +++ b/debugfs/set_fields.c @@ -1,8 +1,8 @@ /* * set_fields.c --- set a superblock value - * + * * Copyright (C) 2000, 2001, 2002, 2003, 2004 by Theodore Ts'o. - * + * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public * License. @@ -97,12 +97,12 @@ static struct field_set_info super_fields[] = { { "block_group_nr", &set_sb.s_block_group_nr, 2, parse_uint }, { "feature_compat", &set_sb.s_feature_compat, 4, parse_uint }, { "feature_incompat", &set_sb.s_feature_incompat, 4, parse_uint }, - { "feature_ro_compat", &set_sb.s_feature_ro_compat, 4, parse_uint }, + { "feature_ro_compat", &set_sb.s_feature_ro_compat, 4, parse_uint }, { "uuid", &set_sb.s_uuid, 16, parse_uuid }, { "volume_name", &set_sb.s_volume_name, 16, parse_string }, { "last_mounted", &set_sb.s_last_mounted, 64, parse_string }, { "lastcheck", &set_sb.s_lastcheck, 4, parse_uint }, - { "algorithm_usage_bitmap", &set_sb.s_algorithm_usage_bitmap, + { "algorithm_usage_bitmap", &set_sb.s_algorithm_usage_bitmap, 4, parse_uint }, { "prealloc_blocks", &set_sb.s_prealloc_blocks, 1, parse_uint }, { "prealloc_dir_blocks", &set_sb.s_prealloc_dir_blocks, 1, @@ -120,7 +120,7 @@ static struct field_set_info super_fields[] = { { "default_mount_opts", &set_sb.s_default_mount_opts, 4, parse_uint }, { "first_meta_bg", &set_sb.s_first_meta_bg, 4, parse_uint }, { "mkfs_time", &set_sb.s_mkfs_time, 4, parse_time }, - { "jnl_blocks", &set_sb.s_jnl_blocks[0], 4, parse_uint, FLAG_ARRAY, + { "jnl_blocks", &set_sb.s_jnl_blocks[0], 4, parse_uint, FLAG_ARRAY, 17 }, { "blocks_count_hi", &set_sb.s_blocks_count_hi, 4, parse_uint }, { "r_blocks_count_hi", &set_sb.s_r_blocks_count_hi, 4, parse_uint }, @@ -151,7 +151,7 @@ static struct field_set_info inode_fields[] = { { "flags", &set_inode.i_flags, 4, parse_uint }, { "version", &set_inode.osd1.linux1.l_i_version, 4, parse_uint }, { "translator", &set_inode.osd1.hurd1.h_i_translator, 4, parse_uint }, - { "block", &set_inode.i_block[0], 4, parse_uint, FLAG_ARRAY, + { "block", &set_inode.i_block[0], 4, parse_uint, FLAG_ARRAY, EXT2_NDIR_BLOCKS }, { "block[IND]", &set_inode.i_block[EXT2_IND_BLOCK], 4, parse_uint }, { "block[DIND]", &set_inode.i_block[EXT2_DIND_BLOCK], 4, parse_uint }, @@ -218,7 +218,7 @@ static struct field_set_info *find_field(struct field_set_info *fields, else *delim = 0; } - /* + /* * Can we parse the number? */ if (idx) { @@ -353,7 +353,7 @@ static errcode_t parse_time(struct field_set_info *info, char *arg) static errcode_t parse_uuid(struct field_set_info *info, char *arg) { unsigned char * p = (unsigned char *) info->ptr; - + if ((strcasecmp(arg, "null") == 0) || (strcasecmp(arg, "clear") == 0)) { uuid_clear(p); @@ -397,7 +397,7 @@ static errcode_t parse_bmap(struct field_set_info *info, char *arg) } blk = num; - retval = ext2fs_bmap(current_fs, set_ino, &set_inode, 0, BMAP_SET, + retval = ext2fs_bmap(current_fs, set_ino, &set_inode, 0, BMAP_SET, array_idx, &blk); if (retval) { com_err("set_inode", retval, "while setting block map"); @@ -411,7 +411,7 @@ static errcode_t parse_gd_csum(struct field_set_info *info, char *arg) if (strcmp(arg, "calc") == 0) { ext2fs_group_desc_csum_set(current_fs, set_bg); set_gd = current_fs->group_desc[set_bg]; - printf("Checksum set to 0x%04x\n", + printf("Checksum set to 0x%04x\n", current_fs->group_desc[set_bg].bg_checksum); return 0; } @@ -458,7 +458,7 @@ static void print_possible_fields(struct field_set_info *fields) type = "set physical->logical block map"; strcpy(name, ss->name); if (ss->flags & FLAG_ARRAY) { - if (ss->max_idx > 0) + if (ss->max_idx > 0) sprintf(idx, "[%d]", ss->max_idx); else strcpy(idx, "[]"); @@ -476,7 +476,7 @@ void do_set_super(int argc, char *argv[]) "\t\"set_super_value -l\" will list the names of " "superblock fields\n\twhich can be set."; static struct field_set_info *ss; - + if ((argc == 2) && !strcmp(argv[1], "-l")) { print_possible_fields(super_fields); return; @@ -503,7 +503,7 @@ void do_set_inode(int argc, char *argv[]) "\t\"set_inode_field -l\" will list the names of " "the fields in an ext2 inode\n\twhich can be set."; static struct field_set_info *ss; - + if ((argc == 2) && !strcmp(argv[1], "-l")) { print_possible_fields(inode_fields); return; diff --git a/debugfs/unused.c b/debugfs/unused.c index 0eee8e62..818fef13 100644 --- a/debugfs/unused.c +++ b/debugfs/unused.c @@ -1,6 +1,6 @@ /* * unused.c --- quick and dirty unused space dumper - * + * * Copyright (C) 1997 Theodore Ts'o. This file may be redistributed * under the terms of the GNU Public License. */ @@ -17,7 +17,7 @@ #include #ifdef HAVE_GETOPT_H #include -#else +#else extern int optind; extern char *optarg; #endif diff --git a/debugfs/util.c b/debugfs/util.c index 4f9c44a9..e4ecb1fe 100644 --- a/debugfs/util.c +++ b/debugfs/util.c @@ -1,6 +1,6 @@ /* * util.c --- utilities for the debugfs program - * + * * Copyright (C) 1993, 1994 Theodore Ts'o. This file may be * redistributed under the terms of the GNU Public License. * @@ -17,7 +17,7 @@ #include #ifdef HAVE_GETOPT_H #include -#else +#else extern int optind; extern char *optarg; #endif @@ -40,7 +40,7 @@ extern int optreset; /* defined by BSD, but not others */ * affairs is that BSD-derived versions of getopt() misbehave if * optind is set to 0 in order to reset getopt(), and glibc's getopt() * will core dump if optind is set 1 in order to reset getopt(). - * + * * More modern versions of BSD require that optreset be set to 1 in * order to reset getopt(). Sigh. Standards, anyone? * @@ -88,7 +88,7 @@ FILE *open_pager(void) pager = getenv("PAGER"); if (!pager) pager = find_pager(buf); - if (!pager || + if (!pager || (strcmp(pager, "__none__") == 0) || ((outfile = popen(pager, "w")) == 0)) return stdout; @@ -251,7 +251,7 @@ unsigned long parse_ulong(const char *str, const char *cmd, { char *tmp; unsigned long ret; - + ret = strtoul(str, &tmp, 0); if (*tmp == 0) { if (err) @@ -317,9 +317,9 @@ int common_inode_args_process(int argc, char *argv[], { if (common_args_process(argc, argv, 2, 2, argv[0], "", flags)) return 1; - + *inode = string_to_inode(argv[1]); - if (!*inode) + if (!*inode) return 1; return 0; } -- cgit v1.2.3