From: Masatake YAMATO Date: Sat, 1 May 2021 11:59:51 +0000 (+0900) Subject: lsfd: add columns for DEV and RDEV X-Git-Tag: v2.38-rc1~144^2~168 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=15b4715726708b6ad212d9cb2a475e74935a3933;p=thirdparty%2Futil-linux.git lsfd: add columns for DEV and RDEV Signed-off-by: Masatake YAMATO --- diff --git a/misc-utils/lsfd-file.c b/misc-utils/lsfd-file.c index 435608c49f..b9c77d8879 100644 --- a/misc-utils/lsfd-file.c +++ b/misc-utils/lsfd-file.c @@ -119,11 +119,17 @@ static bool file_fill_column(struct proc *proc, case COL_INODE: xasprintf(&str, "%llu", (unsigned long long)file->stat.st_ino); break; + case COL_DEV: case COL_DEVICE: xasprintf(&str, "%u:%u", major(file->stat.st_dev), minor(file->stat.st_dev)); break; + case COL_RDEV: + xasprintf(&str, "%u:%u", + major(file->stat.st_rdev), + minor(file->stat.st_rdev)); + break; case COL_PID: xasprintf(&str, "%d", (int)proc->pid); break; diff --git a/misc-utils/lsfd.c b/misc-utils/lsfd.c index 85227fd4e4..1eb24f7522 100644 --- a/misc-utils/lsfd.c +++ b/misc-utils/lsfd.c @@ -77,15 +77,16 @@ struct colinfo { static struct colinfo infos[] = { [COL_ASSOC] = { "ASSOC", 0, SCOLS_FL_RIGHT, N_("association between file and process") }, [COL_COMMAND] = { "COMMAND", 0, 0, N_("command of the process opening the file") }, - [COL_DEVICE] = { "DEVICE", 0, SCOLS_FL_RIGHT, N_("device major and minor number") }, + [COL_DEV] = { "DEV", 0, SCOLS_FL_RIGHT, N_("ID of device containing file") }, + [COL_DEVICE] = { "DEVICE", 0, SCOLS_FL_RIGHT, N_("device ID for special, or ID of device containing file") }, [COL_FD] = { "FD", 0, SCOLS_FL_RIGHT, N_("file descriptor for the file") }, [COL_INODE] = { "INODE", 0, SCOLS_FL_RIGHT, N_("inode number") }, [COL_NAME] = { "NAME", 0, 0, N_("name of the file") }, [COL_PID] = { "PID", 0, SCOLS_FL_RIGHT, N_("PID of the process opening the file") }, + [COL_RDEV] = { "RDEV", 0, SCOLS_FL_RIGHT, N_("device ID (if special file)") }, [COL_TYPE] = { "TYPE", 0, SCOLS_FL_RIGHT, N_("file type") }, [COL_UID] = { "UID", 0, SCOLS_FL_RIGHT, N_("user ID number") }, [COL_USER] = { "USER", 0, SCOLS_FL_RIGHT, N_("user of the process") }, - /* DEVICE */ /* SIZE/OFF */ /* MNTID */ }; diff --git a/misc-utils/lsfd.h b/misc-utils/lsfd.h index 7caa3bb9d9..69996614ce 100644 --- a/misc-utils/lsfd.h +++ b/misc-utils/lsfd.h @@ -54,10 +54,12 @@ enum { COL_ASSOC, COL_COMMAND, COL_DEVICE, + COL_DEV, COL_FD, COL_INODE, COL_NAME, COL_PID, + COL_RDEV, COL_TYPE, COL_UID, COL_USER,