summaryrefslogtreecommitdiff
path: root/src/partition
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2022-11-29 12:06:35 +0100
committerLennart Poettering <lennart@poettering.net>2022-11-29 12:07:15 +0100
commit63b96eb9b3fde23d3d3dfbc44adc6bc3d36c2736 (patch)
tree5604fcdff4279e4b5d8397883507bf402aa12c9e /src/partition
parent02e32aa62958eb49d97540985f95bd79b2f59ccc (diff)
downloadsystemd-63b96eb9b3fde23d3d3dfbc44adc6bc3d36c2736.tar.gz
fdisk-util: add fdisk_partition_get_type_as_id128() helper
Let's also add an easy accessor for the other per-partition UUID.
Diffstat (limited to 'src/partition')
-rw-r--r--src/partition/repart.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/partition/repart.c b/src/partition/repart.c
index 375df04ad7..95672f240d 100644
--- a/src/partition/repart.c
+++ b/src/partition/repart.c
@@ -2092,8 +2092,7 @@ static int context_load_partition_table(
_cleanup_free_ char *label_copy = NULL;
Partition *last = NULL;
struct fdisk_partition *p;
- struct fdisk_parttype *pt;
- const char *pts, *label;
+ const char *label;
uint64_t sz, start;
bool found = false;
sd_id128_t ptid, id;
@@ -2111,17 +2110,9 @@ static int context_load_partition_table(
fdisk_partition_has_partno(p) <= 0)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Found a partition without a position, size or number.");
- pt = fdisk_partition_get_type(p);
- if (!pt)
- return log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to acquire type of partition: %m");
-
- pts = fdisk_parttype_get_string(pt);
- if (!pts)
- return log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to acquire type of partition as string: %m");
-
- r = sd_id128_from_string(pts, &ptid);
+ r = fdisk_partition_get_type_as_id128(p, &ptid);
if (r < 0)
- return log_error_errno(r, "Failed to parse partition type UUID %s: %m", pts);
+ return log_error_errno(r, "Failed to query partition type UUID: %m");
r = fdisk_partition_get_uuid_as_id128(p, &id);
if (r < 0)