]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsfd: add columns for DEV and RDEV
authorMasatake YAMATO <yamato@redhat.com>
Sat, 1 May 2021 11:59:51 +0000 (20:59 +0900)
committerKarel Zak <kzak@redhat.com>
Wed, 6 Oct 2021 09:01:53 +0000 (11:01 +0200)
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
misc-utils/lsfd-file.c
misc-utils/lsfd.c
misc-utils/lsfd.h

index 435608c49ff7038a85f3a51c80a4a8cb1033b462..b9c77d88798df800e9f471f38bce5e98e03ec84d 100644 (file)
@@ -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;
index 85227fd4e486db8c2c0c4c536dd77b7864f2fa0a..1eb24f75228566bb5f68d56db685493f1c93f9bd 100644 (file)
@@ -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 */
 };
index 7caa3bb9d99ef34ca30fb698f4fef9f27f47b7dc..69996614ced994ad52d5371a2264007688192eeb 100644 (file)
@@ -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,