From bd44566c4d504237b25202a1104f67032c826f2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 5 Apr 2019 12:13:44 +0200 Subject: [PATCH] tree-wide: use SD_ID128_UUID_FORMAT_STR as appropriate --- src/boot/bootctl.c | 10 ++++++---- src/shared/efivars.c | 2 +- src/shared/id128-print.c | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/boot/bootctl.c b/src/boot/bootctl.c index a7de3800fcf..0595f873f05 100644 --- a/src/boot/bootctl.c +++ b/src/boot/bootctl.c @@ -220,7 +220,7 @@ static int status_binaries(const char *esp_path, sd_id128_t partition) { printf(" ESP: %s", esp_path); if (!sd_id128_is_null(partition)) - printf(" (/dev/disk/by-partuuid/%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x)", SD_ID128_FORMAT_VAL(partition)); + printf(" (/dev/disk/by-partuuid/" SD_ID128_UUID_FORMAT_STR ")", SD_ID128_FORMAT_VAL(partition)); printf("\n"); r = enumerate_binaries(esp_path, "EFI/systemd", NULL); @@ -262,7 +262,8 @@ static int print_efi_option(uint16_t id, bool in_order) { printf(" Title: %s%s%s\n", ansi_highlight(), strna(title), ansi_normal()); printf(" ID: 0x%04X\n", id); printf(" Status: %sactive%s\n", active ? "" : "in", in_order ? ", boot-order" : ""); - printf(" Partition: /dev/disk/by-partuuid/%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\n", SD_ID128_FORMAT_VAL(partition)); + printf(" Partition: /dev/disk/by-partuuid/" SD_ID128_UUID_FORMAT_STR "\n", + SD_ID128_FORMAT_VAL(partition)); printf(" File: %s%s\n", special_glyph(SPECIAL_GLYPH_TREE_RIGHT), path); printf("\n"); @@ -380,7 +381,8 @@ static int status_entries( printf("Boot Loader Entries:\n" " $BOOT: %s", dollar_boot_path); if (!sd_id128_is_null(dollar_boot_partition_uuid)) - printf(" (/dev/disk/by-partuuid/%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x)", SD_ID128_FORMAT_VAL(dollar_boot_partition_uuid)); + printf(" (/dev/disk/by-partuuid/" SD_ID128_UUID_FORMAT_STR ")", + SD_ID128_FORMAT_VAL(dollar_boot_partition_uuid)); printf("\n\n"); r = boot_entries_load_config(esp_path, xbootldr_path, &config); @@ -1150,7 +1152,7 @@ static int verb_status(int argc, char *argv[], void *userdata) { if (stub) printf(" Stub: %s\n", stub); if (!sd_id128_is_null(loader_part_uuid)) - printf(" ESP: /dev/disk/by-partuuid/%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\n", + printf(" ESP: /dev/disk/by-partuuid/" SD_ID128_UUID_FORMAT_STR "\n", SD_ID128_FORMAT_VAL(loader_part_uuid)); else printf(" ESP: n/a\n"); diff --git a/src/shared/efivars.c b/src/shared/efivars.c index 4f32163bbaf..875b8439e12 100644 --- a/src/shared/efivars.c +++ b/src/shared/efivars.c @@ -772,7 +772,7 @@ int efi_loader_get_device_part_uuid(sd_id128_t *u) { if (r < 0) return r; - if (sscanf(p, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", + if (sscanf(p, SD_ID128_UUID_FORMAT_STR, &parsed[0], &parsed[1], &parsed[2], &parsed[3], &parsed[4], &parsed[5], &parsed[6], &parsed[7], &parsed[8], &parsed[9], &parsed[10], &parsed[11], diff --git a/src/shared/id128-print.c b/src/shared/id128-print.c index 1b20b8f6445..febe3635baf 100644 --- a/src/shared/id128-print.c +++ b/src/shared/id128-print.c @@ -33,7 +33,7 @@ int id128_pretty_print(sd_id128_t id, bool pretty) { printf("As string:\n" "%s" SD_ID128_FORMAT_STR "%s\n\n" "As UUID:\n" - "%s%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x%s\n\n" + "%s" SD_ID128_UUID_FORMAT_STR "%s\n\n" "As %s macro:\n" "%s#define MESSAGE_XYZ SD_ID128_MAKE(", on, SD_ID128_FORMAT_VAL(id), off,