From: Deepak Rawat Date: Wed, 31 Mar 2021 16:44:07 +0000 (-0700) Subject: logind: Rename kexec reboot flag X-Git-Tag: v249-rc1~491 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1d8a16f1f4827ac8f4a8a46795f311d78536dc44;p=thirdparty%2Fsystemd.git logind: Rename kexec reboot flag Also change error message to be more meanigful. No change in functionality. Fixes: 0d96caa5c0 --- diff --git a/src/basic/login-util.h b/src/basic/login-util.h index dc63fffdea3..841fd324f16 100644 --- a/src/basic/login-util.h +++ b/src/basic/login-util.h @@ -5,12 +5,12 @@ #include #define SD_LOGIND_ROOT_CHECK_INHIBITORS (UINT64_C(1) << 0) -#define SD_LOGIND_KEXEC_REBOOT (UINT64_C(1) << 1) +#define SD_LOGIND_REBOOT_VIA_KEXEC (UINT64_C(1) << 1) /* For internal use only */ #define SD_LOGIND_INTERACTIVE (UINT64_C(1) << 63) -#define SD_LOGIND_SHUTDOWN_AND_SLEEP_FLAGS_PUBLIC (SD_LOGIND_ROOT_CHECK_INHIBITORS|SD_LOGIND_KEXEC_REBOOT) +#define SD_LOGIND_SHUTDOWN_AND_SLEEP_FLAGS_PUBLIC (SD_LOGIND_ROOT_CHECK_INHIBITORS|SD_LOGIND_REBOOT_VIA_KEXEC) #define SD_LOGIND_SHUTDOWN_AND_SLEEP_FLAGS_ALL (SD_LOGIND_SHUTDOWN_AND_SLEEP_FLAGS_PUBLIC|SD_LOGIND_INTERACTIVE) bool session_id_valid(const char *id); diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index 532be12e7a3..526bf21d97b 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -1880,8 +1880,8 @@ static int method_do_shutdown_or_sleep( return r; if ((flags & ~SD_LOGIND_SHUTDOWN_AND_SLEEP_FLAGS_PUBLIC) != 0) return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid flags parameter"); - if (!streq(unit_name, SPECIAL_REBOOT_TARGET) && (flags & SD_LOGIND_KEXEC_REBOOT)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid flags parameter"); + if (!streq(unit_name, SPECIAL_REBOOT_TARGET) && (flags & SD_LOGIND_REBOOT_VIA_KEXEC)) + return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Reboot via kexec is only applicable with reboot operations"); } else { /* Old style method: no flags parameter, but interactive bool passed as boolean in * payload. Let's convert this argument to the new-style flags parameter for our internal @@ -1895,7 +1895,7 @@ static int method_do_shutdown_or_sleep( flags = interactive ? SD_LOGIND_INTERACTIVE : 0; } - if ((flags & SD_LOGIND_KEXEC_REBOOT) && kexec_loaded()) + if ((flags & SD_LOGIND_REBOOT_VIA_KEXEC) && kexec_loaded()) unit_name = SPECIAL_KEXEC_TARGET; /* Don't allow multiple jobs being executed at the same time */ diff --git a/src/systemctl/systemctl-logind.c b/src/systemctl/systemctl-logind.c index 15e396ebd7a..28dd25b523d 100644 --- a/src/systemctl/systemctl-logind.c +++ b/src/systemctl/systemctl-logind.c @@ -80,7 +80,7 @@ int logind_reboot(enum action a) { return 0; SET_FLAG(flags, SD_LOGIND_ROOT_CHECK_INHIBITORS, arg_check_inhibitors > 0); - SET_FLAG(flags, SD_LOGIND_KEXEC_REBOOT, a == ACTION_KEXEC); + SET_FLAG(flags, SD_LOGIND_REBOOT_VIA_KEXEC, a == ACTION_KEXEC); method_with_flags = strjoina(actions[a].method, "WithFlags");