From a36159eec6ca17402b0e146b86efaf76568dc353 Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Fri, 20 Sep 2024 01:41:23 +0000 Subject: [PATCH] 重命名 AX88772C_eeprom/asix.c 为 asix_mac.c --- kernel/fs/efivarfs/super.c | 37 ++++++++++++++++++++----------------- 1 files changed, 20 insertions(+), 17 deletions(-) diff --git a/kernel/fs/efivarfs/super.c b/kernel/fs/efivarfs/super.c index 834615f..b62aefe 100644 --- a/kernel/fs/efivarfs/super.c +++ b/kernel/fs/efivarfs/super.c @@ -1,15 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * Copyright (C) 2012 Red Hat, Inc. * Copyright (C) 2012 Jeremy Kerr <jeremy.kerr@canonical.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #include <linux/ctype.h> #include <linux/efi.h> #include <linux/fs.h> +#include <linux/fs_context.h> #include <linux/module.h> #include <linux/pagemap.h> #include <linux/ucs2_string.h> @@ -30,8 +28,6 @@ .drop_inode = generic_delete_inode, .evict_inode = efivarfs_evict_inode, }; - -static struct super_block *efivarfs_sb; /* * Compare two efivarfs file names. @@ -194,13 +190,11 @@ return 0; } -static int efivarfs_fill_super(struct super_block *sb, void *data, int silent) +static int efivarfs_fill_super(struct super_block *sb, struct fs_context *fc) { struct inode *inode = NULL; struct dentry *root; int err; - - efivarfs_sb = sb; sb->s_maxbytes = MAX_LFS_FILESIZE; sb->s_blocksize = PAGE_SIZE; @@ -209,6 +203,9 @@ sb->s_op = &efivarfs_ops; sb->s_d_op = &efivarfs_d_ops; sb->s_time_gran = 1; + + if (!efivar_supports_writes()) + sb->s_flags |= SB_RDONLY; inode = efivarfs_get_inode(sb, NULL, S_IFDIR | 0755, 0, true); if (!inode) @@ -229,16 +226,24 @@ return err; } -static struct dentry *efivarfs_mount(struct file_system_type *fs_type, - int flags, const char *dev_name, void *data) +static int efivarfs_get_tree(struct fs_context *fc) { - return mount_single(fs_type, flags, data, efivarfs_fill_super); + return get_tree_single(fc, efivarfs_fill_super); +} + +static const struct fs_context_operations efivarfs_context_ops = { + .get_tree = efivarfs_get_tree, +}; + +static int efivarfs_init_fs_context(struct fs_context *fc) +{ + fc->ops = &efivarfs_context_ops; + return 0; } static void efivarfs_kill_sb(struct super_block *sb) { kill_litter_super(sb); - efivarfs_sb = NULL; /* Remove all entries and destroy */ __efivar_entry_iter(efivarfs_destroy, &efivarfs_list, NULL, NULL); @@ -247,15 +252,12 @@ static struct file_system_type efivarfs_type = { .owner = THIS_MODULE, .name = "efivarfs", - .mount = efivarfs_mount, + .init_fs_context = efivarfs_init_fs_context, .kill_sb = efivarfs_kill_sb, }; static __init int efivarfs_init(void) { - if (!efi_enabled(EFI_RUNTIME_SERVICES)) - return -ENODEV; - if (!efivars_kobject()) return -ENODEV; @@ -270,6 +272,7 @@ MODULE_AUTHOR("Matthew Garrett, Jeremy Kerr"); MODULE_DESCRIPTION("EFI Variable Filesystem"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); MODULE_ALIAS_FS("efivarfs"); module_init(efivarfs_init); -- Gitblit v1.6.2