aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/efi.h
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2013-02-08 10:48:51 -0500
committerMatt Fleming <matt.fleming@intel.com>2013-04-17 08:24:01 -0400
commit048517722cde2595a7366d0c3c72b8b1ec142a9c (patch)
tree1f54a4009c3f418285473e56bc930d606116bd11 /include/linux/efi.h
parente14ab23dde12b80db4c94b684a2e485b72b16af3 (diff)
efivars: Move pstore code into the new EFI directory
efivars.c has grown far too large and needs to be divided up. Create a new directory and move the persistence storage code to efi-pstore.c now that it uses the new efivar API. This helps us to greatly reduce the size of efivars.c and paves the way for moving other code out of efivars.c. Note that because CONFIG_EFI_VARS can be built as a module efi-pstore must also include support for building as a module. Reviewed-by: Tom Gundersen <teg@jklm.no> Tested-by: Tom Gundersen <teg@jklm.no> Cc: Seiji Aguchi <seiji.aguchi@hds.com> Cc: Anton Vorontsov <cbouatmailru@gmail.com> Cc: Colin Cross <ccross@android.com> Cc: Kees Cook <keescook@chromium.org> Cc: Matthew Garrett <mjg59@srcf.ucam.org> Cc: Tony Luck <tony.luck@intel.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'include/linux/efi.h')
-rw-r--r--include/linux/efi.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/include/linux/efi.h b/include/linux/efi.h
index cd561b301e6a..8ff6ec1ac046 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -744,6 +744,34 @@ utf16_strlen(efi_char16_t *s)
744 744
745#if defined(CONFIG_EFI_VARS) || defined(CONFIG_EFI_VARS_MODULE) 745#if defined(CONFIG_EFI_VARS) || defined(CONFIG_EFI_VARS_MODULE)
746/* 746/*
747 * Return the number of bytes is the length of this string
748 * Note: this is NOT the same as the number of unicode characters
749 */
750static inline unsigned long
751utf16_strsize(efi_char16_t *data, unsigned long maxlength)
752{
753 return utf16_strnlen(data, maxlength/sizeof(efi_char16_t)) * sizeof(efi_char16_t);
754}
755
756static inline int
757utf16_strncmp(const efi_char16_t *a, const efi_char16_t *b, size_t len)
758{
759 while (1) {
760 if (len == 0)
761 return 0;
762 if (*a < *b)
763 return -1;
764 if (*a > *b)
765 return 1;
766 if (*a == 0) /* implies *b == 0 */
767 return 0;
768 a++;
769 b++;
770 len--;
771 }
772}
773
774/*
747 * EFI Variable support. 775 * EFI Variable support.
748 * 776 *
749 * Different firmware drivers can expose their EFI-like variables using 777 * Different firmware drivers can expose their EFI-like variables using
@@ -795,6 +823,14 @@ struct efivar_entry {
795 struct kobject kobj; 823 struct kobject kobj;
796}; 824};
797 825
826extern struct list_head efivar_sysfs_list;
827
828static inline void
829efivar_unregister(struct efivar_entry *var)
830{
831 kobject_put(&var->kobj);
832}
833
798int efivars_register(struct efivars *efivars, 834int efivars_register(struct efivars *efivars,
799 const struct efivar_operations *ops, 835 const struct efivar_operations *ops,
800 struct kobject *kobject); 836 struct kobject *kobject);
@@ -836,6 +872,8 @@ struct efivar_entry *efivar_entry_find(efi_char16_t *name, efi_guid_t guid,
836 872
837bool efivar_validate(struct efi_variable *var, u8 *data, unsigned long len); 873bool efivar_validate(struct efi_variable *var, u8 *data, unsigned long len);
838 874
875void efivar_run_worker(void);
876
839int efivars_sysfs_init(void); 877int efivars_sysfs_init(void);
840 878
841#endif /* CONFIG_EFI_VARS */ 879#endif /* CONFIG_EFI_VARS */