]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
e2fsck: Add support for %It in problem description messages
authorTheodore Ts'o <tytso@mit.edu>
Sat, 31 Mar 2007 23:53:53 +0000 (19:53 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 31 Mar 2007 23:53:53 +0000 (19:53 -0400)
Add support for the %It expansion, which will print the type of the inode
in the problem context.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
e2fsck/ChangeLog
e2fsck/message.c

index 5d1de4fc20d036e8157f4bdee9c540bc65889cbd..bb0f6b5fe29a2312872da992106418a699b4c975 100644 (file)
@@ -1,5 +1,8 @@
 2007-03-31  Theodore Tso  <tytso@mit.edu>
 
+       * message.c (expand_percent_expression): Add support for %It, which
+               will print the type of the inode.
+
        * pass3.c (fix_dotdot_proc): Fix the filetype of the '..' entry to
                be EXT2_FT_DIR.  (Addresses Lustre BZ #11645)
 
index 268620a5048699f127d2781fffcb380494a34726..23735d3c72a742497b873456b377416ecd946b75 100644 (file)
@@ -35,6 +35,7 @@
  *     %Id     <inode> -> i_dir_acl
  *     %Iu     <inode> -> i_uid
  *     %Ig     <inode> -> i_gid
+ *     %It     <inode type>
  *     %j      <ino2>                  inode number
  *     %m      <com_err error message>
  *     %N      <num>
@@ -310,6 +311,25 @@ static _INLINE_ void expand_inode_expression(char ch,
                printf("%d", (inode->i_gid |
                              (inode->osd2.linux2.l_i_gid_high << 16)));
                break;
+       case 't':
+               if (LINUX_S_ISREG(inode->i_mode)) 
+                       printf(_("regular file"));
+               else if (LINUX_S_ISDIR(inode->i_mode)) 
+                       printf(_("directory"));
+               else if (LINUX_S_ISCHR(inode->i_mode)) 
+                       printf(_("character device"));
+               else if (LINUX_S_ISBLK(inode->i_mode)) 
+                       printf(_("block device"));
+               else if (LINUX_S_ISFIFO(inode->i_mode)) 
+                       printf(_("named pipe"));
+               else if (LINUX_S_ISLNK(inode->i_mode)) 
+                       printf(_("symbolic link"));
+               else if (LINUX_S_ISSOCK(inode->i_mode))
+                       printf(_("socket"));
+               else
+                       printf(_("unknown file type with mode 0%o"),
+                              inode->i_mode);
+               break;
        default:
        no_inode:
                printf("%%I%c", ch);