mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 00:22:00 +02:00
efivarfs: abstract initial variable creation routine
Reuse later for variable creation after hibernation Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
This commit is contained in:
parent
8ba14d9f49
commit
0e2f98da20
|
|
@ -226,26 +226,18 @@ bool efivarfs_variable_is_present(efi_char16_t *variable_name,
|
|||
return dentry != NULL;
|
||||
}
|
||||
|
||||
static int efivarfs_callback(efi_char16_t *name16, efi_guid_t vendor,
|
||||
unsigned long name_size, void *data)
|
||||
static int efivarfs_create_dentry(struct super_block *sb, efi_char16_t *name16,
|
||||
unsigned long name_size, efi_guid_t vendor,
|
||||
char *name)
|
||||
{
|
||||
struct super_block *sb = (struct super_block *)data;
|
||||
struct efivar_entry *entry;
|
||||
struct inode *inode = NULL;
|
||||
struct inode *inode;
|
||||
struct dentry *dentry, *root = sb->s_root;
|
||||
unsigned long size = 0;
|
||||
char *name;
|
||||
int len;
|
||||
int err = -ENOMEM;
|
||||
bool is_removable = false;
|
||||
|
||||
if (guid_equal(&vendor, &LINUX_EFI_RANDOM_SEED_TABLE_GUID))
|
||||
return 0;
|
||||
|
||||
name = efivar_get_utf8name(name16, &vendor);
|
||||
if (!name)
|
||||
return err;
|
||||
|
||||
/* length of the variable name itself: remove GUID and separator */
|
||||
len = strlen(name) - EFI_VARIABLE_GUID_LEN - 1;
|
||||
|
||||
|
|
@ -289,6 +281,22 @@ static int efivarfs_callback(efi_char16_t *name16, efi_guid_t vendor,
|
|||
return err;
|
||||
}
|
||||
|
||||
static int efivarfs_callback(efi_char16_t *name16, efi_guid_t vendor,
|
||||
unsigned long name_size, void *data)
|
||||
{
|
||||
struct super_block *sb = (struct super_block *)data;
|
||||
char *name;
|
||||
|
||||
if (guid_equal(&vendor, &LINUX_EFI_RANDOM_SEED_TABLE_GUID))
|
||||
return 0;
|
||||
|
||||
name = efivar_get_utf8name(name16, &vendor);
|
||||
if (!name)
|
||||
return -ENOMEM;
|
||||
|
||||
return efivarfs_create_dentry(sb, name16, name_size, vendor, name);
|
||||
}
|
||||
|
||||
enum {
|
||||
Opt_uid, Opt_gid,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user