From 048517722cde2595a7366d0c3c72b8b1ec142a9c Mon Sep 17 00:00:00 2001 From: Matt Fleming Date: Fri, 8 Feb 2013 15:48:51 +0000 Subject: 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 Tested-by: Tom Gundersen Cc: Seiji Aguchi Cc: Anton Vorontsov Cc: Colin Cross Cc: Kees Cook Cc: Matthew Garrett Cc: Tony Luck Signed-off-by: Matt Fleming --- include/linux/efi.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'include/linux/efi.h') 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 @@ -743,6 +743,34 @@ utf16_strlen(efi_char16_t *s) } #if defined(CONFIG_EFI_VARS) || defined(CONFIG_EFI_VARS_MODULE) +/* + * Return the number of bytes is the length of this string + * Note: this is NOT the same as the number of unicode characters + */ +static inline unsigned long +utf16_strsize(efi_char16_t *data, unsigned long maxlength) +{ + return utf16_strnlen(data, maxlength/sizeof(efi_char16_t)) * sizeof(efi_char16_t); +} + +static inline int +utf16_strncmp(const efi_char16_t *a, const efi_char16_t *b, size_t len) +{ + while (1) { + if (len == 0) + return 0; + if (*a < *b) + return -1; + if (*a > *b) + return 1; + if (*a == 0) /* implies *b == 0 */ + return 0; + a++; + b++; + len--; + } +} + /* * EFI Variable support. * @@ -795,6 +823,14 @@ struct efivar_entry { struct kobject kobj; }; +extern struct list_head efivar_sysfs_list; + +static inline void +efivar_unregister(struct efivar_entry *var) +{ + kobject_put(&var->kobj); +} + int efivars_register(struct efivars *efivars, const struct efivar_operations *ops, struct kobject *kobject); @@ -836,6 +872,8 @@ struct efivar_entry *efivar_entry_find(efi_char16_t *name, efi_guid_t guid, bool efivar_validate(struct efi_variable *var, u8 *data, unsigned long len); +void efivar_run_worker(void); + int efivars_sysfs_init(void); #endif /* CONFIG_EFI_VARS */ -- cgit v1.2.3