summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-08-03 14:38:36 +0200
committerGitHub <noreply@github.com>2016-08-03 14:38:36 +0200
commit5e0bb1a6287387f179540895e43647a0baa8c724 (patch)
treee823e540cbfe3ba0d2bf39a465788619626fb44a /src
parente5bc3f4fdc2ac2f68b781adc958e9570e577538b (diff)
parent72ccee50d0d08e2339ec283d669eb9ed282aac29 (diff)
Merge pull request #3828 from keszybz/drop-systemd-vconsole-setup-service
Update documentation for systemd-vconsole-setup
Diffstat (limited to 'src')
-rw-r--r--src/basic/util.h4
-rw-r--r--src/boot/bootctl.c2
-rw-r--r--src/journal-remote/journal-remote.c2
-rw-r--r--src/network/networkd-link.c8
-rw-r--r--src/timedate/timedated.c2
-rw-r--r--src/vconsole/vconsole-setup.c38
6 files changed, 33 insertions, 23 deletions
diff --git a/src/basic/util.h b/src/basic/util.h
index 44497dcd78..bb2fc318ef 100644
--- a/src/basic/util.h
+++ b/src/basic/util.h
@@ -61,6 +61,10 @@ static inline const char* one_zero(bool b) {
return b ? "1" : "0";
}
+static inline const char* enable_disable(bool b) {
+ return b ? "enable" : "disable";
+}
+
void execute_directories(const char* const* directories, usec_t timeout, char *argv[]);
bool plymouth_running(void);
diff --git a/src/boot/bootctl.c b/src/boot/bootctl.c
index ff8c7a38dd..a7cdf92ed2 100644
--- a/src/boot/bootctl.c
+++ b/src/boot/bootctl.c
@@ -1094,7 +1094,7 @@ static int verb_status(int argc, char *argv[], void *userdata) {
if (r < 0)
log_warning_errno(r, "Failed to query secure boot status: %m");
else
- printf(" Secure Boot: %s\n", r ? "enabled" : "disabled");
+ printf(" Secure Boot: %sd\n", enable_disable(r));
r = is_efi_secure_boot_setup_mode();
if (r < 0)
diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c
index 35a1e55f9e..f1ef90ed7a 100644
--- a/src/journal-remote/journal-remote.c
+++ b/src/journal-remote/journal-remote.c
@@ -1564,7 +1564,7 @@ int main(int argc, char **argv) {
if (r < 0)
log_error_errno(r, "Failed to enable watchdog: %m");
else
- log_debug("Watchdog is %s.", r > 0 ? "enabled" : "disabled");
+ log_debug("Watchdog is %sd.", enable_disable(r > 0));
log_debug("%s running as pid "PID_FMT,
program_invocation_short_name, getpid());
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 82f56158be..a0da697707 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -256,12 +256,8 @@ static int link_enable_ipv6(Link *link) {
r = write_string_file(p, one_zero(disabled), WRITE_STRING_FILE_VERIFY_ON_FAILURE);
if (r < 0)
log_link_warning_errno(link, r, "Cannot %s IPv6 for interface %s: %m", disabled ? "disable" : "enable", link->ifname);
- else {
- if (disabled)
- log_link_info(link, "IPv6 disabled for interface: %m");
- else
- log_link_info(link, "IPv6 enabled for interface: %m");
- }
+ else
+ log_link_info(link, "IPv6 %sd for interface: %m", enable_disable(!disabled));
return 0;
}
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index ffec609c69..490929e93b 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -637,7 +637,7 @@ static int method_set_ntp(sd_bus_message *m, void *userdata, sd_bus_error *error
return r;
c->use_ntp = enabled;
- log_info("Set NTP to %s", enabled ? "enabled" : "disabled");
+ log_info("Set NTP to %sd", enable_disable(enabled));
(void) sd_bus_emit_properties_changed(sd_bus_message_get_bus(m), "/org/freedesktop/timedate1", "org.freedesktop.timedate1", "NTP", NULL);
diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
index 59e6c90c9a..c0d76f9685 100644
--- a/src/vconsole/vconsole-setup.c
+++ b/src/vconsole/vconsole-setup.c
@@ -83,17 +83,19 @@ static bool is_settable(int fd) {
return r == 0 && IN_SET(curr_mode, K_XLATE, K_UNICODE);
}
-static int toggle_utf8(int fd, bool utf8) {
+static int toggle_utf8(const char *name, int fd, bool utf8) {
int r;
struct termios tc = {};
+ assert(name);
+
r = ioctl(fd, KDSKBMODE, utf8 ? K_UNICODE : K_XLATE);
if (r < 0)
- return log_warning_errno(errno, "Failed to %s UTF-8 kbdmode: %m", utf8 ? "enable" : "disable");
+ return log_warning_errno(errno, "Failed to %s UTF-8 kbdmode on %s: %m", enable_disable(utf8), name);
r = loop_write(fd, utf8 ? "\033%G" : "\033%@", 3, false);
if (r < 0)
- return log_warning_errno(r, "Failed to %s UTF-8 term processing: %m", utf8 ? "enable" : "disable");
+ return log_warning_errno(r, "Failed to %s UTF-8 term processing on %s: %m", enable_disable(utf8), name);
r = tcgetattr(fd, &tc);
if (r >= 0) {
@@ -104,8 +106,9 @@ static int toggle_utf8(int fd, bool utf8) {
r = tcsetattr(fd, TCSANOW, &tc);
}
if (r < 0)
- return log_warning_errno(errno, "Failed to %s iutf8 flag: %m", utf8 ? "enable" : "disable");
+ return log_warning_errno(errno, "Failed to %s iutf8 flag on %s: %m", enable_disable(utf8), name);
+ log_debug("UTF-8 kbdmode %sd on %s", enable_disable(utf8), name);
return 0;
}
@@ -114,8 +117,10 @@ static int toggle_utf8_sysfs(bool utf8) {
r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), 0);
if (r < 0)
- log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", utf8 ? "enable" : "disable");
- return r;
+ return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8));
+
+ log_debug("Sysfs UTF-8 flag %sd", enable_disable(utf8));
+ return 0;
}
static int keyboard_load_and_wait(const char *vc, const char *map, const char *map_toggle, bool utf8) {
@@ -266,7 +271,7 @@ static void setup_remaining_vcs(int fd, bool utf8) {
if (!is_settable(fd_d))
continue;
- toggle_utf8(fd_d, utf8);
+ toggle_utf8(ttyname, fd_d, utf8);
if (cfo.op != KD_FONT_OP_SET)
continue;
@@ -281,13 +286,18 @@ static void setup_remaining_vcs(int fd, bool utf8) {
/* unimapd is a ushort count and a pointer to an
array of struct unipair { ushort, ushort } */
r = ioctl(fd_d, PIO_UNIMAPCLR, &adv);
- if (r < 0)
+ if (r < 0) {
log_warning_errno(errno, "PIO_UNIMAPCLR failed, unimaps might be incorrect for tty%i: %m", i);
- else {
- r = ioctl(fd_d, PIO_UNIMAP, &unimapd);
- if (r < 0)
- log_warning_errno(errno, "PIO_UNIMAP failed, unimaps might be incorrect for tty%i: %m", i);
+ continue;
}
+
+ r = ioctl(fd_d, PIO_UNIMAP, &unimapd);
+ if (r < 0) {
+ log_warning_errno(errno, "PIO_UNIMAP failed, unimaps might be incorrect for tty%i: %m", i);
+ continue;
+ }
+
+ log_debug("Font and unimap successfully copied to %s", ttyname);
}
}
@@ -366,7 +376,7 @@ int main(int argc, char **argv) {
}
toggle_utf8_sysfs(utf8);
- toggle_utf8(fd, utf8);
+ toggle_utf8(vc, fd, utf8);
font_ok = font_load_and_wait(vc, vc_font, vc_font_map, vc_font_unimap) == 0;
keyboard_ok = keyboard_load_and_wait(vc, vc_keymap, vc_keymap_toggle, utf8) == 0;
@@ -374,7 +384,7 @@ int main(int argc, char **argv) {
if (font_ok)
setup_remaining_vcs(fd, utf8);
else
- log_warning("Setting source virtual console failed, ignoring remaining ones.");
+ log_warning("Setting source virtual console failed, ignoring remaining ones");
}
return font_ok && keyboard_ok ? EXIT_SUCCESS : EXIT_FAILURE;