mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
change the calling conventions for vfs_parse_fs_string()
Absolute majority of callers are passing the 4th argument equal to strlen() of the 3rd one. Drop the v_size argument, add vfs_parse_fs_qstr() for the cases that want independent length. Reviewed-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@@ -161,25 +161,24 @@ int vfs_parse_fs_param(struct fs_context *fc, struct fs_parameter *param)
|
||||
EXPORT_SYMBOL(vfs_parse_fs_param);
|
||||
|
||||
/**
|
||||
* vfs_parse_fs_string - Convenience function to just parse a string.
|
||||
* vfs_parse_fs_qstr - Convenience function to just parse a string.
|
||||
* @fc: Filesystem context.
|
||||
* @key: Parameter name.
|
||||
* @value: Default value.
|
||||
* @v_size: Maximum number of bytes in the value.
|
||||
*/
|
||||
int vfs_parse_fs_string(struct fs_context *fc, const char *key,
|
||||
const char *value, size_t v_size)
|
||||
int vfs_parse_fs_qstr(struct fs_context *fc, const char *key,
|
||||
const struct qstr *value)
|
||||
{
|
||||
int ret;
|
||||
|
||||
struct fs_parameter param = {
|
||||
.key = key,
|
||||
.type = fs_value_is_flag,
|
||||
.size = v_size,
|
||||
.size = value ? value->len : 0,
|
||||
};
|
||||
|
||||
if (value) {
|
||||
param.string = kmemdup_nul(value, v_size, GFP_KERNEL);
|
||||
param.string = kmemdup_nul(value->name, value->len, GFP_KERNEL);
|
||||
if (!param.string)
|
||||
return -ENOMEM;
|
||||
param.type = fs_value_is_string;
|
||||
@@ -189,7 +188,7 @@ int vfs_parse_fs_string(struct fs_context *fc, const char *key,
|
||||
kfree(param.string);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(vfs_parse_fs_string);
|
||||
EXPORT_SYMBOL(vfs_parse_fs_qstr);
|
||||
|
||||
/**
|
||||
* vfs_parse_monolithic_sep - Parse key[=val][,key[=val]]* mount data
|
||||
@@ -218,16 +217,14 @@ int vfs_parse_monolithic_sep(struct fs_context *fc, void *data,
|
||||
|
||||
while ((key = sep(&options)) != NULL) {
|
||||
if (*key) {
|
||||
size_t v_len = 0;
|
||||
char *value = strchr(key, '=');
|
||||
|
||||
if (value) {
|
||||
if (unlikely(value == key))
|
||||
continue;
|
||||
*value++ = 0;
|
||||
v_len = strlen(value);
|
||||
}
|
||||
ret = vfs_parse_fs_string(fc, key, value, v_len);
|
||||
ret = vfs_parse_fs_string(fc, key, value);
|
||||
if (ret < 0)
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user