[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120925154100.GA13412@ldl.usa.hp.com>
Date: Tue, 25 Sep 2012 09:41:00 -0600
From: Khalid Aziz <khalid.aziz@...com>
To: Matthew Garrett <mjg@...hat.com>, hpa@...or.com,
keescook@...omium.org, tony.luck@...el.com,
Greg KH <gregkh@...uxfoundation.org>, cbouatmailru@...il.com,
ccross@...roid.com, paul.gortmaker@...driver.com,
maxin.john@...il.com, matt.fleming@...el.com, olof@...om.net,
dhowells@...hat.com
Cc: linux-next@...r.kernel.org, linux-kernel@...r.kernel.org,
khalid@...ehiking.org
Subject: [PATCH -next v2] Shorten constant names for EFI variable attributes
Replace very long constants for EFI variable attributes with
shorter and more convenient names. Also create an alias for
the current longer names so as to not break compatibility
with current API since these constants are used by
userspace programs.
Signed-off-by: Khalid Aziz <khalid.aziz@...com>
Cc: Khalid Aziz <khalid@...ehiking.org>
---
Change for v2: Made only the new constant names available for use in kernel by
adding #ifndef __KERNEL__ around aliases for old constant names
drivers/firmware/efivars.c | 20 ++++++++------------
drivers/firmware/google/gsmi.c | 8 ++------
include/linux/efi.h | 37 ++++++++++++++++++++++---------------
3 files changed, 32 insertions(+), 33 deletions(-)
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
index d10c987..27f4fab 100644
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -122,10 +122,7 @@ struct efivar_attribute {
ssize_t (*store)(struct efivar_entry *entry, const char *buf, size_t count);
};
-#define PSTORE_EFI_ATTRIBUTES \
- (EFI_VARIABLE_NON_VOLATILE | \
- EFI_VARIABLE_BOOTSERVICE_ACCESS | \
- EFI_VARIABLE_RUNTIME_ACCESS)
+#define PSTORE_EFI_ATTRIBUTES (EFI_VAR_NV | EFI_VAR_BOOT | EFI_VAR_RUNTIME)
#define EFIVAR_ATTR(_name, _mode, _show, _store) \
struct efivar_attribute efivar_attr_##_name = { \
@@ -435,22 +432,21 @@ efivar_attr_read(struct efivar_entry *entry, char *buf)
if (status != EFI_SUCCESS)
return -EIO;
- if (var->Attributes & EFI_VARIABLE_NON_VOLATILE)
+ if (var->Attributes & EFI_VAR_NV)
str += sprintf(str, "EFI_VARIABLE_NON_VOLATILE\n");
- if (var->Attributes & EFI_VARIABLE_BOOTSERVICE_ACCESS)
+ if (var->Attributes & EFI_VAR_BOOT)
str += sprintf(str, "EFI_VARIABLE_BOOTSERVICE_ACCESS\n");
- if (var->Attributes & EFI_VARIABLE_RUNTIME_ACCESS)
+ if (var->Attributes & EFI_VAR_RUNTIME)
str += sprintf(str, "EFI_VARIABLE_RUNTIME_ACCESS\n");
- if (var->Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD)
+ if (var->Attributes & EFI_VAR_HW_ERR)
str += sprintf(str, "EFI_VARIABLE_HARDWARE_ERROR_RECORD\n");
- if (var->Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS)
+ if (var->Attributes & EFI_VAR_AUTH_WRITE)
str += sprintf(str,
"EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS\n");
- if (var->Attributes &
- EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)
+ if (var->Attributes & EFI_VAR_TIMED_AUTH_WRITE)
str += sprintf(str,
"EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS\n");
- if (var->Attributes & EFI_VARIABLE_APPEND_WRITE)
+ if (var->Attributes & EFI_VAR_APPEND)
str += sprintf(str, "EFI_VARIABLE_APPEND_WRITE\n");
return str - buf;
}
diff --git a/drivers/firmware/google/gsmi.c b/drivers/firmware/google/gsmi.c
index 91ddf0f..3e2d6d4 100644
--- a/drivers/firmware/google/gsmi.c
+++ b/drivers/firmware/google/gsmi.c
@@ -353,9 +353,7 @@ static efi_status_t gsmi_get_variable(efi_char16_t *name,
memcpy(data, gsmi_dev.data_buf->start, *data_size);
/* All variables are have the following attributes */
- *attr = EFI_VARIABLE_NON_VOLATILE |
- EFI_VARIABLE_BOOTSERVICE_ACCESS |
- EFI_VARIABLE_RUNTIME_ACCESS;
+ *attr = EFI_VAR_NV | EFI_VAR_BOOT | EFI_VAR_RUNTIME;
}
spin_unlock_irqrestore(&gsmi_dev.lock, flags);
@@ -430,9 +428,7 @@ static efi_status_t gsmi_set_variable(efi_char16_t *name,
.name_ptr = gsmi_dev.name_buf->address,
.data_ptr = gsmi_dev.data_buf->address,
.data_len = (u32)data_size,
- .attributes = EFI_VARIABLE_NON_VOLATILE |
- EFI_VARIABLE_BOOTSERVICE_ACCESS |
- EFI_VARIABLE_RUNTIME_ACCESS,
+ .attributes = EFI_VAR_NV | EFI_VAR_BOOT | EFI_VAR_RUNTIME,
};
size_t name_len = utf16_strlen(name, GSMI_BUF_SIZE / 2);
efi_status_t ret = EFI_SUCCESS;
diff --git a/include/linux/efi.h b/include/linux/efi.h
index ec45ccd..9240a5e 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -551,21 +551,28 @@ extern int __init efi_setup_pcdp_console(char *);
/*
* Variable Attributes
*/
-#define EFI_VARIABLE_NON_VOLATILE 0x0000000000000001
-#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x0000000000000002
-#define EFI_VARIABLE_RUNTIME_ACCESS 0x0000000000000004
-#define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x0000000000000008
-#define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x0000000000000010
-#define EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS 0x0000000000000020
-#define EFI_VARIABLE_APPEND_WRITE 0x0000000000000040
-
-#define EFI_VARIABLE_MASK (EFI_VARIABLE_NON_VOLATILE | \
- EFI_VARIABLE_BOOTSERVICE_ACCESS | \
- EFI_VARIABLE_RUNTIME_ACCESS | \
- EFI_VARIABLE_HARDWARE_ERROR_RECORD | \
- EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS | \
- EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS | \
- EFI_VARIABLE_APPEND_WRITE)
+#define EFI_VAR_NV 0x0000000000000001
+#define EFI_VAR_BOOT 0x0000000000000002
+#define EFI_VAR_RUNTIME 0x0000000000000004
+#define EFI_VAR_HW_ERR 0x0000000000000008
+#define EFI_VAR_AUTH_WRITE 0x0000000000000010
+#define EFI_VAR_TIMED_AUTH_WRITE 0x0000000000000020
+#define EFI_VAR_APPEND 0x0000000000000040
+
+#ifndef __KERNEL__
+#define EFI_VARIABLE_NON_VOLATILE EFI_VAR_NV
+#define EFI_VARIABLE_BOOTSERVICE_ACCESS EFI_VAR_BOOT
+#define EFI_VARIABLE_RUNTIME_ACCESS EFI_VAR_RUNTIME
+#define EFI_VARIABLE_HARDWARE_ERROR_RECORD EFI_VAR_HW_ERR
+#define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS EFI_VAR_AUTH_WRITE
+#define EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS \
+ EFI_VAR_TIMED_AUTH_WRITE
+#define EFI_VARIABLE_APPEND_WRITE EFI_VAR_APPEND
+#endif
+
+#define EFI_VARIABLE_MASK (EFI_VAR_NV | EFI_VAR_BOOT | EFI_VAR_RUNTIME | \
+ EFI_VAR_HW_ERR | EFI_VAR_AUTH_WRITE | \
+ EFI_VAR_TIMED_AUTH_WRITE | EFI_VAR_APPEND)
/*
* The type of search to perform when calling boottime->locate_handle
*/
--
1.7.8.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists