internal.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (C) 2012 Red Hat, Inc.
  4. * Copyright (C) 2012 Jeremy Kerr <[email protected]>
  5. */
  6. #ifndef EFIVAR_FS_INTERNAL_H
  7. #define EFIVAR_FS_INTERNAL_H
  8. #include <linux/list.h>
  9. #include <linux/efi.h>
  10. struct efi_variable {
  11. efi_char16_t VariableName[EFI_VAR_NAME_LEN/sizeof(efi_char16_t)];
  12. efi_guid_t VendorGuid;
  13. unsigned long DataSize;
  14. __u8 Data[1024];
  15. efi_status_t Status;
  16. __u32 Attributes;
  17. } __attribute__((packed));
  18. struct efivar_entry {
  19. struct efi_variable var;
  20. struct list_head list;
  21. struct kobject kobj;
  22. };
  23. int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *),
  24. void *data, bool duplicates, struct list_head *head);
  25. int efivar_entry_add(struct efivar_entry *entry, struct list_head *head);
  26. void __efivar_entry_add(struct efivar_entry *entry, struct list_head *head);
  27. void efivar_entry_remove(struct efivar_entry *entry);
  28. int efivar_entry_delete(struct efivar_entry *entry);
  29. int efivar_entry_size(struct efivar_entry *entry, unsigned long *size);
  30. int __efivar_entry_get(struct efivar_entry *entry, u32 *attributes,
  31. unsigned long *size, void *data);
  32. int efivar_entry_get(struct efivar_entry *entry, u32 *attributes,
  33. unsigned long *size, void *data);
  34. int efivar_entry_set_get_size(struct efivar_entry *entry, u32 attributes,
  35. unsigned long *size, void *data, bool *set);
  36. int efivar_entry_iter(int (*func)(struct efivar_entry *, void *),
  37. struct list_head *head, void *data);
  38. bool efivar_validate(efi_guid_t vendor, efi_char16_t *var_name, u8 *data,
  39. unsigned long data_size);
  40. bool efivar_variable_is_removable(efi_guid_t vendor, const char *name,
  41. size_t len);
  42. extern const struct file_operations efivarfs_file_operations;
  43. extern const struct inode_operations efivarfs_dir_inode_operations;
  44. extern bool efivarfs_valid_name(const char *str, int len);
  45. extern struct inode *efivarfs_get_inode(struct super_block *sb,
  46. const struct inode *dir, int mode, dev_t dev,
  47. bool is_removable);
  48. extern struct list_head efivarfs_list;
  49. #endif /* EFIVAR_FS_INTERNAL_H */