From: Andreas Dilger Date: Mon, 16 Oct 2017 02:27:40 +0000 (-0400) Subject: debugfs: print "Xst" bits of file mode via stat X-Git-Tag: v1.44.0-rc1~43 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8dca24c3cb23d69a484b28a0bc2f64a89508c1eb;p=thirdparty%2Fe2fsprogs.git debugfs: print "Xst" bits of file mode via stat Currently, debugfs does not print the Xst high-order mode bits in the "stat" output. While "ls -l" shows these bits are set: # ls -il /mnt/tmp/O/0/d2/406306 1588 0 -rwSrwSrw- 1 root root 0 Dec 31 1969 /mnt/tmp/O/0/d2/406306 debugfs currently only prints the low nine "ugo" mode bits: # debugfs -c -R "stat O/0/d2/406306" /dev/vgmyth/lvmythost4 Inode: 1588 Type: regular Mode: 0666 Flags: 0x80000 Fix debugfs so that the high-order mode bits are also printed, if available, otherwise only print the standard low mode bits. # debugfs -c -R "stat O/0/d2/406306" /dev/vgmyth/lvmythost4 Inode: 1588 Type: regular Mode: 06666 Flags: 0x80000 Signed-off-by: Andreas Dilger Signed-off-by: Theodore Ts'o --- diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c index 0a4b536bc..4a533b53b 100644 --- a/debugfs/debugfs.c +++ b/debugfs/debugfs.c @@ -830,8 +830,8 @@ void internal_dump_inode(FILE *out, const char *prefix, else if (LINUX_S_ISSOCK(inode->i_mode)) i_type = "socket"; else i_type = "bad type"; fprintf(out, "%sInode: %u Type: %s ", prefix, inode_num, i_type); - fprintf(out, "%sMode: %04o Flags: 0x%x\n", - prefix, inode->i_mode & 0777, inode->i_flags); + fprintf(out, "%sMode: 0%03o Flags: 0x%x\n", + prefix, inode->i_mode & 07777, inode->i_flags); if (is_large_inode && large_inode->i_extra_isize >= 24) { fprintf(out, "%sGeneration: %u Version: 0x%08x:%08x\n", prefix, inode->i_generation, large_inode->i_version_hi,