dissect: split list of discard-supporting fs out into mount-util.c

Let's manage the list of file systems that do a specific thing at one
place, following similar naming.

No functional changes.
This commit is contained in:
Lennart Poettering
2017-09-29 14:36:29 +02:00
parent 896f937f58
commit 154d22695a
3 changed files with 14 additions and 1 deletions
+12
View File
@@ -591,6 +591,18 @@ bool fstype_is_ro(const char *fstype) {
return nulstr_contains(table, fstype);
}
bool fstype_can_discard(const char *fstype) {
static const char table[] =
"btrfs\0"
"ext4\0"
"vfat\0"
"xfs\0"
;
return nulstr_contains(table, fstype);
}
int repeat_unmount(const char *path, int flags) {
bool done = false;
+1
View File
@@ -46,6 +46,7 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(FILE*, endmntent);
bool fstype_is_network(const char *fstype);
bool fstype_is_api_vfs(const char *fstype);
bool fstype_is_ro(const char *fsype);
bool fstype_can_discard(const char *fstype);
union file_handle_union {
struct file_handle handle;
+1 -1
View File
@@ -684,7 +684,7 @@ static int mount_partition(
p = where;
/* If requested, turn on discard support. */
if (STR_IN_SET(fstype, "btrfs", "ext4", "vfat", "xfs") &&
if (fstype_can_discard(fstype) &&
((flags & DISSECT_IMAGE_DISCARD) ||
((flags & DISSECT_IMAGE_DISCARD_ON_LOOP) && is_loop_device(m->node))))
options = "discard";