From: Theodore Ts'o Date: Tue, 5 Mar 2002 06:57:53 +0000 (-0500) Subject: Two bug fixes to debugfs, courtesy of Jaroslav Drzik for suggesting... X-Git-Tag: E2FSPROGS-1.27-WIP-0305~4 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=7380ac903316c0fe91ed6706eb4d84249a9b348d;p=tools%2Fe2fsprogs.git Two bug fixes to debugfs, courtesy of Jaroslav Drzik for suggesting this enh ancement. 1) The modify_inode command was core dumping if no filesystem was open. 2) The lsdel command command now uses the pager. Also updated the Makefile.in file with "make depend". --- diff --git a/debugfs/ChangeLog b/debugfs/ChangeLog index f3a5a67..3a7990c 100644 --- a/debugfs/ChangeLog +++ b/debugfs/ChangeLog @@ -1,3 +1,14 @@ +2002-03-05 Theodore Tso + + * lsdel.c (do_lsdel): lsdel uses the pager to print out the list + of potentially deleted inode. Thanks to Jaroslav Drzik + for suggesting this enhancement. + + * debugfs.c (do_modify_inode): Fix bug which caused modify_inode + to core dump if a fliesystem isn't open. Thanks to + Jaroslav Drzik for finding and reporting + the bug and his proposed fix. + 2002-02-26 Theodore Tso * ls.c (list_dir_proc): When listing the directory entry in long diff --git a/debugfs/Makefile.in b/debugfs/Makefile.in index b76dec2..c3811fd 100644 --- a/debugfs/Makefile.in +++ b/debugfs/Makefile.in @@ -126,3 +126,8 @@ logdump.o: $(srcdir)/logdump.c $(srcdir)/debugfs.h \ $(top_srcdir)/lib/ext2fs/bitops.h $(srcdir)/jfs_user.h \ $(top_srcdir)/lib/ext2fs/kernel-jbd.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/uuid/uuid.h +htree.o: $(srcdir)/htree.c $(srcdir)/debugfs.h \ + $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ + $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/et/com_err.h \ + $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \ + $(top_srcdir)/lib/ext2fs/bitops.h diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c index c735337..ed4f23b 100644 --- a/debugfs/debugfs.c +++ b/debugfs/debugfs.c @@ -686,7 +686,7 @@ void do_modify_inode(int argc, char *argv[]) int i; unsigned char *frag, *fsize; char buf[80]; - int os = current_fs->super->s_creator_os; + int os; const char *hex_format = "0x%x"; const char *octal_format = "0%o"; const char *decimal_format = "%d"; @@ -694,6 +694,8 @@ void do_modify_inode(int argc, char *argv[]) if (common_inode_args_process(argc, argv, &inode_num, CHECK_FS_RW)) return; + os = current_fs->super->s_creator_os; + if (debugfs_read_inode(inode_num, &inode, argv[1])) return; diff --git a/debugfs/lsdel.c b/debugfs/lsdel.c index 251e06e..9a57a41 100644 --- a/debugfs/lsdel.c +++ b/debugfs/lsdel.c @@ -82,6 +82,7 @@ void do_lsdel(int argc, char **argv) long secs = 0; char *tmp; time_t now = time(0); + FILE *out; if (common_args_process(argc, argv, 1, 2, "ls_deleted_inodes", "[secs]", 0)) @@ -179,18 +180,21 @@ void do_lsdel(int argc, char **argv) } } - printf(" Inode Owner Mode Size Blocks Time deleted\n"); + 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++) { - printf("%6u %6d %6o %6llu %4d/%4d %s", delarray[i].ino, + fprintf(out, "%6u %6d %6o %6llu %4d/%4d %s", delarray[i].ino, delarray[i].uid, delarray[i].mode, delarray[i].size, delarray[i].free_blocks, delarray[i].num_blocks, time_to_string(delarray[i].dtime)); } - printf("%d deleted inodes found.\n", num_delarray); + fprintf(out, "%d deleted inodes found.\n", num_delarray); + close_pager(out); error_out: free(block_buf);