X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=debugfs%2Fdebugfs.c;h=e33c92ef66a5248d0e47eecc74b9d9858d437f29;hb=336c440ccea8f94b0728f881cddee84f730e7cc7;hp=e03519c42cf6b70973562c4db6e2c00322b49dad;hpb=2fcbcb1b9eef11ce2158b3172e8a9bde2b671438;p=tools%2Fe2fsprogs.git diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c index e03519c..e33c92e 100644 --- a/debugfs/debugfs.c +++ b/debugfs/debugfs.c @@ -48,8 +48,14 @@ extern char *optarg; int journal_enable_debug = -1; #endif +/* + * There must be only one definition if we're hooking in extra commands or + * chaging default prompt. Use -DSKIP_GLOBDEF for that. + */ +#ifndef SKIP_GLOBDEFS ss_request_table *extra_cmds; const char *debug_prog_name; +#endif int ss_sci_idx; ext2_filsys current_fs; @@ -848,7 +854,7 @@ void internal_dump_inode(FILE *out, const char *prefix, if (is_large_inode && large_inode->i_extra_isize >= 32) fprintf(out, " Project: %5d", large_inode->i_projid); fputs(" Size: ", out); - if (LINUX_S_ISREG(inode->i_mode)) + if (LINUX_S_ISREG(inode->i_mode) || LINUX_S_ISDIR(inode->i_mode)) fprintf(out, "%llu\n", EXT2_I_SIZE(inode)); else fprintf(out, "%d\n", inode->i_size); @@ -994,8 +1000,8 @@ void do_stat(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)), return; } - if (debugfs_read_inode_full(inode, inode_buf, argv[0], - EXT2_INODE_SIZE(current_fs->super))) { + if (debugfs_read_inode2(inode, inode_buf, argv[0], + EXT2_INODE_SIZE(current_fs->super), 0)) { free(inode_buf); return; } @@ -1636,12 +1642,12 @@ void do_copy_inode(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)), if (!dest_ino) return; - if (debugfs_read_inode_full(src_ino, (struct ext2_inode *) buf, - argv[0], sizeof(buf))) + if (debugfs_read_inode2(src_ino, (struct ext2_inode *) buf, + argv[0], sizeof(buf), 0)) return; - if (debugfs_write_inode_full(dest_ino, (struct ext2_inode *) buf, - argv[0], sizeof(buf))) + if (debugfs_write_inode2(dest_ino, (struct ext2_inode *) buf, + argv[0], sizeof(buf), 0)) return; } @@ -2446,8 +2452,10 @@ void do_dump_mmp(int argc EXT2FS_ATTR((unused)), char *argv[], fprintf(stdout, "check_interval: %d\n", mmp_s->mmp_check_interval); fprintf(stdout, "sequence: %08x\n", mmp_s->mmp_seq); fprintf(stdout, "time: %lld -- %s", mmp_s->mmp_time, ctime(&t)); - fprintf(stdout, "node_name: %s\n", mmp_s->mmp_nodename); - fprintf(stdout, "device_name: %s\n", mmp_s->mmp_bdevname); + fprintf(stdout, "node_name: %.*s\n", + EXT2_LEN_STR(mmp_s->mmp_nodename)); + fprintf(stdout, "device_name: %.*s\n", + EXT2_LEN_STR(mmp_s->mmp_bdevname)); fprintf(stdout, "magic: 0x%x\n", mmp_s->mmp_magic); fprintf(stdout, "checksum: 0x%08x\n", mmp_s->mmp_checksum); }