From 9e4a51a860e90439f60b4fcfdd3ae03042d2c72a Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Fri, 3 Mar 2017 20:23:14 +0000 Subject: [PATCH] Implement -d / --device-path to print the ascii representation of a variable that contains a UEFI device path. Sponsored by: Netflix --- usr.sbin/efivar/efivar.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/usr.sbin/efivar/efivar.c b/usr.sbin/efivar/efivar.c index 12ed5dc7b174..d877eb1b9cc2 100644 --- a/usr.sbin/efivar/efivar.c +++ b/usr.sbin/efivar/efivar.c @@ -45,6 +45,8 @@ static struct option longopts[] = { { "attributes", required_argument, NULL, 't' }, { "binary", no_argument, NULL, 'b' }, { "delete", no_argument, NULL, 'D' }, + { "device", no_argument, NULL, 'd' }, + { "device-path", no_argument, NULL, 'd' }, { "fromfile", required_argument, NULL, 'f' }, { "guid", no_argument, NULL, 'g' }, { "hex", no_argument, NULL, 'H' }, @@ -196,6 +198,13 @@ bindump(uint8_t *data, size_t datalen) write(1, data, datalen); } +static void +devpath_dump(uint8_t *data, size_t datalen) +{ + + fprintf(stderr, "junk %p %zu\n", data, datalen); +} + static void pretty_guid(efi_guid_t *guid, char **gname) { @@ -232,6 +241,8 @@ print_var(efi_guid_t *guid, char *name) asciidump(data, datalen); else if (bflag) bindump(data, datalen); + else if (dflag) + devpath_dump(data, datalen); else hexdump(data, datalen); } else {