]> git.ozlabs.org Git - petitboot/blobdiff - lib/efi/efivar.h
lib/efi: Add new struct efi_mount
[petitboot] / lib / efi / efivar.h
index 48edd17a2b0231eacd8649a1566453151b55ed59..b74ab64d254c377d7da6b39766ba29fb398a3157 100644 (file)
 #ifndef EFIVAR_H
 #define EFIVAR_H
 
 #ifndef EFIVAR_H
 #define EFIVAR_H
 
-#include <linux/magic.h>
+#include <stdbool.h>
 #include <stdint.h>
 
 #include <stdint.h>
 
+#include <linux/magic.h>
+
 #define EFI_VARIABLE_NON_VOLATILE                           0x00000001
 #define EFI_VARIABLE_BOOTSERVICE_ACCESS                     0x00000002
 #define EFI_VARIABLE_RUNTIME_ACCESS                         0x00000004
 #define EFI_VARIABLE_NON_VOLATILE                           0x00000001
 #define EFI_VARIABLE_BOOTSERVICE_ACCESS                     0x00000002
 #define EFI_VARIABLE_RUNTIME_ACCESS                         0x00000004
@@ -47,13 +49,23 @@ struct efi_data {
        uint8_t fill[0];
 };
 
        uint8_t fill[0];
 };
 
-void set_efivarfs_path(const char *path);
-const char *get_efivarfs_path(void);
+struct efi_mount {
+       const char *path;
+       const char *guid;
+};
+
+void efi_init_mount(struct efi_mount *efi_mount, const char *path,
+       const char *guid);
+bool efi_check_mount_magic(const struct efi_mount *efi_mount, bool check_magic);
+static inline bool efi_check_mount(const struct efi_mount *efi_mount)
+{
+       return efi_check_mount_magic(efi_mount, true);
+}
 
 
-int efi_get_variable(void *ctx, const char *guidstr, const char *name,
-               struct efi_data **efi_data);
-int efi_set_variable(const char *guidstr, const char *name,
-               const struct efi_data *efi_data);
-int efi_del_variable(const char *guidstr, const char *name);
+int efi_get_variable(void *ctx, const struct efi_mount *efi_mount,
+       const char *name, struct efi_data **efi_data);
+int efi_set_variable(const struct efi_mount *efi_mount, const char *name,
+       const struct efi_data *efi_data);
+int efi_del_variable(const struct efi_mount *efi_mount, const char *name);
 
 #endif /* EFIVAR_H */
 
 #endif /* EFIVAR_H */