From: Karel Zak Date: Mon, 20 Sep 2021 10:46:31 +0000 (+0200) Subject: lsfd:remove struct fdinfo_data X-Git-Tag: v2.38-rc1~144^2~87 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a96342124d918f44873825bb598f895d8162dbbe;p=thirdparty%2Futil-linux.git lsfd:remove struct fdinfo_data Signed-off-by: Karel Zak --- diff --git a/misc-utils/lsfd-file.c b/misc-utils/lsfd-file.c index 4eb2e51e4a..8165b3ada2 100644 --- a/misc-utils/lsfd-file.c +++ b/misc-utils/lsfd-file.c @@ -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; diff --git a/misc-utils/lsfd.h b/misc-utils/lsfd.h index a3c40277ba..f03f12d5b2 100644 --- a/misc-utils/lsfd.h +++ b/misc-utils/lsfd.h @@ -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)