From 93e63b2a351df80c893b3771b19e313af3c900b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Mon, 18 Nov 2019 18:15:44 +0100 Subject: [PATCH 1/4] core/path: minor simplification --- src/core/path.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/core/path.c b/src/core/path.c index dff551f377..2872f103ce 100644 --- a/src/core/path.c +++ b/src/core/path.c @@ -501,18 +501,14 @@ fail: static bool path_check_good(Path *p, bool initial) { PathSpec *s; - bool good = false; assert(p); - LIST_FOREACH(spec, s, p->specs) { - good = path_spec_check_good(s, initial); + LIST_FOREACH(spec, s, p->specs) + if (path_spec_check_good(s, initial)) + return true; - if (good) - break; - } - - return good; + return false; } static void path_enter_waiting(Path *p, bool initial, bool recheck) { From b289de2b06c60fd7d3bed14deb014dc32e74079b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Mon, 18 Nov 2019 18:19:16 +0100 Subject: [PATCH 2/4] bootctl: update --help text --- src/boot/bootctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/boot/bootctl.c b/src/boot/bootctl.c index d062ac2616..803b056a3e 100644 --- a/src/boot/bootctl.c +++ b/src/boot/bootctl.c @@ -1033,7 +1033,7 @@ static int help(int argc, char *argv[], void *userdata) { return log_oom(); printf("%s [OPTIONS...] COMMAND ...\n" - "\n%sInstall, update or remove the systemd-boot EFI boot manager.%s\n" + "\n%sInstall/update/remove the systemd-boot EFI boot manager and list/select entries.%s\n" "\nBoot Loader Commands:\n" " status Show status of installed systemd-boot and EFI variables\n" " install Install systemd-boot to the ESP and EFI variables\n" From cc560ac064608e9109e1a5a4a99674f360833bee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Mon, 18 Nov 2019 19:44:54 +0100 Subject: [PATCH 3/4] NEWS: fix antique typo --- NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 01eb2d5218..67a2fc3604 100644 --- a/NEWS +++ b/NEWS @@ -505,7 +505,7 @@ CHANGES WITH 243: * SuccessExitStatus=, RestartPreventExitStatus=, and RestartForceExitStatus= now accept exit status names (e.g. "DATAERR" is equivalent to "65"). Those exit status name mappings may be - displayed with the sytemd-analyze exit-status verb describe above. + displayed with the systemd-analyze exit-status verb describe above. * systemd-logind now exposes a per-session SetBrightness() bus call, which may be used to securely change the brightness of a kernel From 2536752dda4b62646814fa4e6b3d0987642bf200 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Mon, 18 Nov 2019 19:47:50 +0100 Subject: [PATCH 4/4] Rename "system-options" to "systemd-efi-options" This makes the naming more consistent: we now have bootctl systemd-efi-options, $SYSTEMD_EFI_OPTIONS and the SystemdOptions EFI variable. (SystemdEFIOptions would be redundant, because it is only used in the context of efivars, and users don't interact with that name directly.) bootctl is adjusted to use 2sp indentation, similarly to systemctl and other programs. Remove the prefix with the old name from 'bootctl systemd-efi-options' output, since it's redundant and we don't want the old name anyway. --- NEWS | 2 +- docs/ENVIRONMENT.md | 4 ++-- man/bootctl.xml | 2 +- src/basic/efivars.c | 2 +- src/basic/efivars.h | 4 ++-- src/basic/proc-cmdline.c | 4 ++-- src/boot/bootctl.c | 48 ++++++++++++++++++++-------------------- 7 files changed, 33 insertions(+), 33 deletions(-) diff --git a/NEWS b/NEWS index 67a2fc3604..84ca2dc4d5 100644 --- a/NEWS +++ b/NEWS @@ -19,7 +19,7 @@ CHANGES WITH 244 in spe: SystemdOptions. This may be used to configure systemd behaviour when modifying the kernel command line is inconvenient, but configuration on disk is read too late, for example for the options related to - cgroup hierarchy setup. 'bootctl system-options' may be used to + cgroup hierarchy setup. 'bootctl systemd-efi-options' may be used to set the EFI variable. * systemd will now disable printk ratelimits in early boot. This should diff --git a/docs/ENVIRONMENT.md b/docs/ENVIRONMENT.md index 4882cab600..a3837ebfdb 100644 --- a/docs/ENVIRONMENT.md +++ b/docs/ENVIRONMENT.md @@ -47,8 +47,8 @@ All tools: * `$SYSTEMD_CRYPTTAB` — if set, use this path instead of /etc/crypttab. Only useful for debugging. Currently only supported by systemd-cryptsetup-generator. -* `$SYSTEMD_EFI_OPTIONS` — if set, used instead of the string in SystemdOptions - EFI variable. Analogous to `$SYSTEMD_PROC_CMDLINE`. +* `$SYSTEMD_EFI_OPTIONS` — if set, used instead of the string in the + SystemdOptions EFI variable. Analogous to `$SYSTEMD_PROC_CMDLINE`. * `$SYSTEMD_IN_INITRD` — takes a boolean. If set, overrides initrd detection. This is useful for debugging and testing initrd-only programs in the main diff --git a/man/bootctl.xml b/man/bootctl.xml index 7f3e74e677..fbd6574418 100644 --- a/man/bootctl.xml +++ b/man/bootctl.xml @@ -102,7 +102,7 @@ - VALUE + VALUE When called without the optional argument, prints the current value of the SystemdOptions EFI variable. When called with an argument, sets the diff --git a/src/basic/efivars.c b/src/basic/efivars.c index daa66ac2d9..7b14c062df 100644 --- a/src/basic/efivars.c +++ b/src/basic/efivars.c @@ -220,7 +220,7 @@ int efi_set_variable_string(sd_id128_t vendor, const char *name, const char *v) return efi_set_variable(vendor, name, u16, (char16_strlen(u16) + 1) * sizeof(char16_t)); } -int efi_systemd_options_variable(char **line) { +int systemd_efi_options_variable(char **line) { const char *e; int r; diff --git a/src/basic/efivars.h b/src/basic/efivars.h index 22edbed985..46ca58d0a5 100644 --- a/src/basic/efivars.h +++ b/src/basic/efivars.h @@ -28,7 +28,7 @@ int efi_get_variable_string(sd_id128_t vendor, const char *name, char **p); int efi_set_variable(sd_id128_t vendor, const char *name, const void *value, size_t size); int efi_set_variable_string(sd_id128_t vendor, const char *name, const char *p); -int efi_systemd_options_variable(char **line); +int systemd_efi_options_variable(char **line); #else @@ -52,7 +52,7 @@ static inline int efi_set_variable_string(sd_id128_t vendor, const char *name, c return -EOPNOTSUPP; } -static inline int efi_systemd_options_variable(char **line) { +static inline int systemd_efi_options_variable(char **line) { return -ENODATA; } diff --git a/src/basic/proc-cmdline.c b/src/basic/proc-cmdline.c index bb2be068bb..d3d99d9a7f 100644 --- a/src/basic/proc-cmdline.c +++ b/src/basic/proc-cmdline.c @@ -119,7 +119,7 @@ int proc_cmdline_parse(proc_cmdline_parse_t parse_item, void *data, ProcCmdlineF /* We parse the EFI variable first, because later settings have higher priority. */ - r = efi_systemd_options_variable(&line); + r = systemd_efi_options_variable(&line); if (r < 0 && r != -ENODATA) log_debug_errno(r, "Failed to get SystemdOptions EFI variable, ignoring: %m"); @@ -250,7 +250,7 @@ int proc_cmdline_get_key(const char *key, ProcCmdlineFlags flags, char **ret_val return r; line = mfree(line); - r = efi_systemd_options_variable(&line); + r = systemd_efi_options_variable(&line); if (r == -ENODATA) return false; /* Not found */ if (r < 0) diff --git a/src/boot/bootctl.c b/src/boot/bootctl.c index 803b056a3e..f8845369ec 100644 --- a/src/boot/bootctl.c +++ b/src/boot/bootctl.c @@ -1035,17 +1035,17 @@ static int help(int argc, char *argv[], void *userdata) { printf("%s [OPTIONS...] COMMAND ...\n" "\n%sInstall/update/remove the systemd-boot EFI boot manager and list/select entries.%s\n" "\nBoot Loader Commands:\n" - " status Show status of installed systemd-boot and EFI variables\n" - " install Install systemd-boot to the ESP and EFI variables\n" - " update Update systemd-boot in the ESP and EFI variables\n" - " remove Remove systemd-boot from the ESP and EFI variables\n" - " is-installed Test whether systemd-boot is installed in the ESP\n" - " random-seed Initialize random seed in ESP and EFI variables\n" - " system-options Query or set system options string in EFI variable\n" + " status Show status of installed systemd-boot and EFI variables\n" + " install Install systemd-boot to the ESP and EFI variables\n" + " update Update systemd-boot in the ESP and EFI variables\n" + " remove Remove systemd-boot from the ESP and EFI variables\n" + " is-installed Test whether systemd-boot is installed in the ESP\n" + " random-seed Initialize random seed in ESP and EFI variables\n" + " systemd-efi-options Query or set system options string in EFI variable\n" "\nBoot Loader Entries Commands:\n" - " list List boot loader entries\n" - " set-default ID Set default boot loader entry\n" - " set-oneshot ID Set default boot loader entry, for next boot only\n" + " list List boot loader entries\n" + " set-default ID Set default boot loader entry\n" + " set-oneshot ID Set default boot loader entry, for next boot only\n" "\nOptions:\n" " -h --help Show this help\n" " --version Print version\n" @@ -1716,17 +1716,17 @@ static int verb_random_seed(int argc, char *argv[], void *userdata) { return 0; } -static int verb_system_options(int argc, char *argv[], void *userdata) { +static int verb_systemd_efi_options(int argc, char *argv[], void *userdata) { int r; if (argc == 1) { _cleanup_free_ char *line = NULL; - r = efi_systemd_options_variable(&line); + r = systemd_efi_options_variable(&line); if (r < 0) return log_error_errno(r, "Failed to query SystemdOptions EFI variable: %m"); - printf("SystemdOptions: %s\n", line); + puts(line); } else { r = efi_set_variable_string(EFI_VENDOR_SYSTEMD, "SystemdOptions", argv[1]); @@ -1739,17 +1739,17 @@ static int verb_system_options(int argc, char *argv[], void *userdata) { static int bootctl_main(int argc, char *argv[]) { static const Verb verbs[] = { - { "help", VERB_ANY, VERB_ANY, 0, help }, - { "status", VERB_ANY, 1, VERB_DEFAULT, verb_status }, - { "install", VERB_ANY, 1, 0, verb_install }, - { "update", VERB_ANY, 1, 0, verb_install }, - { "remove", VERB_ANY, 1, 0, verb_remove }, - { "is-installed", VERB_ANY, 1, 0, verb_is_installed }, - { "list", VERB_ANY, 1, 0, verb_list }, - { "set-default", 2, 2, 0, verb_set_default }, - { "set-oneshot", 2, 2, 0, verb_set_default }, - { "random-seed", VERB_ANY, 1, 0, verb_random_seed }, - { "system-options", VERB_ANY, 2, 0, verb_system_options }, + { "help", VERB_ANY, VERB_ANY, 0, help }, + { "status", VERB_ANY, 1, VERB_DEFAULT, verb_status }, + { "install", VERB_ANY, 1, 0, verb_install }, + { "update", VERB_ANY, 1, 0, verb_install }, + { "remove", VERB_ANY, 1, 0, verb_remove }, + { "is-installed", VERB_ANY, 1, 0, verb_is_installed }, + { "list", VERB_ANY, 1, 0, verb_list }, + { "set-default", 2, 2, 0, verb_set_default }, + { "set-oneshot", 2, 2, 0, verb_set_default }, + { "random-seed", VERB_ANY, 1, 0, verb_random_seed }, + { "systemd-efi-options", VERB_ANY, 2, 0, verb_systemd_efi_options }, {} };