Skip to content

Commit b0ecc9d

Browse files
dhowellsAl Viro
authored andcommitted
vfs: Convert apparmorfs to use the new mount API
Convert the apparmorfs 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: John Johansen <john.johansen@canonical.com> cc: apparmor@lists.ubuntu.com cc: linux-security-module@vger.kernel.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 7ab2fa7 commit b0ecc9d

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

‎security/apparmor/apparmorfs.c‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/capability.h>
2424
#include <linux/rcupdate.h>
2525
#include <linux/fs.h>
26+
#include <linux/fs_context.h>
2627
#include <linux/poll.h>
2728
#include <uapi/linux/major.h>
2829
#include <uapi/linux/magic.h>
@@ -136,7 +137,7 @@ static const struct super_operations aafs_super_ops = {
136137
.show_path = aafs_show_path,
137138
};
138139

139-
static int fill_super(struct super_block *sb, void *data, int silent)
140+
static int apparmorfs_fill_super(struct super_block *sb, struct fs_context *fc)
140141
{
141142
static struct tree_descr files[] = { {""} };
142143
int error;
@@ -149,16 +150,25 @@ static int fill_super(struct super_block *sb, void *data, int silent)
149150
return 0;
150151
}
151152

152-
static struct dentry *aafs_mount(struct file_system_type *fs_type,
153-
int flags, const char *dev_name, void *data)
153+
static int apparmorfs_get_tree(struct fs_context *fc)
154154
{
155-
return mount_single(fs_type, flags, data, fill_super);
155+
return get_tree_single(fc, apparmorfs_fill_super);
156+
}
157+
158+
static const struct fs_context_operations apparmorfs_context_ops = {
159+
.get_tree = apparmorfs_get_tree,
160+
};
161+
162+
static int apparmorfs_init_fs_context(struct fs_context *fc)
163+
{
164+
fc->ops = &apparmorfs_context_ops;
165+
return 0;
156166
}
157167

158168
static struct file_system_type aafs_ops = {
159169
.owner = THIS_MODULE,
160170
.name = AAFS_NAME,
161-
.mount = aafs_mount,
171+
.init_fs_context = apparmorfs_init_fs_context,
162172
.kill_sb = kill_anon_super,
163173
};
164174

0 commit comments

Comments
 (0)