]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsfd: (refactor) split the function processing mountinfo file
authorMasatake YAMATO <yamato@redhat.com>
Thu, 4 Jan 2024 07:02:03 +0000 (16:02 +0900)
committerMasatake YAMATO <yamato@redhat.com>
Sat, 24 Feb 2024 17:11:07 +0000 (02:11 +0900)
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
misc-utils/lsfd.c

index 6481945fe19177ff9af35e3a31cbbcb61fc842c2..f6a33fdba2a4333fb577f41d996a9af02dd7b769 100644 (file)
@@ -1171,6 +1171,17 @@ const char *get_nodev_filesystem(unsigned long minor)
        return NULL;
 }
 
+static void process_mountinfo_entry(unsigned long major, unsigned long minor,
+                                    const char *filesystem)
+{
+       if (major != 0)
+               return;
+       if (get_nodev_filesystem(minor))
+               return;
+
+       add_nodev(minor, filesystem);
+}
+
 static void read_mountinfo(FILE *mnt)
 {
        /* This can be very long. A line in mountinfo can have more than 3
@@ -1189,12 +1200,7 @@ static void read_mountinfo(FILE *mnt)
                                   &major, &minor, filesystem) != 3)
                                continue;
 
-               if (major != 0)
-                       continue;
-               if (get_nodev_filesystem(minor))
-                       continue;
-
-               add_nodev(minor, filesystem);
+               process_mountinfo_entry(major, minor, filesystem);
        }
 }