diff options
Diffstat (limited to 'src/boot')
-rw-r--r-- | src/boot/bootctl-reboot-to-firmware.c | 16 | ||||
-rw-r--r-- | src/boot/bootctl-reboot-to-firmware.h | 6 | ||||
-rw-r--r-- | src/boot/bootctl-status.c | 14 | ||||
-rw-r--r-- | src/boot/bootctl-status.h | 4 | ||||
-rw-r--r-- | src/boot/bootctl.c | 15 |
5 files changed, 28 insertions, 27 deletions
diff --git a/src/boot/bootctl-reboot-to-firmware.c b/src/boot/bootctl-reboot-to-firmware.c index fbde7cbb66..0bedd230bb 100644 --- a/src/boot/bootctl-reboot-to-firmware.c +++ b/src/boot/bootctl-reboot-to-firmware.c @@ -38,7 +38,7 @@ int verb_reboot_to_firmware(int argc, char *argv[], void *userdata) { } } -int vl_method_set_reboot_to_firmware(Varlink *link, sd_json_variant *parameters, VarlinkMethodFlags flags, void *userdata) { +int vl_method_set_reboot_to_firmware(sd_varlink *link, sd_json_variant *parameters, sd_varlink_method_flags_t flags, void *userdata) { static const sd_json_dispatch_field dispatch_table[] = { { "state", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, 0, 0 }, {} @@ -46,30 +46,30 @@ int vl_method_set_reboot_to_firmware(Varlink *link, sd_json_variant *parameters, bool b; int r; - r = varlink_dispatch(link, parameters, dispatch_table, &b); + r = sd_varlink_dispatch(link, parameters, dispatch_table, &b); if (r != 0) return r; r = efi_set_reboot_to_firmware(b); if (ERRNO_IS_NEG_NOT_SUPPORTED(r)) - return varlink_error(link, "io.systemd.BootControl.RebootToFirmwareNotSupported", NULL); + return sd_varlink_error(link, "io.systemd.BootControl.RebootToFirmwareNotSupported", NULL); if (r < 0) return r; - return varlink_reply(link, NULL); + return sd_varlink_reply(link, NULL); } -int vl_method_get_reboot_to_firmware(Varlink *link, sd_json_variant *parameters, VarlinkMethodFlags flags, void *userdata) { +int vl_method_get_reboot_to_firmware(sd_varlink *link, sd_json_variant *parameters, sd_varlink_method_flags_t flags, void *userdata) { int r; if (sd_json_variant_elements(parameters) > 0) - return varlink_error_invalid_parameter(link, parameters); + return sd_varlink_error_invalid_parameter(link, parameters); r = efi_get_reboot_to_firmware(); if (ERRNO_IS_NEG_NOT_SUPPORTED(r)) - return varlink_error(link, "io.systemd.BootControl.RebootToFirmwareNotSupported", NULL); + return sd_varlink_error(link, "io.systemd.BootControl.RebootToFirmwareNotSupported", NULL); if (r < 0) return r; - return varlink_replybo(link, SD_JSON_BUILD_PAIR_BOOLEAN("state", r)); + return sd_varlink_replybo(link, SD_JSON_BUILD_PAIR_BOOLEAN("state", r)); } diff --git a/src/boot/bootctl-reboot-to-firmware.h b/src/boot/bootctl-reboot-to-firmware.h index 4fc3241343..e9cf9bf3a6 100644 --- a/src/boot/bootctl-reboot-to-firmware.h +++ b/src/boot/bootctl-reboot-to-firmware.h @@ -1,8 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include "varlink.h" +#include "sd-varlink.h" int verb_reboot_to_firmware(int argc, char *argv[], void *userdata); -int vl_method_set_reboot_to_firmware(Varlink *link, sd_json_variant *parameters, VarlinkMethodFlags flags, void *userdata); -int vl_method_get_reboot_to_firmware(Varlink *link, sd_json_variant *parameters, VarlinkMethodFlags flags, void *userdata); +int vl_method_set_reboot_to_firmware(sd_varlink *link, sd_json_variant *parameters, sd_varlink_method_flags_t flags, void *userdata); +int vl_method_get_reboot_to_firmware(sd_varlink *link, sd_json_variant *parameters, sd_varlink_method_flags_t flags, void *userdata); diff --git a/src/boot/bootctl-status.c b/src/boot/bootctl-status.c index d2c7d50d12..113d27410f 100644 --- a/src/boot/bootctl-status.c +++ b/src/boot/bootctl-status.c @@ -835,7 +835,7 @@ int verb_unlink(int argc, char *argv[], void *userdata) { return verb_list(argc, argv, userdata); } -int vl_method_list_boot_entries(Varlink *link, sd_json_variant *parameters, VarlinkMethodFlags flags, void *userdata) { +int vl_method_list_boot_entries(sd_varlink *link, sd_json_variant *parameters, sd_varlink_method_flags_t flags, void *userdata) { _cleanup_(boot_config_free) BootConfig config = BOOT_CONFIG_NULL; dev_t esp_devid = 0, xbootldr_devid = 0; int r; @@ -843,10 +843,10 @@ int vl_method_list_boot_entries(Varlink *link, sd_json_variant *parameters, Varl assert(link); if (sd_json_variant_elements(parameters) > 0) - return varlink_error_invalid_parameter(link, parameters); + return sd_varlink_error_invalid_parameter(link, parameters); - if (!FLAGS_SET(flags, VARLINK_METHOD_MORE)) - return varlink_error(link, VARLINK_ERROR_EXPECTED_MORE, NULL); + if (!FLAGS_SET(flags, SD_VARLINK_METHOD_MORE)) + return sd_varlink_error(link, SD_VARLINK_ERROR_EXPECTED_MORE, NULL); r = acquire_esp(/* unprivileged_mode= */ false, /* graceful= */ false, @@ -876,7 +876,7 @@ int vl_method_list_boot_entries(Varlink *link, sd_json_variant *parameters, Varl _cleanup_(sd_json_variant_unrefp) sd_json_variant *previous = NULL; for (size_t i = 0; i < config.n_entries; i++) { if (previous) { - r = varlink_notifybo(link, SD_JSON_BUILD_PAIR_VARIANT("entry", previous)); + r = sd_varlink_notifybo(link, SD_JSON_BUILD_PAIR_VARIANT("entry", previous)); if (r < 0) return r; @@ -889,7 +889,7 @@ int vl_method_list_boot_entries(Varlink *link, sd_json_variant *parameters, Varl } if (!previous) - return varlink_error(link, "io.systemd.BootControl.NoSuchBootEntry", NULL); + return sd_varlink_error(link, "io.systemd.BootControl.NoSuchBootEntry", NULL); - return varlink_replybo(link, SD_JSON_BUILD_PAIR_VARIANT("entry", previous)); + return sd_varlink_replybo(link, SD_JSON_BUILD_PAIR_VARIANT("entry", previous)); } diff --git a/src/boot/bootctl-status.h b/src/boot/bootctl-status.h index e276ba35eb..44542f4dbd 100644 --- a/src/boot/bootctl-status.h +++ b/src/boot/bootctl-status.h @@ -1,9 +1,9 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include "varlink.h" +#include "sd-varlink.h" int verb_status(int argc, char *argv[], void *userdata); int verb_list(int argc, char *argv[], void *userdata); int verb_unlink(int argc, char *argv[], void *userdata); -int vl_method_list_boot_entries(Varlink *link, sd_json_variant *parameters, VarlinkMethodFlags flags, void *userdata); +int vl_method_list_boot_entries(sd_varlink *link, sd_json_variant *parameters, sd_varlink_method_flags_t flags, void *userdata); diff --git a/src/boot/bootctl.c b/src/boot/bootctl.c index e609028731..b2f84f00f7 100644 --- a/src/boot/bootctl.c +++ b/src/boot/bootctl.c @@ -2,6 +2,8 @@ #include <getopt.h> +#include "sd-varlink.h" + #include "blockdev-util.h" #include "bootctl.h" #include "bootctl-install.h" @@ -22,7 +24,6 @@ #include "parse-argument.h" #include "pretty-print.h" #include "utf8.h" -#include "varlink.h" #include "varlink-io.systemd.BootControl.h" #include "verbs.h" #include "virt.h" @@ -432,7 +433,7 @@ static int parse_argv(int argc, char *argv[]) { if (arg_dry_run && argv[optind] && !STR_IN_SET(argv[optind], "unlink", "cleanup")) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "--dry is only supported with --unlink or --cleanup"); - r = varlink_invocation(VARLINK_ALLOW_ACCEPT); + r = sd_varlink_invocation(SD_VARLINK_ALLOW_ACCEPT); if (r < 0) return log_error_errno(r, "Failed to check if invoked in Varlink mode: %m"); if (r > 0) { @@ -485,19 +486,19 @@ static int run(int argc, char *argv[]) { return r; if (arg_varlink) { - _cleanup_(varlink_server_unrefp) VarlinkServer *varlink_server = NULL; + _cleanup_(sd_varlink_server_unrefp) sd_varlink_server *varlink_server = NULL; /* Invocation as Varlink service */ - r = varlink_server_new(&varlink_server, VARLINK_SERVER_ROOT_ONLY); + r = sd_varlink_server_new(&varlink_server, SD_VARLINK_SERVER_ROOT_ONLY); if (r < 0) return log_error_errno(r, "Failed to allocate Varlink server: %m"); - r = varlink_server_add_interface(varlink_server, &vl_interface_io_systemd_BootControl); + r = sd_varlink_server_add_interface(varlink_server, &vl_interface_io_systemd_BootControl); if (r < 0) return log_error_errno(r, "Failed to add Varlink interface: %m"); - r = varlink_server_bind_method_many( + r = sd_varlink_server_bind_method_many( varlink_server, "io.systemd.BootControl.ListBootEntries", vl_method_list_boot_entries, "io.systemd.BootControl.SetRebootToFirmware", vl_method_set_reboot_to_firmware, @@ -505,7 +506,7 @@ static int run(int argc, char *argv[]) { if (r < 0) return log_error_errno(r, "Failed to bind Varlink methods: %m"); - r = varlink_server_loop_auto(varlink_server); + r = sd_varlink_server_loop_auto(varlink_server); if (r < 0) return log_error_errno(r, "Failed to run Varlink event loop: %m"); |