Commit c9d35ee0 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'merge.nfs-fs_parse.1' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull vfs file system parameter updates from Al Viro:
 "Saner fs_parser.c guts and data structures. The system-wide registry
  of syntax types (string/enum/int32/oct32/.../etc.) is gone and so is
  the horror switch() in fs_parse() that would have to grow another case
  every time something got added to that system-wide registry.

  New syntax types can be added by filesystems easily now, and their
  namespace is that of functions - not of system-wide enum members. IOW,
  they can be shared or kept private and if some turn out to be widely
  useful, we can make them common library helpers, etc., without having
  to do anything whatsoever to fs_parse() itself.

  And we already get that kind of requests - the thing that finally
  pushed me into doing that was "oh, and let's add one for timeouts -
  things like 15s or 2h". If some filesystem really wants that, let them
  do it. Without somebody having to play gatekeeper for the variants
  blessed by direct support in fs_parse(), TYVM.

  Quite a bit of boilerplate is gone. And IMO the data structures make a
  lot more sense now. -200LoC, while we are at it"

* 'merge.nfs-fs_parse.1' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (25 commits)
  tmpfs: switch to use of invalfc()
  cgroup1: switch to use of errorfc() et.al.
  procfs: switch to use of invalfc()
  hugetlbfs: switch to use of invalfc()
  cramfs: switch to use of errofc() et.al.
  gfs2: switch to use of errorfc() et.al.
  fuse: switch to use errorfc() et.al.
  ceph: use errorfc() and friends instead of spelling the prefix out
  prefix-handling analogues of errorf() and friends
  turn fs_param_is_... into functions
  fs_parse: handle optional arguments sanely
  fs_parse: fold fs_parameter_desc/fs_parameter_spec
  fs_parser: remove fs_parameter_description name field
  add prefix to fs_context->log
  ceph_parse_param(), ceph_parse_mon_ips(): switch to passing fc_log
  new primitive: __fs_parse()
  switch rbd and libceph to p_log-based primitives
  struct p_log, variants of warnf() et.al. taking that one instead
  teach logfc() to handle prefices, give it saner calling conventions
  get rid of cg_invalf()
  ...
parents 236f4532 f35aa2bc
Loading
Loading
Loading
Loading
+2 −10
Original line number Diff line number Diff line
@@ -427,7 +427,6 @@ returned.
	fs_value_is_string,		Value is a string
	fs_value_is_blob,		Value is a binary blob
	fs_value_is_filename,		Value is a filename* + dirfd
	fs_value_is_filename_empty,	Value is a filename* + dirfd + AT_EMPTY_PATH
	fs_value_is_file,		Value is an open file (file*)

     If there is a value, that value is stored in a union in the struct in one
@@ -519,7 +518,6 @@ Parameters are described using structures defined in linux/fs_parser.h.
There's a core description struct that links everything together:

	struct fs_parameter_description {
		const char	name[16];
		const struct fs_parameter_spec *specs;
		const struct fs_parameter_enum *enums;
	};
@@ -535,19 +533,13 @@ For example:
	};

	static const struct fs_parameter_description afs_fs_parameters = {
		.name		= "kAFS",
		.specs		= afs_param_specs,
		.enums		= afs_param_enums,
	};

The members are as follows:

 (1) const char name[16];

     The name to be used in error messages generated by the parse helper
     functions.

 (2) const struct fs_parameter_specification *specs;
 (1) const struct fs_parameter_specification *specs;

     Table of parameter specifications, terminated with a null entry, where the
     entries are of type:
@@ -626,7 +618,7 @@ The members are as follows:
     of arguments to specify the type and the flags for anything that doesn't
     match one of the above macros.

 (6) const struct fs_parameter_enum *enums;
 (2) const struct fs_parameter_enum *enums;

     Table of enum value names to integer mappings, terminated with a null
     entry.  This is of type:
+3 −8
Original line number Diff line number Diff line
@@ -583,7 +583,7 @@ enum {
	Opt_uid, Opt_gid, Opt_mode, Opt_debug,
};

static const struct fs_parameter_spec spufs_param_specs[] = {
static const struct fs_parameter_spec spufs_fs_parameters[] = {
	fsparam_u32	("gid",				Opt_gid),
	fsparam_u32oct	("mode",			Opt_mode),
	fsparam_u32	("uid",				Opt_uid),
@@ -591,11 +591,6 @@ static const struct fs_parameter_spec spufs_param_specs[] = {
	{}
};

static const struct fs_parameter_description spufs_fs_parameters = {
	.name		= "spufs",
	.specs		= spufs_param_specs,
};

static int spufs_show_options(struct seq_file *m, struct dentry *root)
{
	struct spufs_sb_info *sbi = spufs_get_sb_info(root->d_sb);
@@ -623,7 +618,7 @@ static int spufs_parse_param(struct fs_context *fc, struct fs_parameter *param)
	kgid_t gid;
	int opt;

	opt = fs_parse(fc, &spufs_fs_parameters, param, &result);
	opt = fs_parse(fc, spufs_fs_parameters, param, &result);
	if (opt < 0)
		return opt;

@@ -774,7 +769,7 @@ static struct file_system_type spufs_type = {
	.owner = THIS_MODULE,
	.name = "spufs",
	.init_fs_context = spufs_init_fs_context,
	.parameters	= &spufs_fs_parameters,
	.parameters	= spufs_fs_parameters,
	.kill_sb = kill_litter_super,
};
MODULE_ALIAS_FS("spufs");
+3 −8
Original line number Diff line number Diff line
@@ -209,17 +209,12 @@ static int hypfs_release(struct inode *inode, struct file *filp)

enum { Opt_uid, Opt_gid, };

static const struct fs_parameter_spec hypfs_param_specs[] = {
static const struct fs_parameter_spec hypfs_fs_parameters[] = {
	fsparam_u32("gid", Opt_gid),
	fsparam_u32("uid", Opt_uid),
	{}
};

static const struct fs_parameter_description hypfs_fs_parameters = {
	.name		= "hypfs",
	.specs		= hypfs_param_specs,
};

static int hypfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
{
	struct hypfs_sb_info *hypfs_info = fc->s_fs_info;
@@ -228,7 +223,7 @@ static int hypfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
	kgid_t gid;
	int opt;

	opt = fs_parse(fc, &hypfs_fs_parameters, param, &result);
	opt = fs_parse(fc, hypfs_fs_parameters, param, &result);
	if (opt < 0)
		return opt;

@@ -455,7 +450,7 @@ static struct file_system_type hypfs_type = {
	.owner		= THIS_MODULE,
	.name		= "s390_hypfs",
	.init_fs_context = hypfs_init_fs_context,
	.parameters	= &hypfs_fs_parameters,
	.parameters	= hypfs_fs_parameters,
	.kill_sb	= hypfs_kill_super
};

+3 −8
Original line number Diff line number Diff line
@@ -2127,25 +2127,20 @@ enum rdt_param {
	nr__rdt_params
};

static const struct fs_parameter_spec rdt_param_specs[] = {
static const struct fs_parameter_spec rdt_fs_parameters[] = {
	fsparam_flag("cdp",		Opt_cdp),
	fsparam_flag("cdpl2",		Opt_cdpl2),
	fsparam_flag("mba_MBps",	Opt_mba_mbps),
	{}
};

static const struct fs_parameter_description rdt_fs_parameters = {
	.name		= "rdt",
	.specs		= rdt_param_specs,
};

static int rdt_parse_param(struct fs_context *fc, struct fs_parameter *param)
{
	struct rdt_fs_context *ctx = rdt_fc2context(fc);
	struct fs_parse_result result;
	int opt;

	opt = fs_parse(fc, &rdt_fs_parameters, param, &result);
	opt = fs_parse(fc, rdt_fs_parameters, param, &result);
	if (opt < 0)
		return opt;

@@ -2378,7 +2373,7 @@ static void rdt_kill_sb(struct super_block *sb)
static struct file_system_type rdt_fs_type = {
	.name			= "resctrl",
	.init_fs_context	= rdt_init_fs_context,
	.parameters		= &rdt_fs_parameters,
	.parameters		= rdt_fs_parameters,
	.kill_sb		= rdt_kill_sb,
};

+2 −2
Original line number Diff line number Diff line
@@ -67,10 +67,10 @@ static struct file_system_type internal_fs_type = {
	.name = "devtmpfs",
#ifdef CONFIG_TMPFS
	.init_fs_context = shmem_init_fs_context,
	.parameters	= &shmem_fs_parameters,
	.parameters	= shmem_fs_parameters,
#else
	.init_fs_context = ramfs_init_fs_context,
	.parameters	= &ramfs_fs_parameters,
	.parameters	= ramfs_fs_parameters,
#endif
	.kill_sb = kill_litter_super,
};
Loading