Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F115647777
D50036.id154306.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D50036.id154306.diff
View Options
diff --git a/usr.sbin/efitable/efitable.c b/usr.sbin/efitable/efitable.c
--- a/usr.sbin/efitable/efitable.c
+++ b/usr.sbin/efitable/efitable.c
@@ -46,17 +46,19 @@
static void efi_table_print_prop(const void *data);
static void usage(void) __dead2;
+typedef uuid_t efi_guid_t; /* Typedef for future efi_guid_t */
+
struct efi_table_op {
char name[TABLE_MAX_LEN];
void (*parse) (const void *);
- struct uuid uuid;
+ efi_guid_t guid;
};
static const struct efi_table_op efi_table_ops[] = {
{ .name = "esrt", .parse = efi_table_print_esrt,
- .uuid = EFI_TABLE_ESRT },
+ .guid = EFI_TABLE_ESRT },
{ .name = "prop", .parse = efi_table_print_prop,
- .uuid = EFI_PROPERTIES_TABLE }
+ .guid = EFI_PROPERTIES_TABLE }
};
int
@@ -81,14 +83,23 @@
if (argc < 0)
exit(EXIT_FAILURE);
- while ((ch = getopt_long(argc, argv, "u:t:", longopts, NULL)) != -1) {
+ while ((ch = getopt_long(argc, argv, "g:t:u:", longopts, NULL)) != -1) {
switch (ch) {
+ case 'g':
case 'u':
{
char *uuid_str = optarg;
struct uuid uuid;
uint32_t status;
+ /*
+ * Note: we use the uuid parsing routine to parse the
+ * guid strings. However, EFI defines a slightly
+ * different structure to access them. We unify on
+ * using a structure that's compatible with EDK2
+ * EFI_GUID structure.
+ */
+
uuid_set = 1;
uuid_from_string(uuid_str, &uuid, &status);
@@ -96,7 +107,7 @@
xo_errx(EX_DATAERR, "invalid UUID");
for (size_t n = 0; n < nitems(efi_table_ops); n++) {
- if (!memcmp(&uuid, &efi_table_ops[n].uuid,
+ if (!memcmp(&uuid, &efi_table_ops[n].guid,
sizeof(uuid))) {
efi_idx = n;
got_table = true;
@@ -140,7 +151,7 @@
if (efi_fd < 0)
xo_err(EX_OSFILE, "/dev/efi");
- table.uuid = efi_table_ops[efi_idx].uuid;
+ memcpy(&table.uuid, &efi_table_ops[efi_idx].guid, sizeof(struct uuid));
if (ioctl(efi_fd, EFIIOC_GET_TABLE, &table) == -1)
xo_err(EX_OSERR, "EFIIOC_GET_TABLE (len == 0)");
@@ -181,7 +192,7 @@
uint32_t status;
char *uuid;
- uuid_to_string(&e->fw_class, &uuid, &status);
+ uuid_to_string((const uuid_t *)&e->fw_class, &uuid, &status);
if (status != uuid_s_ok) {
xo_errx(EX_DATAERR, "uuid_to_string error");
}
@@ -232,6 +243,6 @@
static void usage(void)
{
- xo_error("usage: efitable [-d uuid | -t name] [--libxo]\n");
+ xo_error("usage: efitable [-g guid | -t name] [--libxo]\n");
exit(EX_USAGE);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 27, 12:54 PM (13 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17808234
Default Alt Text
D50036.id154306.diff (2 KB)
Attached To
Mode
D50036: efitable: Don't assume EFI GUID are uuid_t
Attached
Detach File
Event Timeline
Log In to Comment