From: Masatake YAMATO Date: Thu, 4 Jan 2024 07:02:03 +0000 (+0900) Subject: lsfd: (refactor) split the function processing mountinfo file X-Git-Tag: v2.42-start~502^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d3553b6085bf67d57b8e4a19bd3ca83f9c69187d;p=thirdparty%2Futil-linux.git lsfd: (refactor) split the function processing mountinfo file Signed-off-by: Masatake YAMATO --- diff --git a/misc-utils/lsfd.c b/misc-utils/lsfd.c index 6481945fe..f6a33fdba 100644 --- a/misc-utils/lsfd.c +++ b/misc-utils/lsfd.c @@ -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); } }