From ccfbb266d6ca61c3c94ef6f391bb6384b8c58841 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sat, 31 Mar 2007 19:53:53 -0400 Subject: [PATCH] e2fsck: Add support for %It in problem description messages Add support for the %It expansion, which will print the type of the inode in the problem context. Signed-off-by: "Theodore Ts'o" --- e2fsck/ChangeLog | 3 +++ e2fsck/message.c | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index 5d1de4f..bb0f6b5 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -1,5 +1,8 @@ 2007-03-31 Theodore Tso + * 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) diff --git a/e2fsck/message.c b/e2fsck/message.c index 268620a..23735d3 100644 --- a/e2fsck/message.c +++ b/e2fsck/message.c @@ -35,6 +35,7 @@ * %Id -> i_dir_acl * %Iu -> i_uid * %Ig -> i_gid + * %It * %j inode number * %m * %N @@ -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); -- 1.8.3.1