MCPcopy Create free account
hub / github.com/coreboot/coreboot / format_guid

Function format_guid

util/smmstoretool/guids.c:53–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51const int known_guid_count = ARRAY_SIZE(known_guids);
52
53char *format_guid(const EFI_GUID *guid, bool use_alias)
54{
55 if (use_alias) {
56 for (int i = 0; i < known_guid_count; ++i) {
57 const struct guid_alias_t *known_guid = &known_guids[i];
58 if (memcmp(&known_guid->guid, guid, sizeof(*guid)) == 0)
59 return strdup(known_guid->alias);
60 }
61 }
62
63 char *str = xmalloc(GUID_LEN + 1);
64 snprintf(str, GUID_LEN + 1,
65 "%08x-%04x-%04x-%02x%02x%02x%02x%02x%02x%02x%02x",
66 guid->Data1, guid->Data2, guid->Data3,
67 guid->Data4[0], guid->Data4[1],
68 guid->Data4[2], guid->Data4[3],
69 guid->Data4[4], guid->Data4[5],
70 guid->Data4[6], guid->Data4[7]);
71 return str;
72}
73
74bool parse_guid(const char str[], EFI_GUID *guid)
75{

Callers 2

process_listFunction · 0.85
process_guidsFunction · 0.85

Calls 4

xmallocFunction · 0.70
memcmpFunction · 0.50
strdupFunction · 0.50
snprintfFunction · 0.50

Tested by

no test coverage detected