]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - security/apparmor/apparmorfs.c
Merge branch 'work.mount0' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[linux.git] / security / apparmor / apparmorfs.c
index b9298d2e816547da98c2fd19da931b66fe1f110a..45d13b6462aa75161bf0b768bf966b1920ca6312 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * AppArmor security module
  *
@@ -5,11 +6,6 @@
  *
  * Copyright (C) 1998-2008 Novell/SUSE
  * Copyright 2009-2010 Canonical Ltd.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, version 2 of the
- * License.
  */
 
 #include <linux/ctype.h>
@@ -23,6 +19,7 @@
 #include <linux/capability.h>
 #include <linux/rcupdate.h>
 #include <linux/fs.h>
+#include <linux/fs_context.h>
 #include <linux/poll.h>
 #include <uapi/linux/major.h>
 #include <uapi/linux/magic.h>
@@ -123,26 +120,20 @@ static int aafs_show_path(struct seq_file *seq, struct dentry *dentry)
        return 0;
 }
 
-static void aafs_i_callback(struct rcu_head *head)
+static void aafs_free_inode(struct inode *inode)
 {
-       struct inode *inode = container_of(head, struct inode, i_rcu);
        if (S_ISLNK(inode->i_mode))
                kfree(inode->i_link);
        free_inode_nonrcu(inode);
 }
 
-static void aafs_destroy_inode(struct inode *inode)
-{
-       call_rcu(&inode->i_rcu, aafs_i_callback);
-}
-
 static const struct super_operations aafs_super_ops = {
        .statfs = simple_statfs,
-       .destroy_inode = aafs_destroy_inode,
+       .free_inode = aafs_free_inode,
        .show_path = aafs_show_path,
 };
 
-static int fill_super(struct super_block *sb, void *data, int silent)
+static int apparmorfs_fill_super(struct super_block *sb, struct fs_context *fc)
 {
        static struct tree_descr files[] = { {""} };
        int error;
@@ -155,16 +146,25 @@ static int fill_super(struct super_block *sb, void *data, int silent)
        return 0;
 }
 
-static struct dentry *aafs_mount(struct file_system_type *fs_type,
-                                int flags, const char *dev_name, void *data)
+static int apparmorfs_get_tree(struct fs_context *fc)
+{
+       return get_tree_single(fc, apparmorfs_fill_super);
+}
+
+static const struct fs_context_operations apparmorfs_context_ops = {
+       .get_tree       = apparmorfs_get_tree,
+};
+
+static int apparmorfs_init_fs_context(struct fs_context *fc)
 {
-       return mount_single(fs_type, flags, data, fill_super);
+       fc->ops = &apparmorfs_context_ops;
+       return 0;
 }
 
 static struct file_system_type aafs_ops = {
        .owner = THIS_MODULE,
        .name = AAFS_NAME,
-       .mount = aafs_mount,
+       .init_fs_context = apparmorfs_init_fs_context,
        .kill_sb = kill_anon_super,
 };