]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsfd: (refactor) flatten bit fields in struct file
authorMasatake YAMATO <yamato@redhat.com>
Sun, 14 Jan 2024 00:37:37 +0000 (09:37 +0900)
committerMasatake YAMATO <yamato@redhat.com>
Fri, 2 Feb 2024 19:27:50 +0000 (04:27 +0900)
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
misc-utils/lsfd-file.c
misc-utils/lsfd.h

index 9b91462d6b157e8bab46c30d28f4496d091274f8..c6d7491728eb2df05e46281e57c7a0d36c730bf8 100644 (file)
@@ -300,8 +300,8 @@ static bool file_fill_column(struct proc *proc,
        case COL_XMODE: {
                char r, w, x;
                char D = file->stat.st_nlink == 0? 'D': '-';
-               char L = file->locked.write? 'L'
-                       :file->locked.read?  'l'
+               char L = file->locked_write? 'L'
+                       :file->locked_read?  'l'
                        :                    '-';
                char m = file->multiplexed? 'm': '-';
 
@@ -400,10 +400,10 @@ static int file_handle_fdinfo(struct file *file, const char *key, const char* va
        } else if (strcmp(key, "lock") == 0) {
                switch (parse_lock_line(value)) {
                case READ_LOCK:
-                       file->locked.read = 1;
+                       file->locked_read = 1;
                        break;
                case WRITE_LOCK:
-                       file->locked.write = 1;
+                       file->locked_write = 1;
                        break;
                }
                rc = 1;
index 1859dc746ffdd888ef3c1597946af5582cdcde3e..14167b5fd259f9a9e047e76155c73aeb577aa497 100644 (file)
@@ -185,10 +185,9 @@ struct file {
        unsigned int sys_flags;
        unsigned int mnt_id;
 
-       struct {
-               uint8_t read:1, write:1;
-       } locked;
-       uint8_t multiplexed;
+       uint8_t locked_read:1,
+               locked_write:1,
+               multiplexed:1;
 };
 
 #define is_opened_file(_f) ((_f)->association >= 0)