From 92e720281250aab9cd2728964c9d38d93b5b2013 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 15 Sep 2022 17:48:16 +0200 Subject: headers: export partition uuids and flags in new sd-gpt.h file I think those constants are generally useful. It's quite easy to make a mistake when copying things from the docs, so let's make them easy and convenient to access. --- src/sysupdate/sysupdate-partition.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/sysupdate') diff --git a/src/sysupdate/sysupdate-partition.c b/src/sysupdate/sysupdate-partition.c index f3e21001e4..812007fa3b 100644 --- a/src/sysupdate/sysupdate-partition.c +++ b/src/sysupdate/sysupdate-partition.c @@ -48,11 +48,11 @@ static int fdisk_partition_get_attrs_as_uint64( break; if (streq(word, "RequiredPartition")) - flags |= GPT_FLAG_REQUIRED_PARTITION; + flags |= SD_GPT_FLAG_REQUIRED_PARTITION; else if (streq(word, "NoBlockIOProtocol")) - flags |= GPT_FLAG_NO_BLOCK_IO_PROTOCOL; + flags |= SD_GPT_FLAG_NO_BLOCK_IO_PROTOCOL; else if (streq(word, "LegacyBIOSBootable")) - flags |= GPT_FLAG_LEGACY_BIOS_BOOTABLE; + flags |= SD_GPT_FLAG_LEGACY_BIOS_BOOTABLE; else { const char *e; unsigned u; @@ -188,9 +188,9 @@ int read_partition_info( .uuid = id, .label = TAKE_PTR(label_copy), .device = TAKE_PTR(device), - .no_auto = FLAGS_SET(flags, GPT_FLAG_NO_AUTO) && gpt_partition_type_knows_no_auto(ptid), - .read_only = FLAGS_SET(flags, GPT_FLAG_READ_ONLY) && gpt_partition_type_knows_read_only(ptid), - .growfs = FLAGS_SET(flags, GPT_FLAG_GROWFS) && gpt_partition_type_knows_growfs(ptid), + .no_auto = FLAGS_SET(flags, SD_GPT_FLAG_NO_AUTO) && gpt_partition_type_knows_no_auto(ptid), + .read_only = FLAGS_SET(flags, SD_GPT_FLAG_READ_ONLY) && gpt_partition_type_knows_read_only(ptid), + .growfs = FLAGS_SET(flags, SD_GPT_FLAG_GROWFS) && gpt_partition_type_knows_growfs(ptid), }; return 1; /* found! */ @@ -332,11 +332,11 @@ int patch_partition( flags = info->flags; if (tweak_no_auto) - SET_FLAG(flags, GPT_FLAG_NO_AUTO, info->no_auto); + SET_FLAG(flags, SD_GPT_FLAG_NO_AUTO, info->no_auto); if (tweak_read_only) - SET_FLAG(flags, GPT_FLAG_READ_ONLY, info->read_only); + SET_FLAG(flags, SD_GPT_FLAG_READ_ONLY, info->read_only); if (tweak_growfs) - SET_FLAG(flags, GPT_FLAG_GROWFS, info->growfs); + SET_FLAG(flags, SD_GPT_FLAG_GROWFS, info->growfs); r = fdisk_partition_set_attrs_as_uint64(pa, flags); if (r < 0) @@ -354,11 +354,11 @@ int patch_partition( new_flags = old_flags; if (tweak_no_auto) - SET_FLAG(new_flags, GPT_FLAG_NO_AUTO, info->no_auto); + SET_FLAG(new_flags, SD_GPT_FLAG_NO_AUTO, info->no_auto); if (tweak_read_only) - SET_FLAG(new_flags, GPT_FLAG_READ_ONLY, info->read_only); + SET_FLAG(new_flags, SD_GPT_FLAG_READ_ONLY, info->read_only); if (tweak_growfs) - SET_FLAG(new_flags, GPT_FLAG_GROWFS, info->growfs); + SET_FLAG(new_flags, SD_GPT_FLAG_GROWFS, info->growfs); if (new_flags != old_flags) { r = fdisk_partition_set_attrs_as_uint64(pa, new_flags); -- cgit v1.2.1