Include a coccinelle script that patches this automatically.
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+@@
+expression key, val;
+@@
+- SD_JSON_BUILD_PAIR(key, SD_JSON_BUILD_BOOLEAN(val))
++ SD_JSON_BUILD_PAIR_BOOLEAN(key, val)
+@@
+expression key, val;
+@@
+- SD_JSON_BUILD_PAIR(key, SD_JSON_BUILD_INTEGER(val))
++ SD_JSON_BUILD_PAIR_INTEGER(key, val)
+@@
+expression key, val;
+@@
+- SD_JSON_BUILD_PAIR(key, SD_JSON_BUILD_STRING(val))
++ SD_JSON_BUILD_PAIR_STRING(key, val)
+@@
+expression key, val;
+@@
+- SD_JSON_BUILD_PAIR(key, SD_JSON_BUILD_UNSIGNED(val))
++ SD_JSON_BUILD_PAIR_UNSIGNED(key, val)
+@@
+expression key, val;
+@@
+- SD_JSON_BUILD_PAIR(key, SD_JSON_BUILD_VARIANT(val))
++ SD_JSON_BUILD_PAIR_VARIANT(key, val)
sd_json_variant_sensitive(vl);
- return sd_varlink_replybo(link, SD_JSON_BUILD_PAIR("passwords", SD_JSON_BUILD_VARIANT(vl)));
+ return sd_varlink_replybo(link, SD_JSON_BUILD_PAIR_VARIANT("passwords", vl));
}
static int vl_server(void) {
r = sd_json_buildo(
&v,
- SD_JSON_BUILD_PAIR("name", SD_JSON_BUILD_STRING(bn)),
+ SD_JSON_BUILD_PAIR_STRING("name", bn),
SD_JSON_BUILD_PAIR_CONDITION(size != UINT64_MAX, "size", SD_JSON_BUILD_INTEGER(size)),
- SD_JSON_BUILD_PAIR("sectorSize", SD_JSON_BUILD_INTEGER(m->sector_size)),
+ SD_JSON_BUILD_PAIR_INTEGER("sectorSize", m->sector_size),
SD_JSON_BUILD_PAIR_CONDITION(a >= 0, "architecture", SD_JSON_BUILD_STRING(architecture_to_string(a))),
SD_JSON_BUILD_PAIR_CONDITION(!sd_id128_is_null(m->image_uuid), "imageUuid", SD_JSON_BUILD_UUID(m->image_uuid)),
SD_JSON_BUILD_PAIR_CONDITION(!!m->hostname, "hostname", SD_JSON_BUILD_STRING(m->hostname)),
SD_JSON_BUILD_PAIR_CONDITION(!strv_isempty(m->initrd_release), "initrdRelease", JSON_BUILD_STRV_ENV_PAIR(m->initrd_release)),
SD_JSON_BUILD_PAIR_CONDITION(!strv_isempty(m->sysext_release), "sysextRelease", JSON_BUILD_STRV_ENV_PAIR(m->sysext_release)),
SD_JSON_BUILD_PAIR_CONDITION(!strv_isempty(m->confext_release), "confextRelease", JSON_BUILD_STRV_ENV_PAIR(m->confext_release)),
- SD_JSON_BUILD_PAIR("useBootableUefi", SD_JSON_BUILD_BOOLEAN(dissected_image_is_bootable_uefi(m))),
- SD_JSON_BUILD_PAIR("useBootableContainer", SD_JSON_BUILD_BOOLEAN(dissected_image_is_bootable_os(m))),
- SD_JSON_BUILD_PAIR("useInitrd", SD_JSON_BUILD_BOOLEAN(dissected_image_is_initrd(m))),
- SD_JSON_BUILD_PAIR("usePortableService", SD_JSON_BUILD_BOOLEAN(dissected_image_is_portable(m))),
- SD_JSON_BUILD_PAIR("useSystemExtension", SD_JSON_BUILD_BOOLEAN(strv_contains(sysext_scopes, "system"))),
- SD_JSON_BUILD_PAIR("useInitRDSystemExtension", SD_JSON_BUILD_BOOLEAN(strv_contains(sysext_scopes, "initrd"))),
- SD_JSON_BUILD_PAIR("usePortableSystemExtension", SD_JSON_BUILD_BOOLEAN(strv_contains(sysext_scopes, "portable"))),
- SD_JSON_BUILD_PAIR("useConfigurationExtension", SD_JSON_BUILD_BOOLEAN(strv_contains(confext_scopes, "system"))),
- SD_JSON_BUILD_PAIR("useInitRDConfigurationExtension", SD_JSON_BUILD_BOOLEAN(strv_contains(confext_scopes, "initrd"))),
- SD_JSON_BUILD_PAIR("usePortableConfigurationExtension", SD_JSON_BUILD_BOOLEAN(strv_contains(confext_scopes, "portable"))));
+ SD_JSON_BUILD_PAIR_BOOLEAN("useBootableUefi", dissected_image_is_bootable_uefi(m)),
+ SD_JSON_BUILD_PAIR_BOOLEAN("useBootableContainer", dissected_image_is_bootable_os(m)),
+ SD_JSON_BUILD_PAIR_BOOLEAN("useInitrd", dissected_image_is_initrd(m)),
+ SD_JSON_BUILD_PAIR_BOOLEAN("usePortableService", dissected_image_is_portable(m)),
+ SD_JSON_BUILD_PAIR_BOOLEAN("useSystemExtension", strv_contains(sysext_scopes, "system")),
+ SD_JSON_BUILD_PAIR_BOOLEAN("useInitRDSystemExtension", strv_contains(sysext_scopes, "initrd")),
+ SD_JSON_BUILD_PAIR_BOOLEAN("usePortableSystemExtension", strv_contains(sysext_scopes, "portable")),
+ SD_JSON_BUILD_PAIR_BOOLEAN("useConfigurationExtension", strv_contains(confext_scopes, "system")),
+ SD_JSON_BUILD_PAIR_BOOLEAN("useInitRDConfigurationExtension", strv_contains(confext_scopes, "initrd")),
+ SD_JSON_BUILD_PAIR_BOOLEAN("usePortableConfigurationExtension", strv_contains(confext_scopes, "portable")));
if (r < 0)
return log_oom();
}
assert(t);
r = sd_json_buildo(ret,
- SD_JSON_BUILD_PAIR("id", SD_JSON_BUILD_UNSIGNED(t->id)),
+ SD_JSON_BUILD_PAIR_UNSIGNED("id", t->id),
SD_JSON_BUILD_PAIR("type", JSON_BUILD_STRING_UNDERSCORIFY(transfer_type_to_string(t->type))),
- SD_JSON_BUILD_PAIR("remote", SD_JSON_BUILD_STRING(t->remote)),
- SD_JSON_BUILD_PAIR("local", SD_JSON_BUILD_STRING(t->local)),
+ SD_JSON_BUILD_PAIR_STRING("remote", t->remote),
+ SD_JSON_BUILD_PAIR_STRING("local", t->local),
SD_JSON_BUILD_PAIR("class", JSON_BUILD_STRING_UNDERSCORIFY(image_class_to_string(t->class))),
- SD_JSON_BUILD_PAIR("percent", SD_JSON_BUILD_REAL(transfer_percent_as_double(t))));
+ SD_JSON_BUILD_PAIR_REAL("percent", transfer_percent_as_double(t)));
if (r < 0)
return log_error_errno(r, "Failed to build transfer JSON data: %m");
/* If more was not set, just return the download id, and be done with it */
if (!FLAGS_SET(flags, SD_VARLINK_METHOD_MORE))
- return sd_varlink_replybo(link, SD_JSON_BUILD_PAIR("id", SD_JSON_BUILD_UNSIGNED(t->id)));
+ return sd_varlink_replybo(link, SD_JSON_BUILD_PAIR_UNSIGNED("id", t->id));
/* Otherwise add this connection to the set of subscriptions, return the id, but keep the thing running */
r = set_ensure_put(&t->varlink_subscribed, &varlink_hash_ops, link);
sd_varlink_ref(link);
- r = sd_varlink_notifybo(link, SD_JSON_BUILD_PAIR("id", SD_JSON_BUILD_UNSIGNED(t->id)));
+ r = sd_varlink_notifybo(link, SD_JSON_BUILD_PAIR_UNSIGNED("id", t->id));
if (r < 0)
return r;
}
}
} else if (VARLINK_STATE_WANTS_REPLY(v->state)) {
- r = sd_varlink_errorbo(v, SD_VARLINK_ERROR_METHOD_NOT_FOUND, SD_JSON_BUILD_PAIR("method", SD_JSON_BUILD_STRING(method)));
+ r = sd_varlink_errorbo(v, SD_VARLINK_ERROR_METHOD_NOT_FOUND, SD_JSON_BUILD_PAIR_STRING("method", method));
/* If we didn't manage to enqueue an error response, then fail the connection completely. */
if (r < 0 && VARLINK_STATE_WANTS_REPLY(v->state))
goto fail;
r = sd_json_buildo(
&m,
- SD_JSON_BUILD_PAIR("method", SD_JSON_BUILD_STRING(method)),
+ SD_JSON_BUILD_PAIR_STRING("method", method),
JSON_BUILD_PAIR_VARIANT_NON_EMPTY("parameters", parameters),
- SD_JSON_BUILD_PAIR("oneway", SD_JSON_BUILD_BOOLEAN(true)));
+ SD_JSON_BUILD_PAIR_BOOLEAN("oneway", true));
if (r < 0)
return varlink_log_errno(v, r, "Failed to build json message: %m");
r = sd_json_buildo(
&m,
- SD_JSON_BUILD_PAIR("method", SD_JSON_BUILD_STRING(method)),
+ SD_JSON_BUILD_PAIR_STRING("method", method),
JSON_BUILD_PAIR_VARIANT_NON_EMPTY("parameters", parameters));
if (r < 0)
return varlink_log_errno(v, r, "Failed to build json message: %m");
r = sd_json_buildo(
&m,
- SD_JSON_BUILD_PAIR("method", SD_JSON_BUILD_STRING(method)),
+ SD_JSON_BUILD_PAIR_STRING("method", method),
JSON_BUILD_PAIR_VARIANT_NON_EMPTY("parameters", parameters),
- SD_JSON_BUILD_PAIR("more", SD_JSON_BUILD_BOOLEAN(true)));
+ SD_JSON_BUILD_PAIR_BOOLEAN("more", true));
if (r < 0)
return varlink_log_errno(v, r, "Failed to build json message: %m");
r = sd_json_buildo(
&m,
- SD_JSON_BUILD_PAIR("method", SD_JSON_BUILD_STRING(method)),
+ SD_JSON_BUILD_PAIR_STRING("method", method),
JSON_BUILD_PAIR_VARIANT_NON_EMPTY("parameters", parameters));
if (r < 0)
return varlink_log_errno(v, r, "Failed to build json message: %m");
r = sd_json_buildo(
&m,
- SD_JSON_BUILD_PAIR("method", SD_JSON_BUILD_STRING(method)),
+ SD_JSON_BUILD_PAIR_STRING("method", method),
JSON_BUILD_PAIR_VARIANT_NON_EMPTY("parameters", parameters),
- SD_JSON_BUILD_PAIR("more", SD_JSON_BUILD_BOOLEAN(true)));
+ SD_JSON_BUILD_PAIR_BOOLEAN("more", true));
if (r < 0)
return varlink_log_errno(v, r, "Failed to build json message: %m");
r = sd_json_buildo(
&m,
- SD_JSON_BUILD_PAIR("error", SD_JSON_BUILD_STRING(error_id)),
+ SD_JSON_BUILD_PAIR_STRING("error", error_id),
JSON_BUILD_PAIR_VARIANT_NON_EMPTY("parameters", parameters));
if (r < 0)
return varlink_log_errno(v, r, "Failed to build json message: %m");
if (sd_json_variant_is_string(parameters)) {
_cleanup_(sd_json_variant_unrefp) sd_json_variant *parameters_obj = NULL;
- r = sd_json_buildo(¶meters_obj,SD_JSON_BUILD_PAIR("parameter", SD_JSON_BUILD_VARIANT(parameters)));
+ r = sd_json_buildo(¶meters_obj,SD_JSON_BUILD_PAIR_VARIANT("parameter", parameters));
if (r < 0)
return r;
sd_json_variant_elements(parameters) > 0) {
_cleanup_(sd_json_variant_unrefp) sd_json_variant *parameters_obj = NULL;
- r = sd_json_buildo(¶meters_obj, SD_JSON_BUILD_PAIR("parameter", SD_JSON_BUILD_VARIANT(sd_json_variant_by_index(parameters, 0))));
+ r = sd_json_buildo(¶meters_obj, SD_JSON_BUILD_PAIR_VARIANT("parameter", sd_json_variant_by_index(parameters, 0)));
if (r < 0)
return r;
return sd_varlink_errorbo(
v,
SD_VARLINK_ERROR_INVALID_PARAMETER,
- SD_JSON_BUILD_PAIR("parameter", SD_JSON_BUILD_STRING(name)));
+ SD_JSON_BUILD_PAIR_STRING("parameter", name));
}
_public_ int sd_varlink_error_errno(sd_varlink *v, int error) {
r = sd_json_buildo(
&m,
JSON_BUILD_PAIR_VARIANT_NON_EMPTY("parameters", parameters),
- SD_JSON_BUILD_PAIR("continues", SD_JSON_BUILD_BOOLEAN(true)));
+ SD_JSON_BUILD_PAIR_BOOLEAN("continues", true));
if (r < 0)
return varlink_log_errno(v, r, "Failed to build json message: %m");
return sd_json_buildo(
ret,
SD_JSON_BUILD_PAIR("record", SD_JSON_BUILD_OBJECT(
- SD_JSON_BUILD_PAIR("userName", SD_JSON_BUILD_STRING(user_name)),
- SD_JSON_BUILD_PAIR("uid", SD_JSON_BUILD_UNSIGNED(uid)),
- SD_JSON_BUILD_PAIR("gid", SD_JSON_BUILD_UNSIGNED(GID_NOBODY)),
+ SD_JSON_BUILD_PAIR_STRING("userName", user_name),
+ SD_JSON_BUILD_PAIR_UNSIGNED("uid", uid),
+ SD_JSON_BUILD_PAIR_UNSIGNED("gid", GID_NOBODY),
SD_JSON_BUILD_PAIR_CONDITION(!isempty(real_name), "realName", SD_JSON_BUILD_STRING(real_name)),
SD_JSON_BUILD_PAIR("homeDirectory", JSON_BUILD_CONST_STRING("/")),
SD_JSON_BUILD_PAIR("shell", JSON_BUILD_CONST_STRING(NOLOGIN)),
- SD_JSON_BUILD_PAIR("locked", SD_JSON_BUILD_BOOLEAN(true)),
+ SD_JSON_BUILD_PAIR_BOOLEAN("locked", true),
SD_JSON_BUILD_PAIR("service", JSON_BUILD_CONST_STRING("io.systemd.Machine")),
SD_JSON_BUILD_PAIR("disposition", JSON_BUILD_CONST_STRING("container")))));
}
return sd_json_buildo(
ret,
SD_JSON_BUILD_PAIR("record", SD_JSON_BUILD_OBJECT(
- SD_JSON_BUILD_PAIR("groupName", SD_JSON_BUILD_STRING(group_name)),
- SD_JSON_BUILD_PAIR("gid", SD_JSON_BUILD_UNSIGNED(gid)),
+ SD_JSON_BUILD_PAIR_STRING("groupName", group_name),
+ SD_JSON_BUILD_PAIR_UNSIGNED("gid", gid),
SD_JSON_BUILD_PAIR_CONDITION(!isempty(description), "description", SD_JSON_BUILD_STRING(description)),
SD_JSON_BUILD_PAIR("service", JSON_BUILD_CONST_STRING("io.systemd.Machine")),
SD_JSON_BUILD_PAIR("disposition", JSON_BUILD_CONST_STRING("container")))));
r = sd_json_variant_append_arraybo(
&array,
SD_JSON_BUILD_PAIR_CONDITION(!isempty(*phase), "phase", SD_JSON_BUILD_STRING(*phase)),
- SD_JSON_BUILD_PAIR("pcr", SD_JSON_BUILD_INTEGER(TPM2_PCR_KERNEL_BOOT)),
- SD_JSON_BUILD_PAIR("hash", SD_JSON_BUILD_HEX(pcr_states[i].value, pcr_states[i].value_size)));
+ SD_JSON_BUILD_PAIR_INTEGER("pcr", TPM2_PCR_KERNEL_BOOT),
+ SD_JSON_BUILD_PAIR_HEX("hash", pcr_states[i].value, pcr_states[i].value_size));
if (r < 0)
return log_error_errno(r, "Failed to append JSON object to array: %m");
_cleanup_(sd_json_variant_unrefp) sd_json_variant *bv = NULL;
r = sd_json_buildo(&bv,
- SD_JSON_BUILD_PAIR("pcrs", SD_JSON_BUILD_VARIANT(a)), /* PCR mask */
+ SD_JSON_BUILD_PAIR_VARIANT("pcrs", a), /* PCR mask */
SD_JSON_BUILD_PAIR_CONDITION(pubkey_fp_size > 0, "pkfp", SD_JSON_BUILD_HEX(pubkey_fp, pubkey_fp_size)), /* SHA256 fingerprint of public key (DER) used for the signature */
- SD_JSON_BUILD_PAIR("pol", SD_JSON_BUILD_HEX(pcr_policy_digest.buffer, pcr_policy_digest.size)), /* TPM2 policy hash that is signed */
+ SD_JSON_BUILD_PAIR_HEX("pol", pcr_policy_digest.buffer, pcr_policy_digest.size), /* TPM2 policy hash that is signed */
SD_JSON_BUILD_PAIR_CONDITION(ss > 0, "sig", SD_JSON_BUILD_BASE64(sig, ss))); /* signature data */
if (r < 0)
return log_error_errno(r, "Failed to build JSON object: %m");
r = sd_json_buildo(
&bv,
- SD_JSON_BUILD_PAIR("pcr", SD_JSON_BUILD_INTEGER(TPM2_PCR_KERNEL_BOOT)),
- SD_JSON_BUILD_PAIR("hash", SD_JSON_BUILD_HEX(h, l)));
+ SD_JSON_BUILD_PAIR_INTEGER("pcr", TPM2_PCR_KERNEL_BOOT),
+ SD_JSON_BUILD_PAIR_HEX("hash", h, l));
if (r < 0)
return log_error_errno(r, "Failed to build JSON object: %m");
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_STRING("designator", partition_designator_to_string(d)),
+ SD_JSON_BUILD_PAIR_BOOLEAN("writable", pp->rw),
+ SD_JSON_BUILD_PAIR_BOOLEAN("growFileSystem", 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_STRING("fileSystemType", 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_UNSIGNED(pp->size)),
- SD_JSON_BUILD_PAIR("offset", SD_JSON_BUILD_UNSIGNED(pp->offset)),
- SD_JSON_BUILD_PAIR("mountFileDescriptor", SD_JSON_BUILD_INTEGER(fd_idx)),
+ SD_JSON_BUILD_PAIR_UNSIGNED("size", pp->size),
+ SD_JSON_BUILD_PAIR_UNSIGNED("offset", pp->offset),
+ SD_JSON_BUILD_PAIR_INTEGER("mountFileDescriptor", fd_idx),
JSON_BUILD_PAIR_STRV_NON_EMPTY("mountPoint", l));
if (r < 0)
return r;
return sd_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_UNSIGNED(di->image_size)),
- SD_JSON_BUILD_PAIR("sectorSize", SD_JSON_BUILD_UNSIGNED(di->sector_size)),
+ SD_JSON_BUILD_PAIR_VARIANT("partitions", aj),
+ SD_JSON_BUILD_PAIR_STRING("imagePolicy", ps),
+ SD_JSON_BUILD_PAIR_UNSIGNED("imageSize", di->image_size),
+ SD_JSON_BUILD_PAIR_UNSIGNED("sectorSize", di->sector_size),
SD_JSON_BUILD_PAIR_CONDITION(!sd_id128_is_null(di->image_uuid), "imageUuid", SD_JSON_BUILD_UUID(di->image_uuid)));
}
return sd_varlink_replybo(
link,
- SD_JSON_BUILD_PAIR("mountFileDescriptor", SD_JSON_BUILD_INTEGER(fd_idx)));
+ SD_JSON_BUILD_PAIR_INTEGER("mountFileDescriptor", fd_idx));
}
typedef struct MakeDirectoryParameters {
return sd_varlink_replybo(
link,
- SD_JSON_BUILD_PAIR("directoryFileDescriptor", SD_JSON_BUILD_INTEGER(fd_idx)));
+ SD_JSON_BUILD_PAIR_INTEGER("directoryFileDescriptor", fd_idx));
fail:
(void) unlinkat(parent_fd, t ?: p.name, AT_REMOVEDIR);
return sd_json_buildo(
ret,
- SD_JSON_BUILD_PAIR("userName", SD_JSON_BUILD_STRING(name)),
- SD_JSON_BUILD_PAIR("uid", SD_JSON_BUILD_UNSIGNED(userns_info->start_uid + offset)),
- SD_JSON_BUILD_PAIR("gid", SD_JSON_BUILD_UNSIGNED(GID_NOBODY)),
- SD_JSON_BUILD_PAIR("realName", SD_JSON_BUILD_STRING(realname)),
+ SD_JSON_BUILD_PAIR_STRING("userName", name),
+ SD_JSON_BUILD_PAIR_UNSIGNED("uid", userns_info->start_uid + offset),
+ SD_JSON_BUILD_PAIR_UNSIGNED("gid", GID_NOBODY),
+ SD_JSON_BUILD_PAIR_STRING("realName", realname),
SD_JSON_BUILD_PAIR("homeDirectory", JSON_BUILD_CONST_STRING("/")),
- SD_JSON_BUILD_PAIR("shell", SD_JSON_BUILD_STRING(NOLOGIN)),
- SD_JSON_BUILD_PAIR("locked", SD_JSON_BUILD_BOOLEAN(true)),
+ SD_JSON_BUILD_PAIR_STRING("shell", NOLOGIN),
+ SD_JSON_BUILD_PAIR_BOOLEAN("locked", true),
SD_JSON_BUILD_PAIR("service", JSON_BUILD_CONST_STRING("io.systemd.NamespaceResource")),
- SD_JSON_BUILD_PAIR("disposition", SD_JSON_BUILD_STRING(user_disposition_to_string(disposition))));
+ SD_JSON_BUILD_PAIR_STRING("disposition", user_disposition_to_string(disposition)));
}
static int vl_method_get_user_record(sd_varlink *link, sd_json_variant *parameters, sd_varlink_method_flags_t flags, void *userdata) {
if (r < 0)
return r;
- return sd_varlink_replybo(link, SD_JSON_BUILD_PAIR("record", SD_JSON_BUILD_VARIANT(v)));
+ return sd_varlink_replybo(link, SD_JSON_BUILD_PAIR_VARIANT("record", v));
not_found:
return sd_varlink_error(link, "io.systemd.UserDatabase.NoRecordFound", NULL);
return sd_json_buildo(
ret,
- SD_JSON_BUILD_PAIR("groupName", SD_JSON_BUILD_STRING(name)),
- SD_JSON_BUILD_PAIR("gid", SD_JSON_BUILD_UNSIGNED(userns_info->start_gid + offset)),
- SD_JSON_BUILD_PAIR("description", SD_JSON_BUILD_STRING(description)),
+ SD_JSON_BUILD_PAIR_STRING("groupName", name),
+ SD_JSON_BUILD_PAIR_UNSIGNED("gid", userns_info->start_gid + offset),
+ SD_JSON_BUILD_PAIR_STRING("description", description),
SD_JSON_BUILD_PAIR("service", JSON_BUILD_CONST_STRING("io.systemd.NamespaceResource")),
- SD_JSON_BUILD_PAIR("disposition", SD_JSON_BUILD_STRING(user_disposition_to_string(disposition))));
+ SD_JSON_BUILD_PAIR_STRING("disposition", user_disposition_to_string(disposition)));
}
static int vl_method_get_group_record(sd_varlink *link, sd_json_variant *parameters, sd_varlink_method_flags_t flags, void *userdata) {
if (r < 0)
return r;
- return sd_varlink_replybo(link, SD_JSON_BUILD_PAIR("record", SD_JSON_BUILD_VARIANT(v)));
+ return sd_varlink_replybo(link, SD_JSON_BUILD_PAIR_VARIANT("record", v));
not_found:
return sd_varlink_error(link, "io.systemd.UserDatabase.NoRecordFound", NULL);
return sd_varlink_replybo(
link,
- SD_JSON_BUILD_PAIR("hostInterfaceName", SD_JSON_BUILD_STRING(ifname_host)),
- SD_JSON_BUILD_PAIR("namespaceInterfaceName", SD_JSON_BUILD_STRING(ifname_namespace)));
+ SD_JSON_BUILD_PAIR_STRING("hostInterfaceName", ifname_host),
+ SD_JSON_BUILD_PAIR_STRING("namespaceInterfaceName", ifname_namespace));
} else if (streq(p.mode, "tap")) {
/* NB: when we do the "tap" stuff we do not actually do any namespace operation here, neither
_cleanup_(sd_json_variant_unrefp) sd_json_variant *def = NULL;
r = sd_json_buildo(
&def,
- SD_JSON_BUILD_PAIR("owner", SD_JSON_BUILD_UNSIGNED(info->owner)),
- SD_JSON_BUILD_PAIR("name", SD_JSON_BUILD_STRING(info->name)),
- SD_JSON_BUILD_PAIR("userns", SD_JSON_BUILD_UNSIGNED(info->userns_inode)),
+ SD_JSON_BUILD_PAIR_UNSIGNED("owner", info->owner),
+ SD_JSON_BUILD_PAIR_STRING("name", info->name),
+ SD_JSON_BUILD_PAIR_UNSIGNED("userns", info->userns_inode),
SD_JSON_BUILD_PAIR_CONDITION(info->size > 0, "size", SD_JSON_BUILD_UNSIGNED(info->size)),
SD_JSON_BUILD_PAIR_CONDITION(uid_is_valid(info->start_uid), "start", SD_JSON_BUILD_UNSIGNED(info->start_uid)),
SD_JSON_BUILD_PAIR_CONDITION(uid_is_valid(info->target_uid), "target", SD_JSON_BUILD_UNSIGNED(info->target_uid)),
r = sd_json_buildo(
&cparams,
- SD_JSON_BUILD_PAIR("name", SD_JSON_BUILD_STRING(name)),
- SD_JSON_BUILD_PAIR("flags", SD_JSON_BUILD_UNSIGNED(query_flags())));
+ SD_JSON_BUILD_PAIR_STRING("name", name),
+ SD_JSON_BUILD_PAIR_UNSIGNED("flags", query_flags()));
if (r < 0)
goto fail;
r = sd_json_buildo(
&cparams,
- SD_JSON_BUILD_PAIR("name", SD_JSON_BUILD_STRING(name)),
- SD_JSON_BUILD_PAIR("family", SD_JSON_BUILD_INTEGER(af)),
- SD_JSON_BUILD_PAIR("flags", SD_JSON_BUILD_UNSIGNED(query_flags())));
+ SD_JSON_BUILD_PAIR_STRING("name", name),
+ SD_JSON_BUILD_PAIR_INTEGER("family", af),
+ SD_JSON_BUILD_PAIR_UNSIGNED("flags", query_flags()));
if (r < 0)
goto fail;
r = sd_json_buildo(
&cparams,
- SD_JSON_BUILD_PAIR("address", SD_JSON_BUILD_BYTE_ARRAY(addr, len)),
- SD_JSON_BUILD_PAIR("family", SD_JSON_BUILD_INTEGER(af)),
- SD_JSON_BUILD_PAIR("flags", SD_JSON_BUILD_UNSIGNED(query_flags())));
+ SD_JSON_BUILD_PAIR_BYTE_ARRAY("address", addr, len),
+ SD_JSON_BUILD_PAIR_INTEGER("family", af),
+ SD_JSON_BUILD_PAIR_UNSIGNED("flags", query_flags()));
if (r < 0)
goto fail;
case DNS_TRANSACTION_DNSSEC_FAILED:
return sd_varlink_errorbo(q->varlink_request, "io.systemd.Resolve.DNSSECValidationFailed",
- SD_JSON_BUILD_PAIR("result", SD_JSON_BUILD_STRING(dnssec_result_to_string(q->answer_dnssec_result))),
+ SD_JSON_BUILD_PAIR_STRING("result", dnssec_result_to_string(q->answer_dnssec_result)),
SD_JSON_BUILD_PAIR_CONDITION(q->answer_ede_rcode >= 0,
"extendedDNSErrorCode", SD_JSON_BUILD_INTEGER(q->answer_ede_rcode)),
SD_JSON_BUILD_PAIR_CONDITION(q->answer_ede_rcode >= 0 && !isempty(q->answer_ede_msg),
/* We return this as NXDOMAIN. This is only generated when a host doesn't implement LLMNR/TCP, and we
* thus quickly know that we cannot resolve an in-addr.arpa or ip6.arpa address. */
return sd_varlink_errorbo(q->varlink_request, "io.systemd.Resolve.DNSError",
- SD_JSON_BUILD_PAIR("rcode", SD_JSON_BUILD_INTEGER(DNS_RCODE_NXDOMAIN)));
+ SD_JSON_BUILD_PAIR_INTEGER("rcode", DNS_RCODE_NXDOMAIN));
case DNS_TRANSACTION_RCODE_FAILURE:
return sd_varlink_errorbo(q->varlink_request, "io.systemd.Resolve.DNSError",
- SD_JSON_BUILD_PAIR("rcode", SD_JSON_BUILD_INTEGER(q->answer_rcode)),
+ SD_JSON_BUILD_PAIR_INTEGER("rcode", q->answer_rcode),
SD_JSON_BUILD_PAIR_CONDITION(q->answer_ede_rcode >= 0,
"extendedDNSErrorCode", SD_JSON_BUILD_INTEGER(q->answer_ede_rcode)),
SD_JSON_BUILD_PAIR_CONDITION(q->answer_ede_rcode >= 0 && !isempty(q->answer_ede_msg),
/* Send a ready message to the connecting client, to indicate that we are now listinening, and all
* queries issued after the point the client sees this will also be reported to the client. */
- r = sd_varlink_notifybo(link, SD_JSON_BUILD_PAIR("ready", SD_JSON_BUILD_BOOLEAN(true)));
+ r = sd_varlink_notifybo(link, SD_JSON_BUILD_PAIR_BOOLEAN("ready", true));
if (r < 0)
return log_error_errno(r, "Failed to report monitor to be established: %m");