]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsfd: (refactor) add has_mnt_id helper macro
authorMasatake YAMATO <yamato@redhat.com>
Fri, 9 Jan 2026 05:05:44 +0000 (14:05 +0900)
committerMasatake YAMATO <yamato@redhat.com>
Mon, 12 Jan 2026 18:39:33 +0000 (03:39 +0900)
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
lsfd-cmd/file.c
lsfd-cmd/lsfd.h

index d52f3a319469d977d1492228563cd8b40a34fb7e..8571aa860372bd52fc7c48172b39a096f1598a62 100644 (file)
@@ -478,7 +478,7 @@ static bool file_fill_column(struct proc *proc __attribute__((__unused__)),
                xasprintf(&str, "%d", file->stat.st_nlink == 0);
                break;
        case COL_MNT_ID:
-               xasprintf(&str, "%d", is_opened_file(file)? file->mnt_id: 0);
+               xasprintf(&str, "%d", has_mnt_id(file)? file->mnt_id: 0);
                break;
        case COL_MODE:
                if (does_file_has_fdinfo_alike(file))
index ea9bf5e70fc71d35fa3ddc233b1ed78797536e64..63a9f460e184e3106070b1805f6fb1a15cbfddd5 100644 (file)
@@ -226,6 +226,7 @@ struct file {
 #define is_opened_file(_f) ((_f)->association >= 0)
 #define is_mapped_file(_f) (is_association((_f), SHM) || is_association((_f), MEM))
 #define is_association(_f, a)  ((_f)->association < 0 && (_f)->association == -ASSOC_ ## a)
+#define has_mnt_id(_f) (is_opened_file(_f))
 
 struct file_class {
        const struct file_class *super;