summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2019-03-25 12:38:29 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2019-07-04 22:01:59 -0400
commit4799974555de565df0d0aca86c15bbea70105a19 (patch)
tree0728ffeeccfdf3b28502193ce69a724f263945d6
parent6bc62f2067d30f90621c42a2794c2515eff7bf11 (diff)
vfs: Convert efivarfs to use the new mount API
Convert the efivarfs 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. [AV: get rid of efivarfs_sb nonsense - it has never been used] See Documentation/filesystems/mount_api.txt for more information. Signed-off-by: David Howells <dhowells@redhat.com> cc: Matthew Garrett <matthew.garrett@nebula.com> cc: Jeremy Kerr <jk@ozlabs.org> cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> cc: linux-efi@vger.kernel.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/efivarfs/super.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c
index 5b68e4294faa..124f1aa9ab03 100644
--- a/fs/efivarfs/super.c
+++ b/fs/efivarfs/super.c
@@ -10,6 +10,7 @@
10#include <linux/ctype.h> 10#include <linux/ctype.h>
11#include <linux/efi.h> 11#include <linux/efi.h>
12#include <linux/fs.h> 12#include <linux/fs.h>
13#include <linux/fs_context.h>
13#include <linux/module.h> 14#include <linux/module.h>
14#include <linux/pagemap.h> 15#include <linux/pagemap.h>
15#include <linux/ucs2_string.h> 16#include <linux/ucs2_string.h>
@@ -31,8 +32,6 @@ static const struct super_operations efivarfs_ops = {
31 .evict_inode = efivarfs_evict_inode, 32 .evict_inode = efivarfs_evict_inode,
32}; 33};
33 34
34static struct super_block *efivarfs_sb;
35
36/* 35/*
37 * Compare two efivarfs file names. 36 * Compare two efivarfs file names.
38 * 37 *
@@ -191,14 +190,12 @@ static int efivarfs_destroy(struct efivar_entry *entry, void *data)
191 return 0; 190 return 0;
192} 191}
193 192
194static int efivarfs_fill_super(struct super_block *sb, void *data, int silent) 193static int efivarfs_fill_super(struct super_block *sb, struct fs_context *fc)
195{ 194{
196 struct inode *inode = NULL; 195 struct inode *inode = NULL;
197 struct dentry *root; 196 struct dentry *root;
198 int err; 197 int err;
199 198
200 efivarfs_sb = sb;
201
202 sb->s_maxbytes = MAX_LFS_FILESIZE; 199 sb->s_maxbytes = MAX_LFS_FILESIZE;
203 sb->s_blocksize = PAGE_SIZE; 200 sb->s_blocksize = PAGE_SIZE;
204 sb->s_blocksize_bits = PAGE_SHIFT; 201 sb->s_blocksize_bits = PAGE_SHIFT;
@@ -226,16 +223,24 @@ static int efivarfs_fill_super(struct super_block *sb, void *data, int silent)
226 return err; 223 return err;
227} 224}
228 225
229static struct dentry *efivarfs_mount(struct file_system_type *fs_type, 226static int efivarfs_get_tree(struct fs_context *fc)
230 int flags, const char *dev_name, void *data) 227{
228 return get_tree_single(fc, efivarfs_fill_super);
229}
230
231static const struct fs_context_operations efivarfs_context_ops = {
232 .get_tree = efivarfs_get_tree,
233};
234
235static int efivarfs_init_fs_context(struct fs_context *fc)
231{ 236{
232 return mount_single(fs_type, flags, data, efivarfs_fill_super); 237 fc->ops = &efivarfs_context_ops;
238 return 0;
233} 239}
234 240
235static void efivarfs_kill_sb(struct super_block *sb) 241static void efivarfs_kill_sb(struct super_block *sb)
236{ 242{
237 kill_litter_super(sb); 243 kill_litter_super(sb);
238 efivarfs_sb = NULL;
239 244
240 /* Remove all entries and destroy */ 245 /* Remove all entries and destroy */
241 __efivar_entry_iter(efivarfs_destroy, &efivarfs_list, NULL, NULL); 246 __efivar_entry_iter(efivarfs_destroy, &efivarfs_list, NULL, NULL);
@@ -244,7 +249,7 @@ static void efivarfs_kill_sb(struct super_block *sb)
244static struct file_system_type efivarfs_type = { 249static struct file_system_type efivarfs_type = {
245 .owner = THIS_MODULE, 250 .owner = THIS_MODULE,
246 .name = "efivarfs", 251 .name = "efivarfs",
247 .mount = efivarfs_mount, 252 .init_fs_context = efivarfs_init_fs_context,
248 .kill_sb = efivarfs_kill_sb, 253 .kill_sb = efivarfs_kill_sb,
249}; 254};
250 255