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" <tytso@mit.edu>
bitmap-optimize
Theodore Ts'o 2007-03-31 19:53:53 -04:00
parent 56c8c592ac
commit ccfbb266d6
2 changed files with 23 additions and 0 deletions

View 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)

View 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);