]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
debugfs: print "Xst" bits of file mode via stat
authorAndreas Dilger <adilger@dilger.ca>
Mon, 16 Oct 2017 02:27:40 +0000 (22:27 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 16 Oct 2017 02:27:40 +0000 (22:27 -0400)
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 <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
debugfs/debugfs.c

index 0a4b536bc25afa06f23098f8ba81428614097a18..4a533b53be4b3bf1d414a3eaa42b2a6937276915 100644 (file)
@@ -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,