[PATCH v1] exfat: make flag mount options unsetable via negative param

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The 'fsparam_flag' type mount options can not unset when remounting.
For example, if a user mounts a device with the 'discard' option, the
user cannot unset it via remount, but can only unmount the device and
then mount it again. This is inconvenient for users.

This commit changes the type of the 4 mount options(keep_last_dots,
discard, sys_tz and zero_size_dir) to 'fsparam_flag_no', makes them
unsetable via negative param when remounting.

Signed-off-by: Yuezhang Mo <Yuezhang.Mo@xxxxxxxx>
---
 fs/exfat/super.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/fs/exfat/super.c b/fs/exfat/super.c
index 6a23523b1276..f090f6fd8fe2 100644
--- a/fs/exfat/super.c
+++ b/fs/exfat/super.c
@@ -263,11 +263,11 @@ static const struct fs_parameter_spec exfat_parameters[] = {
 	fsparam_u32oct("allow_utime",		Opt_allow_utime),
 	fsparam_string("iocharset",		Opt_charset),
 	fsparam_enum("errors",			Opt_errors, exfat_param_enums),
-	fsparam_flag("discard",			Opt_discard),
-	fsparam_flag("keep_last_dots",		Opt_keep_last_dots),
-	fsparam_flag("sys_tz",			Opt_sys_tz),
+	fsparam_flag_no("discard",		Opt_discard),
+	fsparam_flag_no("keep_last_dots",	Opt_keep_last_dots),
+	fsparam_flag_no("sys_tz",		Opt_sys_tz),
 	fsparam_s32("time_offset",		Opt_time_offset),
-	fsparam_flag("zero_size_dir",		Opt_zero_size_dir),
+	fsparam_flag_no("zero_size_dir",	Opt_zero_size_dir),
 	__fsparam(NULL, "utf8",			Opt_utf8, fs_param_deprecated,
 		  NULL),
 	__fsparam(NULL, "debug",		Opt_debug, fs_param_deprecated,
@@ -319,13 +319,13 @@ static int exfat_parse_param(struct fs_context *fc, struct fs_parameter *param)
 		opts->errors = result.uint_32;
 		break;
 	case Opt_discard:
-		opts->discard = 1;
+		opts->discard = !result.negated;
 		break;
 	case Opt_keep_last_dots:
-		opts->keep_last_dots = 1;
+		opts->keep_last_dots = !result.negated;
 		break;
 	case Opt_sys_tz:
-		opts->sys_tz = 1;
+		opts->sys_tz = !result.negated;
 		break;
 	case Opt_time_offset:
 		/*
@@ -337,7 +337,7 @@ static int exfat_parse_param(struct fs_context *fc, struct fs_parameter *param)
 		opts->time_offset = result.int_32;
 		break;
 	case Opt_zero_size_dir:
-		opts->zero_size_dir = true;
+		opts->zero_size_dir = !result.negated;
 		break;
 	case Opt_utf8:
 	case Opt_debug:
-- 
2.43.0





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux