summaryrefslogtreecommitdiffstats
path: root/src/mountfsd
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-06-18 17:08:49 +0200
committerLennart Poettering <lennart@poettering.net>2024-06-19 22:50:02 +0200
commitbe5bee2a132d2d3b45d79bb3f27b05bbc767cd0a (patch)
tree7bf23c1e6ecb5289bbbb44e6e7492f764a4340bb /src/mountfsd
parentsd-json: add sd_json_build() wrapper macro that implies SD_JSON_BUILD_OBJECT() (diff)
downloadsystemd-be5bee2a132d2d3b45d79bb3f27b05bbc767cd0a.tar.xz
systemd-be5bee2a132d2d3b45d79bb3f27b05bbc767cd0a.zip
tree-wide: port over to new builder apis
Diffstat (limited to 'src/mountfsd')
-rw-r--r--src/mountfsd/mountwork.c44
1 files changed, 20 insertions, 24 deletions
diff --git a/src/mountfsd/mountwork.c b/src/mountfsd/mountwork.c
index 27d9cc3d2d..cfeb8b60e8 100644
--- a/src/mountfsd/mountwork.c
+++ b/src/mountfsd/mountwork.c
@@ -487,7 +487,6 @@ static int vl_method_mount_image(
return r;
for (PartitionDesignator d = 0; d < _PARTITION_DESIGNATOR_MAX; d++) {
- _cleanup_(sd_json_variant_unrefp) sd_json_variant *pj = NULL;
DissectedPartition *pp = di->partitions + d;
int fd_idx;
@@ -509,35 +508,32 @@ static int vl_method_mount_image(
TAKE_FD(pp->fsmount_fd);
- r = sd_json_build(&pj,
- SD_JSON_BUILD_OBJECT(
- SD_JSON_BUILD_PAIR("designator", SD_JSON_BUILD_STRING(partition_designator_to_string(d))),
- SD_JSON_BUILD_PAIR("writable", SD_JSON_BUILD_BOOLEAN(pp->rw)),
- SD_JSON_BUILD_PAIR("growFileSystem", SD_JSON_BUILD_BOOLEAN(pp->growfs)),
- SD_JSON_BUILD_PAIR_CONDITION(pp->partno > 0, "partitionNumber", SD_JSON_BUILD_INTEGER(pp->partno)),
- SD_JSON_BUILD_PAIR_CONDITION(pp->architecture > 0, "architecture", SD_JSON_BUILD_STRING(architecture_to_string(pp->architecture))),
- SD_JSON_BUILD_PAIR_CONDITION(!sd_id128_is_null(pp->uuid), "partitionUuid", SD_JSON_BUILD_UUID(pp->uuid)),
- SD_JSON_BUILD_PAIR("fileSystemType", SD_JSON_BUILD_STRING(dissected_partition_fstype(pp))),
- SD_JSON_BUILD_PAIR_CONDITION(!!pp->label, "partitionLabel", SD_JSON_BUILD_STRING(pp->label)),
- SD_JSON_BUILD_PAIR("size", SD_JSON_BUILD_INTEGER(pp->size)),
- SD_JSON_BUILD_PAIR("offset", SD_JSON_BUILD_INTEGER(pp->offset)),
- SD_JSON_BUILD_PAIR("mountFileDescriptor", SD_JSON_BUILD_INTEGER(fd_idx))));
- if (r < 0)
- return r;
-
- r = sd_json_variant_append_array(&aj, pj);
+ r = sd_json_variant_append_arraybo(
+ &aj,
+ SD_JSON_BUILD_PAIR("designator", SD_JSON_BUILD_STRING(partition_designator_to_string(d))),
+ SD_JSON_BUILD_PAIR("writable", SD_JSON_BUILD_BOOLEAN(pp->rw)),
+ SD_JSON_BUILD_PAIR("growFileSystem", SD_JSON_BUILD_BOOLEAN(pp->growfs)),
+ SD_JSON_BUILD_PAIR_CONDITION(pp->partno > 0, "partitionNumber", SD_JSON_BUILD_INTEGER(pp->partno)),
+ SD_JSON_BUILD_PAIR_CONDITION(pp->architecture > 0, "architecture", SD_JSON_BUILD_STRING(architecture_to_string(pp->architecture))),
+ SD_JSON_BUILD_PAIR_CONDITION(!sd_id128_is_null(pp->uuid), "partitionUuid", SD_JSON_BUILD_UUID(pp->uuid)),
+ SD_JSON_BUILD_PAIR("fileSystemType", SD_JSON_BUILD_STRING(dissected_partition_fstype(pp))),
+ SD_JSON_BUILD_PAIR_CONDITION(!!pp->label, "partitionLabel", SD_JSON_BUILD_STRING(pp->label)),
+ SD_JSON_BUILD_PAIR("size", SD_JSON_BUILD_INTEGER(pp->size)),
+ SD_JSON_BUILD_PAIR("offset", SD_JSON_BUILD_INTEGER(pp->offset)),
+ SD_JSON_BUILD_PAIR("mountFileDescriptor", SD_JSON_BUILD_INTEGER(fd_idx)));
if (r < 0)
return r;
}
loop_device_relinquish(loop);
- r = varlink_replyb(link, SD_JSON_BUILD_OBJECT(
- SD_JSON_BUILD_PAIR("partitions", SD_JSON_BUILD_VARIANT(aj)),
- SD_JSON_BUILD_PAIR("imagePolicy", SD_JSON_BUILD_STRING(ps)),
- SD_JSON_BUILD_PAIR("imageSize", SD_JSON_BUILD_INTEGER(di->image_size)),
- SD_JSON_BUILD_PAIR("sectorSize", SD_JSON_BUILD_INTEGER(di->sector_size)),
- SD_JSON_BUILD_PAIR_CONDITION(!sd_id128_is_null(di->image_uuid), "imageUuid", SD_JSON_BUILD_UUID(di->image_uuid))));
+ r = varlink_replybo(
+ link,
+ SD_JSON_BUILD_PAIR("partitions", SD_JSON_BUILD_VARIANT(aj)),
+ SD_JSON_BUILD_PAIR("imagePolicy", SD_JSON_BUILD_STRING(ps)),
+ SD_JSON_BUILD_PAIR("imageSize", SD_JSON_BUILD_INTEGER(di->image_size)),
+ SD_JSON_BUILD_PAIR("sectorSize", SD_JSON_BUILD_INTEGER(di->sector_size)),
+ SD_JSON_BUILD_PAIR_CONDITION(!sd_id128_is_null(di->image_uuid), "imageUuid", SD_JSON_BUILD_UUID(di->image_uuid)));
if (r < 0)
return r;