diff mbox series

[4/6] fsconfig: parse "subtype" param for old internal API

Message ID 20180920151214.15484-5-mszeredi@redhat.com (mailing list archive)
State New, archived
Headers show
Series mount-api: fixes and cleanups | expand

Commit Message

Miklos Szeredi Sept. 20, 2018, 3:12 p.m. UTC
This subtype thing is specific to "fuse" and "fuseblk" filesystems.  When these
are switched over to the new context API, the handling of this parameter can be
moved from legacy_parse_param() into fuse.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
---
 fs/fs_context.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

David Howells Sept. 21, 2018, 2:56 p.m. UTC | #1
Miklos Szeredi <mszeredi@redhat.com> wrote:

> This subtype thing is specific to "fuse" and "fuseblk" filesystems.  When
> these are switched over to the new context API, the handling of this
> parameter can be moved from legacy_parse_param() into fuse.

I think do_new_mount() should do:

	vfs_parse_fs_string(fc, "subtype", subtype, strlen(subtype));

rather than setting fc->subtype itself.  I've made that change and folded this
patch also.

David
diff mbox series

Patch

diff --git a/fs/fs_context.c b/fs/fs_context.c
index c0ecbb1ecdfe..0192456712d2 100644
--- a/fs/fs_context.c
+++ b/fs/fs_context.c
@@ -574,6 +574,16 @@  static int legacy_parse_param(struct fs_context *fc, struct fs_parameter *param)
 		param->string = NULL;
 		return 0;
 	}
+	if ((fc->fs_type->fs_flags & FS_HAS_SUBTYPE) &&
+	    strcmp(param->key, "subtype") == 0) {
+		if (param->type != fs_value_is_string)
+			return invalf(fc, "VFS: Legacy: Non-string subtype");
+		if (fc->subtype)
+			return invalf(fc, "VFS: Legacy: Multiple subtype");
+		fc->subtype = param->string;
+		param->string= NULL;
+		return 0;
+	}
 
 	if (ctx->param_type != LEGACY_FS_UNSET_PARAMS &&
 	    ctx->param_type != LEGACY_FS_INDIVIDUAL_PARAMS)