vfs: Convert smackfs to use the new mount API

Convert the smackfs 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: Casey Schaufler <casey@schaufler-ca.com>
cc: linux-security-module@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
David Howells 2019-03-25 16:38:31 +00:00 committed by Al Viro
parent 920f50b2a4
commit 5afdd0f1e6

View File

@ -27,6 +27,7 @@
#include <linux/ctype.h>
#include <linux/audit.h>
#include <linux/magic.h>
#include <linux/fs_context.h>
#include "smack.h"
#define BEBITS (sizeof(__be32) * 8)
@ -2820,14 +2821,13 @@ static const struct file_operations smk_ptrace_ops = {
/**
* smk_fill_super - fill the smackfs superblock
* @sb: the empty superblock
* @data: unused
* @silent: unused
* @fc: unused
*
* Fill in the well known entries for the smack filesystem
*
* Returns 0 on success, an error code on failure
*/
static int smk_fill_super(struct super_block *sb, void *data, int silent)
static int smk_fill_super(struct super_block *sb, struct fs_context *fc)
{
int rc;
@ -2897,25 +2897,35 @@ static int smk_fill_super(struct super_block *sb, void *data, int silent)
}
/**
* smk_mount - get the smackfs superblock
* @fs_type: passed along without comment
* @flags: passed along without comment
* @dev_name: passed along without comment
* @data: passed along without comment
* smk_get_tree - get the smackfs superblock
* @fc: The mount context, including any options
*
* Just passes everything along.
*
* Returns what the lower level code does.
*/
static struct dentry *smk_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data)
static int smk_get_tree(struct fs_context *fc)
{
return mount_single(fs_type, flags, data, smk_fill_super);
return get_tree_single(fc, smk_fill_super);
}
static const struct fs_context_operations smk_context_ops = {
.get_tree = smk_get_tree,
};
/**
* smk_init_fs_context - Initialise a filesystem context for smackfs
* @fc: The blank mount context
*/
static int smk_init_fs_context(struct fs_context *fc)
{
fc->ops = &smk_context_ops;
return 0;
}
static struct file_system_type smk_fs_type = {
.name = "smackfs",
.mount = smk_mount,
.init_fs_context = smk_init_fs_context,
.kill_sb = kill_litter_super,
};