vfs: Convert oprofilefs to use the new mount API

Convert the oprofilefs filesystem to the new internal mount API as the old
one will be obsoleted and removed.  This allows greater flexibility in
communication of mount parameters between userspace, the VFS and the
filesystem.

See Documentation/filesystems/mount_api.txt for more information.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Robert Richter <rric@kernel.org>
cc: oprofile-list@lists.sf.net
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
David Howells 2019-03-25 16:38:30 +00:00 committed by Al Viro
parent 129f809d2a
commit c6a2c720d2
1 changed files with 14 additions and 6 deletions

View File

@ -14,6 +14,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/oprofile.h> #include <linux/oprofile.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/fs_context.h>
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
@ -238,7 +239,7 @@ struct dentry *oprofilefs_mkdir(struct dentry *parent, char const *name)
} }
static int oprofilefs_fill_super(struct super_block *sb, void *data, int silent) static int oprofilefs_fill_super(struct super_block *sb, struct fs_context *fc)
{ {
struct inode *root_inode; struct inode *root_inode;
@ -263,18 +264,25 @@ static int oprofilefs_fill_super(struct super_block *sb, void *data, int silent)
return 0; return 0;
} }
static int oprofilefs_get_tree(struct fs_context *fc)
static struct dentry *oprofilefs_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data)
{ {
return mount_single(fs_type, flags, data, oprofilefs_fill_super); return get_tree_single(fc, oprofilefs_fill_super);
} }
static const struct fs_context_operations oprofilefs_context_ops = {
.get_tree = oprofilefs_get_tree,
};
static int oprofilefs_init_fs_context(struct fs_context *fc)
{
fc->ops = &oprofilefs_context_ops;
return 0;
}
static struct file_system_type oprofilefs_type = { static struct file_system_type oprofilefs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "oprofilefs", .name = "oprofilefs",
.mount = oprofilefs_mount, .init_fs_context = oprofilefs_init_fs_context,
.kill_sb = kill_litter_super, .kill_sb = kill_litter_super,
}; };
MODULE_ALIAS_FS("oprofilefs"); MODULE_ALIAS_FS("oprofilefs");