From: Lennart Poettering Date: Fri, 20 Dec 2024 11:10:55 +0000 (+0100) Subject: analyze-chid: show friendly smbios field names X-Git-Tag: v258-rc1~1796^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0f55038c84d83039cec5e4b9aea5997ed6ddd3f9;p=thirdparty%2Fsystemd.git analyze-chid: show friendly smbios field names Some of the field names between kernel and smbios spec differ. Kinda confusing. Let's use the smbios field names, to match the CHID spec, which also uses them, and thus be least confusing, treating kernel attribute fields as an internal Linux thing only. --- diff --git a/src/analyze/analyze-chid.c b/src/analyze/analyze-chid.c index 9e555e39aa0..bc562f7b069 100644 --- a/src/analyze/analyze-chid.c +++ b/src/analyze/analyze-chid.c @@ -30,6 +30,15 @@ static int parse_chid_type(const char *s, size_t *ret) { return 0; } +static const char *const chid_smbios_friendly[_CHID_SMBIOS_FIELDS_MAX] = { + [CHID_SMBIOS_MANUFACTURER] = "manufacturer", + [CHID_SMBIOS_FAMILY] = "family", + [CHID_SMBIOS_PRODUCT_NAME] = "product-name", + [CHID_SMBIOS_PRODUCT_SKU] = "product-sku", + [CHID_SMBIOS_BASEBOARD_MANUFACTURER] = "baseboard-manufacturer", + [CHID_SMBIOS_BASEBOARD_PRODUCT] = "baseboard-product", +}; + static const char chid_smbios_fields_char[_CHID_SMBIOS_FIELDS_MAX] = { [CHID_SMBIOS_MANUFACTURER] = 'M', [CHID_SMBIOS_FAMILY] = 'F', @@ -207,7 +216,7 @@ int verb_chid(int argc, char *argv[], void *userdata) { special_glyph(SPECIAL_GLYPH_ARROW_RIGHT), " ", ansi_normal(), - smbios_files[f], + chid_smbios_friendly[f], ansi_grey(), " (", c ? ansi_highlight() : ansi_grey(), @@ -219,7 +228,7 @@ int verb_chid(int argc, char *argv[], void *userdata) { w += separator * 3 + 4 + - utf8_console_width(smbios_files[f]) + + utf8_console_width(chid_smbios_friendly[f]) + 2 + utf8_console_width(strna(c)) + 1;