2019-06-04 10:11:33 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2013-02-08 16:27:24 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2012 Red Hat, Inc.
|
|
|
|
* Copyright (C) 2012 Jeremy Kerr <jeremy.kerr@canonical.com>
|
|
|
|
*/
|
|
|
|
#ifndef EFIVAR_FS_INTERNAL_H
|
|
|
|
#define EFIVAR_FS_INTERNAL_H
|
|
|
|
|
2022-06-20 18:19:43 +02:00
|
|
|
#include <linux/efi.h>
|
|
|
|
|
2023-10-20 00:46:39 +02:00
|
|
|
struct efivarfs_mount_opts {
|
|
|
|
kuid_t uid;
|
|
|
|
kgid_t gid;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct efivarfs_fs_info {
|
|
|
|
struct efivarfs_mount_opts mount_opts;
|
2023-11-07 14:40:55 +09:00
|
|
|
struct super_block *sb;
|
|
|
|
struct notifier_block nb;
|
2023-10-20 00:46:39 +02:00
|
|
|
};
|
|
|
|
|
2022-06-20 18:19:43 +02:00
|
|
|
struct efi_variable {
|
|
|
|
efi_char16_t VariableName[EFI_VAR_NAME_LEN/sizeof(efi_char16_t)];
|
|
|
|
efi_guid_t VendorGuid;
|
2024-03-28 21:50:32 +01:00
|
|
|
};
|
2022-06-20 18:19:43 +02:00
|
|
|
|
|
|
|
struct efivar_entry {
|
|
|
|
struct efi_variable var;
|
2025-01-19 10:12:10 -05:00
|
|
|
struct inode vfs_inode;
|
2025-01-19 10:12:12 -05:00
|
|
|
unsigned long open_count;
|
|
|
|
bool removed;
|
2022-06-20 18:19:43 +02:00
|
|
|
};
|
|
|
|
|
2025-01-19 10:12:10 -05:00
|
|
|
static inline struct efivar_entry *efivar_entry(struct inode *inode)
|
|
|
|
{
|
|
|
|
return container_of(inode, struct efivar_entry, vfs_inode);
|
|
|
|
}
|
|
|
|
|
2025-01-19 10:12:11 -05:00
|
|
|
int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *),
|
2025-01-07 13:31:29 -08:00
|
|
|
void *data, bool duplicate_check);
|
2022-06-20 18:19:43 +02:00
|
|
|
|
|
|
|
int efivar_entry_delete(struct efivar_entry *entry);
|
|
|
|
|
|
|
|
int efivar_entry_size(struct efivar_entry *entry, unsigned long *size);
|
|
|
|
int __efivar_entry_get(struct efivar_entry *entry, u32 *attributes,
|
|
|
|
unsigned long *size, void *data);
|
|
|
|
int efivar_entry_get(struct efivar_entry *entry, u32 *attributes,
|
|
|
|
unsigned long *size, void *data);
|
|
|
|
int efivar_entry_set_get_size(struct efivar_entry *entry, u32 attributes,
|
|
|
|
unsigned long *size, void *data, bool *set);
|
|
|
|
|
|
|
|
|
|
|
|
bool efivar_validate(efi_guid_t vendor, efi_char16_t *var_name, u8 *data,
|
|
|
|
unsigned long data_size);
|
|
|
|
bool efivar_variable_is_removable(efi_guid_t vendor, const char *name,
|
|
|
|
size_t len);
|
2025-01-06 18:35:21 -08:00
|
|
|
char *efivar_get_utf8name(const efi_char16_t *name16, efi_guid_t *vendor);
|
2025-01-06 18:35:22 -08:00
|
|
|
bool efivarfs_variable_is_present(efi_char16_t *variable_name,
|
|
|
|
efi_guid_t *vendor, void *data);
|
2013-02-08 16:27:24 +00:00
|
|
|
|
|
|
|
extern const struct file_operations efivarfs_file_operations;
|
|
|
|
extern const struct inode_operations efivarfs_dir_inode_operations;
|
|
|
|
extern struct inode *efivarfs_get_inode(struct super_block *sb,
|
2016-02-08 14:48:15 -05:00
|
|
|
const struct inode *dir, int mode, dev_t dev,
|
|
|
|
bool is_removable);
|
2013-02-08 16:27:24 +00:00
|
|
|
|
|
|
|
#endif /* EFIVAR_FS_INTERNAL_H */
|