Browse Source

Do some minor cleanup (whitespaces mainly)

Signed-off-by: Sven Eden <sven.eden@prydeworx.com>
debian
Sven Eden 1 year ago
parent
commit
f1c37cfd45
  1. 2
      po/uk.po
  2. 1
      src/basic/cgroup-util.c
  3. 1
      src/basic/process-util.c
  4. 10
      src/libelogind/sd-path/sd-path.c
  5. 1
      src/login/logind-brightness.c
  6. 8
      src/login/logind-dbus.c
  7. 1
      src/login/logind-session-dbus.c
  8. 2
      src/login/logind-user.c
  9. 1
      src/login/logind.c
  10. 2
      src/login/pam_elogind.c
  11. 2
      src/login/user-runtime-dir.c
  12. 4
      src/shared/cgroup-setup.c
  13. 3
      src/shared/sleep-config.c
  14. 28
      src/sleep/sleep.c
  15. 2
      src/test/test-cgroup.c
  16. 2
      src/test/test-pretty-print.c

2
po/uk.po

@ -933,4 +933,6 @@ msgstr "Для зміни віртуального термінала слід
# "Authentication is required to delete files and directories associated with "
# "'$(unit)'."
# msgstr ""
# "Потрібна автентифікація, щоб вилучити файли і каталоги, які пов'язано із "
# "«$(unit)»."
#endif // 0

1
src/basic/cgroup-util.c

@ -2144,6 +2144,7 @@ int cg_unified_cached(bool flush) {
#if 0 /// elogind supports other controllers than systemd and itself
if (statfs("/sys/fs/cgroup/systemd/", &fs) < 0)
return log_debug_errno(errno, "statfs(\"/sys/fs/cgroup/systemd\" failed: %m");
#else // 0
if (statfs("/sys/fs/cgroup/" CGROUP_CONTROLLER_NAME "/", &fs) < 0)
return log_debug_errno(errno, "statfs(\"/sys/fs/cgroup/%s\" failed: %m", CGROUP_CONTROLLER_NAME);

1
src/basic/process-util.c

@ -320,7 +320,6 @@ int rename_process(const char name[]) {
size_t k;
log_debug_elogind("Setting program_invocation_name to '%s'", name);
k = strlen(program_invocation_name);
strncpy(program_invocation_name, name, k);
if (l > k)

10
src/libelogind/sd-path/sd-path.c

@ -322,7 +322,7 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
case SD_PATH_SYSTEMD_UTIL:
#if 0 /// elogind is most probably somewhere else
*ret = ROOTPREFIX_NOSLASH "/lib/elogind";
*ret = ROOTPREFIX_NOSLASH "/lib/systemd";
#else // 0
*ret = ROOTLIBEXECDIR;
#endif // 0
@ -334,7 +334,7 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
return 0;
case SD_PATH_SYSTEMD_SYSTEM_PRESET:
*ret = ROOTPREFIX_NOSLASH "/lib/elogind/system-preset";
*ret = ROOTPREFIX_NOSLASH "/lib/systemd/system-preset";
return 0;
case SD_PATH_SYSTEMD_USER_UNIT:
@ -342,7 +342,7 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
return 0;
case SD_PATH_SYSTEMD_USER_PRESET:
*ret = ROOTPREFIX_NOSLASH "/lib/elogind/user-preset";
*ret = ROOTPREFIX_NOSLASH "/lib/systemd/user-preset";
return 0;
case SD_PATH_SYSTEMD_SYSTEM_CONF:
@ -364,7 +364,7 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
case SD_PATH_SYSTEMD_SLEEP:
#if 0 /// elogind has it most probably somewhere else
*ret = ROOTPREFIX_NOSLASH "/lib/elogind/system-sleep";
*ret = ROOTPREFIX_NOSLASH "/lib/systemd/system-sleep";
#else // 0
*ret = SYSTEM_SLEEP_PATH;
#endif // 0
@ -372,7 +372,7 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
case SD_PATH_SYSTEMD_SHUTDOWN:
#if 0 /// elogind has it most probably somewhere else
*ret = ROOTPREFIX_NOSLASH "/lib/elogind/system-shutdown";
*ret = ROOTPREFIX_NOSLASH "/lib/systemd/system-shutdown";
#else // 0
*ret = SYSTEM_SHUTDOWN_PATH;
#endif // 0

1
src/login/logind-brightness.c

@ -207,7 +207,6 @@ int manager_write_brightness(
* our message to the set of message to reply when done. */
log_debug_elogind("Appending message to brightness writer %s", existing->path);
r = set_add_message(&existing->pending_messages, message);
if (r < 0)
return log_error_errno(r, "Failed to add message to set: %m");

8
src/login/logind-dbus.c

@ -2017,7 +2017,6 @@ static int method_do_shutdown_or_sleep(
#endif // 1
r = verify_shutdown_creds(m, message, w, interactive, action, action_multiple_sessions,
action_ignore_inhibit, error);
if (r != 0)
return r;
#if 1 && !ENABLE_POLKIT /// If the polkit check what reduced to shutdown/reboot, elogind needs another bracket here
@ -2042,7 +2041,6 @@ static int method_poweroff(sd_bus_message *message, void *userdata, sd_bus_error
Manager *m = userdata;
log_debug_elogind("Called for '%s'", SPECIAL_POWEROFF_TARGET);
return method_do_shutdown_or_sleep(
m, message,
#if 0 /// elogind uses HandleAction instead of const char* unit names
@ -2062,7 +2060,6 @@ static int method_reboot(sd_bus_message *message, void *userdata, sd_bus_error *
Manager *m = userdata;
log_debug_elogind("Called for '%s'", SPECIAL_REBOOT_TARGET);
return method_do_shutdown_or_sleep(
m, message,
#if 0 /// elogind uses HandleAction instead of const char* unit names
@ -2082,7 +2079,6 @@ static int method_halt(sd_bus_message *message, void *userdata, sd_bus_error *er
Manager *m = userdata;
log_debug_elogind("Called for '%s'", SPECIAL_HALT_TARGET);
return method_do_shutdown_or_sleep(
m, message,
#if 0 /// elogind uses HandleAction instead of const char* unit names
@ -2102,7 +2098,6 @@ static int method_suspend(sd_bus_message *message, void *userdata, sd_bus_error
Manager *m = userdata;
log_debug_elogind("Called for '%s'", SPECIAL_SUSPEND_TARGET);
return method_do_shutdown_or_sleep(
m, message,
#if 0 /// elogind uses HandleAction instead of const char* unit names
@ -2122,7 +2117,6 @@ static int method_hibernate(sd_bus_message *message, void *userdata, sd_bus_erro
Manager *m = userdata;
log_debug_elogind("Called for '%s'", SPECIAL_HIBERNATE_TARGET);
return method_do_shutdown_or_sleep(
m, message,
#if 0 /// elogind uses HandleAction instead of const char* unit names
@ -2142,7 +2136,6 @@ static int method_hybrid_sleep(sd_bus_message *message, void *userdata, sd_bus_e
Manager *m = userdata;
log_debug_elogind("Called for '%s'", SPECIAL_HYBRID_SLEEP_TARGET);
return method_do_shutdown_or_sleep(
m, message,
#if 0 /// elogind uses HandleAction instead of const char* unit names
@ -2347,7 +2340,6 @@ static int method_schedule_shutdown(sd_bus_message *message, void *userdata, sd_
return r;
log_debug_elogind("Called with type '%s'", strempty(type));
if (startswith(type, "dry-")) {
type += 4;
dry_run = true;

1
src/login/logind-session-dbus.c

@ -550,7 +550,6 @@ static int method_set_brightness(sd_bus_message *message, void *userdata, sd_bus
return r;
log_debug_elogind("Called for subsystem '%s', device '%s', brightness %u", subsystem, name, brightness);
if (!STR_IN_SET(subsystem, "backlight", "leds"))
return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, "Subsystem type %s not supported, must be one of 'backlight' or 'leds'.", subsystem);
if (!filename_is_valid(name))

2
src/login/logind-user.c

@ -1031,7 +1031,7 @@ int config_parse_compat_user_tasks_max(
"Support for option %s= has been removed.",
lvalue);
#if 0 /// elogind does not use slices
log_info("Hint: try creating /etc/elogind/system/user-.slice.d/50-limits.conf with:\n"
log_info("Hint: try creating /etc/systemd/system/user-.slice.d/50-limits.conf with:\n"
" [Slice]\n"
" TasksMax=%s",
rvalue);

1
src/login/logind.c

@ -1217,7 +1217,6 @@ static int run(int argc, char *argv[]) {
int r;
elogind_set_program_name(argv[0]);
log_set_facility(LOG_AUTH);
log_setup_service();

2
src/login/pam_elogind.c

@ -128,7 +128,7 @@ static int acquire_user_record(
return r;
}
if (r == PAM_SUCCESS && json) {
#else
#else // 0
if ( 0 ) {
#endif // 0
_cleanup_(json_variant_unrefp) JsonVariant *v = NULL;

2
src/login/user-runtime-dir.c

@ -215,6 +215,7 @@ static int run(int argc, char *argv[]) {
r = mac_selinux_init();
if (r < 0)
return r;
#else // 0
int user_runtime_dir(const char *verb, User *u) {
int r = 0;
@ -225,7 +226,6 @@ int user_runtime_dir(const char *verb, User *u) {
#endif // 0
#if 0 /// elogind has more information and can do this more conveniently
if (streq(argv[1], "start"))
return do_mount(argv[2]);

4
src/shared/cgroup-setup.c

@ -34,8 +34,8 @@ bool cg_is_unified_wanted(void) {
if (r >= 0)
return (wanted = r >= CGROUP_UNIFIED_ALL);
/* If we were explicitly passed elogind.unified_cgroup_hierarchy, respect that. */
r = proc_cmdline_get_bool("elogind.unified_cgroup_hierarchy", &b);
/* If we were explicitly passed systemd.unified_cgroup_hierarchy, respect that. */
r = proc_cmdline_get_bool("systemd.unified_cgroup_hierarchy", &b);
if (r > 0)
return (wanted = b);

3
src/shared/sleep-config.c

@ -81,6 +81,7 @@ int parse_sleep_config(SleepConfig **ret_sleep_config) {
CONFIG_PARSE_WARN,
NULL,
NULL);
#else // 0
const char* logind_conf = getenv("ELOGIND_CONF_FILE");
@ -701,7 +702,6 @@ static bool can_s2h(const SleepConfig *sleep_config) {
return true;
}
static int can_sleep_internal(const char *verb, bool check_allowed, const SleepConfig *sleep_config) {
bool allow;
char **modes = NULL, **states = NULL;
@ -770,7 +770,6 @@ int sleep_settings(const char *verb, const SleepConfig *sleep_config, bool *ret_
assert(STR_IN_SET(verb, "suspend", "hibernate", "hybrid-sleep", "suspend-then-hibernate"));
log_debug_elogind("Called for '%s'", verb);
if (streq(verb, "suspend")) {
*ret_allow = sleep_config->allow_suspend;
*ret_modes = sleep_config->suspend_modes;

28
src/sleep/sleep.c

@ -124,7 +124,7 @@ static int nvidia_sleep(Manager* m, char const* verb, unsigned* vtnr) {
}
#endif // 1
static int write_hibernate_location_info(const HibernateLocation* hibernate_location) {
static int write_hibernate_location_info(const HibernateLocation *hibernate_location) {
char offset_str[DECIMAL_STR_MAX(uint64_t)];
char resume_str[DECIMAL_STR_MAX(unsigned) * 2 + STRLEN(":")];
int r;
@ -251,7 +251,6 @@ static int write_state(FILE **f, char **states) {
int k;
log_debug_elogind("Writing '%s' into /sys/power/state", *state);
k = write_string_stream(*f, *state, WRITE_STRING_FILE_DISABLE_BUFFER);
if (k >= 0)
return 0;
@ -314,7 +313,7 @@ static int lock_all_homes(void) {
#if 0 /// Changes needed by elogind are too vast to do this inline
static int execute(char **modes, char **states) {
char* arguments[] = {
char *arguments[] = {
NULL,
(char*) "pre",
arg_verb,
@ -343,12 +342,13 @@ static int execute(char **modes, char **states) {
if (r < 0)
return log_error_errno(r, "Failed to find location to hibernate to: %m");
if (r == 0) { /* 0 means: no hibernation location was configured in the kernel so far, let's
* do it ourselves then. > 0 means: kernel already had a configured hibernation
* location which we shouldn't touch. */
* do it ourselves then. > 0 means: kernel already had a configured hibernation
* location which we shouldn't touch. */
r = write_hibernate_location_info(hibernate_location);
if (r < 0)
return log_error_errno(r, "Failed to prepare for hibernation: %m");
}
r = write_mode(modes);
if (r < 0)
return log_error_errno(r, "Failed to write mode to /sys/power/disk: %m");;
@ -359,23 +359,23 @@ static int execute(char **modes, char **states) {
log_struct(LOG_INFO,
"MESSAGE_ID=" SD_MESSAGE_SLEEP_START_STR,
LOG_MESSAGE("Suspending system..."),
"SLEEP=%s", arg_verb);
LOG_MESSAGE("Suspending system..."),
"SLEEP=%s", arg_verb);
r = write_state(&f, states);
if (r < 0)
log_struct_errno(LOG_ERR, r,
"MESSAGE_ID=" SD_MESSAGE_SLEEP_STOP_STR,
LOG_MESSAGE("Failed to suspend system. System resumed again: %m"),
"SLEEP=%s", arg_verb);
LOG_MESSAGE("Failed to suspend system. System resumed again: %m"),
"SLEEP=%s", arg_verb);
else
log_struct(LOG_INFO,
"MESSAGE_ID=" SD_MESSAGE_SLEEP_STOP_STR,
LOG_MESSAGE("System resumed."),
"SLEEP=%s", arg_verb);
log_struct(LOG_INFO,
"MESSAGE_ID=" SD_MESSAGE_SLEEP_STOP_STR,
LOG_MESSAGE("System resumed."),
"SLEEP=%s", arg_verb);
arguments[1] = (char*) "post";
(void) execute_directories(dirs, DEFAULT_TIMEOUT_USEC, NULL, NULL, arguments, NULL, EXEC_DIR_IGNORE_ERRORS);
(void) execute_directories(dirs, DEFAULT_TIMEOUT_USEC, NULL, NULL, arguments, NULL, EXEC_DIR_PARALLEL | EXEC_DIR_IGNORE_ERRORS);
return r;
}

2
src/test/test-cgroup.c

@ -111,7 +111,7 @@ static void test_cg_create(void) {
#else // 0
full_d = strjoina("/sys/fs/cgroup/" CGROUP_CONTROLLER_NAME, test_d);
#endif // 0
log_debug("full_d: %s", full_d);
log_debug_elogind("full_d: %s", full_d);
assert_se(path_equal(path, full_d));
free(path);

2
src/test/test-pretty-print.c

@ -16,7 +16,7 @@ static void test_terminal_urlify(void) {
#if 0 /// Aww... lets use an elogind URL, okay?
assert_se(terminal_urlify("https://www.freedesktop.org/wiki/Software/systemd/", "systemd homepage", &formatted) >= 0);
#else // 0
#else // 0
assert_se(terminal_urlify("https://github.com/elogind/elogind/", "elogind homepage", &formatted) >= 0);
#endif // 0
printf("Hey, consider visiting the %s right now! It is very good!\n", formatted);

Loading…
Cancel
Save