]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsfd:remove struct fdinfo_data
authorKarel Zak <kzak@redhat.com>
Mon, 20 Sep 2021 10:46:31 +0000 (12:46 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 6 Oct 2021 09:01:54 +0000 (11:01 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/lsfd-file.c
misc-utils/lsfd.h

index 4eb2e51e4a6b0260ef338abf604bbee4abbe9f14..8165b3ada21c4473caa2fafdb1ca10bad20d0167 100644 (file)
@@ -291,7 +291,7 @@ static bool file_fill_column(struct proc *proc,
                xasprintf(&str, "%d", file->stat.st_nlink == 0);
                break;
        case COL_MNT_ID:
-               xasprintf(&str, "%d", file->association < 0? 0: file->assoc_data.fdinfo.mnt_id);
+               xasprintf(&str, "%d", file->association < 0? 0: file->mnt_id);
                break;
        case COL_MODE:
                if (does_file_has_fdinfo_alike(file))
@@ -314,10 +314,10 @@ static bool file_fill_column(struct proc *proc,
                if (file->association < 0)
                        return true;
 
-               if (file->assoc_data.fdinfo.flags == 0)
+               if (file->sys_flags == 0)
                        return true;
 
-               file_fill_flags_buf(&buf, file->assoc_data.fdinfo.flags);
+               file_fill_flags_buf(&buf, file->sys_flags);
                if (ul_buffer_is_empty(&buf))
                        return true;
                str = ul_buffer_get_data(&buf, NULL, NULL);
@@ -346,10 +346,10 @@ static int file_handle_fdinfo(struct file *file, const char *key, const char* va
                file->pos = strtoull(value, NULL, 10);
                return 1;
        } else if (strcmp(key, "flags") == 0) {
-               file->assoc_data.fdinfo.flags = (int)strtol(value, NULL, 8);
+               file->sys_flags = (int)strtol(value, NULL, 8);
                return 1;
        } else if (strcmp(key, "mnt_id") == 0) {
-               file->assoc_data.fdinfo.mnt_id = (int)strtol(value, NULL, 10);
+               file->mnt_id = (int)strtol(value, NULL, 10);
                return 1;
        }
        return 0;
index a3c40277bab595b475d444f826e6c7b5f939cfef..f03f12d5b29ae3e0033f9c24c53c72fbcfcc47d7 100644 (file)
@@ -101,13 +101,8 @@ struct proc {
 };
 
 /*
- * File classes
+ * File class
  */
-struct fdinfo_data {
-       int flags;
-       int mnt_id;
-};
-
 struct file {
        struct list_head files;
        const struct file_class *class;
@@ -121,9 +116,8 @@ struct file {
        unsigned long map_start;
        unsigned long map_end;
 
-       union assoc_data {
-               struct fdinfo_data fdinfo;
-       } assoc_data;
+       int sys_flags;
+       int mnt_id;
 };
 
 #define is_association(_f, a)  ((_f)->association < 0 && (_f)->association == -ASSOC_ ## a)