>From c996b7ade9b839678eed0e0f9ffdf9e47b35761d Mon Sep 17 00:00:00 2001 From: Bernhard Voelker Date: Wed, 25 Jan 2017 00:07:49 +0100 Subject: [PATCH 4/5] maint: move is_used_fs_type to fstype.c * find/parser.c (is_used_fs_type): Move to ... * find/fstype.c: ... here. * find/defs.h (is_used_fs_type): Add declaration. --- find/defs.h | 1 + find/fstype.c | 29 +++++++++++++++++++++++++++++ find/parser.c | 30 ------------------------------ 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/find/defs.h b/find/defs.h index 1761ec50..919c1bdc 100644 --- a/find/defs.h +++ b/find/defs.h @@ -371,6 +371,7 @@ void cleanup(void); /* fstype.c */ char *filesystem_type (const struct stat *statp, const char *path); +bool is_used_fs_type(const char *name); dev_t * get_mounted_devices (size_t *); diff --git a/find/fstype.c b/find/fstype.c index 4f026255..3b460540 100644 --- a/find/fstype.c +++ b/find/fstype.c @@ -138,6 +138,35 @@ filesystem_type (const struct stat *statp, const char *path) return current_fstype; } +bool +is_used_fs_type(const char *name) +{ + if (0 == strcmp("afs", name)) + { + /* I guess AFS may not appear in /etc/mtab (or equivalent) but still be in use, + so assume we always need to check for AFS. */ + return true; + } + else + { + const struct mount_entry *entries = read_file_system_list(false); + if (entries) + { + const struct mount_entry *entry; + for (entry = entries; entry; entry = entry->me_next) + { + if (0 == strcmp(name, entry->me_type)) + return true; + } + } + else + { + return true; + } + } + return false; +} + static int set_fstype_devno (struct mount_entry *p) { diff --git a/find/parser.c b/find/parser.c index 0a03731d..0fc94d0a 100644 --- a/find/parser.c +++ b/find/parser.c @@ -1079,36 +1079,6 @@ static float estimate_fstype_success_rate (const char *fsname) static bool -is_used_fs_type(const char *name) -{ - if (0 == strcmp("afs", name)) - { - /* I guess AFS may not appear in /etc/mtab (or equivalent) but still be in use, - so assume we always need to check for AFS. */ - return true; - } - else - { - const struct mount_entry *entries = read_file_system_list(false); - if (entries) - { - const struct mount_entry *entry; - for (entry = entries; entry; entry = entry->me_next) - { - if (0 == strcmp(name, entry->me_type)) - return true; - } - } - else - { - return true; - } - } - return false; -} - - -static bool parse_fstype (const struct parser_table* entry, char **argv, int *arg_ptr) { const char *typename; -- 2.11.0