Implement -d / --device-path to print the ascii representation of a variable that contains a UEFI device path.

Sponsored by: Netflix
This commit is contained in:
Warner Losh 2017-03-03 20:23:14 +00:00
parent 1644567051
commit 9e4a51a860

View File

@ -45,6 +45,8 @@ static struct option longopts[] = {
{ "attributes", required_argument, NULL, 't' }, { "attributes", required_argument, NULL, 't' },
{ "binary", no_argument, NULL, 'b' }, { "binary", no_argument, NULL, 'b' },
{ "delete", no_argument, NULL, 'D' }, { "delete", no_argument, NULL, 'D' },
{ "device", no_argument, NULL, 'd' },
{ "device-path", no_argument, NULL, 'd' },
{ "fromfile", required_argument, NULL, 'f' }, { "fromfile", required_argument, NULL, 'f' },
{ "guid", no_argument, NULL, 'g' }, { "guid", no_argument, NULL, 'g' },
{ "hex", no_argument, NULL, 'H' }, { "hex", no_argument, NULL, 'H' },
@ -196,6 +198,13 @@ bindump(uint8_t *data, size_t datalen)
write(1, data, 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 static void
pretty_guid(efi_guid_t *guid, char **gname) pretty_guid(efi_guid_t *guid, char **gname)
{ {
@ -232,6 +241,8 @@ print_var(efi_guid_t *guid, char *name)
asciidump(data, datalen); asciidump(data, datalen);
else if (bflag) else if (bflag)
bindump(data, datalen); bindump(data, datalen);
else if (dflag)
devpath_dump(data, datalen);
else else
hexdump(data, datalen); hexdump(data, datalen);
} else { } else {