dissect-image: port to varlink_callbo_and_log()

This commit is contained in:
Lennart Poettering
2025-06-05 14:28:31 +02:00
parent a589e1bd9e
commit 01e82dfa96
+5 -8
View File
@@ -67,6 +67,7 @@
#include "time-util.h"
#include "udev-util.h"
#include "user-util.h"
#include "varlink-util.h"
#include "xattr-util.h"
/* how many times to wait for the device nodes to appear */
@@ -4586,7 +4587,7 @@ int mountfsd_mount_image(
}
sd_json_variant *reply = NULL;
r = sd_varlink_callbo(
r = varlink_callbo_and_log(
vl,
"io.systemd.MountFileSystem.MountImage",
&reply,
@@ -4598,9 +4599,7 @@ int mountfsd_mount_image(
SD_JSON_BUILD_PAIR_CONDITION(!!ps, "imagePolicy", SD_JSON_BUILD_STRING(ps)),
SD_JSON_BUILD_PAIR("allowInteractiveAuthentication", SD_JSON_BUILD_BOOLEAN(FLAGS_SET(flags, DISSECT_IMAGE_ALLOW_INTERACTIVE_AUTH))));
if (r < 0)
return log_error_errno(r, "Failed to call MountImage() varlink call: %m");
if (!isempty(error_id))
return log_error_errno(sd_varlink_error_to_errno(error_id, reply), "Failed to call MountImage() varlink call: %s", error_id);
return r;
r = sd_json_dispatch(reply, dispatch_table, SD_JSON_ALLOW_EXTENSIONS, &p);
if (r < 0)
@@ -4723,7 +4722,7 @@ int mountfsd_mount_directory(
sd_json_variant *reply = NULL;
const char *error_id = NULL;
r = sd_varlink_callbo(
r = varlink_callbo_and_log(
vl,
"io.systemd.MountFileSystem.MountDirectory",
&reply,
@@ -4735,9 +4734,7 @@ int mountfsd_mount_directory(
FLAGS_SET(flags, DISSECT_IMAGE_IDENTITY_UID) ? "identity" : "auto"),
SD_JSON_BUILD_PAIR_BOOLEAN("allowInteractiveAuthentication", FLAGS_SET(flags, DISSECT_IMAGE_ALLOW_INTERACTIVE_AUTH)));
if (r < 0)
return log_error_errno(r, "Failed to call MountDirectory() varlink call: %m");
if (!isempty(error_id))
return log_error_errno(sd_varlink_error_to_errno(error_id, reply), "Failed to call MountDirectory() varlink call: %s", error_id);
return r;
static const sd_json_dispatch_field dispatch_table[] = {
{ "mountFileDescriptor", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint, 0, SD_JSON_MANDATORY },