summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-11-27 20:20:23 +0100
committerLennart Poettering <lennart@poettering.net>2014-11-27 22:05:24 +0100
commit79008bddf679a5e0900369950eb346c9fa687107 (patch)
tree620eed51b44a64aa065c4184a4661c8c95c146e3
parente09ca588d25a0c383880d6c2f5b129296af781ab (diff)
log: rearrange log function naming
- Rename log_meta() → log_internal(), to follow naming scheme of most other log functions that are usually invoked through macros, but never directly. - Rename log_info_object() to log_object_info(), simply because the object should be before any other parameters, to follow OO-style programming style.
-rw-r--r--src/analyze/analyze-verify.c20
-rw-r--r--src/core/automount.c48
-rw-r--r--src/core/busname.c61
-rw-r--r--src/core/device.c4
-rw-r--r--src/core/execute.c16
-rw-r--r--src/core/job.c24
-rw-r--r--src/core/kmod-setup.c2
-rw-r--r--src/core/main.c2
-rw-r--r--src/core/manager.c14
-rw-r--r--src/core/mount.c59
-rw-r--r--src/core/path.c4
-rw-r--r--src/core/scope.c12
-rw-r--r--src/core/selinux-access.c2
-rw-r--r--src/core/service.c191
-rw-r--r--src/core/slice.c2
-rw-r--r--src/core/snapshot.c12
-rw-r--r--src/core/socket.c156
-rw-r--r--src/core/swap.c42
-rw-r--r--src/core/timer.c30
-rw-r--r--src/core/transaction.c39
-rw-r--r--src/core/unit.c42
-rw-r--r--src/core/unit.h16
-rw-r--r--src/journal-remote/microhttpd-util.c6
-rw-r--r--src/journal/test-journal-interleaving.c6
-rw-r--r--src/libsystemd-network/dhcp-internal.h2
-rw-r--r--src/libsystemd-network/dhcp-server-internal.h2
-rw-r--r--src/libsystemd-network/dhcp6-internal.h2
-rw-r--r--src/libsystemd-network/ipv4ll-internal.h2
-rw-r--r--src/libsystemd-network/sd-icmp6-nd.c2
-rw-r--r--src/libsystemd-terminal/idev-keyboard.c2
-rw-r--r--src/modules-load/modules-load.c2
-rw-r--r--src/network/networkd-address.c4
-rw-r--r--src/network/networkd-dhcp4.c64
-rw-r--r--src/network/networkd-ipv4ll.c16
-rw-r--r--src/network/networkd-link.c182
-rw-r--r--src/network/networkd-link.h16
-rw-r--r--src/network/networkd-netdev-bond.c12
-rw-r--r--src/network/networkd-netdev-macvlan.c2
-rw-r--r--src/network/networkd-netdev-tunnel.c38
-rw-r--r--src/network/networkd-netdev-tuntap.c10
-rw-r--r--src/network/networkd-netdev-veth.c6
-rw-r--r--src/network/networkd-netdev-vlan.c2
-rw-r--r--src/network/networkd-netdev-vxlan.c12
-rw-r--r--src/network/networkd-netdev.c70
-rw-r--r--src/network/networkd-netdev.h6
-rw-r--r--src/network/networkd.h16
-rw-r--r--src/shared/env-util.c2
-rw-r--r--src/shared/log.c14
-rw-r--r--src/shared/log.h22
-rw-r--r--src/sysv-generator/sysv-generator.c16
-rw-r--r--src/udev/udev-builtin-kmod.c2
51 files changed, 671 insertions, 665 deletions
diff --git a/src/analyze/analyze-verify.c b/src/analyze/analyze-verify.c
index 5b16b6c3d9..f084579f1a 100644
--- a/src/analyze/analyze-verify.c
+++ b/src/analyze/analyze-verify.c
@@ -74,7 +74,7 @@ static int verify_socket(Unit *u) {
/* This makes sure instance is created if necessary. */
r = socket_instantiate_service(SOCKET(u));
if (r < 0) {
- log_error_unit(u->id, "Socket %s cannot be started, failed to create instance.",
+ log_unit_error(u->id, "Socket %s cannot be started, failed to create instance.",
u->id);
return r;
}
@@ -84,10 +84,10 @@ static int verify_socket(Unit *u) {
Service *service;
service = SERVICE(UNIT_DEREF(SOCKET(u)->service));
- log_debug_unit(u->id, "%s uses %s", u->id, UNIT(service)->id);
+ log_unit_debug(u->id, "%s uses %s", u->id, UNIT(service)->id);
if (UNIT(service)->load_state != UNIT_LOADED) {
- log_error_unit(u->id, "Service %s not loaded, %s cannot be started.",
+ log_unit_error(u->id, "Service %s not loaded, %s cannot be started.",
UNIT(service)->id, u->id);
return -ENOENT;
}
@@ -101,7 +101,7 @@ static int verify_executable(Unit *u, ExecCommand *exec) {
return 0;
if (access(exec->path, X_OK) < 0) {
- log_error_unit(u->id, "%s: command %s is not executable: %m",
+ log_unit_error(u->id, "%s: command %s is not executable: %m",
u->id, exec->path);
return -errno;
}
@@ -145,15 +145,15 @@ static int verify_documentation(Unit *u, bool check_man) {
int r = 0, k;
STRV_FOREACH(p, u->documentation) {
- log_debug_unit(u->id, "%s: found documentation item %s.", u->id, *p);
+ log_unit_debug(u->id, "%s: found documentation item %s.", u->id, *p);
if (check_man && startswith(*p, "man:")) {
k = show_man_page(*p + 4, true);
if (k != 0) {
if (k < 0)
- log_error_unit(u->id, "%s: can't show %s: %s",
+ log_unit_error(u->id, "%s: can't show %s: %s",
u->id, *p, strerror(-r));
else {
- log_error_unit(u->id, "%s: man %s command failed with code %d",
+ log_unit_error(u->id, "%s: man %s command failed with code %d",
u->id, *p + 4, k);
k = -ENOEXEC;
}
@@ -178,13 +178,13 @@ static int verify_unit(Unit *u, bool check_man) {
if (log_get_max_level() >= LOG_DEBUG)
unit_dump(u, stdout, "\t");
- log_debug_unit(u->id, "Creating %s/start job", u->id);
+ log_unit_debug(u->id, "Creating %s/start job", u->id);
r = manager_add_job(u->manager, JOB_START, u, JOB_REPLACE, false, &err, &j);
if (sd_bus_error_is_set(&err))
- log_error_unit(u->id, "Error: %s: %s",
+ log_unit_error(u->id, "Error: %s: %s",
err.name, err.message);
if (r < 0)
- log_error_unit(u->id, "Failed to create %s/start: %s",
+ log_unit_error(u->id, "Failed to create %s/start: %s",
u->id, strerror(-r));
k = verify_socket(u);
diff --git a/src/core/automount.c b/src/core/automount.c
index f72aca2957..f874951f4c 100644
--- a/src/core/automount.c
+++ b/src/core/automount.c
@@ -151,7 +151,7 @@ static int automount_verify(Automount *a) {
return 0;
if (path_equal(a->where, "/")) {
- log_error_unit(UNIT(a)->id, "Cannot have an automount unit for the root directory. Refusing.");
+ log_unit_error(UNIT(a)->id, "Cannot have an automount unit for the root directory. Refusing.");
return -EINVAL;
}
@@ -162,7 +162,7 @@ static int automount_verify(Automount *a) {
b = unit_has_name(UNIT(a), e);
if (!b) {
- log_error_unit(UNIT(a)->id, "%s's Where setting doesn't match unit name. Refusing.", UNIT(a)->id);
+ log_unit_error(UNIT(a)->id, "%s's Where setting doesn't match unit name. Refusing.", UNIT(a)->id);
return -EINVAL;
}
@@ -226,7 +226,7 @@ static void automount_set_state(Automount *a, AutomountState state) {
unmount_autofs(a);
if (state != old_state)
- log_debug_unit(UNIT(a)->id,
+ log_unit_debug(UNIT(a)->id,
"%s changed %s -> %s",
UNIT(a)->id,
automount_state_to_string(old_state),
@@ -422,9 +422,9 @@ int automount_send_ready(Automount *a, int status) {
return ioctl_fd;
if (status)
- log_debug_unit(UNIT(a)->id, "Sending failure: %s", strerror(-status));
+ log_unit_debug(UNIT(a)->id, "Sending failure: %s", strerror(-status));
else
- log_debug_unit(UNIT(a)->id, "Sending success.");
+ log_unit_debug(UNIT(a)->id, "Sending success.");
r = 0;
@@ -536,7 +536,7 @@ fail:
if (mounted)
repeat_unmount(a->where);
- log_error_unit(UNIT(a)->id,
+ log_unit_error(UNIT(a)->id,
"Failed to initialize automounter: %s", strerror(-r));
automount_enter_dead(a, AUTOMOUNT_FAILURE_RESOURCES);
}
@@ -551,7 +551,7 @@ static void automount_enter_runnning(Automount *a) {
/* We don't take mount requests anymore if we are supposed to
* shut down anyway */
if (unit_stop_pending(UNIT(a))) {
- log_debug_unit(UNIT(a)->id,
+ log_unit_debug(UNIT(a)->id,
"Suppressing automount request on %s since unit stop is scheduled.", UNIT(a)->id);
automount_send_ready(a, -EHOSTDOWN);
return;
@@ -561,19 +561,19 @@ static void automount_enter_runnning(Automount *a) {
/* Before we do anything, let's see if somebody is playing games with us? */
if (lstat(a->where, &st) < 0) {
- log_warning_unit(UNIT(a)->id,
+ log_unit_warning(UNIT(a)->id,
"%s failed to stat automount point: %m", UNIT(a)->id);
goto fail;
}
if (!S_ISDIR(st.st_mode) || st.st_dev != a->dev_id)
- log_info_unit(UNIT(a)->id,
+ log_unit_info(UNIT(a)->id,
"%s's automount point already active?", UNIT(a)->id);
else {
r = manager_add_job(UNIT(a)->manager, JOB_START, UNIT_TRIGGER(UNIT(a)),
JOB_REPLACE, true, &error, NULL);
if (r < 0) {
- log_warning_unit(UNIT(a)->id,
+ log_unit_warning(UNIT(a)->id,
"%s failed to queue mount startup job: %s",
UNIT(a)->id, bus_error_message(&error, r));
goto fail;
@@ -594,7 +594,7 @@ static int automount_start(Unit *u) {
assert(a->state == AUTOMOUNT_DEAD || a->state == AUTOMOUNT_FAILED);
if (path_is_mount_point(a->where, false)) {
- log_error_unit(u->id,
+ log_unit_error(u->id,
"Path %s is already a mount point, refusing start for %s",
a->where, u->id);
return -EEXIST;
@@ -659,7 +659,7 @@ static int automount_deserialize_item(Unit *u, const char *key, const char *valu
state = automount_state_from_string(value);
if (state < 0)
- log_debug_unit(u->id, "Failed to parse state value %s", value);
+ log_unit_debug(u->id, "Failed to parse state value %s", value);
else
a->deserialized_state = state;
} else if (streq(key, "result")) {
@@ -667,7 +667,7 @@ static int automount_deserialize_item(Unit *u, const char *key, const char *valu
f = automount_result_from_string(value);
if (f < 0)
- log_debug_unit(u->id, "Failed to parse result value %s", value);
+ log_unit_debug(u->id, "Failed to parse result value %s", value);
else if (f != AUTOMOUNT_SUCCESS)
a->result = f;
@@ -675,14 +675,14 @@ static int automount_deserialize_item(Unit *u, const char *key, const char *valu
unsigned d;
if (safe_atou(value, &d) < 0)
- log_debug_unit(u->id, "Failed to parse dev-id value %s", value);
+ log_unit_debug(u->id, "Failed to parse dev-id value %s", value);
else
a->dev_id = (unsigned) d;
} else if (streq(key, "token")) {
unsigned token;
if (safe_atou(value, &token) < 0)
- log_debug_unit(u->id, "Failed to parse token value %s", value);
+ log_unit_debug(u->id, "Failed to parse token value %s", value);
else {
if (!a->tokens)
if (!(a->tokens = set_new(NULL)))
@@ -696,13 +696,13 @@ static int automount_deserialize_item(Unit *u, const char *key, const char *valu
int fd;
if (safe_atoi(value, &fd) < 0 || fd < 0 || !fdset_contains(fds, fd))
- log_debug_unit(u->id, "Failed to parse pipe-fd value %s", value);
+ log_unit_debug(u->id, "Failed to parse pipe-fd value %s", value);
else {
safe_close(a->pipe_fd);
a->pipe_fd = fdset_remove(fds, fd);
}
} else
- log_debug_unit(u->id, "Unknown serialization key '%s'", key);
+ log_unit_debug(u->id, "Unknown serialization key '%s'", key);
return 0;
}
@@ -738,13 +738,13 @@ static int automount_dispatch_io(sd_event_source *s, int fd, uint32_t events, vo
assert(fd == a->pipe_fd);
if (events != EPOLLIN) {
- log_error_unit(UNIT(a)->id, "Got invalid poll event on pipe.");
+ log_unit_error(UNIT(a)->id, "Got invalid poll event on pipe.");
goto fail;
}
l = loop_read(a->pipe_fd, &packet, sizeof(packet), true);
if (l != sizeof(packet)) {
- log_error_unit(UNIT(a)->id, "Invalid read from pipe: %s", l < 0 ? strerror(-l) : "short read");
+ log_unit_error(UNIT(a)->id, "Invalid read from pipe: %s", l < 0 ? strerror(-l) : "short read");
goto fail;
}
@@ -756,21 +756,21 @@ static int automount_dispatch_io(sd_event_source *s, int fd, uint32_t events, vo
_cleanup_free_ char *p = NULL;
get_process_comm(packet.v5_packet.pid, &p);
- log_info_unit(UNIT(a)->id,
+ log_unit_info(UNIT(a)->id,
"Got automount request for %s, triggered by "PID_FMT" (%s)",
a->where, packet.v5_packet.pid, strna(p));
} else
- log_debug_unit(UNIT(a)->id, "Got direct mount request on %s", a->where);
+ log_unit_debug(UNIT(a)->id, "Got direct mount request on %s", a->where);
r = set_ensure_allocated(&a->tokens, NULL);
if (r < 0) {
- log_error_unit(UNIT(a)->id, "Failed to allocate token set.");
+ log_unit_error(UNIT(a)->id, "Failed to allocate token set.");
goto fail;
}
r = set_put(a->tokens, UINT_TO_PTR(packet.v5_packet.wait_queue_token));
if (r < 0) {
- log_error_unit(UNIT(a)->id, "Failed to remember token: %s", strerror(-r));
+ log_unit_error(UNIT(a)->id, "Failed to remember token: %s", strerror(-r));
goto fail;
}
@@ -778,7 +778,7 @@ static int automount_dispatch_io(sd_event_source *s, int fd, uint32_t events, vo
break;
default:
- log_error_unit(UNIT(a)->id, "Received unknown automount request %i", packet.hdr.type);
+ log_unit_error(UNIT(a)->id, "Received unknown automount request %i", packet.hdr.type);
break;
}
diff --git a/src/core/busname.c b/src/core/busname.c
index 8926c6bd94..2ad6c6e137 100644
--- a/src/core/busname.c
+++ b/src/core/busname.c
@@ -200,13 +200,13 @@ static int busname_verify(BusName *n) {
return 0;
if (!service_name_is_valid(n->name)) {
- log_error_unit(UNIT(n)->id, "%s's Name= setting is not a valid service name Refusing.", UNIT(n)->id);
+ log_unit_error(UNIT(n)->id, "%s's Name= setting is not a valid service name Refusing.", UNIT(n)->id);
return -EINVAL;
}
e = strappenda(n->name, ".busname");
if (!unit_has_name(UNIT(n), e)) {
- log_error_unit(UNIT(n)->id, "%s's Name= setting doesn't match unit name. Refusing.", UNIT(n)->id);
+ log_unit_error(UNIT(n)->id, "%s's Name= setting doesn't match unit name. Refusing.", UNIT(n)->id);
return -EINVAL;
}
@@ -268,7 +268,7 @@ static void busname_unwatch_fd(BusName *n) {
r = sd_event_source_set_enabled(n->starter_event_source, SD_EVENT_OFF);
if (r < 0)
- log_debug_unit(UNIT(n)->id, "Failed to disable event source.");
+ log_unit_debug(UNIT(n)->id, "Failed to disable event source.");
}
static int busname_watch_fd(BusName *n) {
@@ -284,7 +284,7 @@ static int busname_watch_fd(BusName *n) {
else
r = sd_event_add_io(UNIT(n)->manager->event, &n->starter_event_source, n->starter_fd, EPOLLIN, busname_dispatch_io, n);
if (r < 0) {
- log_warning_unit(UNIT(n)->id, "Failed to watch starter fd: %s", strerror(-r));
+ log_unit_warning(UNIT(n)->id, "Failed to watch starter fd: %s", strerror(-r));
busname_unwatch_fd(n);
return r;
}
@@ -304,7 +304,7 @@ static int busname_open_fd(BusName *n) {
mode = UNIT(n)->manager->running_as == SYSTEMD_SYSTEM ? "system" : "user";
n->starter_fd = bus_kernel_open_bus_fd(mode, &path);
if (n->starter_fd < 0) {
- log_warning_unit(UNIT(n)->id, "Failed to open %s: %s", path ?: "kdbus", strerror(-n->starter_fd));
+ log_unit_warning(UNIT(n)->id, "Failed to open %s: %s", path ?: "kdbus", strerror(-n->starter_fd));
return n->starter_fd;
}
@@ -330,7 +330,7 @@ static void busname_set_state(BusName *n, BusNameState state) {
busname_close_fd(n);
if (state != old_state)
- log_debug_unit(UNIT(n)->id, "%s changed %s -> %s",
+ log_unit_debug(UNIT(n)->id, "%s changed %s -> %s",
UNIT(n)->id, busname_state_to_string(old_state), busname_state_to_string(state));
unit_notify(UNIT(n), state_translation_table[old_state], state_translation_table[state], true);
@@ -453,14 +453,14 @@ static void busname_enter_signal(BusName *n, BusNameState state, BusNameResult f
n->control_pid,
false);
if (r < 0) {
- log_warning_unit(UNIT(n)->id, "%s failed to kill control process: %s", UNIT(n)->id, strerror(-r));
+ log_unit_warning(UNIT(n)->id, "%s failed to kill control process: %s", UNIT(n)->id, strerror(-r));
goto fail;
}
if (r > 0) {
r = busname_arm_timer(n);
if (r < 0) {
- log_warning_unit(UNIT(n)->id, "%s failed to arm timer: %s", UNIT(n)->id, strerror(-r));
+ log_unit_warning(UNIT(n)->id, "%s failed to arm timer: %s", UNIT(n)->id, strerror(-r));
goto fail;
}
@@ -484,7 +484,7 @@ static void busname_enter_listening(BusName *n) {
if (n->activating) {
r = busname_watch_fd(n);
if (r < 0) {
- log_warning_unit(UNIT(n)->id, "%s failed to watch names: %s", UNIT(n)->id, strerror(-r));
+ log_unit_warning(UNIT(n)->id, "%s failed to watch names: %s", UNIT(n)->id, strerror(-r));
goto fail;
}
@@ -515,7 +515,7 @@ static void busname_enter_making(BusName *n) {
r = busname_make_starter(n, &n->control_pid);
if (r < 0) {
- log_warning_unit(UNIT(n)->id, "%s failed to fork 'making' task: %s", UNIT(n)->id, strerror(-r));
+ log_unit_warning(UNIT(n)->id, "%s failed to fork 'making' task: %s", UNIT(n)->id, strerror(-r));
goto fail;
}
@@ -526,7 +526,7 @@ static void busname_enter_making(BusName *n) {
r = bus_kernel_make_starter(n->starter_fd, n->name, n->activating, n->accept_fd, NULL, n->policy_world);
if (r < 0) {
- log_warning_unit(UNIT(n)->id, "%s failed to make starter: %s", UNIT(n)->id, strerror(-r));
+ log_unit_warning(UNIT(n)->id, "%s failed to make starter: %s", UNIT(n)->id, strerror(-r));
goto fail;
}
@@ -555,7 +555,7 @@ static void busname_enter_running(BusName *n) {
* shut down anyway */
if (unit_stop_pending(UNIT(n))) {
- log_debug_unit(UNIT(n)->id, "Suppressing activation request on %s since unit stop is scheduled.", UNIT(n)->id);
+ log_unit_debug(UNIT(n)->id, "Suppressing activation request on %s since unit stop is scheduled.", UNIT(n)->id);
/* Flush all queued activation reqeuest by closing and reopening the connection */
bus_kernel_drop_one(n->starter_fd);
@@ -582,7 +582,7 @@ static void busname_enter_running(BusName *n) {
return;
fail:
- log_warning_unit(UNIT(n)->id, "%s failed to queue service startup job: %s", UNIT(n)->id, bus_error_message(&error, r));
+ log_unit_warning(UNIT(n)->id, "%s failed to queue service startup job: %s", UNIT(n)->id, bus_error_message(&error, r));
busname_enter_dead(n, BUSNAME_FAILURE_RESOURCES);
}
@@ -606,7 +606,7 @@ static int busname_start(Unit *u) {
service = SERVICE(UNIT_DEREF(n->service));
if (UNIT(service)->load_state != UNIT_LOADED) {
- log_error_unit(u->id, "Bus service %s not loaded, refusing.", UNIT(service)->id);
+ log_unit_error(u->id, "Bus service %s not loaded, refusing.", UNIT(service)->id);
return -ENOENT;
}
}
@@ -680,7 +680,7 @@ static int busname_deserialize_item(Unit *u, const char *key, const char *value,
state = busname_state_from_string(value);
if (state < 0)
- log_debug_unit(u->id, "Failed to parse state value %s", value);
+ log_unit_debug(u->id, "Failed to parse state value %s", value);
else
n->deserialized_state = state;
@@ -689,7 +689,7 @@ static int busname_deserialize_item(Unit *u, const char *key, const char *value,
f = busname_result_from_string(value);
if (f < 0)
- log_debug_unit(u->id, "Failed to parse result value %s", value);
+ log_unit_debug(u->id, "Failed to parse result value %s", value);
else if (f != BUSNAME_SUCCESS)
n->result = f;
@@ -697,20 +697,20 @@ static int busname_deserialize_item(Unit *u, const char *key, const char *value,
pid_t pid;
if (parse_pid(value, &pid) < 0)
- log_debug_unit(u->id, "Failed to parse control-pid value %s", value);
+ log_unit_debug(u->id, "Failed to parse control-pid value %s", value);
else
n->control_pid = pid;
} else if (streq(key, "starter-fd")) {
int fd;
if (safe_atoi(value, &fd) < 0 || fd < 0 || !fdset_contains(fds, fd))
- log_debug_unit(u->id, "Failed to parse starter fd value %s", value);
+ log_unit_debug(u->id, "Failed to parse starter fd value %s", value);
else {
safe_close(n->starter_fd);
n->starter_fd = fdset_remove(fds, fd);
}
} else
- log_debug_unit(u->id, "Unknown serialization key '%s'", key);
+ log_unit_debug(u->id, "Unknown serialization key '%s'", key);
return 0;
}
@@ -757,7 +757,7 @@ static int busname_peek_message(BusName *n) {
if (errno == EINTR || errno == EAGAIN)
return 0;
- log_error_unit(UNIT(n)->id, "%s: Failed to query activation message: %m", UNIT(n)->id);
+ log_unit_error(UNIT(n)->id, "%s: Failed to query activation message: %m", UNIT(n)->id);
return -errno;
}
@@ -774,7 +774,7 @@ static int busname_peek_message(BusName *n) {
p = mmap(NULL, sz, PROT_READ, MAP_SHARED, n->starter_fd, start);
if (p == MAP_FAILED) {
- log_error_unit(UNIT(n)->id, "%s: Failed to map activation message: %m", UNIT(n)->id);
+ log_unit_error(UNIT(n)->id, "%s: Failed to map activation message: %m", UNIT(n)->id);
r = -errno;
goto finish;
}
@@ -794,7 +794,7 @@ static int busname_peek_message(BusName *n) {
}
if (pid > 0)
- log_debug_unit(UNIT(n)->id, "%s: Activation triggered by process " PID_FMT " (%s)", UNIT(n)->id, pid, strna(comm));
+ log_unit_debug(UNIT(n)->id, "%s: Activation triggered by process " PID_FMT " (%s)", UNIT(n)->id, pid, strna(comm));
r = 0;
@@ -804,7 +804,7 @@ finish:
cmd_free.offset = cmd_recv.offset;
if (ioctl(n->starter_fd, KDBUS_CMD_FREE, &cmd_free) < 0)
- log_warning_unit(UNIT(n)->id, "Failed to free peeked message, ignoring: %m");
+ log_unit_warning(UNIT(n)->id, "Failed to free peeked message, ignoring: %m");
return r;
}
@@ -818,10 +818,10 @@ static int busname_dispatch_io(sd_event_source *source, int fd, uint32_t revents
if (n->state != BUSNAME_LISTENING)
return 0;
- log_debug_unit(UNIT(n)->id, "Activation request on %s", UNIT(n)->id);
+ log_unit_debug(UNIT(n)->id, "Activation request on %s", UNIT(n)->id);
if (revents != EPOLLIN) {
- log_error_unit(UNIT(n)->id, "%s: Got unexpected poll event (0x%x) on starter fd.",
+ log_unit_error(UNIT(n)->id, "%s: Got unexpected poll event (0x%x) on starter fd.",
UNIT(n)->id, revents);
goto fail;
}
@@ -858,8 +858,9 @@ static void busname_sigchld_event(Unit *u, pid_t pid, int code, int status) {
else
assert_not_reached("Unknown sigchld code");
- log_full_unit(f == BUSNAME_SUCCESS ? LOG_DEBUG : LOG_NOTICE,
- u->id, "%s control process exited, code=%s status=%i",
+ log_unit_full(u->id,
+ f == BUSNAME_SUCCESS ? LOG_DEBUG : LOG_NOTICE,
+ "%s control process exited, code=%s status=%i",
u->id, sigchld_code_to_string(code), status);
if (f != BUSNAME_SUCCESS)
@@ -896,17 +897,17 @@ static int busname_dispatch_timer(sd_event_source *source, usec_t usec, void *us
switch (n->state) {
case BUSNAME_MAKING:
- log_warning_unit(UNIT(n)->id, "%s making timed out. Terminating.", UNIT(n)->id);
+ log_unit_warning(UNIT(n)->id, "%s making timed out. Terminating.", UNIT(n)->id);
busname_enter_signal(n, BUSNAME_SIGTERM, BUSNAME_FAILURE_TIMEOUT);
break;
case BUSNAME_SIGTERM:
- log_warning_unit(UNIT(n)->id, "%s stopping timed out. Killing.", UNIT(n)->id);
+ log_unit_warning(UNIT(n)->id, "%s stopping timed out. Killing.", UNIT(n)->id);
busname_enter_signal(n, BUSNAME_SIGKILL, BUSNAME_FAILURE_TIMEOUT);
break;
case BUSNAME_SIGKILL:
- log_warning_unit(UNIT(n)->id, "%s still around after SIGKILL. Ignoring.", UNIT(n)->id);
+ log_unit_warning(UNIT(n)->id, "%s still around after SIGKILL. Ignoring.", UNIT(n)->id);
busname_enter_dead(n, BUSNAME_FAILURE_TIMEOUT);
break;
diff --git a/src/core/device.c b/src/core/device.c
index 11c4261081..068578dc82 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -98,7 +98,7 @@ static void device_set_state(Device *d, DeviceState state) {
d->state = state;
if (state != old_state)
- log_debug_unit(UNIT(d)->id,
+ log_unit_debug(UNIT(d)->id,
"%s changed %s -> %s", UNIT(d)->id,
device_state_to_string(old_state),
device_state_to_string(state));
@@ -249,7 +249,7 @@ static int device_add_udev_wants(Unit *u, struct udev_device *dev) {
return r;
}
if (!isempty(state))
- log_warning_unit(u->id, "Property %s on %s has trailing garbage, ignoring.",
+ log_unit_warning(u->id, "Property %s on %s has trailing garbage, ignoring.",
property, strna(udev_device_get_syspath(dev)));
return 0;
diff --git a/src/core/execute.c b/src/core/execute.c
index e6c19993ae..dd182f5564 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -426,7 +426,7 @@ static int setup_output(const ExecContext *context, int fileno, int socket_fd, c
case EXEC_OUTPUT_JOURNAL_AND_CONSOLE:
r = connect_logger_as(context, o, ident, unit_id, fileno);
if (r < 0) {
- log_struct_unit(LOG_CRIT, unit_id,
+ log_unit_struct(LOG_CRIT, unit_id,
"MESSAGE=Failed to connect std%s of %s to the journal socket: %s",
fileno == STDOUT_FILENO ? "out" : "err",
unit_id, strerror(-r),
@@ -1549,7 +1549,7 @@ static int exec_child(ExecCommand *command,
context->mount_flags);
if (err == -EPERM)
- log_warning_unit(params->unit_id, "Failed to set up file system namespace due to lack of privileges. Execution sandbox will not be in effect: %s", strerror(-err));
+ log_unit_warning(params->unit_id, "Failed to set up file system namespace due to lack of privileges. Execution sandbox will not be in effect: %s", strerror(-err));
else if (err < 0) {
*error = EXIT_NAMESPACE;
return err;
@@ -1751,7 +1751,7 @@ static int exec_child(ExecCommand *command,
line = exec_command_line(final_argv);
if (line) {
log_open();
- log_struct_unit(LOG_DEBUG,
+ log_unit_struct(LOG_DEBUG,
params->unit_id,
"EXECUTABLE=%s", command->path,
"MESSAGE=Executing: %s", line,
@@ -1799,7 +1799,7 @@ int exec_spawn(ExecCommand *command,
err = exec_context_load_environment(context, params->unit_id, &files_env);
if (err < 0) {
- log_struct_unit(LOG_ERR,
+ log_unit_struct(LOG_ERR,
params->unit_id,
"MESSAGE=Failed to load environment files: %s", strerror(-err),
"ERRNO=%d", -err,
@@ -1813,7 +1813,7 @@ int exec_spawn(ExecCommand *command,
if (!line)
return log_oom();
- log_struct_unit(LOG_DEBUG,
+ log_unit_struct(LOG_DEBUG,
params->unit_id,
"EXECUTABLE=%s", command->path,
"MESSAGE=About to execute: %s", line,
@@ -1851,7 +1851,7 @@ int exec_spawn(ExecCommand *command,
_exit(r);
}
- log_struct_unit(LOG_DEBUG,
+ log_unit_struct(LOG_DEBUG,
params->unit_id,
"MESSAGE=Forked %s as "PID_FMT,
command->path, pid,
@@ -2771,7 +2771,7 @@ int exec_runtime_deserialize_item(ExecRuntime **rt, Unit *u, const char *key, co
return r;
if (safe_atoi(value, &fd) < 0 || !fdset_contains(fds, fd))
- log_debug_unit(u->id, "Failed to parse netns socket value %s", value);
+ log_unit_debug(u->id, "Failed to parse netns socket value %s", value);
else {
safe_close((*rt)->netns_storage_socket[0]);
(*rt)->netns_storage_socket[0] = fdset_remove(fds, fd);
@@ -2784,7 +2784,7 @@ int exec_runtime_deserialize_item(ExecRuntime **rt, Unit *u, const char *key, co
return r;
if (safe_atoi(value, &fd) < 0 || !fdset_contains(fds, fd))
- log_debug_unit(u->id, "Failed to parse netns socket value %s", value);
+ log_unit_debug(u->id, "Failed to parse netns socket value %s", value);
else {
safe_close((*rt)->netns_storage_socket[1]);
(*rt)->netns_storage_socket[1] = fdset_remove(fds, fd);
diff --git a/src/core/job.c b/src/core/job.c
index 9adc3fda6a..80fdbde5ab 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -168,7 +168,7 @@ Job* job_install(Job *j) {
if (uj->state == JOB_WAITING ||
(job_type_allows_late_merge(j->type) && job_type_is_superset(uj->type, j->type))) {
job_merge_into_installed(uj, j);
- log_debug_unit(uj->unit->id,
+ log_unit_debug(uj->unit->id,
"Merged into installed job %s/%s as %u",
uj->unit->id, job_type_to_string(uj->type), (unsigned) uj->id);
return uj;
@@ -178,7 +178,7 @@ Job* job_install(Job *j) {
/* XXX It should be safer to queue j to run after uj finishes, but it is
* not currently possible to have more than one installed job per unit. */
job_merge_into_installed(uj, j);
- log_debug_unit(uj->unit->id,
+ log_unit_debug(uj->unit->id,
"Merged into running job, re-running: %s/%s as %u",
uj->unit->id, job_type_to_string(uj->type), (unsigned) uj->id);
uj->state = JOB_WAITING;
@@ -192,7 +192,7 @@ Job* job_install(Job *j) {
*pj = j;
j->installed = true;
j->manager->n_installed_jobs ++;
- log_debug_unit(j->unit->id,
+ log_unit_debug(j->unit->id,
"Installed new job %s/%s as %u",
j->unit->id, job_type_to_string(j->type), (unsigned) j->id);
return j;
@@ -211,14 +211,14 @@ int job_install_deserialized(Job *j) {
pj = (j->type == JOB_NOP) ? &j->unit->nop_job : &j->unit->job;
if (*pj) {
- log_debug_unit(j->unit->id,
+ log_unit_debug(j->unit->id,
"Unit %s already has a job installed. Not installing deserialized job.",
j->unit->id);
return -EEXIST;
}
*pj = j;
j->installed = true;
- log_debug_unit(j->unit->id,
+ log_unit_debug(j->unit->id,
"Reinstalled deserialized job %s/%s as %u",
j->unit->id, job_type_to_string(j->type), (unsigned) j->id);
return 0;
@@ -457,7 +457,7 @@ static bool job_is_runnable(Job *j) {
}
static void job_change_type(Job *j, JobType newtype) {
- log_debug_unit(j->unit->id,
+ log_unit_debug(j->unit->id,
"Converting job %s/%s -> %s/%s",
j->unit->id, job_type_to_string(j->type),
j->unit->id, job_type_to_string(newtype));
@@ -730,7 +730,7 @@ static void job_log_status_message(Unit *u, JobType t, JobResult result) {
sd_id128_t mid;
mid = result == JOB_DONE ? SD_MESSAGE_UNIT_STARTED : SD_MESSAGE_UNIT_FAILED;
- log_struct_unit(result == JOB_DONE ? LOG_INFO : LOG_ERR,
+ log_unit_struct(result == JOB_DONE ? LOG_INFO : LOG_ERR,
u->id,
MESSAGE_ID(mid),
"RESULT=%s", job_result_to_string(result),
@@ -738,7 +738,7 @@ static void job_log_status_message(Unit *u, JobType t, JobResult result) {
NULL);
} else if (t == JOB_STOP)
- log_struct_unit(result == JOB_DONE ? LOG_INFO : LOG_ERR,
+ log_unit_struct(result == JOB_DONE ? LOG_INFO : LOG_ERR,
u->id,
MESSAGE_ID(SD_MESSAGE_UNIT_STOPPED),
"RESULT=%s", job_result_to_string(result),
@@ -746,7 +746,7 @@ static void job_log_status_message(Unit *u, JobType t, JobResult result) {
NULL);
else if (t == JOB_RELOAD)
- log_struct_unit(result == JOB_DONE ? LOG_INFO : LOG_ERR,
+ log_unit_struct(result == JOB_DONE ? LOG_INFO : LOG_ERR,
u->id,
MESSAGE_ID(SD_MESSAGE_UNIT_RELOADED),
"RESULT=%s", job_result_to_string(result),
@@ -772,7 +772,7 @@ int job_finish_and_invalidate(Job *j, JobResult result, bool recursive) {
if (j->state == JOB_RUNNING)
j->manager->n_running_jobs--;
- log_debug_unit(u->id, "Job %s/%s finished, result=%s",
+ log_unit_debug(u->id, "Job %s/%s finished, result=%s",
u->id, job_type_to_string(t), job_result_to_string(result));
job_print_status_message(u, t, result);
@@ -837,7 +837,7 @@ int job_finish_and_invalidate(Job *j, JobResult result, bool recursive) {
* this context. And JOB_FAILURE is already handled by the
* unit itself. */
if (result == JOB_TIMEOUT || result == JOB_DEPENDENCY) {
- log_struct_unit(LOG_NOTICE,
+ log_unit_struct(LOG_NOTICE,
u->id,
"JOB_TYPE=%s", job_type_to_string(t),
"JOB_RESULT=%s", job_result_to_string(result),
@@ -873,7 +873,7 @@ static int job_dispatch_timer(sd_event_source *s, uint64_t monotonic, void *user
assert(j);
assert(s == j->timer_event_source);
- log_warning_unit(j->unit->id, "Job %s/%s timed out.", j->unit->id, job_type_to_string(j->type));
+ log_unit_warning(j->unit->id, "Job %s/%s timed out.", j->unit->id, job_type_to_string(j->type));
u = j->unit;
job_finish_and_invalidate(j, JOB_TIMEOUT, true);
diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c
index 50af7932f6..019858f092 100644
--- a/src/core/kmod-setup.c
+++ b/src/core/kmod-setup.c
@@ -44,7 +44,7 @@ static void systemd_kmod_log(
/* library logging is enabled at debug only */
DISABLE_WARNING_FORMAT_NONLITERAL;
- log_metav(LOG_DEBUG, 0, file, line, fn, format, args);
+ log_internalv(LOG_DEBUG, 0, file, line, fn, format, args);
REENABLE_WARNING;
}
diff --git a/src/core/main.c b/src/core/main.c
index 486602ec0a..78054afc4d 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -468,7 +468,7 @@ static int config_parse_cpu_affinity2(
if (c) {
if (sched_setaffinity(0, CPU_ALLOC_SIZE(ncpus), c) < 0)
- log_warning_unit(unit, "Failed to set CPU affinity: %m");
+ log_unit_warning(unit, "Failed to set CPU affinity: %m");
CPU_FREE(c);
}
diff --git a/src/core/manager.c b/src/core/manager.c
index d5d6486cc7..7af502aba6 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -854,7 +854,7 @@ static unsigned manager_dispatch_gc_queue(Manager *m) {
if (u->gc_marker == gc_marker + GC_OFFSET_BAD ||
u->gc_marker == gc_marker + GC_OFFSET_UNSURE) {
- log_debug_unit(u->id, "Collecting %s", u->id);
+ log_unit_debug(u->id, "Collecting %s", u->id);
u->gc_marker = gc_marker + GC_OFFSET_BAD;
unit_add_to_cleanup_queue(u);
}
@@ -1173,7 +1173,7 @@ int manager_add_job(Manager *m, JobType type, Unit *unit, JobMode mode, bool ove
if (mode == JOB_ISOLATE && !unit->allow_isolate)
return sd_bus_error_setf(e, BUS_ERROR_NO_ISOLATION, "Operation refused, unit may not be isolated.");
- log_debug_unit(unit->id,
+ log_unit_debug(unit->id,
"Trying to enqueue job %s/%s/%s", unit->id,
job_type_to_string(type), job_mode_to_string(mode));
@@ -1199,7 +1199,7 @@ int manager_add_job(Manager *m, JobType type, Unit *unit, JobMode mode, bool ove
if (r < 0)
goto tr_abort;
- log_debug_unit(unit->id,
+ log_unit_debug(unit->id,
"Enqueued job %s/%s as %u", unit->id,
job_type_to_string(type), (unsigned) tr->anchor_job->id);
@@ -1469,7 +1469,7 @@ static void manager_invoke_notify_message(Manager *m, Unit *u, pid_t pid, char *
return;
}
- log_debug_unit(u->id, "Got notification message for unit %s", u->id);
+ log_unit_debug(u->id, "Got notification message for unit %s", u->id);
if (UNIT_VTABLE(u)->notify_message)
UNIT_VTABLE(u)->notify_message(u, pid, tags);
@@ -1565,7 +1565,7 @@ static void invoke_sigchld_event(Manager *m, Unit *u, siginfo_t *si) {
assert(u);
assert(si);
- log_debug_unit(u->id, "Child "PID_FMT" belongs to %s", si->si_pid, u->id);
+ log_unit_debug(u->id, "Child "PID_FMT" belongs to %s", si->si_pid, u->id);
unit_unwatch_pid(u, si->si_pid);
UNIT_VTABLE(u)->sigchld_event(u, si->si_pid, si->si_code, si->si_status);
@@ -1637,11 +1637,11 @@ static int manager_start_target(Manager *m, const char *name, JobMode mode) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
int r;
- log_debug_unit(name, "Activating special unit %s", name);
+ log_unit_debug(name, "Activating special unit %s", name);
r = manager_add_job_by_name(m, JOB_START, name, mode, true, &error, NULL);
if (r < 0)
- log_error_unit(name, "Failed to enqueue %s job: %s", name, bus_error_message(&error, r));
+ log_unit_error(name, "Failed to enqueue %s job: %s", name, bus_error_message(&error, r));
return r;
}
diff --git a/src/core/mount.c b/src/core/mount.c
index b571db946d..36375f65bc 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -437,22 +437,22 @@ static int mount_verify(Mount *m) {
b = unit_has_name(UNIT(m), e);
if (!b) {
- log_error_unit(UNIT(m)->id, "%s's Where= setting doesn't match unit name. Refusing.", UNIT(m)->id);
+ log_unit_error(UNIT(m)->id, "%s's Where= setting doesn't match unit name. Refusing.", UNIT(m)->id);
return -EINVAL;
}
if (mount_point_is_api(m->where) || mount_point_ignore(m->where)) {
- log_error_unit(UNIT(m)->id, "Cannot create mount unit for API file system %s. Refusing.", m->where);
+ log_unit_error(UNIT(m)->id, "Cannot create mount unit for API file system %s. Refusing.", m->where);
return -EINVAL;
}
if (UNIT(m)->fragment_path && !m->parameters_fragment.what) {
- log_error_unit(UNIT(m)->id, "%s's What setting is missing. Refusing.", UNIT(m)->id);
+ log_unit_error(UNIT(m)->id, "%s's What setting is missing. Refusing.", UNIT(m)->id);
return -EBADMSG;
}
if (m->exec_context.pam_name && m->kill_context.kill_mode != KILL_CONTROL_GROUP) {
- log_error_unit(UNIT(m)->id, "%s has PAM enabled. Kill mode must be set to control-group'. Refusing.",UNIT(m)->id);
+ log_unit_error(UNIT(m)->id, "%s has PAM enabled. Kill mode must be set to control-group'. Refusing.",UNIT(m)->id);
return -EINVAL;
}
@@ -597,7 +597,7 @@ static void mount_set_state(Mount *m, MountState state) {
}
if (state != old_state)
- log_debug_unit(UNIT(m)->id,
+ log_unit_debug(UNIT(m)->id,
"%s changed %s -> %s",
UNIT(m)->id,
mount_state_to_string(old_state),
@@ -804,7 +804,7 @@ static void mount_enter_signal(Mount *m, MountState state, MountResult f) {
return;
fail:
- log_warning_unit(UNIT(m)->id,
+ log_unit_warning(UNIT(m)->id,
"%s failed to kill processes: %s", UNIT(m)->id, strerror(-r));
if (state == MOUNT_REMOUNTING_SIGTERM || state == MOUNT_REMOUNTING_SIGKILL)
@@ -823,7 +823,7 @@ void warn_if_dir_nonempty(const char *unit, const char* where) {
if (r > 0)
return;
else if (r == 0)
- log_struct_unit(LOG_NOTICE,
+ log_unit_struct(LOG_NOTICE,
unit,
"MESSAGE=%s: Directory %s to mount over is not empty, mounting anyway.",
unit, where,
@@ -831,7 +831,7 @@ void warn_if_dir_nonempty(const char *unit, const char* where) {
MESSAGE_ID(SD_MESSAGE_OVERMOUNTING),
NULL);
else
- log_warning_unit(unit,
+ log_unit_warning(unit,
"MESSAGE=Failed to check directory %s: %s",
where, strerror(-r));
}
@@ -840,7 +840,7 @@ static int fail_if_symlink(const char *unit, const char* where) {
assert(where);
if (is_symlink(where) > 0) {
- log_struct_unit(LOG_WARNING,
+ log_unit_struct(LOG_WARNING,
unit,
"MESSAGE=%s: Mount on symlink %s not allowed.",
unit, where,
@@ -879,7 +879,7 @@ static void mount_enter_unmounting(Mount *m) {
return;
fail:
- log_warning_unit(UNIT(m)->id,
+ log_unit_warning(UNIT(m)->id,
"%s failed to run 'umount' task: %s",
UNIT(m)->id, strerror(-r));
mount_enter_mounted(m, MOUNT_FAILURE_RESOURCES);
@@ -934,7 +934,7 @@ static void mount_enter_mounting(Mount *m) {
return;
fail:
- log_warning_unit(UNIT(m)->id,
+ log_unit_warning(UNIT(m)->id,
"%s failed to run 'mount' task: %s",
UNIT(m)->id, strerror(-r));
mount_enter_dead(m, MOUNT_FAILURE_RESOURCES);
@@ -982,7 +982,7 @@ static void mount_enter_remounting(Mount *m) {
return;
fail:
- log_warning_unit(UNIT(m)->id,
+ log_unit_warning(UNIT(m)->id,
"%s failed to run 'remount' task: %s",
UNIT(m)->id, strerror(-r));
m->reload_result = MOUNT_FAILURE_RESOURCES;
@@ -1086,7 +1086,7 @@ static int mount_deserialize_item(Unit *u, const char *key, const char *value, F
MountState state;
if ((state = mount_state_from_string(value)) < 0)
- log_debug_unit(u->id, "Failed to parse state value %s", value);
+ log_unit_debug(u->id, "Failed to parse state value %s", value);
else
m->deserialized_state = state;
} else if (streq(key, "result")) {
@@ -1094,7 +1094,7 @@ static int mount_deserialize_item(Unit *u, const char *key, const char *value, F
f = mount_result_from_string(value);
if (f < 0)
- log_debug_unit(UNIT(m)->id,
+ log_unit_debug(UNIT(m)->id,
"Failed to parse result value %s", value);
else if (f != MOUNT_SUCCESS)
m->result = f;
@@ -1104,7 +1104,7 @@ static int mount_deserialize_item(Unit *u, const char *key, const char *value, F
f = mount_result_from_string(value);
if (f < 0)
- log_debug_unit(UNIT(m)->id,
+ log_unit_debug(UNIT(m)->id,
"Failed to parse reload result value %s", value);
else if (f != MOUNT_SUCCESS)
m->reload_result = f;
@@ -1113,7 +1113,7 @@ static int mount_deserialize_item(Unit *u, const char *key, const char *value, F
pid_t pid;
if (parse_pid(value, &pid) < 0)
- log_debug_unit(UNIT(m)->id,
+ log_unit_debug(UNIT(m)->id,
"Failed to parse control-pid value %s", value);
else
m->control_pid = pid;
@@ -1121,14 +1121,14 @@ static int mount_deserialize_item(Unit *u, const char *key, const char *value, F
MountExecCommand id;
if ((id = mount_exec_command_from_string(value)) < 0)
- log_debug_unit(UNIT(m)->id,
+ log_unit_debug(UNIT(m)->id,
"Failed to parse exec-command value %s", value);
else {
m->control_command_id = id;
m->control_command = m->exec_command + id;
}
} else
- log_debug_unit(UNIT(m)->id,
+ log_unit_debug(UNIT(m)->id,
"Unknown serialization key '%s'", key);
return 0;
@@ -1187,7 +1187,8 @@ static void mount_sigchld_event(Unit *u, pid_t pid, int code, int status) {
m->control_command_id = _MOUNT_EXEC_COMMAND_INVALID;
}
- log_full_unit(f == MOUNT_SUCCESS ? LOG_DEBUG : LOG_NOTICE, u->id,
+ log_unit_full(u->id,
+ f == MOUNT_SUCCESS ? LOG_DEBUG : LOG_NOTICE,
"%s mount process exited, code=%s status=%i",
u->id, sigchld_code_to_string(code), status);
@@ -1255,31 +1256,31 @@ static int mount_dispatch_timer(sd_event_source *source, usec_t usec, void *user
case MOUNT_MOUNTING:
case MOUNT_MOUNTING_DONE:
- log_warning_unit(UNIT(m)->id,
+ log_unit_warning(UNIT(m)->id,
"%s mounting timed out. Stopping.", UNIT(m)->id);
mount_enter_signal(m, MOUNT_MOUNTING_SIGTERM, MOUNT_FAILURE_TIMEOUT);
break;
case MOUNT_REMOUNTING:
- log_warning_unit(UNIT(m)->id,
+ log_unit_warning(UNIT(m)->id,
"%s remounting timed out. Stopping.", UNIT(m)->id);
m->reload_result = MOUNT_FAILURE_TIMEOUT;
mount_enter_mounted(m, MOUNT_SUCCESS);
break;
case MOUNT_UNMOUNTING:
- log_warning_unit(UNIT(m)->id,
+ log_unit_warning(UNIT(m)->id,
"%s unmounting timed out. Stopping.", UNIT(m)->id);
mount_enter_signal(m, MOUNT_UNMOUNTING_SIGTERM, MOUNT_FAILURE_TIMEOUT);
break;
case MOUNT_MOUNTING_SIGTERM:
if (m->kill_context.send_sigkill) {
- log_warning_unit(UNIT(m)->id,
+ log_unit_warning(UNIT(m)->id,
"%s mounting timed out. Killing.", UNIT(m)->id);
mount_enter_signal(m, MOUNT_MOUNTING_SIGKILL, MOUNT_FAILURE_TIMEOUT);
} else {
- log_warning_unit(UNIT(m)->id,
+ log_unit_warning(UNIT(m)->id,
"%s mounting timed out. Skipping SIGKILL. Ignoring.",
UNIT(m)->id);
@@ -1292,11 +1293,11 @@ static int mount_dispatch_timer(sd_event_source *source, usec_t usec, void *user
case MOUNT_REMOUNTING_SIGTERM:
if (m->kill_context.send_sigkill) {
- log_warning_unit(UNIT(m)->id,
+ log_unit_warning(UNIT(m)->id,
"%s remounting timed out. Killing.", UNIT(m)->id);
mount_enter_signal(m, MOUNT_REMOUNTING_SIGKILL, MOUNT_FAILURE_TIMEOUT);
} else {
- log_warning_unit(UNIT(m)->id,
+ log_unit_warning(UNIT(m)->id,
"%s remounting timed out. Skipping SIGKILL. Ignoring.",
UNIT(m)->id);
@@ -1309,11 +1310,11 @@ static int mount_dispatch_timer(sd_event_source *source, usec_t usec, void *user
case MOUNT_UNMOUNTING_SIGTERM:
if (m->kill_context.send_sigkill) {
- log_warning_unit(UNIT(m)->id,
+ log_unit_warning(UNIT(m)->id,
"%s unmounting timed out. Killing.", UNIT(m)->id);
mount_enter_signal(m, MOUNT_UNMOUNTING_SIGKILL, MOUNT_FAILURE_TIMEOUT);
} else {
- log_warning_unit(UNIT(m)->id,
+ log_unit_warning(UNIT(m)->id,
"%s unmounting timed out. Skipping SIGKILL. Ignoring.",
UNIT(m)->id);
@@ -1327,7 +1328,7 @@ static int mount_dispatch_timer(sd_event_source *source, usec_t usec, void *user
case MOUNT_MOUNTING_SIGKILL:
case MOUNT_REMOUNTING_SIGKILL:
case MOUNT_UNMOUNTING_SIGKILL:
- log_warning_unit(UNIT(m)->id,
+ log_unit_warning(UNIT(m)->id,
"%s mount process still around after SIGKILL. Ignoring.",
UNIT(m)->id);
diff --git a/src/core/path.c b/src/core/path.c
index f54c77f6c3..d399238a41 100644
--- a/src/core/path.c
+++ b/src/core/path.c
@@ -320,7 +320,7 @@ static int path_verify(Path *p) {
return 0;
if (!p->specs) {
- log_error_unit(UNIT(p)->id,
+ log_unit_error(UNIT(p)->id,
"%s lacks path setting. Refusing.", UNIT(p)->id);
return -EINVAL;
}
@@ -724,7 +724,7 @@ static void path_trigger_notify(Unit *u, Unit *other) {
if (p->state == PATH_RUNNING &&
UNIT_IS_INACTIVE_OR_FAILED(unit_active_state(other))) {
- log_debug_unit(UNIT(p)->id,
+ log_unit_debug(UNIT(p)->id,
"%s got notified about unit deactivation.",
UNIT(p)->id);
diff --git a/src/core/scope.c b/src/core/scope.c
index 0f7c1f97ce..a2b9265061 100644
--- a/src/core/scope.c
+++ b/src/core/scope.c
@@ -133,7 +133,7 @@ static int scope_verify(Scope *s) {
return 0;
if (set_isempty(UNIT(s)->pids) && UNIT(s)->manager->n_reloading <= 0) {
- log_error_unit(UNIT(s)->id, "Scope %s has no PIDs. Refusing.", UNIT(s)->id);
+ log_unit_error(UNIT(s)->id, "Scope %s has no PIDs. Refusing.", UNIT(s)->id);
return -EINVAL;
}
@@ -264,7 +264,7 @@ static void scope_enter_signal(Scope *s, ScopeState state, ScopeResult f) {
return;
fail:
- log_warning_unit(UNIT(s)->id,
+ log_unit_warning(UNIT(s)->id,
"%s failed to kill processes: %s", UNIT(s)->id, strerror(-r));
scope_enter_dead(s, SCOPE_FAILURE_RESOURCES);
@@ -405,7 +405,7 @@ static void scope_notify_cgroup_empty_event(Unit *u) {
Scope *s = SCOPE(u);
assert(u);
- log_debug_unit(u->id, "%s: cgroup is empty", u->id);
+ log_unit_debug(u->id, "%s: cgroup is empty", u->id);
if (IN_SET(s->state, SCOPE_RUNNING, SCOPE_ABANDONED, SCOPE_STOP_SIGTERM, SCOPE_STOP_SIGKILL))
scope_enter_dead(s, SCOPE_SUCCESS);
@@ -437,17 +437,17 @@ static int scope_dispatch_timer(sd_event_source *source, usec_t usec, void *user
case SCOPE_STOP_SIGTERM:
if (s->kill_context.send_sigkill) {
- log_warning_unit(UNIT(s)->id, "%s stopping timed out. Killing.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s stopping timed out. Killing.", UNIT(s)->id);
scope_enter_signal(s, SCOPE_STOP_SIGKILL, SCOPE_FAILURE_TIMEOUT);
} else {
- log_warning_unit(UNIT(s)->id, "%s stopping timed out. Skipping SIGKILL.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s stopping timed out. Skipping SIGKILL.", UNIT(s)->id);
scope_enter_dead(s, SCOPE_FAILURE_TIMEOUT);
}
break;
case SCOPE_STOP_SIGKILL:
- log_warning_unit(UNIT(s)->id, "%s still around after SIGKILL. Ignoring.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s still around after SIGKILL. Ignoring.", UNIT(s)->id);
scope_enter_dead(s, SCOPE_FAILURE_TIMEOUT);
break;
diff --git a/src/core/selinux-access.c b/src/core/selinux-access.c
index b3835d59a5..a2cc850188 100644
--- a/src/core/selinux-access.c
+++ b/src/core/selinux-access.c
@@ -112,7 +112,7 @@ _printf_(2, 3) static int log_callback(int type, const char *fmt, ...) {
#endif
va_start(ap, fmt);
- log_metav(LOG_USER | LOG_INFO, 0, __FILE__, __LINE__, __FUNCTION__, fmt, ap);
+ log_internalv(LOG_USER | LOG_INFO, 0, __FILE__, __LINE__, __FUNCTION__, fmt, ap);
va_end(ap);
return 0;
diff --git a/src/core/service.c b/src/core/service.c
index 6a27e8f67d..72e8f71e5f 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -137,7 +137,7 @@ static void service_unwatch_pid_file(Service *s) {
if (!s->pid_file_pathspec)
return;
- log_debug_unit(UNIT(s)->id, "Stopping watch for %s's PID file %s", UNIT(s)->id, s->pid_file_pathspec->path);
+ log_unit_debug(UNIT(s)->id, "Stopping watch for %s's PID file %s", UNIT(s)->id, s->pid_file_pathspec->path);
path_spec_unwatch(s->pid_file_pathspec);
path_spec_done(s->pid_file_pathspec);
free(s->pid_file_pathspec);
@@ -167,7 +167,7 @@ static int service_set_main_pid(Service *s, pid_t pid) {
s->main_pid_known = true;
if (get_parent_of_pid(pid, &ppid) >= 0 && ppid != getpid()) {
- log_warning_unit(UNIT(s)->id, "%s: Supervising process "PID_FMT" which is not our child. We'll most likely not notice when it exits.", UNIT(s)->id, pid);
+ log_unit_warning(UNIT(s)->id, "%s: Supervising process "PID_FMT" which is not our child. We'll most likely not notice when it exits.", UNIT(s)->id, pid);
s->main_pid_alien = true;
} else
s->main_pid_alien = false;
@@ -209,7 +209,7 @@ static void service_start_watchdog(Service *s) {
if (s->watchdog_event_source) {
r = sd_event_source_set_time(s->watchdog_event_source, s->watchdog_timestamp.monotonic + s->watchdog_usec);
if (r < 0) {
- log_warning_unit(UNIT(s)->id, "%s failed to reset watchdog timer: %s", UNIT(s)->id, strerror(-r));
+ log_unit_warning(UNIT(s)->id, "%s failed to reset watchdog timer: %s", UNIT(s)->id, strerror(-r));
return;
}
@@ -222,7 +222,7 @@ static void service_start_watchdog(Service *s) {
s->watchdog_timestamp.monotonic + s->watchdog_usec, 0,
service_dispatch_watchdog, s);
if (r < 0) {
- log_warning_unit(UNIT(s)->id, "%s failed to add watchdog timer: %s", UNIT(s)->id, strerror(-r));
+ log_unit_warning(UNIT(s)->id, "%s failed to add watchdog timer: %s", UNIT(s)->id, strerror(-r));
return;
}
@@ -232,7 +232,7 @@ static void service_start_watchdog(Service *s) {
}
if (r < 0)
- log_warning_unit(UNIT(s)->id, "%s failed to install watchdog timer: %s", UNIT(s)->id, strerror(-r));
+ log_unit_warning(UNIT(s)->id, "%s failed to install watchdog timer: %s", UNIT(s)->id, strerror(-r));
}
static void service_reset_watchdog(Service *s) {
@@ -316,45 +316,45 @@ static int service_verify(Service *s) {
return 0;
if (!s->exec_command[SERVICE_EXEC_START] && !s->exec_command[SERVICE_EXEC_STOP]) {
- log_error_unit(UNIT(s)->id, "%s lacks both ExecStart= and ExecStop= setting. Refusing.", UNIT(s)->id);
+ log_unit_error(UNIT(s)->id, "%s lacks both ExecStart= and ExecStop= setting. Refusing.", UNIT(s)->id);
return -EINVAL;
}
if (s->type != SERVICE_ONESHOT && !s->exec_command[SERVICE_EXEC_START]) {
- log_error_unit(UNIT(s)->id, "%s has no ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.", UNIT(s)->id);
+ log_unit_error(UNIT(s)->id, "%s has no ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.", UNIT(s)->id);
return -EINVAL;
}
if (!s->remain_after_exit && !s->exec_command[SERVICE_EXEC_START]) {
- log_error_unit(UNIT(s)->id, "%s has no ExecStart= setting, which is only allowed for RemainAfterExit=yes services. Refusing.", UNIT(s)->id);
+ log_unit_error(UNIT(s)->id, "%s has no ExecStart= setting, which is only allowed for RemainAfterExit=yes services. Refusing.", UNIT(s)->id);
return -EINVAL;
}
if (s->type != SERVICE_ONESHOT && s->exec_command[SERVICE_EXEC_START]->command_next) {
- log_error_unit(UNIT(s)->id, "%s has more than one ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.", UNIT(s)->id);
+ log_unit_error(UNIT(s)->id, "%s has more than one ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.", UNIT(s)->id);
return -EINVAL;
}
if (s->type == SERVICE_ONESHOT && s->restart != SERVICE_RESTART_NO) {
- log_error_unit(UNIT(s)->id, "%s has Restart= setting other than no, which isn't allowed for Type=oneshot services. Refusing.", UNIT(s)->id);
+ log_unit_error(UNIT(s)->id, "%s has Restart= setting other than no, which isn't allowed for Type=oneshot services. Refusing.", UNIT(s)->id);
return -EINVAL;
}
if (s->type == SERVICE_ONESHOT && !exit_status_set_is_empty(&s->restart_force_status)) {
- log_error_unit(UNIT(s)->id, "%s has RestartForceStatus= set, which isn't allowed for Type=oneshot services. Refusing.", UNIT(s)->id);
+ log_unit_error(UNIT(s)->id, "%s has RestartForceStatus= set, which isn't allowed for Type=oneshot services. Refusing.", UNIT(s)->id);
return -EINVAL;
}
if (s->type == SERVICE_DBUS && !s->bus_name) {
- log_error_unit(UNIT(s)->id, "%s is of type D-Bus but no D-Bus service name has been specified. Refusing.", UNIT(s)->id);
+ log_unit_error(UNIT(s)->id, "%s is of type D-Bus but no D-Bus service name has been specified. Refusing.", UNIT(s)->id);
return -EINVAL;
}
if (s->bus_name && s->type != SERVICE_DBUS)
- log_warning_unit(UNIT(s)->id, "%s has a D-Bus service name specified, but is not of type dbus. Ignoring.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s has a D-Bus service name specified, but is not of type dbus. Ignoring.", UNIT(s)->id);
if (s->exec_context.pam_name && !(s->kill_context.kill_mode == KILL_CONTROL_GROUP || s->kill_context.kill_mode == KILL_MIXED)) {
- log_error_unit(UNIT(s)->id, "%s has PAM enabled. Kill mode must be set to 'control-group' or 'mixed'. Refusing.", UNIT(s)->id);
+ log_unit_error(UNIT(s)->id, "%s has PAM enabled. Kill mode must be set to 'control-group' or 'mixed'. Refusing.", UNIT(s)->id);
return -EINVAL;
}
@@ -571,20 +571,20 @@ static int service_load_pid_file(Service *s, bool may_warn) {
r = read_one_line_file(s->pid_file, &k);
if (r < 0) {
if (may_warn)
- log_info_unit(UNIT(s)->id, "PID file %s not readable (yet?) after %s.", s->pid_file, service_state_to_string(s->state));
+ log_unit_info(UNIT(s)->id, "PID file %s not readable (yet?) after %s.", s->pid_file, service_state_to_string(s->state));
return r;
}
r = parse_pid(k, &pid);
if (r < 0) {
if (may_warn)
- log_info_unit(UNIT(s)->id, "Failed to read PID from file %s: %s", s->pid_file, strerror(-r));
+ log_unit_info(UNIT(s)->id, "Failed to read PID from file %s: %s", s->pid_file, strerror(-r));
return r;
}
if (!pid_is_alive(pid)) {
if (may_warn)
- log_info_unit(UNIT(s)->id, "PID "PID_FMT" read from file %s does not exist or is a zombie.", pid, s->pid_file);
+ log_unit_info(UNIT(s)->id, "PID "PID_FMT" read from file %s does not exist or is a zombie.", pid, s->pid_file);
return -ESRCH;
}
@@ -592,12 +592,12 @@ static int service_load_pid_file(Service *s, bool may_warn) {
if (pid == s->main_pid)
return 0;
- log_debug_unit(UNIT(s)->id, "Main PID changing: "PID_FMT" -> "PID_FMT, s->main_pid, pid);
+ log_unit_debug(UNIT(s)->id, "Main PID changing: "PID_FMT" -> "PID_FMT, s->main_pid, pid);
service_unwatch_main_pid(s);
s->main_pid_known = false;
} else
- log_debug_unit(UNIT(s)->id, "Main PID loaded: "PID_FMT, pid);
+ log_unit_debug(UNIT(s)->id, "Main PID loaded: "PID_FMT, pid);
r = service_set_main_pid(s, pid);
if (r < 0)
@@ -606,7 +606,7 @@ static int service_load_pid_file(Service *s, bool may_warn) {
r = unit_watch_pid(UNIT(s), pid);
if (r < 0) {
/* FIXME: we need to do something here */
- log_warning_unit(UNIT(s)->id, "Failed to watch PID "PID_FMT" from service %s", pid, UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "Failed to watch PID "PID_FMT" from service %s", pid, UNIT(s)->id);
return r;
}
@@ -633,7 +633,7 @@ static int service_search_main_pid(Service *s) {
if (pid <= 0)
return -ENOENT;
- log_debug_unit(UNIT(s)->id, "Main PID guessed: "PID_FMT, pid);
+ log_unit_debug(UNIT(s)->id, "Main PID guessed: "PID_FMT, pid);
r = service_set_main_pid(s, pid);
if (r < 0)
return r;
@@ -641,7 +641,7 @@ static int service_search_main_pid(Service *s) {
r = unit_watch_pid(UNIT(s), pid);
if (r < 0) {
/* FIXME: we need to do something here */
- log_warning_unit(UNIT(s)->id, "Failed to watch PID "PID_FMT" from service %s", pid, UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "Failed to watch PID "PID_FMT" from service %s", pid, UNIT(s)->id);
return r;
}
@@ -733,7 +733,7 @@ static void service_set_state(Service *s, ServiceState state) {
}
if (old_state != state)
- log_debug_unit(UNIT(s)->id, "%s changed %s -> %s", UNIT(s)->id, service_state_to_string(old_state), service_state_to_string(state));
+ log_unit_debug(UNIT(s)->id, "%s changed %s -> %s", UNIT(s)->id, service_state_to_string(old_state), service_state_to_string(state));
unit_notify(UNIT(s), table[old_state], table[state], s->reload_result == SERVICE_SUCCESS);
s->reload_result = SERVICE_SUCCESS;
@@ -1088,7 +1088,7 @@ static void service_enter_dead(Service *s, ServiceResult f, bool allow_restart)
service_set_state(s, s->result != SERVICE_SUCCESS ? SERVICE_FAILED : SERVICE_DEAD);
if (s->result != SERVICE_SUCCESS) {
- log_warning_unit(UNIT(s)->id, "%s failed.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s failed.", UNIT(s)->id);
failure_action(UNIT(s)->manager, s->failure_action, s->reboot_arg);
}
@@ -1130,7 +1130,7 @@ static void service_enter_dead(Service *s, ServiceResult f, bool allow_restart)
return;
fail:
- log_warning_unit(UNIT(s)->id, "%s failed to run install restart timer: %s", UNIT(s)->id, strerror(-r));
+ log_unit_warning(UNIT(s)->id, "%s failed to run install restart timer: %s", UNIT(s)->id, strerror(-r));
service_enter_dead(s, SERVICE_FAILURE_RESOURCES, false);
}
@@ -1167,7 +1167,7 @@ static void service_enter_stop_post(Service *s, ServiceResult f) {
return;
fail:
- log_warning_unit(UNIT(s)->id, "%s failed to run 'stop-post' task: %s", UNIT(s)->id, strerror(-r));
+ log_unit_warning(UNIT(s)->id, "%s failed to run 'stop-post' task: %s", UNIT(s)->id, strerror(-r));
service_enter_signal(s, SERVICE_FINAL_SIGTERM, SERVICE_FAILURE_RESOURCES);
}
@@ -1213,7 +1213,7 @@ static void service_enter_signal(Service *s, ServiceState state, ServiceResult f
return;
fail:
- log_warning_unit(UNIT(s)->id, "%s failed to kill processes: %s", UNIT(s)->id, strerror(-r));
+ log_unit_warning(UNIT(s)->id, "%s failed to kill processes: %s", UNIT(s)->id, strerror(-r));
if (state == SERVICE_STOP_SIGTERM || state == SERVICE_STOP_SIGKILL ||
state == SERVICE_STOP_SIGABRT)
@@ -1268,7 +1268,7 @@ static void service_enter_stop(Service *s, ServiceResult f) {
return;
fail:
- log_warning_unit(UNIT(s)->id, "%s failed to run 'stop' task: %s", UNIT(s)->id, strerror(-r));
+ log_unit_warning(UNIT(s)->id, "%s failed to run 'stop' task: %s", UNIT(s)->id, strerror(-r));
service_enter_signal(s, SERVICE_STOP_SIGTERM, SERVICE_FAILURE_RESOURCES);
}
@@ -1330,7 +1330,7 @@ static void service_enter_start_post(Service *s) {
return;
fail:
- log_warning_unit(UNIT(s)->id, "%s failed to run 'start-post' task: %s", UNIT(s)->id, strerror(-r));
+ log_unit_warning(UNIT(s)->id, "%s failed to run 'start-post' task: %s", UNIT(s)->id, strerror(-r));
service_enter_stop(s, SERVICE_FAILURE_RESOURCES);
}
@@ -1423,7 +1423,7 @@ static void service_enter_start(Service *s) {
return;
fail:
- log_warning_unit(UNIT(s)->id, "%s failed to run 'start' task: %s", UNIT(s)->id, strerror(-r));
+ log_unit_warning(UNIT(s)->id, "%s failed to run 'start' task: %s", UNIT(s)->id, strerror(-r));
service_enter_signal(s, SERVICE_FINAL_SIGTERM, SERVICE_FAILURE_RESOURCES);
}
@@ -1461,7 +1461,7 @@ static void service_enter_start_pre(Service *s) {
return;
fail:
- log_warning_unit(UNIT(s)->id, "%s failed to run 'start-pre' task: %s", UNIT(s)->id, strerror(-r));
+ log_unit_warning(UNIT(s)->id, "%s failed to run 'start-pre' task: %s", UNIT(s)->id, strerror(-r));
service_enter_dead(s, SERVICE_FAILURE_RESOURCES, true);
}
@@ -1473,7 +1473,7 @@ static void service_enter_restart(Service *s) {
if (UNIT(s)->job && UNIT(s)->job->type == JOB_STOP) {
/* Don't restart things if we are going down anyway */
- log_info_unit(UNIT(s)->id, "Stop job pending for unit, delaying automatic restart.");
+ log_unit_info(UNIT(s)->id, "Stop job pending for unit, delaying automatic restart.");
r = service_arm_timer(s, s->restart_usec);
if (r < 0)
@@ -1494,11 +1494,11 @@ static void service_enter_restart(Service *s) {
* it will be canceled as part of the service_stop() call that
* is executed as part of JOB_RESTART. */
- log_debug_unit(UNIT(s)->id, "%s scheduled restart job.", UNIT(s)->id);
+ log_unit_debug(UNIT(s)->id, "%s scheduled restart job.", UNIT(s)->id);
return;
fail:
- log_warning_unit(UNIT(s)->id, "%s failed to schedule restart job: %s", UNIT(s)->id, bus_error_message(&error, -r));
+ log_unit_warning(UNIT(s)->id, "%s failed to schedule restart job: %s", UNIT(s)->id, bus_error_message(&error, -r));
service_enter_dead(s, SERVICE_FAILURE_RESOURCES, false);
}
@@ -1541,7 +1541,7 @@ static void service_enter_reload(Service *s) {
return;
fail:
- log_warning_unit(UNIT(s)->id, "%s failed to run 'reload' task: %s", UNIT(s)->id, strerror(-r));
+ log_unit_warning(UNIT(s)->id, "%s failed to run 'reload' task: %s", UNIT(s)->id, strerror(-r));
s->reload_result = SERVICE_FAILURE_RESOURCES;
service_enter_running(s, SERVICE_SUCCESS);
}
@@ -1574,7 +1574,7 @@ static void service_run_next_control(Service *s) {
return;
fail:
- log_warning_unit(UNIT(s)->id, "%s failed to run next control task: %s", UNIT(s)->id, strerror(-r));
+ log_unit_warning(UNIT(s)->id, "%s failed to run next control task: %s", UNIT(s)->id, strerror(-r));
if (s->state == SERVICE_START_PRE)
service_enter_signal(s, SERVICE_FINAL_SIGTERM, SERVICE_FAILURE_RESOURCES);
@@ -1618,7 +1618,7 @@ static void service_run_next_main(Service *s) {
return;
fail:
- log_warning_unit(UNIT(s)->id, "%s failed to run next main task: %s", UNIT(s)->id, strerror(-r));
+ log_unit_warning(UNIT(s)->id, "%s failed to run next main task: %s", UNIT(s)->id, strerror(-r));
service_enter_stop(s, SERVICE_FAILURE_RESOURCES);
}
@@ -1628,7 +1628,7 @@ static int service_start_limit_test(Service *s) {
if (ratelimit_test(&s->start_limit))
return 0;
- log_warning_unit(UNIT(s)->id, "start request repeated too quickly for %s", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "start request repeated too quickly for %s", UNIT(s)->id);
return failure_action(UNIT(s)->manager, s->start_limit_action, s->reboot_arg);
}
@@ -1836,7 +1836,7 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
state = service_state_from_string(value);
if (state < 0)
- log_debug_unit(u->id, "Failed to parse state value %s", value);
+ log_unit_debug(u->id, "Failed to parse state value %s", value);
else
s->deserialized_state = state;
} else if (streq(key, "result")) {
@@ -1844,7 +1844,7 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
f = service_result_from_string(value);
if (f < 0)
- log_debug_unit(u->id, "Failed to parse result value %s", value);
+ log_unit_debug(u->id, "Failed to parse result value %s", value);
else if (f != SERVICE_SUCCESS)
s->result = f;
@@ -1853,7 +1853,7 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
f = service_result_from_string(value);
if (f < 0)
- log_debug_unit(u->id, "Failed to parse reload result value %s", value);
+ log_unit_debug(u->id, "Failed to parse reload result value %s", value);
else if (f != SERVICE_SUCCESS)
s->reload_result = f;
@@ -1861,14 +1861,14 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
pid_t pid;
if (parse_pid(value, &pid) < 0)
- log_debug_unit(u->id, "Failed to parse control-pid value %s", value);
+ log_unit_debug(u->id, "Failed to parse control-pid value %s", value);
else
s->control_pid = pid;
} else if (streq(key, "main-pid")) {
pid_t pid;
if (parse_pid(value, &pid) < 0)
- log_debug_unit(u->id, "Failed to parse main-pid value %s", value);
+ log_unit_debug(u->id, "Failed to parse main-pid value %s", value);
else {
service_set_main_pid(s, pid);
unit_watch_pid(UNIT(s), pid);
@@ -1878,7 +1878,7 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
b = parse_boolean(value);
if (b < 0)
- log_debug_unit(u->id, "Failed to parse main-pid-known value %s", value);
+ log_unit_debug(u->id, "Failed to parse main-pid-known value %s", value);
else
s->main_pid_known = b;
} else if (streq(key, "status-text")) {
@@ -1897,7 +1897,7 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
id = service_exec_command_from_string(value);
if (id < 0)
- log_debug_unit(u->id, "Failed to parse exec-command value %s", value);
+ log_unit_debug(u->id, "Failed to parse exec-command value %s", value);
else {
s->control_command_id = id;
s->control_command = s->exec_command[id];
@@ -1906,7 +1906,7 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
int fd;
if (safe_atoi(value, &fd) < 0 || fd < 0 || !fdset_contains(fds, fd))
- log_debug_unit(u->id, "Failed to parse socket-fd value %s", value);
+ log_unit_debug(u->id, "Failed to parse socket-fd value %s", value);
else {
asynchronous_close(s->socket_fd);
s->socket_fd = fdset_remove(fds, fd);
@@ -1915,7 +1915,7 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
int fd;
if (safe_atoi(value, &fd) < 0 || fd < 0 || !fdset_contains(fds, fd))
- log_debug_unit(u->id, "Failed to parse endpoint-fd value %s", value);
+ log_unit_debug(u->id, "Failed to parse endpoint-fd value %s", value);
else {
safe_close(s->bus_endpoint_fd);
s->bus_endpoint_fd = fdset_remove(fds, fd);
@@ -1924,21 +1924,21 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
pid_t pid;
if (parse_pid(value, &pid) < 0)
- log_debug_unit(u->id, "Failed to parse main-exec-status-pid value %s", value);
+ log_unit_debug(u->id, "Failed to parse main-exec-status-pid value %s", value);
else
s->main_exec_status.pid = pid;
} else if (streq(key, "main-exec-status-code")) {
int i;
if (safe_atoi(value, &i) < 0)
- log_debug_unit(u->id, "Failed to parse main-exec-status-code value %s", value);
+ log_unit_debug(u->id, "Failed to parse main-exec-status-code value %s", value);
else
s->main_exec_status.code = i;
} else if (streq(key, "main-exec-status-status")) {
int i;
if (safe_atoi(value, &i) < 0)
- log_debug_unit(u->id, "Failed to parse main-exec-status-status value %s", value);
+ log_unit_debug(u->id, "Failed to parse main-exec-status-status value %s", value);
else
s->main_exec_status.status = i;
} else if (streq(key, "main-exec-status-start"))
@@ -1952,11 +1952,11 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
b = parse_boolean(value);
if (b < 0)
- log_debug_unit(u->id, "Failed to parse forbid-restart value %s", value);
+ log_unit_debug(u->id, "Failed to parse forbid-restart value %s", value);
else
s->forbid_restart = b;
} else
- log_debug_unit(u->id, "Unknown serialization key '%s'", key);
+ log_unit_debug(u->id, "Unknown serialization key '%s'", key);
return 0;
}
@@ -2019,19 +2019,19 @@ static int service_retry_pid_file(Service *s) {
static int service_watch_pid_file(Service *s) {
int r;
- log_debug_unit(UNIT(s)->id, "Setting watch for %s's PID file %s", UNIT(s)->id, s->pid_file_pathspec->path);
+ log_unit_debug(UNIT(s)->id, "Setting watch for %s's PID file %s", UNIT(s)->id, s->pid_file_pathspec->path);
r = path_spec_watch(s->pid_file_pathspec, service_dispatch_io);
if (r < 0)
goto fail;
/* the pidfile might have appeared just before we set the watch */
- log_debug_unit(UNIT(s)->id, "Trying to read %s's PID file %s in case it changed", UNIT(s)->id, s->pid_file_pathspec->path);
+ log_unit_debug(UNIT(s)->id, "Trying to read %s's PID file %s in case it changed", UNIT(s)->id, s->pid_file_pathspec->path);
service_retry_pid_file(s);
return 0;
fail:
- log_error_unit(UNIT(s)->id, "Failed to set a watch for %s's PID file %s: %s", UNIT(s)->id, s->pid_file_pathspec->path, strerror(-r));
+ log_unit_error(UNIT(s)->id, "Failed to set a watch for %s's PID file %s: %s", UNIT(s)->id, s->pid_file_pathspec->path, strerror(-r));
service_unwatch_pid_file(s);
return r;
}
@@ -2079,7 +2079,7 @@ static int service_dispatch_io(sd_event_source *source, int fd, uint32_t events,
assert(s->pid_file_pathspec);
assert(path_spec_owns_inotify_fd(s->pid_file_pathspec, fd));
- log_debug_unit(UNIT(s)->id, "inotify event for %s", UNIT(s)->id);
+ log_unit_debug(UNIT(s)->id, "inotify event for %s", UNIT(s)->id);
if (path_spec_fd_event(p, events) < 0)
goto fail;
@@ -2103,7 +2103,7 @@ static void service_notify_cgroup_empty_event(Unit *u) {
assert(u);
- log_debug_unit(u->id, "%s: cgroup is empty", u->id);
+ log_unit_debug(u->id, "%s: cgroup is empty", u->id);
switch (s->state) {
@@ -2118,7 +2118,7 @@ static void service_notify_cgroup_empty_event(Unit *u) {
/* If we were hoping for the daemon to write its PID file,
* we can give up now. */
if (s->pid_file_pathspec) {
- log_warning_unit(u->id, "%s never wrote its PID file. Failing.", UNIT(s)->id);
+ log_unit_warning(u->id, "%s never wrote its PID file. Failing.", UNIT(s)->id);
service_unwatch_pid_file(s);
if (s->state == SERVICE_START)
@@ -2205,7 +2205,7 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
f = SERVICE_SUCCESS;
}
- log_struct_unit(f == SERVICE_SUCCESS ? LOG_DEBUG : LOG_NOTICE,
+ log_unit_struct(f == SERVICE_SUCCESS ? LOG_DEBUG : LOG_NOTICE,
u->id,
"MESSAGE=%s: main process exited, code=%s, status=%i/%s",
u->id, sigchld_code_to_string(code), status,
@@ -2226,7 +2226,7 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
/* There is another command to *
* execute, so let's do that. */
- log_debug_unit(u->id, "%s running next main command for state %s", u->id, service_state_to_string(s->state));
+ log_unit_debug(u->id, "%s running next main command for state %s", u->id, service_state_to_string(s->state));
service_run_next_main(s);
} else {
@@ -2293,7 +2293,8 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
f = SERVICE_SUCCESS;
}
- log_full_unit(f == SERVICE_SUCCESS ? LOG_DEBUG : LOG_NOTICE, u->id,
+ log_unit_full(u->id,
+ f == SERVICE_SUCCESS ? LOG_DEBUG : LOG_NOTICE,
"%s: control process exited, code=%s status=%i",
u->id, sigchld_code_to_string(code), status);
@@ -2312,7 +2313,7 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
/* There is another command to *
* execute, so let's do that. */
- log_debug_unit(u->id, "%s running next control command for state %s", u->id, service_state_to_string(s->state));
+ log_unit_debug(u->id, "%s running next control command for state %s", u->id, service_state_to_string(s->state));
service_run_next_control(s);
} else {
@@ -2322,7 +2323,7 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
s->control_command = NULL;
s->control_command_id = _SERVICE_EXEC_COMMAND_INVALID;
- log_debug_unit(u->id, "%s got final SIGCHLD for state %s", u->id, service_state_to_string(s->state));
+ log_unit_debug(u->id, "%s got final SIGCHLD for state %s", u->id, service_state_to_string(s->state));
switch (s->state) {
@@ -2451,38 +2452,38 @@ static int service_dispatch_timer(sd_event_source *source, usec_t usec, void *us
case SERVICE_START_PRE:
case SERVICE_START:
- log_warning_unit(UNIT(s)->id, "%s %s operation timed out. Terminating.", UNIT(s)->id, s->state == SERVICE_START ? "start" : "start-pre");
+ log_unit_warning(UNIT(s)->id, "%s %s operation timed out. Terminating.", UNIT(s)->id, s->state == SERVICE_START ? "start" : "start-pre");
service_enter_signal(s, SERVICE_FINAL_SIGTERM, SERVICE_FAILURE_TIMEOUT);
break;
case SERVICE_START_POST:
- log_warning_unit(UNIT(s)->id, "%s start-post operation timed out. Stopping.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s start-post operation timed out. Stopping.", UNIT(s)->id);
service_enter_stop(s, SERVICE_FAILURE_TIMEOUT);
break;
case SERVICE_RELOAD:
- log_warning_unit(UNIT(s)->id, "%s reload operation timed out. Stopping.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s reload operation timed out. Stopping.", UNIT(s)->id);
s->reload_result = SERVICE_FAILURE_TIMEOUT;
service_enter_running(s, SERVICE_SUCCESS);
break;
case SERVICE_STOP:
- log_warning_unit(UNIT(s)->id, "%s stopping timed out. Terminating.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s stopping timed out. Terminating.", UNIT(s)->id);
service_enter_signal(s, SERVICE_STOP_SIGTERM, SERVICE_FAILURE_TIMEOUT);
break;
case SERVICE_STOP_SIGABRT:
- log_warning_unit(UNIT(s)->id,
+ log_unit_warning(UNIT(s)->id,
"%s stop-sigabrt timed out. Terminating.", UNIT(s)->id);
service_enter_signal(s, SERVICE_STOP_SIGTERM, s->result);
break;
case SERVICE_STOP_SIGTERM:
if (s->kill_context.send_sigkill) {
- log_warning_unit(UNIT(s)->id, "%s stop-sigterm timed out. Killing.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s stop-sigterm timed out. Killing.", UNIT(s)->id);
service_enter_signal(s, SERVICE_STOP_SIGKILL, SERVICE_FAILURE_TIMEOUT);
} else {
- log_warning_unit(UNIT(s)->id, "%s stop-sigterm timed out. Skipping SIGKILL.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s stop-sigterm timed out. Skipping SIGKILL.", UNIT(s)->id);
service_enter_stop_post(s, SERVICE_FAILURE_TIMEOUT);
}
@@ -2493,33 +2494,33 @@ static int service_dispatch_timer(sd_event_source *source, usec_t usec, void *us
* Must be something we cannot kill, so let's just be
* weirded out and continue */
- log_warning_unit(UNIT(s)->id, "%s still around after SIGKILL. Ignoring.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s still around after SIGKILL. Ignoring.", UNIT(s)->id);
service_enter_stop_post(s, SERVICE_FAILURE_TIMEOUT);
break;
case SERVICE_STOP_POST:
- log_warning_unit(UNIT(s)->id, "%s stop-post timed out. Terminating.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s stop-post timed out. Terminating.", UNIT(s)->id);
service_enter_signal(s, SERVICE_FINAL_SIGTERM, SERVICE_FAILURE_TIMEOUT);
break;
case SERVICE_FINAL_SIGTERM:
if (s->kill_context.send_sigkill) {
- log_warning_unit(UNIT(s)->id, "%s stop-final-sigterm timed out. Killing.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s stop-final-sigterm timed out. Killing.", UNIT(s)->id);
service_enter_signal(s, SERVICE_FINAL_SIGKILL, SERVICE_FAILURE_TIMEOUT);
} else {
- log_warning_unit(UNIT(s)->id, "%s stop-final-sigterm timed out. Skipping SIGKILL. Entering failed mode.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s stop-final-sigterm timed out. Skipping SIGKILL. Entering failed mode.", UNIT(s)->id);
service_enter_dead(s, SERVICE_FAILURE_TIMEOUT, false);
}
break;
case SERVICE_FINAL_SIGKILL:
- log_warning_unit(UNIT(s)->id, "%s still around after final SIGKILL. Entering failed mode.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s still around after final SIGKILL. Entering failed mode.", UNIT(s)->id);
service_enter_dead(s, SERVICE_FAILURE_TIMEOUT, true);
break;
case SERVICE_AUTO_RESTART:
- log_info_unit(UNIT(s)->id,
+ log_unit_info(UNIT(s)->id,
s->restart_usec > 0 ?
"%s holdoff time over, scheduling restart." :
"%s has no holdoff time, scheduling restart.",
@@ -2541,7 +2542,7 @@ static int service_dispatch_watchdog(sd_event_source *source, usec_t usec, void
assert(s);
assert(source == s->watchdog_event_source);
- log_error_unit(UNIT(s)->id, "%s watchdog timeout (limit %s)!", UNIT(s)->id,
+ log_unit_error(UNIT(s)->id, "%s watchdog timeout (limit %s)!", UNIT(s)->id,
format_timespan(t, sizeof(t), s->watchdog_usec, 1));
service_enter_signal(s, SERVICE_STOP_SIGABRT, SERVICE_FAILURE_WATCHDOG);
@@ -2558,19 +2559,19 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) {
assert(u);
cc = strv_join(tags, ", ");
- log_debug_unit(u->id, "%s: Got notification message from PID "PID_FMT" (%s)",
+ log_unit_debug(u->id, "%s: Got notification message from PID "PID_FMT" (%s)",
u->id, pid, isempty(cc) ? "n/a" : cc);
if (s->notify_access == NOTIFY_NONE) {
- log_warning_unit(u->id, "%s: Got notification message from PID "PID_FMT", but reception is disabled.", u->id, pid);
+ log_unit_warning(u->id, "%s: Got notification message from PID "PID_FMT", but reception is disabled.", u->id, pid);
return;
}
if (s->notify_access == NOTIFY_MAIN && pid != s->main_pid) {
if (s->main_pid != 0)
- log_warning_unit(u->id, "%s: Got notification message from PID "PID_FMT", but reception only permitted for main PID "PID_FMT, u->id, pid, s->main_pid);
+ log_unit_warning(u->id, "%s: Got notification message from PID "PID_FMT", but reception only permitted for main PID "PID_FMT, u->id, pid, s->main_pid);
else
- log_debug_unit(u->id, "%s: Got notification message from PID "PID_FMT", but reception only permitted for main PID which is currently not known", u->id, pid);
+ log_unit_debug(u->id, "%s: Got notification message from PID "PID_FMT", but reception only permitted for main PID which is currently not known", u->id, pid);
return;
}
@@ -2578,9 +2579,9 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) {
e = strv_find_startswith(tags, "MAINPID=");
if (e && IN_SET(s->state, SERVICE_START, SERVICE_START_POST, SERVICE_RUNNING, SERVICE_RELOAD)) {
if (parse_pid(e, &pid) < 0)
- log_warning_unit(u->id, "Failed to parse MAINPID= field in notification message: %s", e);
+ log_unit_warning(u->id, "Failed to parse MAINPID= field in notification message: %s", e);
else {
- log_debug_unit(u->id, "%s: got MAINPID=%s", u->id, e);
+ log_unit_debug(u->id, "%s: got MAINPID=%s", u->id, e);
service_set_main_pid(s, pid);
unit_watch_pid(UNIT(s), pid);
@@ -2591,7 +2592,7 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) {
/* Interpret RELOADING= */
if (strv_find(tags, "RELOADING=1")) {
- log_debug_unit(u->id, "%s: got RELOADING=1", u->id);
+ log_unit_debug(u->id, "%s: got RELOADING=1", u->id);
s->notify_state = NOTIFY_RELOADING;
if (s->state == SERVICE_RUNNING)
@@ -2603,7 +2604,7 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) {
/* Interpret READY= */
if (strv_find(tags, "READY=1")) {
- log_debug_unit(u->id, "%s: got READY=1", u->id);
+ log_unit_debug(u->id, "%s: got READY=1", u->id);
s->notify_state = NOTIFY_READY;
/* Type=notify services inform us about completed
@@ -2622,7 +2623,7 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) {
/* Interpret STOPPING= */
if (strv_find(tags, "STOPPING=1")) {
- log_debug_unit(u->id, "%s: got STOPPING=1", u->id);
+ log_unit_debug(u->id, "%s: got STOPPING=1", u->id);
s->notify_state = NOTIFY_STOPPING;
if (s->state == SERVICE_RUNNING)
@@ -2638,9 +2639,9 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) {
if (!isempty(e)) {
if (!utf8_is_valid(e))
- log_warning_unit(u->id, "Status message in notification is not UTF-8 clean.");
+ log_unit_warning(u->id, "Status message in notification is not UTF-8 clean.");
else {
- log_debug_unit(u->id, "%s: got STATUS=%s", u->id, e);
+ log_unit_debug(u->id, "%s: got STATUS=%s", u->id, e);
t = strdup(e);
if (!t)
@@ -2664,9 +2665,9 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) {
int status_errno;
if (safe_atoi(e, &status_errno) < 0 || status_errno < 0)
- log_warning_unit(u->id, "Failed to parse ERRNO= field in notification message: %s", e);
+ log_unit_warning(u->id, "Failed to parse ERRNO= field in notification message: %s", e);
else {
- log_debug_unit(u->id, "%s: got ERRNO=%s", u->id, e);
+ log_unit_debug(u->id, "%s: got ERRNO=%s", u->id, e);
if (s->status_errno != status_errno) {
s->status_errno = status_errno;
@@ -2677,7 +2678,7 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) {
/* Interpret WATCHDOG= */
if (strv_find(tags, "WATCHDOG=1")) {
- log_debug_unit(u->id, "%s: got WATCHDOG=1", u->id);
+ log_unit_debug(u->id, "%s: got WATCHDOG=1", u->id);
service_reset_watchdog(s);
}
@@ -2716,11 +2717,11 @@ static void service_bus_name_owner_change(
assert(old_owner || new_owner);
if (old_owner && new_owner)
- log_debug_unit(u->id, "%s's D-Bus name %s changed owner from %s to %s", u->id, name, old_owner, new_owner);
+ log_unit_debug(u->id, "%s's D-Bus name %s changed owner from %s to %s", u->id, name, old_owner, new_owner);
else if (old_owner)
- log_debug_unit(u->id, "%s's D-Bus name %s no longer registered by %s", u->id, name, old_owner);
+ log_unit_debug(u->id, "%s's D-Bus name %s no longer registered by %s", u->id, name, old_owner);
else
- log_debug_unit(u->id, "%s's D-Bus name %s now registered by %s", u->id, name, new_owner);
+ log_unit_debug(u->id, "%s's D-Bus name %s now registered by %s", u->id, name, new_owner);
s->bus_name_good = !!new_owner;
@@ -2749,7 +2750,7 @@ static void service_bus_name_owner_change(
if (r >= 0)
r = sd_bus_creds_get_pid(creds, &pid);
if (r >= 0) {
- log_debug_unit(u->id, "%s's D-Bus name %s is now owned by process %u", u->id, name, (unsigned) pid);
+ log_unit_debug(u->id, "%s's D-Bus name %s is now owned by process %u", u->id, name, (unsigned) pid);
service_set_main_pid(s, pid);
unit_watch_pid(UNIT(s), pid);
diff --git a/src/core/slice.c b/src/core/slice.c
index 057feefa0f..a31e629370 100644
--- a/src/core/slice.c
+++ b/src/core/slice.c
@@ -113,7 +113,7 @@ static int slice_verify(Slice *s) {
a = (char*) SPECIAL_ROOT_SLICE;
if (!unit_has_name(UNIT_DEREF(UNIT(s)->slice), a)) {
- log_error_unit(UNIT(s)->id,
+ log_unit_error(UNIT(s)->id,
"%s located outside its parent slice. Refusing.", UNIT(s)->id);
return -EINVAL;
}
diff --git a/src/core/snapshot.c b/src/core/snapshot.c
index c2678cbe6e..900d0d793a 100644
--- a/src/core/snapshot.c
+++ b/src/core/snapshot.c
@@ -51,7 +51,7 @@ static void snapshot_set_state(Snapshot *s, SnapshotState state) {
s->state = state;
if (state != old_state)
- log_debug_unit(UNIT(s)->id,
+ log_unit_debug(UNIT(s)->id,
"%s changed %s -> %s",
UNIT(s)->id,
snapshot_state_to_string(old_state),
@@ -155,7 +155,7 @@ static int snapshot_deserialize_item(Unit *u, const char *key, const char *value
state = snapshot_state_from_string(value);
if (state < 0)
- log_debug_unit(u->id, "Failed to parse state value %s", value);
+ log_unit_debug(u->id, "Failed to parse state value %s", value);
else
s->deserialized_state = state;
@@ -163,7 +163,7 @@ static int snapshot_deserialize_item(Unit *u, const char *key, const char *value
r = parse_boolean(value);
if (r < 0)
- log_debug_unit(u->id, "Failed to parse cleanup value %s", value);
+ log_unit_debug(u->id, "Failed to parse cleanup value %s", value);
else
s->cleanup = r;
@@ -173,7 +173,7 @@ static int snapshot_deserialize_item(Unit *u, const char *key, const char *value
if (r < 0)
return r;
} else
- log_debug_unit(u->id, "Unknown serialization key '%s'", key);
+ log_unit_debug(u->id, "Unknown serialization key '%s'", key);
return 0;
}
@@ -258,7 +258,7 @@ int snapshot_create(Manager *m, const char *name, bool cleanup, sd_bus_error *e,
SNAPSHOT(u)->cleanup = cleanup;
*_s = SNAPSHOT(u);
- log_info_unit(u->id, "Created snapshot %s.", u->id);
+ log_unit_info(u->id, "Created snapshot %s.", u->id);
return 0;
@@ -272,7 +272,7 @@ fail:
void snapshot_remove(Snapshot *s) {
assert(s);
- log_info_unit(UNIT(s)->id, "Removing snapshot %s.", UNIT(s)->id);
+ log_unit_info(UNIT(s)->id, "Removing snapshot %s.", UNIT(s)->id);
unit_add_to_cleanup_queue(UNIT(s));
}
diff --git a/src/core/socket.c b/src/core/socket.c
index 39652ef560..96fe2d4a41 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -391,33 +391,33 @@ static int socket_verify(Socket *s) {
return 0;
if (!s->ports) {
- log_error_unit(UNIT(s)->id, "%s lacks Listen setting. Refusing.", UNIT(s)->id);
+ log_unit_error(UNIT(s)->id, "%s lacks Listen setting. Refusing.", UNIT(s)->id);
return -EINVAL;
}
if (s->accept && have_non_accept_socket(s)) {
- log_error_unit(UNIT(s)->id, "%s configured for accepting sockets, but sockets are non-accepting. Refusing.",
+ log_unit_error(UNIT(s)->id, "%s configured for accepting sockets, but sockets are non-accepting. Refusing.",
UNIT(s)->id);
return -EINVAL;
}
if (s->accept && s->max_connections <= 0) {
- log_error_unit(UNIT(s)->id, "%s's MaxConnection setting too small. Refusing.", UNIT(s)->id);
+ log_unit_error(UNIT(s)->id, "%s's MaxConnection setting too small. Refusing.", UNIT(s)->id);
return -EINVAL;
}
if (s->accept && UNIT_DEREF(s->service)) {
- log_error_unit(UNIT(s)->id, "Explicit service configuration for accepting sockets not supported on %s. Refusing.", UNIT(s)->id);
+ log_unit_error(UNIT(s)->id, "Explicit service configuration for accepting sockets not supported on %s. Refusing.", UNIT(s)->id);
return -EINVAL;
}
if (s->exec_context.pam_name && s->kill_context.kill_mode != KILL_CONTROL_GROUP) {
- log_error_unit(UNIT(s)->id, "%s has PAM enabled. Kill mode must be set to 'control-group'. Refusing.", UNIT(s)->id);
+ log_unit_error(UNIT(s)->id, "%s has PAM enabled. Kill mode must be set to 'control-group'. Refusing.", UNIT(s)->id);
return -EINVAL;
}
if (!strv_isempty(s->symlinks) && !socket_find_symlink_target(s)) {
- log_error_unit(UNIT(s)->id, "%s has symlinks set but none or more than one node in the file system. Refusing.", UNIT(s)->id);
+ log_unit_error(UNIT(s)->id, "%s has symlinks set but none or more than one node in the file system. Refusing.", UNIT(s)->id);
return -EINVAL;
}
@@ -815,60 +815,60 @@ static void socket_apply_socket_options(Socket *s, int fd) {
if (s->keep_alive) {
int b = s->keep_alive;
if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &b, sizeof(b)) < 0)
- log_warning_unit(UNIT(s)->id, "SO_KEEPALIVE failed: %m");
+ log_unit_warning(UNIT(s)->id, "SO_KEEPALIVE failed: %m");
}
if (s->keep_alive_time) {
int value = s->keep_alive_time / USEC_PER_SEC;
if (setsockopt(fd, SOL_TCP, TCP_KEEPIDLE, &value, sizeof(value)) < 0)
- log_warning_unit(UNIT(s)->id, "TCP_KEEPIDLE failed: %m");
+ log_unit_warning(UNIT(s)->id, "TCP_KEEPIDLE failed: %m");
}
if (s->keep_alive_interval) {
int value = s->keep_alive_interval / USEC_PER_SEC;
if (setsockopt(fd, SOL_TCP, TCP_KEEPINTVL, &value, sizeof(value)) < 0)
- log_warning_unit(UNIT(s)->id, "TCP_KEEPINTVL failed: %m");
+ log_unit_warning(UNIT(s)->id, "TCP_KEEPINTVL failed: %m");
}
if (s->keep_alive_cnt) {
int value = s->keep_alive_cnt;
if (setsockopt(fd, SOL_SOCKET, TCP_KEEPCNT, &value, sizeof(value)) < 0)
- log_warning_unit(UNIT(s)->id, "TCP_KEEPCNT failed: %m");
+ log_unit_warning(UNIT(s)->id, "TCP_KEEPCNT failed: %m");
}
if (s->defer_accept) {
int value = s->defer_accept / USEC_PER_SEC;
if (setsockopt(fd, SOL_TCP, TCP_DEFER_ACCEPT, &value, sizeof(value)) < 0)
- log_warning_unit(UNIT(s)->id, "TCP_DEFER_ACCEPT failed: %m");
+ log_unit_warning(UNIT(s)->id, "TCP_DEFER_ACCEPT failed: %m");
}
if (s->no_delay) {
int b = s->no_delay;
if (setsockopt(fd, SOL_TCP, TCP_NODELAY, &b, sizeof(b)) < 0)
- log_warning_unit(UNIT(s)->id, "TCP_NODELAY failed: %m");
+ log_unit_warning(UNIT(s)->id, "TCP_NODELAY failed: %m");
}
if (s->broadcast) {
int one = 1;
if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &one, sizeof(one)) < 0)
- log_warning_unit(UNIT(s)->id, "SO_BROADCAST failed: %m");
+ log_unit_warning(UNIT(s)->id, "SO_BROADCAST failed: %m");
}
if (s->pass_cred) {
int one = 1;
if (setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &one, sizeof(one)) < 0)
- log_warning_unit(UNIT(s)->id, "SO_PASSCRED failed: %m");
+ log_unit_warning(UNIT(s)->id, "SO_PASSCRED failed: %m");
}
if (s->pass_sec) {
int one = 1;
if (setsockopt(fd, SOL_SOCKET, SO_PASSSEC, &one, sizeof(one)) < 0)
- log_warning_unit(UNIT(s)->id, "SO_PASSSEC failed: %m");
+ log_unit_warning(UNIT(s)->id, "SO_PASSSEC failed: %m");
}
if (s->priority >= 0)
if (setsockopt(fd, SOL_SOCKET, SO_PRIORITY, &s->priority, sizeof(s->priority)) < 0)
- log_warning_unit(UNIT(s)->id, "SO_PRIORITY failed: %m");
+ log_unit_warning(UNIT(s)->id, "SO_PRIORITY failed: %m");
if (s->receive_buffer > 0) {
int value = (int) s->receive_buffer;
@@ -877,23 +877,23 @@ static void socket_apply_socket_options(Socket *s, int fd) {
if (setsockopt(fd, SOL_SOCKET, SO_RCVBUFFORCE, &value, sizeof(value)) < 0)
if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &value, sizeof(value)) < 0)
- log_warning_unit(UNIT(s)->id, "SO_RCVBUF failed: %m");
+ log_unit_warning(UNIT(s)->id, "SO_RCVBUF failed: %m");
}
if (s->send_buffer > 0) {
int value = (int) s->send_buffer;
if (setsockopt(fd, SOL_SOCKET, SO_SNDBUFFORCE, &value, sizeof(value)) < 0)
if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &value, sizeof(value)) < 0)
- log_warning_unit(UNIT(s)->id, "SO_SNDBUF failed: %m");
+ log_unit_warning(UNIT(s)->id, "SO_SNDBUF failed: %m");
}
if (s->mark >= 0)
if (setsockopt(fd, SOL_SOCKET, SO_MARK, &s->mark, sizeof(s->mark)) < 0)
- log_warning_unit(UNIT(s)->id, "SO_MARK failed: %m");
+ log_unit_warning(UNIT(s)->id, "SO_MARK failed: %m");
if (s->ip_tos >= 0)
if (setsockopt(fd, IPPROTO_IP, IP_TOS, &s->ip_tos, sizeof(s->ip_tos)) < 0)
- log_warning_unit(UNIT(s)->id, "IP_TOS failed: %m");
+ log_unit_warning(UNIT(s)->id, "IP_TOS failed: %m");
if (s->ip_ttl >= 0) {
int x;
@@ -908,30 +908,30 @@ static void socket_apply_socket_options(Socket *s, int fd) {
}
if (r < 0 && x < 0)
- log_warning_unit(UNIT(s)->id,
+ log_unit_warning(UNIT(s)->id,
"IP_TTL/IPV6_UNICAST_HOPS failed: %m");
}
if (s->tcp_congestion)
if (setsockopt(fd, SOL_TCP, TCP_CONGESTION, s->tcp_congestion, strlen(s->tcp_congestion)+1) < 0)
- log_warning_unit(UNIT(s)->id, "TCP_CONGESTION failed: %m");
+ log_unit_warning(UNIT(s)->id, "TCP_CONGESTION failed: %m");
if (s->reuse_port) {
int b = s->reuse_port;
if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &b, sizeof(b)) < 0)
- log_warning_unit(UNIT(s)->id, "SO_REUSEPORT failed: %m");
+ log_unit_warning(UNIT(s)->id, "SO_REUSEPORT failed: %m");
}
if (s->smack_ip_in) {
r = mac_smack_apply_ip_in_fd(fd, s->smack_ip_in);
if (r < 0)
- log_error_unit(UNIT(s)->id, "mac_smack_apply_ip_in_fd: %s", strerror(-r));
+ log_unit_error(UNIT(s)->id, "mac_smack_apply_ip_in_fd: %s", strerror(-r));
}
if (s->smack_ip_out) {
r = mac_smack_apply_ip_out_fd(fd, s->smack_ip_out);
if (r < 0)
- log_error_unit(UNIT(s)->id, "mac_smack_apply_ip_out_fd: %s", strerror(-r));
+ log_unit_error(UNIT(s)->id, "mac_smack_apply_ip_out_fd: %s", strerror(-r));
}
}
@@ -943,12 +943,12 @@ static void socket_apply_fifo_options(Socket *s, int fd) {
if (s->pipe_size > 0)
if (fcntl(fd, F_SETPIPE_SZ, s->pipe_size) < 0)
- log_warning_unit(UNIT(s)->id, "F_SETPIPE_SZ: %m");
+ log_unit_warning(UNIT(s)->id, "F_SETPIPE_SZ: %m");
if (s->smack) {
r = mac_smack_apply_fd(fd, s->smack);
if (r < 0)
- log_error_unit(UNIT(s)->id, "mac_smack_apply_fd: %s", strerror(-r));
+ log_unit_error(UNIT(s)->id, "mac_smack_apply_fd: %s", strerror(-r));
}
}
@@ -1249,7 +1249,7 @@ static void socket_unwatch_fds(Socket *s) {
r = sd_event_source_set_enabled(p->event_source, SD_EVENT_OFF);
if (r < 0)
- log_debug_unit(UNIT(s)->id, "Failed to disable event source.");
+ log_unit_debug(UNIT(s)->id, "Failed to disable event source.");
}
}
@@ -1269,7 +1269,7 @@ static int socket_watch_fds(Socket *s) {
r = sd_event_add_io(UNIT(s)->manager->event, &p->event_source, p->fd, EPOLLIN, socket_dispatch_io, p);
if (r < 0) {
- log_warning_unit(UNIT(s)->id, "Failed to watch listening fds: %s", strerror(-r));
+ log_unit_warning(UNIT(s)->id, "Failed to watch listening fds: %s", strerror(-r));
goto fail;
}
}
@@ -1319,7 +1319,7 @@ static void socket_set_state(Socket *s, SocketState state) {
socket_close_fds(s);
if (state != old_state)
- log_debug_unit(UNIT(s)->id, "%s changed %s -> %s",
+ log_unit_debug(UNIT(s)->id, "%s changed %s -> %s",
UNIT(s)->id, socket_state_to_string(old_state), socket_state_to_string(state));
unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state], true);
@@ -1562,7 +1562,7 @@ static void socket_enter_stop_post(Socket *s, SocketResult f) {
return;
fail:
- log_warning_unit(UNIT(s)->id,
+ log_unit_warning(UNIT(s)->id,
"%s failed to run 'stop-post' task: %s",
UNIT(s)->id, strerror(-r));
socket_enter_signal(s, SOCKET_FINAL_SIGTERM, SOCKET_FAILURE_RESOURCES);
@@ -1605,7 +1605,7 @@ static void socket_enter_signal(Socket *s, SocketState state, SocketResult f) {
return;
fail:
- log_warning_unit(UNIT(s)->id, "%s failed to kill processes: %s", UNIT(s)->id, strerror(-r));
+ log_unit_warning(UNIT(s)->id, "%s failed to kill processes: %s", UNIT(s)->id, strerror(-r));
if (state == SOCKET_STOP_PRE_SIGTERM || state == SOCKET_STOP_PRE_SIGKILL)
socket_enter_stop_post(s, SOCKET_FAILURE_RESOURCES);
@@ -1636,7 +1636,7 @@ static void socket_enter_stop_pre(Socket *s, SocketResult f) {
return;
fail:
- log_warning_unit(UNIT(s)->id, "%s failed to run 'stop-pre' task: %s", UNIT(s)->id, strerror(-r));
+ log_unit_warning(UNIT(s)->id, "%s failed to run 'stop-pre' task: %s", UNIT(s)->id, strerror(-r));
socket_enter_stop_post(s, SOCKET_FAILURE_RESOURCES);
}
@@ -1646,7 +1646,7 @@ static void socket_enter_listening(Socket *s) {
r = socket_watch_fds(s);
if (r < 0) {
- log_warning_unit(UNIT(s)->id, "%s failed to watch sockets: %s", UNIT(s)->id, strerror(-r));
+ log_unit_warning(UNIT(s)->id, "%s failed to watch sockets: %s", UNIT(s)->id, strerror(-r));
goto fail;
}
@@ -1668,7 +1668,7 @@ static void socket_enter_start_post(Socket *s) {
if (s->control_command) {
r = socket_spawn(s, s->control_command, &s->control_pid);
if (r < 0) {
- log_warning_unit(UNIT(s)->id, "%s failed to run 'start-post' task: %s", UNIT(s)->id, strerror(-r));
+ log_unit_warning(UNIT(s)->id, "%s failed to run 'start-post' task: %s", UNIT(s)->id, strerror(-r));
goto fail;
}
@@ -1689,7 +1689,7 @@ static void socket_enter_start_chown(Socket *s) {
r = socket_open_fds(s);
if (r < 0) {
- log_warning_unit(UNIT(s)->id, "%s failed to listen on sockets: %s", UNIT(s)->id, strerror(-r));
+ log_unit_warning(UNIT(s)->id, "%s failed to listen on sockets: %s", UNIT(s)->id, strerror(-r));
goto fail;
}
@@ -1701,7 +1701,7 @@ static void socket_enter_start_chown(Socket *s) {
r = socket_chown(s, &s->control_pid);
if (r < 0) {
- log_warning_unit(UNIT(s)->id, "%s failed to fork 'start-chown' task: %s", UNIT(s)->id, strerror(-r));
+ log_unit_warning(UNIT(s)->id, "%s failed to fork 'start-chown' task: %s", UNIT(s)->id, strerror(-r));
goto fail;
}
@@ -1726,7 +1726,7 @@ static void socket_enter_start_pre(Socket *s) {
if (s->control_command) {
r = socket_spawn(s, s->control_command, &s->control_pid);
if (r < 0) {
- log_warning_unit(UNIT(s)->id, "%s failed to run 'start-pre' task: %s", UNIT(s)->id, strerror(-r));
+ log_unit_warning(UNIT(s)->id, "%s failed to run 'start-pre' task: %s", UNIT(s)->id, strerror(-r));
goto fail;
}
@@ -1750,7 +1750,7 @@ static void socket_enter_running(Socket *s, int cfd) {
* shut down anyway */
if (unit_stop_pending(UNIT(s))) {
- log_debug_unit(UNIT(s)->id, "Suppressing connection request on %s since unit stop is scheduled.", UNIT(s)->id);
+ log_unit_debug(UNIT(s)->id, "Suppressing connection request on %s since unit stop is scheduled.", UNIT(s)->id);
if (cfd >= 0)
safe_close(cfd);
@@ -1760,14 +1760,14 @@ static void socket_enter_running(Socket *s, int cfd) {
r = socket_open_fds(s);
if (r < 0) {
- log_warning_unit(UNIT(s)->id, "%s failed to listen on sockets: %s", UNIT(s)->id, strerror(-r));
+ log_unit_warning(UNIT(s)->id, "%s failed to listen on sockets: %s", UNIT(s)->id, strerror(-r));
socket_enter_stop_pre(s, SOCKET_FAILURE_RESOURCES);
return;
}
r = socket_watch_fds(s);
if (r < 0) {
- log_warning_unit(UNIT(s)->id, "%s failed to watch sockets: %s", UNIT(s)->id, strerror(-r));
+ log_unit_warning(UNIT(s)->id, "%s failed to watch sockets: %s", UNIT(s)->id, strerror(-r));
socket_enter_stop_pre(s, SOCKET_FAILURE_RESOURCES);
}
}
@@ -1790,7 +1790,7 @@ static void socket_enter_running(Socket *s, int cfd) {
if (!pending) {
if (!UNIT_ISSET(s->service)) {
- log_error_unit(UNIT(s)->id, "%s: service to activate vanished, refusing activation.", UNIT(s)->id);
+ log_unit_error(UNIT(s)->id, "%s: service to activate vanished, refusing activation.", UNIT(s)->id);
r = -ENOENT;
goto fail;
}
@@ -1806,7 +1806,7 @@ static void socket_enter_running(Socket *s, int cfd) {
Service *service;
if (s->n_connections >= s->max_connections) {
- log_warning_unit(UNIT(s)->id, "%s: Too many incoming connections (%u)", UNIT(s)->id, s->n_connections);
+ log_unit_warning(UNIT(s)->id, "%s: Too many incoming connections (%u)", UNIT(s)->id, s->n_connections);
safe_close(cfd);
return;
}
@@ -1868,7 +1868,7 @@ static void socket_enter_running(Socket *s, int cfd) {
return;
fail:
- log_warning_unit(UNIT(s)->id, "%s failed to queue service startup job (Maybe the service file is missing or not a %s unit?): %s",
+ log_unit_warning(UNIT(s)->id, "%s failed to queue service startup job (Maybe the service file is missing or not a %s unit?): %s",
UNIT(s)->id, cfd >= 0 ? "template" : "non-template",
bus_error_message(&error, r));
@@ -1894,7 +1894,7 @@ static void socket_run_next(Socket *s) {
return;
fail:
- log_warning_unit(UNIT(s)->id, "%s failed to run next task: %s", UNIT(s)->id, strerror(-r));
+ log_unit_warning(UNIT(s)->id, "%s failed to run next task: %s", UNIT(s)->id, strerror(-r));
if (s->state == SOCKET_START_POST)
socket_enter_stop_pre(s, SOCKET_FAILURE_RESOURCES);
@@ -1934,7 +1934,7 @@ static int socket_start(Unit *u) {
service = SERVICE(UNIT_DEREF(s->service));
if (UNIT(service)->load_state != UNIT_LOADED) {
- log_error_unit(u->id, "Socket service %s not loaded, refusing.", UNIT(service)->id);
+ log_unit_error(u->id, "Socket service %s not loaded, refusing.", UNIT(service)->id);
return -ENOENT;
}
@@ -1943,7 +1943,7 @@ static int socket_start(Unit *u) {
if (service->state != SERVICE_DEAD &&
service->state != SERVICE_FAILED &&
service->state != SERVICE_AUTO_RESTART) {
- log_error_unit(u->id, "Socket service %s already active, refusing.", UNIT(service)->id);
+ log_unit_error(u->id, "Socket service %s already active, refusing.", UNIT(service)->id);
return -EBUSY;
}
}
@@ -2053,7 +2053,7 @@ static int socket_deserialize_item(Unit *u, const char *key, const char *value,
state = socket_state_from_string(value);
if (state < 0)
- log_debug_unit(u->id, "Failed to parse state value %s", value);
+ log_unit_debug(u->id, "Failed to parse state value %s", value);
else
s->deserialized_state = state;
} else if (streq(key, "result")) {
@@ -2061,7 +2061,7 @@ static int socket_deserialize_item(Unit *u, const char *key, const char *value,
f = socket_result_from_string(value);
if (f < 0)
- log_debug_unit(u->id, "Failed to parse result value %s", value);
+ log_unit_debug(u->id, "Failed to parse result value %s", value);
else if (f != SOCKET_SUCCESS)
s->result = f;
@@ -2069,14 +2069,14 @@ static int socket_deserialize_item(Unit *u, const char *key, const char *value,
unsigned k;
if (safe_atou(value, &k) < 0)
- log_debug_unit(u->id, "Failed to parse n-accepted value %s", value);
+ log_unit_debug(u->id, "Failed to parse n-accepted value %s", value);
else
s->n_accepted += k;
} else if (streq(key, "control-pid")) {
pid_t pid;
if (parse_pid(value, &pid) < 0)
- log_debug_unit(u->id, "Failed to parse control-pid value %s", value);
+ log_unit_debug(u->id, "Failed to parse control-pid value %s", value);
else
s->control_pid = pid;
} else if (streq(key, "control-command")) {
@@ -2084,7 +2084,7 @@ static int socket_deserialize_item(Unit *u, const char *key, const char *value,
id = socket_exec_command_from_string(value);
if (id < 0)
- log_debug_unit(u->id, "Failed to parse exec-command value %s", value);
+ log_unit_debug(u->id, "Failed to parse exec-command value %s", value);
else {
s->control_command_id = id;
s->control_command = s->exec_command[id];
@@ -2094,7 +2094,7 @@ static int socket_deserialize_item(Unit *u, const char *key, const char *value,
SocketPort *p;
if (sscanf(value, "%i %n", &fd, &skip) < 1 || fd < 0 || !fdset_contains(fds, fd))
- log_debug_unit(u->id, "Failed to parse fifo value %s", value);
+ log_unit_debug(u->id, "Failed to parse fifo value %s", value);
else {
LIST_FOREACH(port, p, s->ports)
@@ -2113,7 +2113,7 @@ static int socket_deserialize_item(Unit *u, const char *key, const char *value,
SocketPort *p;
if (sscanf(value, "%i %n", &fd, &skip) < 1 || fd < 0 || !fdset_contains(fds, fd))
- log_debug_unit(u->id, "Failed to parse special value %s", value);
+ log_unit_debug(u->id, "Failed to parse special value %s", value);
else {
LIST_FOREACH(port, p, s->ports)
@@ -2132,7 +2132,7 @@ static int socket_deserialize_item(Unit *u, const char *key, const char *value,
SocketPort *p;
if (sscanf(value, "%i %n", &fd, &skip) < 1 || fd < 0 || !fdset_contains(fds, fd))
- log_debug_unit(u->id, "Failed to parse mqueue value %s", value);
+ log_unit_debug(u->id, "Failed to parse mqueue value %s", value);
else {
LIST_FOREACH(port, p, s->ports)
@@ -2151,7 +2151,7 @@ static int socket_deserialize_item(Unit *u, const char *key, const char *value,
SocketPort *p;
if (sscanf(value, "%i %i %n", &fd, &type, &skip) < 2 || fd < 0 || type < 0 || !fdset_contains(fds, fd))
- log_debug_unit(u->id, "Failed to parse socket value %s", value);
+ log_unit_debug(u->id, "Failed to parse socket value %s", value);
else {
LIST_FOREACH(port, p, s->ports)
@@ -2169,7 +2169,7 @@ static int socket_deserialize_item(Unit *u, const char *key, const char *value,
SocketPort *p;
if (sscanf(value, "%i %n", &fd, &skip) < 1 || fd < 0 || !fdset_contains(fds, fd))
- log_debug_unit(u->id, "Failed to parse socket value %s", value);
+ log_unit_debug(u->id, "Failed to parse socket value %s", value);
else {
LIST_FOREACH(port, p, s->ports)
@@ -2182,7 +2182,7 @@ static int socket_deserialize_item(Unit *u, const char *key, const char *value,
}
}
} else
- log_debug_unit(UNIT(s)->id, "Unknown serialization key '%s'", key);
+ log_unit_debug(UNIT(s)->id, "Unknown serialization key '%s'", key);
return 0;
}
@@ -2286,15 +2286,15 @@ static int socket_dispatch_io(sd_event_source *source, int fd, uint32_t revents,
if (p->socket->state != SOCKET_LISTENING)
return 0;
- log_debug_unit(UNIT(p->socket)->id, "Incoming traffic on %s", UNIT(p->socket)->id);
+ log_unit_debug(UNIT(p->socket)->id, "Incoming traffic on %s", UNIT(p->socket)->id);
if (revents != EPOLLIN) {
if (revents & EPOLLHUP)
- log_error_unit(UNIT(p->socket)->id, "%s: Got POLLHUP on a listening socket. The service probably invoked shutdown() on it, and should better not do that.",
+ log_unit_error(UNIT(p->socket)->id, "%s: Got POLLHUP on a listening socket. The service probably invoked shutdown() on it, and should better not do that.",
UNIT(p->socket)->id);
else
- log_error_unit(UNIT(p->socket)->id, "%s: Got unexpected poll event (0x%x) on socket.",
+ log_unit_error(UNIT(p->socket)->id, "%s: Got unexpected poll event (0x%x) on socket.",
UNIT(p->socket)->id, revents);
goto fail;
@@ -2312,7 +2312,7 @@ static int socket_dispatch_io(sd_event_source *source, int fd, uint32_t revents,
if (errno == EINTR)
continue;
- log_error_unit(UNIT(p->socket)->id,
+ log_unit_error(UNIT(p->socket)->id,
"Failed to accept socket: %m");
goto fail;
}
@@ -2361,8 +2361,8 @@ static void socket_sigchld_event(Unit *u, pid_t pid, int code, int status) {
f = SOCKET_SUCCESS;
}
- log_full_unit(f == SOCKET_SUCCESS ? LOG_DEBUG : LOG_NOTICE,
- u->id,
+ log_unit_full(u->id,
+ f == SOCKET_SUCCESS ? LOG_DEBUG : LOG_NOTICE,
"%s control process exited, code=%s status=%i",
u->id, sigchld_code_to_string(code), status);
@@ -2373,7 +2373,7 @@ static void socket_sigchld_event(Unit *u, pid_t pid, int code, int status) {
s->control_command->command_next &&
f == SOCKET_SUCCESS) {
- log_debug_unit(u->id,
+ log_unit_debug(u->id,
"%s running next command for state %s",
u->id, socket_state_to_string(s->state));
socket_run_next(s);
@@ -2384,7 +2384,7 @@ static void socket_sigchld_event(Unit *u, pid_t pid, int code, int status) {
/* No further commands for this step, so let's figure
* out what to do next */
- log_debug_unit(u->id,
+ log_unit_debug(u->id,
"%s got final SIGCHLD for state %s",
u->id, socket_state_to_string(s->state));
@@ -2441,53 +2441,53 @@ static int socket_dispatch_timer(sd_event_source *source, usec_t usec, void *use
switch (s->state) {
case SOCKET_START_PRE:
- log_warning_unit(UNIT(s)->id, "%s starting timed out. Terminating.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s starting timed out. Terminating.", UNIT(s)->id);
socket_enter_signal(s, SOCKET_FINAL_SIGTERM, SOCKET_FAILURE_TIMEOUT);
break;
case SOCKET_START_CHOWN:
case SOCKET_START_POST:
- log_warning_unit(UNIT(s)->id, "%s starting timed out. Stopping.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s starting timed out. Stopping.", UNIT(s)->id);
socket_enter_stop_pre(s, SOCKET_FAILURE_TIMEOUT);
break;
case SOCKET_STOP_PRE:
- log_warning_unit(UNIT(s)->id, "%s stopping timed out. Terminating.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s stopping timed out. Terminating.", UNIT(s)->id);
socket_enter_signal(s, SOCKET_STOP_PRE_SIGTERM, SOCKET_FAILURE_TIMEOUT);
break;
case SOCKET_STOP_PRE_SIGTERM:
if (s->kill_context.send_sigkill) {
- log_warning_unit(UNIT(s)->id, "%s stopping timed out. Killing.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s stopping timed out. Killing.", UNIT(s)->id);
socket_enter_signal(s, SOCKET_STOP_PRE_SIGKILL, SOCKET_FAILURE_TIMEOUT);
} else {
- log_warning_unit(UNIT(s)->id, "%s stopping timed out. Skipping SIGKILL. Ignoring.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s stopping timed out. Skipping SIGKILL. Ignoring.", UNIT(s)->id);
socket_enter_stop_post(s, SOCKET_FAILURE_TIMEOUT);
}
break;
case SOCKET_STOP_PRE_SIGKILL:
- log_warning_unit(UNIT(s)->id, "%s still around after SIGKILL. Ignoring.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s still around after SIGKILL. Ignoring.", UNIT(s)->id);
socket_enter_stop_post(s, SOCKET_FAILURE_TIMEOUT);
break;
case SOCKET_STOP_POST:
- log_warning_unit(UNIT(s)->id, "%s stopping timed out (2). Terminating.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s stopping timed out (2). Terminating.", UNIT(s)->id);
socket_enter_signal(s, SOCKET_FINAL_SIGTERM, SOCKET_FAILURE_TIMEOUT);
break;
case SOCKET_FINAL_SIGTERM:
if (s->kill_context.send_sigkill) {
- log_warning_unit(UNIT(s)->id, "%s stopping timed out (2). Killing.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s stopping timed out (2). Killing.", UNIT(s)->id);
socket_enter_signal(s, SOCKET_FINAL_SIGKILL, SOCKET_FAILURE_TIMEOUT);
} else {
- log_warning_unit(UNIT(s)->id, "%s stopping timed out (2). Skipping SIGKILL. Ignoring.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s stopping timed out (2). Skipping SIGKILL. Ignoring.", UNIT(s)->id);
socket_enter_dead(s, SOCKET_FAILURE_TIMEOUT);
}
break;
case SOCKET_FINAL_SIGKILL:
- log_warning_unit(UNIT(s)->id, "%s still around after SIGKILL (2). Entering failed mode.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s still around after SIGKILL (2). Entering failed mode.", UNIT(s)->id);
socket_enter_dead(s, SOCKET_FAILURE_TIMEOUT);
break;
@@ -2556,7 +2556,7 @@ static void socket_notify_service_dead(Socket *s, bool failed_permanent) {
* services. */
if (s->state == SOCKET_RUNNING) {
- log_debug_unit(UNIT(s)->id, "%s got notified about service death (failed permanently: %s)", UNIT(s)->id, yes_no(failed_permanent));
+ log_unit_debug(UNIT(s)->id, "%s got notified about service death (failed permanently: %s)", UNIT(s)->id, yes_no(failed_permanent));
if (failed_permanent)
socket_enter_stop_pre(s, SOCKET_FAILURE_SERVICE_FAILED_PERMANENT);
else
@@ -2575,7 +2575,7 @@ void socket_connection_unref(Socket *s) {
assert(s->n_connections > 0);
s->n_connections--;
- log_debug_unit(UNIT(s)->id, "%s: One connection closed, %u left.", UNIT(s)->id, s->n_connections);
+ log_unit_debug(UNIT(s)->id, "%s: One connection closed, %u left.", UNIT(s)->id, s->n_connections);
}
static void socket_trigger_notify(Unit *u, Unit *other) {
diff --git a/src/core/swap.c b/src/core/swap.c
index e509a633d0..fd16104ebb 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -233,12 +233,12 @@ static int swap_verify(Swap *s) {
b = unit_has_name(UNIT(s), e);
if (!b) {
- log_error_unit(UNIT(s)->id, "%s: Value of \"What\" and unit name do not match, not loading.", UNIT(s)->id);
+ log_unit_error(UNIT(s)->id, "%s: Value of \"What\" and unit name do not match, not loading.", UNIT(s)->id);
return -EINVAL;
}
if (s->exec_context.pam_name && s->kill_context.kill_mode != KILL_CONTROL_GROUP) {
- log_error_unit(UNIT(s)->id, "%s has PAM enabled. Kill mode must be set to 'control-group'. Refusing to load.", UNIT(s)->id);
+ log_unit_error(UNIT(s)->id, "%s has PAM enabled. Kill mode must be set to 'control-group'. Refusing to load.", UNIT(s)->id);
return -EINVAL;
}
@@ -410,7 +410,7 @@ static int swap_add_one(
return 0;
fail:
- log_warning_unit(e, "Failed to load swap unit: %s", strerror(-r));
+ log_unit_warning(e, "Failed to load swap unit: %s", strerror(-r));
if (delete && u)
unit_free(u);
@@ -492,7 +492,7 @@ static void swap_set_state(Swap *s, SwapState state) {
}
if (state != old_state)
- log_debug_unit(UNIT(s)->id,
+ log_unit_debug(UNIT(s)->id,
"%s changed %s -> %s",
UNIT(s)->id,
swap_state_to_string(old_state),
@@ -698,7 +698,7 @@ static void swap_enter_signal(Swap *s, SwapState state, SwapResult f) {
return;
fail:
- log_warning_unit(UNIT(s)->id,
+ log_unit_warning(UNIT(s)->id,
"%s failed to kill processes: %s", UNIT(s)->id, strerror(-r));
swap_enter_dead(s, SWAP_FAILURE_RESOURCES);
@@ -827,7 +827,7 @@ static void swap_enter_activating(Swap *s) {
return;
fail:
- log_warning_unit(UNIT(s)->id,
+ log_unit_warning(UNIT(s)->id,
"%s failed to run 'swapon' task: %s",
UNIT(s)->id, strerror(-r));
swap_enter_dead(s, SWAP_FAILURE_RESOURCES);
@@ -859,7 +859,7 @@ static void swap_enter_deactivating(Swap *s) {
return;
fail:
- log_warning_unit(UNIT(s)->id,
+ log_unit_warning(UNIT(s)->id,
"%s failed to run 'swapoff' task: %s",
UNIT(s)->id, strerror(-r));
swap_enter_active(s, SWAP_FAILURE_RESOURCES);
@@ -946,7 +946,7 @@ static int swap_deserialize_item(Unit *u, const char *key, const char *value, FD
state = swap_state_from_string(value);
if (state < 0)
- log_debug_unit(u->id, "Failed to parse state value %s", value);
+ log_unit_debug(u->id, "Failed to parse state value %s", value);
else
s->deserialized_state = state;
} else if (streq(key, "result")) {
@@ -954,14 +954,14 @@ static int swap_deserialize_item(Unit *u, const char *key, const char *value, FD
f = swap_result_from_string(value);
if (f < 0)
- log_debug_unit(u->id, "Failed to parse result value %s", value);
+ log_unit_debug(u->id, "Failed to parse result value %s", value);
else if (f != SWAP_SUCCESS)
s->result = f;
} else if (streq(key, "control-pid")) {
pid_t pid;
if (parse_pid(value, &pid) < 0)
- log_debug_unit(u->id, "Failed to parse control-pid value %s", value);
+ log_unit_debug(u->id, "Failed to parse control-pid value %s", value);
else
s->control_pid = pid;
@@ -970,13 +970,13 @@ static int swap_deserialize_item(Unit *u, const char *key, const char *value, FD
id = swap_exec_command_from_string(value);
if (id < 0)
- log_debug_unit(u->id, "Failed to parse exec-command value %s", value);
+ log_unit_debug(u->id, "Failed to parse exec-command value %s", value);
else {
s->control_command_id = id;
s->control_command = s->exec_command + id;
}
} else
- log_debug_unit(u->id, "Unknown serialization key '%s'", key);
+ log_unit_debug(u->id, "Unknown serialization key '%s'", key);
return 0;
}
@@ -1034,8 +1034,8 @@ static void swap_sigchld_event(Unit *u, pid_t pid, int code, int status) {
s->control_command_id = _SWAP_EXEC_COMMAND_INVALID;
}
- log_full_unit(f == SWAP_SUCCESS ? LOG_DEBUG : LOG_NOTICE,
- u->id,
+ log_unit_full(u->id,
+ f == SWAP_SUCCESS ? LOG_DEBUG : LOG_NOTICE,
"%s swap process exited, code=%s status=%i",
u->id, sigchld_code_to_string(code), status);
@@ -1077,38 +1077,38 @@ static int swap_dispatch_timer(sd_event_source *source, usec_t usec, void *userd
case SWAP_ACTIVATING:
case SWAP_ACTIVATING_DONE:
- log_warning_unit(UNIT(s)->id, "%s activation timed out. Stopping.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s activation timed out. Stopping.", UNIT(s)->id);
swap_enter_signal(s, SWAP_ACTIVATING_SIGTERM, SWAP_FAILURE_TIMEOUT);
break;
case SWAP_DEACTIVATING:
- log_warning_unit(UNIT(s)->id, "%s deactivation timed out. Stopping.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s deactivation timed out. Stopping.", UNIT(s)->id);
swap_enter_signal(s, SWAP_DEACTIVATING_SIGTERM, SWAP_FAILURE_TIMEOUT);
break;
case SWAP_ACTIVATING_SIGTERM:
if (s->kill_context.send_sigkill) {
- log_warning_unit(UNIT(s)->id, "%s activation timed out. Killing.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s activation timed out. Killing.", UNIT(s)->id);
swap_enter_signal(s, SWAP_ACTIVATING_SIGKILL, SWAP_FAILURE_TIMEOUT);
} else {
- log_warning_unit(UNIT(s)->id, "%s activation timed out. Skipping SIGKILL. Ignoring.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s activation timed out. Skipping SIGKILL. Ignoring.", UNIT(s)->id);
swap_enter_dead(s, SWAP_FAILURE_TIMEOUT);
}
break;
case SWAP_DEACTIVATING_SIGTERM:
if (s->kill_context.send_sigkill) {
- log_warning_unit(UNIT(s)->id, "%s deactivation timed out. Killing.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s deactivation timed out. Killing.", UNIT(s)->id);
swap_enter_signal(s, SWAP_DEACTIVATING_SIGKILL, SWAP_FAILURE_TIMEOUT);
} else {
- log_warning_unit(UNIT(s)->id, "%s deactivation timed out. Skipping SIGKILL. Ignoring.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s deactivation timed out. Skipping SIGKILL. Ignoring.", UNIT(s)->id);
swap_enter_dead(s, SWAP_FAILURE_TIMEOUT);
}
break;
case SWAP_ACTIVATING_SIGKILL:
case SWAP_DEACTIVATING_SIGKILL:
- log_warning_unit(UNIT(s)->id, "%s swap process still around after SIGKILL. Ignoring.", UNIT(s)->id);
+ log_unit_warning(UNIT(s)->id, "%s swap process still around after SIGKILL. Ignoring.", UNIT(s)->id);
swap_enter_dead(s, SWAP_FAILURE_TIMEOUT);
break;
diff --git a/src/core/timer.c b/src/core/timer.c
index 5c4e9f995a..1380443419 100644
--- a/src/core/timer.c
+++ b/src/core/timer.c
@@ -86,7 +86,7 @@ static int timer_verify(Timer *t) {
return 0;
if (!t->values) {
- log_error_unit(UNIT(t)->id, "%s lacks value setting. Refusing.", UNIT(t)->id);
+ log_unit_error(UNIT(t)->id, "%s lacks value setting. Refusing.", UNIT(t)->id);
return -EINVAL;
}
@@ -260,7 +260,7 @@ static void timer_set_state(Timer *t, TimerState state) {
}
if (state != old_state)
- log_debug_unit(UNIT(t)->id,
+ log_unit_debug(UNIT(t)->id,
"%s changed %s -> %s", UNIT(t)->id,
timer_state_to_string(old_state),
timer_state_to_string(state));
@@ -419,7 +419,7 @@ static void timer_enter_waiting(Timer *t, bool initial) {
}
if (!found_monotonic && !found_realtime) {
- log_debug_unit(UNIT(t)->id, "%s: Timer is elapsed.", UNIT(t)->id);
+ log_unit_debug(UNIT(t)->id, "%s: Timer is elapsed.", UNIT(t)->id);
timer_set_state(t, TIMER_ELAPSED);
return;
}
@@ -427,7 +427,7 @@ static void timer_enter_waiting(Timer *t, bool initial) {
if (found_monotonic) {
char buf[FORMAT_TIMESPAN_MAX];
- log_debug_unit(UNIT(t)->id, "%s: Monotonic timer elapses in %s.",
+ log_unit_debug(UNIT(t)->id, "%s: Monotonic timer elapses in %s.",
UNIT(t)->id,
format_timespan(buf, sizeof(buf), t->next_elapse_monotonic_or_boottime > ts_monotonic ? t->next_elapse_monotonic_or_boottime - ts_monotonic : 0, 0));
@@ -456,7 +456,7 @@ static void timer_enter_waiting(Timer *t, bool initial) {
if (found_realtime) {
char buf[FORMAT_TIMESTAMP_MAX];
- log_debug_unit(UNIT(t)->id, "%s: Realtime timer elapses at %s.", UNIT(t)->id, format_timestamp(buf, sizeof(buf), t->next_elapse_realtime));
+ log_unit_debug(UNIT(t)->id, "%s: Realtime timer elapses at %s.", UNIT(t)->id, format_timestamp(buf, sizeof(buf), t->next_elapse_realtime));
if (t->realtime_event_source) {
r = sd_event_source_set_time(t->realtime_event_source, t->next_elapse_realtime);
@@ -485,7 +485,7 @@ static void timer_enter_waiting(Timer *t, bool initial) {
return;
fail:
- log_warning_unit(UNIT(t)->id, "%s failed to enter waiting state: %s", UNIT(t)->id, strerror(-r));
+ log_unit_warning(UNIT(t)->id, "%s failed to enter waiting state: %s", UNIT(t)->id, strerror(-r));
timer_enter_dead(t, TIMER_FAILURE_RESOURCES);
}
@@ -513,7 +513,7 @@ static void timer_enter_running(Timer *t) {
return;
fail:
- log_warning_unit(UNIT(t)->id,
+ log_unit_warning(UNIT(t)->id,
"%s failed to queue unit startup job: %s",
UNIT(t)->id, bus_error_message(&error, r));
timer_enter_dead(t, TIMER_FAILURE_RESOURCES);
@@ -596,7 +596,7 @@ static int timer_deserialize_item(Unit *u, const char *key, const char *value, F
state = timer_state_from_string(value);
if (state < 0)
- log_debug_unit(u->id, "Failed to parse state value %s", value);
+ log_unit_debug(u->id, "Failed to parse state value %s", value);
else
t->deserialized_state = state;
} else if (streq(key, "result")) {
@@ -604,23 +604,23 @@ static int timer_deserialize_item(Unit *u, const char *key, const char *value, F
f = timer_result_from_string(value);
if (f < 0)
- log_debug_unit(u->id, "Failed to parse result value %s", value);
+ log_unit_debug(u->id, "Failed to parse result value %s", value);
else if (f != TIMER_SUCCESS)
t->result = f;
} else if (streq(key, "last-trigger-realtime")) {
r = safe_atou64(value, &t->last_trigger.realtime);
if (r < 0)
- log_debug_unit(u->id, "Failed to parse last-trigger-realtime value %s", value);
+ log_unit_debug(u->id, "Failed to parse last-trigger-realtime value %s", value);
} else if (streq(key, "last-trigger-monotonic")) {
r = safe_atou64(value, &t->last_trigger.monotonic);
if (r < 0)
- log_debug_unit(u->id, "Failed to parse last-trigger-monotonic value %s", value);
+ log_unit_debug(u->id, "Failed to parse last-trigger-monotonic value %s", value);
} else
- log_debug_unit(u->id, "Unknown serialization key '%s'", key);
+ log_unit_debug(u->id, "Unknown serialization key '%s'", key);
return 0;
}
@@ -645,7 +645,7 @@ static int timer_dispatch(sd_event_source *s, uint64_t usec, void *userdata) {
if (t->state != TIMER_WAITING)
return 0;
- log_debug_unit(UNIT(t)->id, "Timer elapsed on %s", UNIT(t)->id);
+ log_unit_debug(UNIT(t)->id, "Timer elapsed on %s", UNIT(t)->id);
timer_enter_running(t);
return 0;
}
@@ -678,7 +678,7 @@ static void timer_trigger_notify(Unit *u, Unit *other) {
case TIMER_RUNNING:
if (UNIT_IS_INACTIVE_OR_FAILED(unit_active_state(other))) {
- log_debug_unit(UNIT(t)->id, "%s got notified about unit deactivation.", UNIT(t)->id);
+ log_unit_debug(UNIT(t)->id, "%s got notified about unit deactivation.", UNIT(t)->id);
timer_enter_waiting(t, false);
}
break;
@@ -711,7 +711,7 @@ static void timer_time_change(Unit *u) {
if (t->state != TIMER_WAITING)
return;
- log_debug_unit(u->id, "%s: time change, recalculating next elapse.", u->id);
+ log_unit_debug(u->id, "%s: time change, recalculating next elapse.", u->id);
timer_enter_waiting(t, false);
}
diff --git a/src/core/transaction.c b/src/core/transaction.c
index 6ad11b2fdb..652ac71094 100644
--- a/src/core/transaction.c
+++ b/src/core/transaction.c
@@ -189,11 +189,11 @@ static int delete_one_unmergeable_job(Transaction *tr, Job *j) {
* another unit in which case we
* rather remove the start. */
- log_debug_unit(j->unit->id,
+ log_unit_debug(j->unit->id,
"Looking at job %s/%s conflicted_by=%s",
j->unit->id, job_type_to_string(j->type),
yes_no(j->type == JOB_STOP && job_is_conflicted_by(j)));
- log_debug_unit(k->unit->id,
+ log_unit_debug(k->unit->id,
"Looking at job %s/%s conflicted_by=%s",
k->unit->id, job_type_to_string(k->type),
yes_no(k->type == JOB_STOP && job_is_conflicted_by(k)));
@@ -222,7 +222,7 @@ static int delete_one_unmergeable_job(Transaction *tr, Job *j) {
return -ENOEXEC;
/* Ok, we can drop one, so let's do so. */
- log_debug_unit(d->unit->id,
+ log_unit_debug(d->unit->id,
"Fixing conflicting jobs %s/%s,%s/%s by deleting job %s/%s",
j->unit->id, job_type_to_string(j->type),
k->unit->id, job_type_to_string(k->type),
@@ -368,7 +368,7 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
* job to remove. We use the marker to find our way
* back, since smart how we are we stored our way back
* in there. */
- log_warning_unit(j->unit->id,
+ log_unit_warning(j->unit->id,
"Found ordering cycle on %s/%s",
j->unit->id, job_type_to_string(j->type));
@@ -376,7 +376,7 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
for (k = from; k; k = ((k->generation == generation && k->marker != k) ? k->marker : NULL)) {
/* logging for j not k here here to provide consistent narrative */
- log_warning_unit(j->unit->id,
+ log_unit_warning(j->unit->id,
"Found dependency on %s/%s",
k->unit->id, job_type_to_string(k->type));
@@ -396,10 +396,10 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
if (delete) {
/* logging for j not k here here to provide consistent narrative */
- log_warning_unit(j->unit->id,
+ log_unit_warning(j->unit->id,
"Breaking ordering cycle by deleting job %s/%s",
delete->unit->id, job_type_to_string(delete->type));
- log_error_unit(delete->unit->id,
+ log_unit_error(delete->unit->id,
"Job %s/%s deleted to break ordering cycle starting with %s/%s",
delete->unit->id, job_type_to_string(delete->type),
j->unit->id, job_type_to_string(j->type));
@@ -552,17 +552,17 @@ rescan:
continue;
if (stops_running_service)
- log_debug_unit(j->unit->id,
+ log_unit_debug(j->unit->id,
"%s/%s would stop a running service.",
j->unit->id, job_type_to_string(j->type));
if (changes_existing_job)
- log_debug_unit(j->unit->id,
+ log_unit_debug(j->unit->id,
"%s/%s would change existing job.",
j->unit->id, job_type_to_string(j->type));
/* Ok, let's get rid of this */
- log_debug_unit(j->unit->id,
+ log_unit_debug(j->unit->id,
"Deleting %s/%s to minimize impact.",
j->unit->id, job_type_to_string(j->type));
@@ -819,7 +819,7 @@ static void transaction_unlink_job(Transaction *tr, Job *j, bool delete_dependen
job_dependency_free(j->object_list);
if (other && delete_dependencies) {
- log_debug_unit(other->unit->id,
+ log_unit_debug(other->unit->id,
"Deleting job %s/%s as dependency of job %s/%s",
other->unit->id, job_type_to_string(other->type),
j->unit->id, job_type_to_string(j->type));
@@ -915,7 +915,7 @@ int transaction_add_job_and_dependencies(
SET_FOREACH(dep, following, i) {
r = transaction_add_job_and_dependencies(tr, type, dep, ret, false, override, false, false, ignore_order, e);
if (r < 0) {
- log_warning_unit(dep->id,
+ log_unit_warning(dep->id,
"Cannot add dependency job for unit %s, ignoring: %s",
dep->id, bus_error_message(e, r));
@@ -954,7 +954,8 @@ int transaction_add_job_and_dependencies(
SET_FOREACH(dep, ret->unit->dependencies[UNIT_REQUIRES_OVERRIDABLE], i) {
r = transaction_add_job_and_dependencies(tr, JOB_START, dep, ret, !override, override, false, false, ignore_order, e);
if (r < 0) {
- log_full_unit(r == -EADDRNOTAVAIL ? LOG_DEBUG : LOG_WARNING, dep->id,
+ log_unit_full(dep->id,
+ r == -EADDRNOTAVAIL ? LOG_DEBUG : LOG_WARNING,
"Cannot add dependency job for unit %s, ignoring: %s",
dep->id, bus_error_message(e, r));
@@ -966,7 +967,8 @@ int transaction_add_job_and_dependencies(
SET_FOREACH(dep, ret->unit->dependencies[UNIT_WANTS], i) {
r = transaction_add_job_and_dependencies(tr, JOB_START, dep, ret, false, false, false, false, ignore_order, e);
if (r < 0) {
- log_full_unit(r == -EADDRNOTAVAIL ? LOG_DEBUG : LOG_WARNING, dep->id,
+ log_unit_full(dep->id,
+ r == -EADDRNOTAVAIL ? LOG_DEBUG : LOG_WARNING,
"Cannot add dependency job for unit %s, ignoring: %s",
dep->id, bus_error_message(e, r));
@@ -989,7 +991,8 @@ int transaction_add_job_and_dependencies(
SET_FOREACH(dep, ret->unit->dependencies[UNIT_REQUISITE_OVERRIDABLE], i) {
r = transaction_add_job_and_dependencies(tr, JOB_VERIFY_ACTIVE, dep, ret, !override, override, false, false, ignore_order, e);
if (r < 0) {
- log_full_unit(r == -EADDRNOTAVAIL ? LOG_DEBUG : LOG_WARNING, dep->id,
+ log_unit_full(dep->id,
+ r == -EADDRNOTAVAIL ? LOG_DEBUG : LOG_WARNING,
"Cannot add dependency job for unit %s, ignoring: %s",
dep->id, bus_error_message(e, r));
@@ -1012,7 +1015,7 @@ int transaction_add_job_and_dependencies(
SET_FOREACH(dep, ret->unit->dependencies[UNIT_CONFLICTED_BY], i) {
r = transaction_add_job_and_dependencies(tr, JOB_STOP, dep, ret, false, override, false, false, ignore_order, e);
if (r < 0) {
- log_warning_unit(dep->id,
+ log_unit_warning(dep->id,
"Cannot add dependency job for unit %s, ignoring: %s",
dep->id, bus_error_message(e, r));
@@ -1065,7 +1068,7 @@ int transaction_add_job_and_dependencies(
SET_FOREACH(dep, ret->unit->dependencies[UNIT_PROPAGATES_RELOAD_TO], i) {
r = transaction_add_job_and_dependencies(tr, JOB_RELOAD, dep, ret, false, override, false, false, ignore_order, e);
if (r < 0) {
- log_warning_unit(dep->id,
+ log_unit_warning(dep->id,
"Cannot add dependency reload job for unit %s, ignoring: %s",
dep->id, bus_error_message(e, r));
@@ -1112,7 +1115,7 @@ int transaction_add_isolate_jobs(Transaction *tr, Manager *m) {
r = transaction_add_job_and_dependencies(tr, JOB_STOP, u, tr->anchor_job, true, false, false, false, false, NULL);
if (r < 0)
- log_warning_unit(u->id,
+ log_unit_warning(u->id,
"Cannot add isolate job for unit %s, ignoring: %s",
u->id, strerror(-r));
}
diff --git a/src/core/unit.c b/src/core/unit.c
index 948f8e21bd..2e8df7d8d8 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -1218,7 +1218,7 @@ int unit_load(Unit *u) {
goto fail;
if (u->on_failure_job_mode == JOB_ISOLATE && set_size(u->dependencies[UNIT_ON_FAILURE]) > 1) {
- log_error_unit(u->id, "More than one OnFailure= dependencies specified for %s but OnFailureJobMode=isolate set. Refusing.", u->id);
+ log_unit_error(u->id, "More than one OnFailure= dependencies specified for %s but OnFailureJobMode=isolate set. Refusing.", u->id);
r = -EINVAL;
goto fail;
}
@@ -1239,7 +1239,7 @@ fail:
unit_add_to_dbus_queue(u);
unit_add_to_gc_queue(u);
- log_debug_unit(u->id, "Failed to load configuration for %s: %s",
+ log_unit_debug(u->id, "Failed to load configuration for %s: %s",
u->id, strerror(-r));
return r;
@@ -1264,7 +1264,7 @@ static bool unit_condition_test_list(Unit *u, Condition *first, const char *(*to
r = condition_test(c);
if (r < 0)
- log_warning_unit(u->id,
+ log_unit_warning(u->id,
"Couldn't determine result for %s=%s%s%s for %s, assuming failed: %s",
to_string(c->type),
c->trigger ? "|" : "",
@@ -1273,7 +1273,7 @@ static bool unit_condition_test_list(Unit *u, Condition *first, const char *(*to
u->id,
strerror(-r));
else
- log_debug_unit(u->id,
+ log_unit_debug(u->id,
"%s=%s%s%s %s for %s.",
to_string(c->type),
c->trigger ? "|" : "",
@@ -1394,7 +1394,7 @@ static void unit_status_log_starting_stopping_reloading(Unit *u, JobType t) {
t == JOB_STOP ? SD_MESSAGE_UNIT_STOPPING :
SD_MESSAGE_UNIT_RELOADING;
- log_struct_unit(LOG_INFO,
+ log_unit_struct(LOG_INFO,
u->id,
MESSAGE_ID(mid),
"MESSAGE=%s", buf,
@@ -1431,21 +1431,21 @@ int unit_start(Unit *u) {
* but we don't want to recheck the condition in that case. */
if (state != UNIT_ACTIVATING &&
!unit_condition_test(u)) {
- log_debug_unit(u->id, "Starting of %s requested but condition failed. Not starting unit.", u->id);
+ log_unit_debug(u->id, "Starting of %s requested but condition failed. Not starting unit.", u->id);
return -EALREADY;
}
/* If the asserts failed, fail the entire job */
if (state != UNIT_ACTIVATING &&
!unit_assert_test(u)) {
- log_debug_unit(u->id, "Starting of %s requested but asserts failed.", u->id);
+ log_unit_debug(u->id, "Starting of %s requested but asserts failed.", u->id);
return -EPROTO;
}
/* Forward to the main object, if we aren't it. */
following = unit_following(u);
if (following) {
- log_debug_unit(u->id, "Redirecting start request from %s to %s.", u->id, following->id);
+ log_unit_debug(u->id, "Redirecting start request from %s to %s.", u->id, following->id);
return unit_start(following);
}
@@ -1496,7 +1496,7 @@ int unit_stop(Unit *u) {
return -EALREADY;
if ((following = unit_following(u))) {
- log_debug_unit(u->id, "Redirecting stop request from %s to %s.",
+ log_unit_debug(u->id, "Redirecting stop request from %s to %s.",
u->id, following->id);
return unit_stop(following);
}
@@ -1534,14 +1534,14 @@ int unit_reload(Unit *u) {
return -EALREADY;
if (state != UNIT_ACTIVE) {
- log_warning_unit(u->id, "Unit %s cannot be reloaded because it is inactive.",
+ log_unit_warning(u->id, "Unit %s cannot be reloaded because it is inactive.",
u->id);
return -ENOEXEC;
}
following = unit_following(u);
if (following) {
- log_debug_unit(u->id, "Redirecting reload request from %s to %s.",
+ log_unit_debug(u->id, "Redirecting reload request from %s to %s.",
u->id, following->id);
return unit_reload(following);
}
@@ -1595,7 +1595,7 @@ static void unit_check_unneeded(Unit *u) {
if (unit_active_or_pending(other))
return;
- log_info_unit(u->id, "Unit %s is not needed anymore. Stopping.", u->id);
+ log_unit_info(u->id, "Unit %s is not needed anymore. Stopping.", u->id);
/* Ok, nobody needs us anymore. Sniff. Then let's commit suicide */
manager_add_job(u->manager, JOB_STOP, u, JOB_FAIL, true, NULL, NULL);
@@ -1627,7 +1627,7 @@ static void unit_check_binds_to(Unit *u) {
if (!stop)
return;
- log_info_unit(u->id, "Unit %s is bound to inactive service. Stopping, too.", u->id);
+ log_unit_info(u->id, "Unit %s is bound to inactive service. Stopping, too.", u->id);
/* A unit we need to run is gone. Sniff. Let's stop this. */
manager_add_job(u->manager, JOB_STOP, u, JOB_FAIL, true, NULL, NULL);
@@ -1719,14 +1719,14 @@ void unit_start_on_failure(Unit *u) {
if (set_size(u->dependencies[UNIT_ON_FAILURE]) <= 0)
return;
- log_info_unit(u->id, "Triggering OnFailure= dependencies of %s.", u->id);
+ log_unit_info(u->id, "Triggering OnFailure= dependencies of %s.", u->id);
SET_FOREACH(other, u->dependencies[UNIT_ON_FAILURE], i) {
int r;
r = manager_add_job(u->manager, JOB_START, other, u->on_failure_job_mode, true, NULL, NULL);
if (r < 0)
- log_error_unit(u->id, "Failed to enqueue OnFailure= job: %s", strerror(-r));
+ log_unit_error(u->id, "Failed to enqueue OnFailure= job: %s", strerror(-r));
}
}
@@ -1890,7 +1890,7 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su
check_unneeded_dependencies(u);
if (ns != os && ns == UNIT_FAILED) {
- log_notice_unit(u->id, "Unit %s entered failed state.", u->id);
+ log_unit_notice(u->id, "Unit %s entered failed state.", u->id);
unit_start_on_failure(u);
}
}
@@ -2152,10 +2152,10 @@ static int maybe_warn_about_dependency(const char *id, const char *other, UnitDe
case UNIT_TRIGGERS:
case UNIT_TRIGGERED_BY:
if (streq_ptr(id, other))
- log_warning_unit(id, "Dependency %s=%s dropped from unit %s",
+ log_unit_warning(id, "Dependency %s=%s dropped from unit %s",
unit_dependency_to_string(dependency), id, other);
else
- log_warning_unit(id, "Dependency %s=%s dropped from unit %s merged into %s",
+ log_unit_warning(id, "Dependency %s=%s dropped from unit %s merged into %s",
unit_dependency_to_string(dependency), id,
strna(other), id);
return -EINVAL;
@@ -3435,7 +3435,7 @@ int unit_kill_context(
_cleanup_free_ char *comm = NULL;
get_process_comm(main_pid, &comm);
- log_warning_unit(u->id, "Failed to kill main process " PID_FMT " (%s): %s", main_pid, strna(comm), strerror(-r));
+ log_unit_warning(u->id, "Failed to kill main process " PID_FMT " (%s): %s", main_pid, strna(comm), strerror(-r));
} else {
if (!main_pid_alien)
wait_for_exit = true;
@@ -3452,7 +3452,7 @@ int unit_kill_context(
_cleanup_free_ char *comm = NULL;
get_process_comm(control_pid, &comm);
- log_warning_unit(u->id, "Failed to kill control process " PID_FMT " (%s): %s", control_pid, strna(comm), strerror(-r));
+ log_unit_warning(u->id, "Failed to kill control process " PID_FMT " (%s): %s", control_pid, strna(comm), strerror(-r));
} else {
wait_for_exit = true;
@@ -3472,7 +3472,7 @@ int unit_kill_context(
r = cg_kill_recursive(SYSTEMD_CGROUP_CONTROLLER, u->cgroup_path, sig, true, true, false, pid_set);
if (r < 0) {
if (r != -EAGAIN && r != -ESRCH && r != -ENOENT)
- log_warning_unit(u->id, "Failed to kill control group: %s", strerror(-r));
+ log_unit_warning(u->id, "Failed to kill control group: %s", strerror(-r));
} else if (r > 0) {
/* FIXME: For now, we will not wait for the
diff --git a/src/core/unit.h b/src/core/unit.h
index 54ba11a889..5c0fba7cf2 100644
--- a/src/core/unit.h
+++ b/src/core/unit.h
@@ -596,13 +596,13 @@ UnitActiveState unit_active_state_from_string(const char *s) _pure_;
/* Macros which append UNIT= or USER_UNIT= to the message */
-#define log_full_unit(level, unit, ...) log_meta_object(level, 0, __FILE__, __LINE__, __func__, getpid() == 1 ? "UNIT=" : "USER_UNIT=", unit, __VA_ARGS__)
-#define log_full_unit_errno(level, error, unit, ...) log_meta_object(level, error, __FILE__, __LINE__, __func__, getpid() == 1 ? "UNIT=" : "USER_UNIT=", unit, __VA_ARGS__)
+#define log_unit_full_errno(unit, level, error, ...) log_object_internal(level, error, __FILE__, __LINE__, __func__, getpid() == 1 ? "UNIT=" : "USER_UNIT=", unit, __VA_ARGS__)
+#define log_unit_full(unit, level, ...) log_unit_full_errno(unit, level, 0, __VA_ARGS__)
-#define log_debug_unit(unit, ...) log_full_unit(LOG_DEBUG, unit, __VA_ARGS__)
-#define log_info_unit(unit, ...) log_full_unit(LOG_INFO, unit, __VA_ARGS__)
-#define log_notice_unit(unit, ...) log_full_unit(LOG_NOTICE, unit, __VA_ARGS__)
-#define log_warning_unit(unit, ...) log_full_unit(LOG_WARNING, unit, __VA_ARGS__)
-#define log_error_unit(unit, ...) log_full_unit(LOG_ERR, unit, __VA_ARGS__)
+#define log_unit_debug(unit, ...) log_unit_full(unit, LOG_DEBUG, __VA_ARGS__)
+#define log_unit_info(unit, ...) log_unit_full(unit, LOG_INFO, __VA_ARGS__)
+#define log_unit_notice(unit, ...) log_unit_full(unit, LOG_NOTICE, __VA_ARGS__)
+#define log_unit_warning(unit, ...) log_unit_full(unit, LOG_WARNING, __VA_ARGS__)
+#define log_unit_error(unit, ...) log_unit_full(unit, LOG_ERR, __VA_ARGS__)
-#define log_struct_unit(level, unit, ...) log_struct(level, getpid() == 1 ? "UNIT=%s" : "USER_UNIT=%s", unit, __VA_ARGS__)
+#define log_unit_struct(level, unit, ...) log_struct(level, getpid() == 1 ? "UNIT=%s" : "USER_UNIT=%s", unit, __VA_ARGS__)
diff --git a/src/journal-remote/microhttpd-util.c b/src/journal-remote/microhttpd-util.c
index bec4134620..5dae10bd80 100644
--- a/src/journal-remote/microhttpd-util.c
+++ b/src/journal-remote/microhttpd-util.c
@@ -41,7 +41,7 @@ void microhttpd_logger(void *arg, const char *fmt, va_list ap) {
f = strappenda("microhttpd: ", fmt);
DISABLE_WARNING_FORMAT_NONLITERAL;
- log_metav(LOG_INFO, 0, NULL, 0, NULL, f, ap);
+ log_internalv(LOG_INFO, 0, NULL, 0, NULL, f, ap);
REENABLE_WARNING;
}
@@ -126,10 +126,10 @@ void log_func_gnutls(int level, const char *message) {
if (0 <= level && level < (int) ELEMENTSOF(gnutls_log_map)) {
if (gnutls_log_map[level].enabled)
- log_meta(gnutls_log_map[level].level, 0, NULL, 0, NULL, "gnutls %d/%s: %s", level, gnutls_log_map[level].names[1], message);
+ log_internal(gnutls_log_map[level].level, 0, NULL, 0, NULL, "gnutls %d/%s: %s", level, gnutls_log_map[level].names[1], message);
} else {
log_debug("Received GNUTLS message with unknown level %d.", level);
- log_meta(LOG_DEBUG, 0, NULL, 0, NULL, "gnutls: %s", message);
+ log_internal(LOG_DEBUG, 0, NULL, 0, NULL, "gnutls: %s", message);
}
}
diff --git a/src/journal/test-journal-interleaving.c b/src/journal/test-journal-interleaving.c
index 8067cd38ee..23a26c43f6 100644
--- a/src/journal/test-journal-interleaving.c
+++ b/src/journal/test-journal-interleaving.c
@@ -37,9 +37,9 @@
static bool arg_keep = false;
noreturn static void log_assert_errno(const char *text, int eno, const char *file, int line, const char *func) {
- log_meta(LOG_CRIT, file, line, func,
- "'%s' failed at %s:%u (%s): %s.",
- text, file, line, func, strerror(eno));
+ log_internal(LOG_CRIT, 0, file, line, func,
+ "'%s' failed at %s:%u (%s): %s.",
+ text, file, line, func, strerror(eno));
abort();
}
diff --git a/src/libsystemd-network/dhcp-internal.h b/src/libsystemd-network/dhcp-internal.h
index d76d0c29d0..7c60ef123c 100644
--- a/src/libsystemd-network/dhcp-internal.h
+++ b/src/libsystemd-network/dhcp-internal.h
@@ -71,4 +71,4 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(sd_dhcp_client*, sd_dhcp_client_unref);
#define DHCP_CLIENT_DONT_DESTROY(client) \
_cleanup_dhcp_client_unref_ _unused_ sd_dhcp_client *_dont_destroy_##client = sd_dhcp_client_ref(client)
-#define log_dhcp_client(client, fmt, ...) log_meta(LOG_DEBUG, 0, __FILE__, __LINE__, __func__, "DHCP CLIENT (0x%x): " fmt, client->xid, ##__VA_ARGS__)
+#define log_dhcp_client(client, fmt, ...) log_internal(LOG_DEBUG, 0, __FILE__, __LINE__, __func__, "DHCP CLIENT (0x%x): " fmt, client->xid, ##__VA_ARGS__)
diff --git a/src/libsystemd-network/dhcp-server-internal.h b/src/libsystemd-network/dhcp-server-internal.h
index 6c2c248696..eb7d6d44d3 100644
--- a/src/libsystemd-network/dhcp-server-internal.h
+++ b/src/libsystemd-network/dhcp-server-internal.h
@@ -79,7 +79,7 @@ typedef struct DHCPRequest {
DEFINE_TRIVIAL_CLEANUP_FUNC(sd_dhcp_server*, sd_dhcp_server_unref);
#define _cleanup_dhcp_server_unref_ _cleanup_(sd_dhcp_server_unrefp)
-#define log_dhcp_server(client, fmt, ...) log_meta(LOG_DEBUG, 0, __FILE__, __LINE__, __func__, "DHCP SERVER: " fmt, ##__VA_ARGS__)
+#define log_dhcp_server(client, fmt, ...) log_internal(LOG_DEBUG, 0, __FILE__, __LINE__, __func__, "DHCP SERVER: " fmt, ##__VA_ARGS__)
int dhcp_server_handle_message(sd_dhcp_server *server, DHCPMessage *message,
size_t length);
diff --git a/src/libsystemd-network/dhcp6-internal.h b/src/libsystemd-network/dhcp6-internal.h
index 3737d49a3a..4f54ad89a6 100644
--- a/src/libsystemd-network/dhcp6-internal.h
+++ b/src/libsystemd-network/dhcp6-internal.h
@@ -56,7 +56,7 @@ struct DHCP6IA {
typedef struct DHCP6IA DHCP6IA;
-#define log_dhcp6_client(p, fmt, ...) log_meta(LOG_DEBUG, 0, __FILE__, __LINE__, __func__, "DHCPv6 CLIENT: " fmt, ##__VA_ARGS__)
+#define log_dhcp6_client(p, fmt, ...) log_internal(LOG_DEBUG, 0, __FILE__, __LINE__, __func__, "DHCPv6 CLIENT: " fmt, ##__VA_ARGS__)
int dhcp_network_icmp6_bind_router_solicitation(int index);
int dhcp_network_icmp6_send_router_solicitation(int s, const struct ether_addr *ether_addr);
diff --git a/src/libsystemd-network/ipv4ll-internal.h b/src/libsystemd-network/ipv4ll-internal.h
index 7b5d3729e5..ae0ce43985 100644
--- a/src/libsystemd-network/ipv4ll-internal.h
+++ b/src/libsystemd-network/ipv4ll-internal.h
@@ -35,4 +35,4 @@ void arp_packet_probe(struct ether_arp *arp, be32_t pa, const struct ether_addr
void arp_packet_announcement(struct ether_arp *arp, be32_t pa, const struct ether_addr *ha);
int arp_packet_verify_headers(struct ether_arp *arp);
-#define log_ipv4ll(ll, fmt, ...) log_meta(LOG_DEBUG, 0, __FILE__, __LINE__, __func__, "IPv4LL: " fmt, ##__VA_ARGS__)
+#define log_ipv4ll(ll, fmt, ...) log_internal(LOG_DEBUG, 0, __FILE__, __LINE__, __func__, "IPv4LL: " fmt, ##__VA_ARGS__)
diff --git a/src/libsystemd-network/sd-icmp6-nd.c b/src/libsystemd-network/sd-icmp6-nd.c
index 23f5682c51..cb06151514 100644
--- a/src/libsystemd-network/sd-icmp6-nd.c
+++ b/src/libsystemd-network/sd-icmp6-nd.c
@@ -54,7 +54,7 @@ struct sd_icmp6_nd {
void *userdata;
};
-#define log_icmp6_nd(p, fmt, ...) log_meta(LOG_DEBUG, 0, __FILE__, __LINE__, __func__, "ICMPv6 CLIENT: " fmt, ##__VA_ARGS__)
+#define log_icmp6_nd(p, fmt, ...) log_internal(LOG_DEBUG, 0, __FILE__, __LINE__, __func__, "ICMPv6 CLIENT: " fmt, ##__VA_ARGS__)
static void icmp6_nd_notify(sd_icmp6_nd *nd, int event)
{
diff --git a/src/libsystemd-terminal/idev-keyboard.c b/src/libsystemd-terminal/idev-keyboard.c
index ad2d74af15..b1af96089c 100644
--- a/src/libsystemd-terminal/idev-keyboard.c
+++ b/src/libsystemd-terminal/idev-keyboard.c
@@ -522,7 +522,7 @@ static void kbdctx_log_fn(struct xkb_context *ctx, enum xkb_log_level lvl, const
sd_lvl = LOG_CRIT;
snprintf(buf, sizeof(buf), "idev-xkb: %s", format);
- log_metav(sd_lvl, __FILE__, __LINE__, __func__, buf, args);
+ log_internalv(sd_lvl, __FILE__, __LINE__, __func__, buf, args);
}
static kbdctx *kbdctx_ref(kbdctx *kc) {
diff --git a/src/modules-load/modules-load.c b/src/modules-load/modules-load.c
index da67247be4..5353814d17 100644
--- a/src/modules-load/modules-load.c
+++ b/src/modules-load/modules-load.c
@@ -44,7 +44,7 @@ static void systemd_kmod_log(void *data, int priority, const char *file, int lin
const char *fn, const char *format, va_list args) {
DISABLE_WARNING_FORMAT_NONLITERAL;
- log_metav(priority, 0, file, line, fn, format, args);
+ log_internalv(priority, 0, file, line, fn, format, args);
REENABLE_WARNING;
}
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c
index ce85109d22..cf49909858 100644
--- a/src/network/networkd-address.c
+++ b/src/network/networkd-address.c
@@ -251,11 +251,11 @@ static int address_acquire(Link *link, Address *original, Address **ret) {
* Then let's acquire something more useful from the pool. */
r = manager_address_pool_acquire(link->manager, original->family, original->prefixlen, &in_addr);
if (r < 0) {
- log_error_link(link, "Failed to acquire address from pool: %s", strerror(-r));
+ log_link_error(link, "Failed to acquire address from pool: %s", strerror(-r));
return r;
}
if (r == 0) {
- log_error_link(link, "Couldn't find free address for interface, all taken.");
+ log_link_error(link, "Couldn't find free address for interface, all taken.");
return -EBUSY;
}
diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
index 63bfa86f99..0a8c8ba8e4 100644
--- a/src/network/networkd-dhcp4.c
+++ b/src/network/networkd-dhcp4.c
@@ -38,7 +38,7 @@ static int dhcp4_route_handler(sd_rtnl *rtnl, sd_rtnl_message *m,
r = sd_rtnl_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
- log_error_link(link, "could not set DHCPv4 route: %s",
+ log_link_error(link, "could not set DHCPv4 route: %s",
strerror(-r));
link_enter_failed(link);
}
@@ -61,7 +61,7 @@ static int link_set_dhcp_routes(Link *link) {
r = sd_dhcp_lease_get_router(link->dhcp_lease, &gateway);
if (r < 0 && r != -ENOENT) {
- log_warning_link(link,
+ log_link_warning(link,
"DHCP error: could not get gateway: %s",
strerror(-r));
return r;
@@ -73,7 +73,7 @@ static int link_set_dhcp_routes(Link *link) {
r = sd_dhcp_lease_get_address(link->dhcp_lease, &address);
if (r < 0) {
- log_warning_link(link,
+ log_link_warning(link,
"DHCP error: could not get address: %s",
strerror(-r));
return r;
@@ -81,7 +81,7 @@ static int link_set_dhcp_routes(Link *link) {
r = route_new_dynamic(&route, RTPROT_DHCP);
if (r < 0) {
- log_error_link(link,
+ log_link_error(link,
"Could not allocate route: %s",
strerror(-r));
return r;
@@ -89,7 +89,7 @@ static int link_set_dhcp_routes(Link *link) {
r = route_new_dynamic(&route_gw, RTPROT_DHCP);
if (r < 0) {
- log_error_link(link,
+ log_link_error(link,
"Could not allocate route: %s",
strerror(-r));
return r;
@@ -107,7 +107,7 @@ static int link_set_dhcp_routes(Link *link) {
r = route_configure(route_gw, link, &dhcp4_route_handler);
if (r < 0) {
- log_warning_link(link,
+ log_link_warning(link,
"could not set host route: %s",
strerror(-r));
return r;
@@ -122,7 +122,7 @@ static int link_set_dhcp_routes(Link *link) {
r = route_configure(route, link, &dhcp4_route_handler);
if (r < 0) {
- log_warning_link(link,
+ log_link_warning(link,
"could not set routes: %s",
strerror(-r));
link_enter_failed(link);
@@ -136,7 +136,7 @@ static int link_set_dhcp_routes(Link *link) {
if (n == -ENOENT)
return 0;
if (n < 0) {
- log_warning_link(link,
+ log_link_warning(link,
"DHCP error: could not get routes: %s",
strerror(-n));
@@ -148,7 +148,7 @@ static int link_set_dhcp_routes(Link *link) {
r = route_new_dynamic(&route, RTPROT_DHCP);
if (r < 0) {
- log_error_link(link, "Could not allocate route: %s",
+ log_link_error(link, "Could not allocate route: %s",
strerror(-r));
return r;
}
@@ -161,7 +161,7 @@ static int link_set_dhcp_routes(Link *link) {
r = route_configure(route, link, &dhcp4_route_handler);
if (r < 0) {
- log_warning_link(link,
+ log_link_warning(link,
"could not set host route: %s",
strerror(-r));
return r;
@@ -184,7 +184,7 @@ static int dhcp_lease_lost(Link *link) {
assert(link);
assert(link->dhcp_lease);
- log_warning_link(link, "DHCP lease lost");
+ log_link_warning(link, "DHCP lease lost");
if (link->network->dhcp_routes) {
struct sd_dhcp_route *routes;
@@ -258,7 +258,7 @@ static int dhcp_lease_lost(Link *link) {
if (r >= 0 && link->original_mtu != mtu) {
r = link_set_mtu(link, link->original_mtu);
if (r < 0) {
- log_warning_link(link,
+ log_link_warning(link,
"DHCP error: could not reset MTU");
link_enter_failed(link);
return r;
@@ -273,7 +273,7 @@ static int dhcp_lease_lost(Link *link) {
if (r >= 0 && hostname) {
r = link_set_hostname(link, "");
if (r < 0)
- log_error_link(link,
+ log_link_error(link,
"Failed to reset transient hostname");
}
}
@@ -293,7 +293,7 @@ static int dhcp4_address_handler(sd_rtnl *rtnl, sd_rtnl_message *m,
r = sd_rtnl_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
- log_error_link(link, "could not set DHCPv4 address: %s",
+ log_link_error(link, "could not set DHCPv4 address: %s",
strerror(-r));
link_enter_failed(link);
} else if (r >= 0) {
@@ -354,7 +354,7 @@ static int dhcp_lease_renew(sd_dhcp_client *client, Link *link) {
r = sd_dhcp_client_get_lease(client, &lease);
if (r < 0) {
- log_warning_link(link, "DHCP error: no lease %s",
+ log_link_warning(link, "DHCP error: no lease %s",
strerror(-r));
return r;
}
@@ -365,14 +365,14 @@ static int dhcp_lease_renew(sd_dhcp_client *client, Link *link) {
r = sd_dhcp_lease_get_address(lease, &address);
if (r < 0) {
- log_warning_link(link, "DHCP error: no address: %s",
+ log_link_warning(link, "DHCP error: no address: %s",
strerror(-r));
return r;
}
r = sd_dhcp_lease_get_netmask(lease, &netmask);
if (r < 0) {
- log_warning_link(link, "DHCP error: no netmask: %s",
+ log_link_warning(link, "DHCP error: no netmask: %s",
strerror(-r));
return r;
}
@@ -381,7 +381,7 @@ static int dhcp_lease_renew(sd_dhcp_client *client, Link *link) {
r = sd_dhcp_lease_get_lifetime(link->dhcp_lease,
&lifetime);
if (r < 0) {
- log_warning_link(link,
+ log_link_warning(link,
"DHCP error: no lifetime: %s",
strerror(-r));
return r;
@@ -390,7 +390,7 @@ static int dhcp_lease_renew(sd_dhcp_client *client, Link *link) {
r = dhcp4_update_address(link, &address, &netmask, lifetime);
if (r < 0) {
- log_warning_link(link, "could not update IP address: %s",
+ log_link_warning(link, "could not update IP address: %s",
strerror(-r));
link_enter_failed(link);
return r;
@@ -413,21 +413,21 @@ static int dhcp_lease_acquired(sd_dhcp_client *client, Link *link) {
r = sd_dhcp_client_get_lease(client, &lease);
if (r < 0) {
- log_warning_link(link, "DHCP error: no lease: %s",
+ log_link_warning(link, "DHCP error: no lease: %s",
strerror(-r));
return r;
}
r = sd_dhcp_lease_get_address(lease, &address);
if (r < 0) {
- log_warning_link(link, "DHCP error: no address: %s",
+ log_link_warning(link, "DHCP error: no address: %s",
strerror(-r));
return r;
}
r = sd_dhcp_lease_get_netmask(lease, &netmask);
if (r < 0) {
- log_warning_link(link, "DHCP error: no netmask: %s",
+ log_link_warning(link, "DHCP error: no netmask: %s",
strerror(-r));
return r;
}
@@ -436,13 +436,13 @@ static int dhcp_lease_acquired(sd_dhcp_client *client, Link *link) {
r = sd_dhcp_lease_get_router(lease, &gateway);
if (r < 0 && r != -ENOENT) {
- log_warning_link(link, "DHCP error: could not get gateway: %s",
+ log_link_warning(link, "DHCP error: could not get gateway: %s",
strerror(-r));
return r;
}
if (r >= 0)
- log_struct_link(LOG_INFO, link,
+ log_link_struct(LOG_INFO, link,
"MESSAGE=%-*s: DHCPv4 address %u.%u.%u.%u/%u via %u.%u.%u.%u",
IFNAMSIZ,
link->ifname,
@@ -457,7 +457,7 @@ static int dhcp_lease_acquired(sd_dhcp_client *client, Link *link) {
ADDRESS_FMT_VAL(gateway),
NULL);
else
- log_struct_link(LOG_INFO, link,
+ log_link_struct(LOG_INFO, link,
"MESSAGE=%-*s: DHCPv4 address %u.%u.%u.%u/%u",
IFNAMSIZ,
link->ifname,
@@ -478,7 +478,7 @@ static int dhcp_lease_acquired(sd_dhcp_client *client, Link *link) {
if (r >= 0) {
r = link_set_mtu(link, mtu);
if (r < 0)
- log_error_link(link, "Failed to set MTU "
+ log_link_error(link, "Failed to set MTU "
"to %" PRIu16, mtu);
}
}
@@ -490,7 +490,7 @@ static int dhcp_lease_acquired(sd_dhcp_client *client, Link *link) {
if (r >= 0) {
r = link_set_hostname(link, hostname);
if (r < 0)
- log_error_link(link,
+ log_link_error(link,
"Failed to set transient hostname to '%s'",
hostname);
}
@@ -500,7 +500,7 @@ static int dhcp_lease_acquired(sd_dhcp_client *client, Link *link) {
r = sd_dhcp_lease_get_lifetime(link->dhcp_lease,
&lifetime);
if (r < 0) {
- log_warning_link(link,
+ log_link_warning(link,
"DHCP error: no lifetime: %s",
strerror(-r));
return r;
@@ -509,7 +509,7 @@ static int dhcp_lease_acquired(sd_dhcp_client *client, Link *link) {
r = dhcp4_update_address(link, &address, &netmask, lifetime);
if (r < 0) {
- log_warning_link(link, "could not update IP address: %s",
+ log_link_warning(link, "could not update IP address: %s",
strerror(-r));
link_enter_failed(link);
return r;
@@ -533,7 +533,7 @@ static void dhcp4_handler(sd_dhcp_client *client, int event, void *userdata) {
case DHCP_EVENT_STOP:
case DHCP_EVENT_IP_CHANGE:
if (link->network->dhcp_critical) {
- log_error_link(link,
+ log_link_error(link,
"DHCPv4 connection considered system critical, ignoring request to reconfigure it.");
return;
}
@@ -571,11 +571,11 @@ static void dhcp4_handler(sd_dhcp_client *client, int event, void *userdata) {
break;
default:
if (event < 0)
- log_warning_link(link,
+ log_link_warning(link,
"DHCP error: client failed: %s",
strerror(-event));
else
- log_warning_link(link,
+ log_link_warning(link,
"DHCP unknown event: %d",
event);
break;
diff --git a/src/network/networkd-ipv4ll.c b/src/network/networkd-ipv4ll.c
index fd55f79693..beac939b39 100644
--- a/src/network/networkd-ipv4ll.c
+++ b/src/network/networkd-ipv4ll.c
@@ -40,11 +40,11 @@ static int ipv4ll_address_lost(Link *link) {
if (r < 0)
return 0;
- log_debug_link(link, "IPv4 link-local release %u.%u.%u.%u", ADDRESS_FMT_VAL(addr));
+ log_link_debug(link, "IPv4 link-local release %u.%u.%u.%u", ADDRESS_FMT_VAL(addr));
r = address_new_dynamic(&address);
if (r < 0) {
- log_error_link(link, "Could not allocate address: %s", strerror(-r));
+ log_link_error(link, "Could not allocate address: %s", strerror(-r));
return r;
}
@@ -57,7 +57,7 @@ static int ipv4ll_address_lost(Link *link) {
r = route_new_dynamic(&route, RTPROT_UNSPEC);
if (r < 0) {
- log_error_link(link, "Could not allocate route: %s",
+ log_link_error(link, "Could not allocate route: %s",
strerror(-r));
return r;
}
@@ -82,7 +82,7 @@ static int ipv4ll_route_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdat
r = sd_rtnl_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
- log_error_link(link, "could not set ipv4ll route: %s", strerror(-r));
+ log_link_error(link, "could not set ipv4ll route: %s", strerror(-r));
link_enter_failed(link);
}
@@ -103,7 +103,7 @@ static int ipv4ll_address_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userd
r = sd_rtnl_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
- log_error_link(link, "could not set ipv4ll address: %s", strerror(-r));
+ log_link_error(link, "could not set ipv4ll address: %s", strerror(-r));
link_enter_failed(link);
} else if (r >= 0) {
/* calling handler directly so take a ref */
@@ -134,7 +134,7 @@ static int ipv4ll_address_claimed(sd_ipv4ll *ll, Link *link) {
else if (r < 0)
return r;
- log_debug_link(link, "IPv4 link-local claim %u.%u.%u.%u",
+ log_link_debug(link, "IPv4 link-local claim %u.%u.%u.%u",
ADDRESS_FMT_VAL(address));
r = address_new_dynamic(&ll_addr);
@@ -199,9 +199,9 @@ static void ipv4ll_handler(sd_ipv4ll *ll, int event, void *userdata){
break;
default:
if (event < 0)
- log_warning_link(link, "IPv4 link-local error: %s", strerror(-event));
+ log_link_warning(link, "IPv4 link-local error: %s", strerror(-event));
else
- log_warning_link(link, "IPv4 link-local unknown event: %d", event);
+ log_link_warning(link, "IPv4 link-local unknown event: %d", event);
break;
}
}
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index fcfbd3e123..b46ac5c3c3 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -89,7 +89,7 @@ static int link_update_flags(Link *link, sd_rtnl_message *m) {
r = sd_rtnl_message_link_get_flags(m, &flags);
if (r < 0) {
- log_warning_link(link, "Could not get link flags");
+ log_link_warning(link, "Could not get link flags");
return r;
}
@@ -103,7 +103,7 @@ static int link_update_flags(Link *link, sd_rtnl_message *m) {
return 0;
if (link->flags != flags) {
- log_debug_link(link, "flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
+ log_link_debug(link, "flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
FLAG_STRING("LOOPBACK", IFF_LOOPBACK, link->flags, flags),
FLAG_STRING("MASTER", IFF_MASTER, link->flags, flags),
FLAG_STRING("SLAVE", IFF_SLAVE, link->flags, flags),
@@ -136,12 +136,12 @@ static int link_update_flags(Link *link, sd_rtnl_message *m) {
/* link flags are currently at most 18 bits, let's align to
* printing 20 */
if (unknown_flags_added)
- log_debug_link(link,
+ log_link_debug(link,
"unknown link flags gained: %#.5x (ignoring)",
unknown_flags_added);
if (unknown_flags_removed)
- log_debug_link(link,
+ log_link_debug(link,
"unknown link flags lost: %#.5x (ignoring)",
unknown_flags_removed);
}
@@ -194,7 +194,7 @@ static int link_new(Manager *manager, sd_rtnl_message *message, Link **ret) {
r = sd_rtnl_message_read_ether_addr(message, IFLA_ADDRESS, &link->mac);
if (r < 0)
- log_debug_link(link, "MAC address not found for new device, continuing without");
+ log_link_debug(link, "MAC address not found for new device, continuing without");
r = asprintf(&link->state_file, "/run/systemd/netif/links/%d",
link->ifindex);
@@ -299,7 +299,7 @@ void link_drop(Link *link) {
link->state = LINK_STATE_LINGER;
- log_debug_link(link, "link removed");
+ log_link_debug(link, "link removed");
link_unref(link);
@@ -309,7 +309,7 @@ void link_drop(Link *link) {
static void link_enter_unmanaged(Link *link) {
assert(link);
- log_debug_link(link, "unmanaged");
+ log_link_debug(link, "unmanaged");
link->state = LINK_STATE_UNMANAGED;
@@ -329,7 +329,7 @@ static int link_stop_clients(Link *link) {
if (link->dhcp_client) {
k = sd_dhcp_client_stop(link->dhcp_client);
if (k < 0) {
- log_warning_link(link, "Could not stop DHCPv4 client: %s",
+ log_link_warning(link, "Could not stop DHCPv4 client: %s",
strerror(-r));
r = k;
}
@@ -338,7 +338,7 @@ static int link_stop_clients(Link *link) {
if (link->ipv4ll) {
k = sd_ipv4ll_stop(link->ipv4ll);
if (k < 0) {
- log_warning_link(link, "Could not stop IPv4 link-local: %s",
+ log_link_warning(link, "Could not stop IPv4 link-local: %s",
strerror(-r));
r = k;
}
@@ -349,7 +349,7 @@ static int link_stop_clients(Link *link) {
if (link->dhcp6_client) {
k = sd_dhcp6_client_stop(link->dhcp6_client);
if (k < 0) {
- log_warning_link(link, "Could not stop DHCPv6 client: %s",
+ log_link_warning(link, "Could not stop DHCPv6 client: %s",
strerror(-r));
r = k;
}
@@ -357,7 +357,7 @@ static int link_stop_clients(Link *link) {
k = sd_icmp6_nd_stop(link->icmp6_router_discovery);
if (k < 0) {
- log_warning_link(link,
+ log_link_warning(link,
"Could not stop ICMPv6 router discovery: %s",
strerror(-r));
r = k;
@@ -373,7 +373,7 @@ void link_enter_failed(Link *link) {
if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
return;
- log_warning_link(link, "failed");
+ log_link_warning(link, "failed");
link->state = LINK_STATE_FAILED;
@@ -425,13 +425,13 @@ static int link_enter_configured(Link *link) {
address = link_find_dhcp_server_address(link);
if (!address) {
- log_warning_link(link,
+ log_link_warning(link,
"Failed to find suitable address for DHCPv4 server instance.");
link_enter_failed(link);
return 0;
}
- log_debug_link(link, "offering DHCPv4 leases");
+ log_link_debug(link, "offering DHCPv4 leases");
r = sd_dhcp_server_set_address(link->dhcp_server,
&address->in_addr.in,
@@ -460,7 +460,7 @@ static int link_enter_configured(Link *link) {
r = sd_dhcp_server_start(link->dhcp_server);
if (r < 0) {
- log_warning_link(link, "could not start DHCPv4 server "
+ log_link_warning(link, "could not start DHCPv4 server "
"instance: %s", strerror(-r));
link_enter_failed(link);
@@ -469,7 +469,7 @@ static int link_enter_configured(Link *link) {
}
}
- log_info_link(link, "link configured");
+ log_link_info(link, "link configured");
link->state = LINK_STATE_CONFIGURED;
@@ -515,7 +515,7 @@ static int route_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
r = sd_rtnl_message_get_errno(m);
if (r < 0 && r != -EEXIST)
- log_struct_link(LOG_WARNING, link,
+ log_link_struct(LOG_WARNING, link,
"MESSAGE=%-*s: could not set route: %s",
IFNAMSIZ,
link->ifname, strerror(-r),
@@ -523,7 +523,7 @@ static int route_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
NULL);
if (link->link_messages == 0) {
- log_debug_link(link, "routes set");
+ log_link_debug(link, "routes set");
link->static_configured = true;
link_client_handler(link);
}
@@ -544,7 +544,7 @@ static int link_enter_set_routes(Link *link) {
LIST_FOREACH(routes, rt, link->network->static_routes) {
r = route_configure(rt, link, &route_handler);
if (r < 0) {
- log_warning_link(link,
+ log_link_warning(link,
"could not set routes: %s",
strerror(-r));
link_enter_failed(link);
@@ -558,7 +558,7 @@ static int link_enter_set_routes(Link *link) {
link->static_configured = true;
link_client_handler(link);
} else
- log_debug_link(link, "setting routes");
+ log_link_debug(link, "setting routes");
return 0;
}
@@ -576,7 +576,7 @@ int link_route_drop_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
r = sd_rtnl_message_get_errno(m);
if (r < 0 && r != -ESRCH)
- log_struct_link(LOG_WARNING, link,
+ log_link_struct(LOG_WARNING, link,
"MESSAGE=%-*s: could not drop route: %s",
IFNAMSIZ,
link->ifname, strerror(-r),
@@ -598,14 +598,14 @@ int link_get_address_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata)
for (; m; m = sd_rtnl_message_next(m)) {
r = sd_rtnl_message_get_errno(m);
if (r < 0) {
- log_debug_link(link, "getting address failed: %s",
+ log_link_debug(link, "getting address failed: %s",
strerror(-r));
continue;
}
r = link_rtnl_process_address(rtnl, m, link->manager);
if (r < 0)
- log_warning_link(link, "could not process address: %s",
+ log_link_warning(link, "could not process address: %s",
strerror(-r));
}
@@ -631,7 +631,7 @@ static int address_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
r = sd_rtnl_message_get_errno(m);
if (r < 0 && r != -EEXIST)
- log_struct_link(LOG_WARNING, link,
+ log_link_struct(LOG_WARNING, link,
"MESSAGE=%-*s: could not set address: %s",
IFNAMSIZ,
link->ifname, strerror(-r),
@@ -644,7 +644,7 @@ static int address_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
}
if (link->link_messages == 0) {
- log_debug_link(link, "addresses set");
+ log_link_debug(link, "addresses set");
link_enter_set_routes(link);
}
@@ -664,7 +664,7 @@ static int link_enter_set_addresses(Link *link) {
LIST_FOREACH(addresses, ad, link->network->static_addresses) {
r = address_configure(ad, link, &address_handler);
if (r < 0) {
- log_warning_link(link,
+ log_link_warning(link,
"could not set addresses: %s",
strerror(-r));
link_enter_failed(link);
@@ -677,7 +677,7 @@ static int link_enter_set_addresses(Link *link) {
if (link->link_messages == 0) {
link_enter_set_routes(link);
} else
- log_debug_link(link, "setting addresses");
+ log_link_debug(link, "setting addresses");
return 0;
}
@@ -695,7 +695,7 @@ int link_address_drop_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata)
r = sd_rtnl_message_get_errno(m);
if (r < 0 && r != -EADDRNOTAVAIL)
- log_struct_link(LOG_WARNING, link,
+ log_link_struct(LOG_WARNING, link,
"MESSAGE=%-*s: could not drop address: %s",
IFNAMSIZ,
link->ifname, strerror(-r),
@@ -717,7 +717,7 @@ static int set_hostname_handler(sd_bus *bus, sd_bus_message *m, void *userdata,
r = sd_bus_message_get_errno(m);
if (r > 0)
- log_warning_link(link, "Could not set hostname: %s",
+ log_link_warning(link, "Could not set hostname: %s",
strerror(r));
return 1;
@@ -731,11 +731,11 @@ int link_set_hostname(Link *link, const char *hostname) {
assert(link->manager);
assert(hostname);
- log_debug_link(link, "Setting transient hostname: '%s'", hostname);
+ log_link_debug(link, "Setting transient hostname: '%s'", hostname);
if (!link->manager->bus) {
/* TODO: replace by assert when we can rely on kdbus */
- log_info_link(link,
+ log_link_info(link,
"Not connected to system bus, ignoring transient hostname.");
return 0;
}
@@ -757,7 +757,7 @@ int link_set_hostname(Link *link, const char *hostname) {
r = sd_bus_call_async(link->manager->bus, NULL, m, set_hostname_handler,
link, 0);
if (r < 0) {
- log_error_link(link, "Could not set transient hostname: %s",
+ log_link_error(link, "Could not set transient hostname: %s",
strerror(-r));
return r;
}
@@ -780,7 +780,7 @@ static int set_mtu_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
r = sd_rtnl_message_get_errno(m);
if (r < 0)
- log_struct_link(LOG_WARNING, link,
+ log_link_struct(LOG_WARNING, link,
"MESSAGE=%-*s: could not set MTU: %s",
IFNAMSIZ, link->ifname, strerror(-r),
"ERRNO=%d", -r,
@@ -797,25 +797,25 @@ int link_set_mtu(Link *link, uint32_t mtu) {
assert(link->manager);
assert(link->manager->rtnl);
- log_debug_link(link, "setting MTU: %" PRIu32, mtu);
+ log_link_debug(link, "setting MTU: %" PRIu32, mtu);
r = sd_rtnl_message_new_link(link->manager->rtnl, &req,
RTM_SETLINK, link->ifindex);
if (r < 0) {
- log_error_link(link, "Could not allocate RTM_SETLINK message");
+ log_link_error(link, "Could not allocate RTM_SETLINK message");
return r;
}
r = sd_rtnl_message_append_u32(req, IFLA_MTU, mtu);
if (r < 0) {
- log_error_link(link, "Could not append MTU: %s", strerror(-r));
+ log_link_error(link, "Could not append MTU: %s", strerror(-r));
return r;
}
r = sd_rtnl_call_async(link->manager->rtnl, req, set_mtu_handler, link,
0, NULL);
if (r < 0) {
- log_error_link(link,
+ log_link_error(link,
"Could not send rtnetlink message: %s",
strerror(-r));
return r;
@@ -841,16 +841,16 @@ static void dhcp6_handler(sd_dhcp6_client *client, int event, void *userdata) {
case DHCP6_EVENT_RESEND_EXPIRE:
case DHCP6_EVENT_RETRANS_MAX:
case DHCP6_EVENT_IP_ACQUIRE:
- log_debug_link(link, "DHCPv6 event %d", event);
+ log_link_debug(link, "DHCPv6 event %d", event);
break;
default:
if (event < 0)
- log_warning_link(link, "DHCPv6 error: %s",
+ log_link_warning(link, "DHCPv6 error: %s",
strerror(-event));
else
- log_warning_link(link, "DHCPv6 unknown event: %d",
+ log_link_warning(link, "DHCPv6 unknown event: %d",
event);
return;
}
@@ -878,10 +878,10 @@ static void icmp6_router_handler(sd_icmp6_nd *nd, int event, void *userdata) {
default:
if (event < 0)
- log_warning_link(link, "ICMPv6 error: %s",
+ log_link_warning(link, "ICMPv6 error: %s",
strerror(-event));
else
- log_warning_link(link, "ICMPv6 unknown event: %d",
+ log_link_warning(link, "ICMPv6 unknown event: %d",
event);
return;
@@ -937,11 +937,11 @@ static int link_acquire_conf(Link *link) {
if (link_ipv4ll_enabled(link)) {
assert(link->ipv4ll);
- log_debug_link(link, "acquiring IPv4 link-local address");
+ log_link_debug(link, "acquiring IPv4 link-local address");
r = sd_ipv4ll_start(link->ipv4ll);
if (r < 0) {
- log_warning_link(link, "could not acquire IPv4 "
+ log_link_warning(link, "could not acquire IPv4 "
"link-local address");
return r;
}
@@ -950,11 +950,11 @@ static int link_acquire_conf(Link *link) {
if (link_dhcp4_enabled(link)) {
assert(link->dhcp_client);
- log_debug_link(link, "acquiring DHCPv4 lease");
+ log_link_debug(link, "acquiring DHCPv4 lease");
r = sd_dhcp_client_start(link->dhcp_client);
if (r < 0) {
- log_warning_link(link, "could not acquire DHCPv4 "
+ log_link_warning(link, "could not acquire DHCPv4 "
"lease");
return r;
}
@@ -963,11 +963,11 @@ static int link_acquire_conf(Link *link) {
if (link_dhcp6_enabled(link)) {
assert(link->icmp6_router_discovery);
- log_debug_link(link, "discovering IPv6 routers");
+ log_link_debug(link, "discovering IPv6 routers");
r = sd_icmp6_router_solicitation_start(link->icmp6_router_discovery);
if (r < 0) {
- log_warning_link(link,
+ log_link_warning(link,
"could not start IPv6 router discovery");
return r;
}
@@ -1003,7 +1003,7 @@ static int link_up_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
if (r < 0) {
/* we warn but don't fail the link, as it may
be brought up later */
- log_struct_link(LOG_WARNING, link,
+ log_link_struct(LOG_WARNING, link,
"MESSAGE=%-*s: could not bring up interface: %s",
IFNAMSIZ,
link->ifname, strerror(-r),
@@ -1022,18 +1022,18 @@ static int link_up(Link *link) {
assert(link->manager);
assert(link->manager->rtnl);
- log_debug_link(link, "bringing link up");
+ log_link_debug(link, "bringing link up");
r = sd_rtnl_message_new_link(link->manager->rtnl, &req,
RTM_SETLINK, link->ifindex);
if (r < 0) {
- log_error_link(link, "Could not allocate RTM_SETLINK message");
+ log_link_error(link, "Could not allocate RTM_SETLINK message");
return r;
}
r = sd_rtnl_message_link_set_flags(req, IFF_UP, IFF_UP);
if (r < 0) {
- log_error_link(link, "Could not set link flags: %s",
+ log_link_error(link, "Could not set link flags: %s",
strerror(-r));
return r;
}
@@ -1041,7 +1041,7 @@ static int link_up(Link *link) {
r = sd_rtnl_call_async(link->manager->rtnl, req, link_up_handler, link,
0, NULL);
if (r < 0) {
- log_error_link(link,
+ log_link_error(link,
"Could not send rtnetlink message: %s",
strerror(-r));
return r;
@@ -1084,7 +1084,7 @@ static int netdev_join_handler(sd_rtnl *rtnl, sd_rtnl_message *m,
r = sd_rtnl_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
- log_struct_link(LOG_ERR, link,
+ log_link_struct(LOG_ERR, link,
"MESSAGE=%-*s: could not join netdev: %s",
IFNAMSIZ,
link->ifname, strerror(-r),
@@ -1093,7 +1093,7 @@ static int netdev_join_handler(sd_rtnl *rtnl, sd_rtnl_message *m,
link_enter_failed(link);
return 1;
} else
- log_debug_link(link, "joined netdev");
+ log_link_debug(link, "joined netdev");
if (link->enslaving <= 0)
link_joined(link);
@@ -1120,7 +1120,7 @@ static int link_enter_join_netdev(Link *link) {
return link_joined(link);
if (link->network->bond) {
- log_struct_link(LOG_DEBUG, link,
+ log_link_struct(LOG_DEBUG, link,
"MESSAGE=%-*s: enslaving by '%s'",
IFNAMSIZ,
link->ifname, link->network->bond->ifname,
@@ -1129,7 +1129,7 @@ static int link_enter_join_netdev(Link *link) {
r = netdev_join(link->network->bond, link, &netdev_join_handler);
if (r < 0) {
- log_struct_link(LOG_WARNING, link,
+ log_link_struct(LOG_WARNING, link,
"MESSAGE=%-*s: could not join netdev '%s': %s",
IFNAMSIZ,
link->ifname, link->network->bond->ifname,
@@ -1144,7 +1144,7 @@ static int link_enter_join_netdev(Link *link) {
}
if (link->network->bridge) {
- log_struct_link(LOG_DEBUG, link,
+ log_link_struct(LOG_DEBUG, link,
"MESSAGE=%-*s: enslaving by '%s'",
IFNAMSIZ,
link->ifname, link->network->bridge->ifname,
@@ -1154,7 +1154,7 @@ static int link_enter_join_netdev(Link *link) {
r = netdev_join(link->network->bridge, link,
&netdev_join_handler);
if (r < 0) {
- log_struct_link(LOG_WARNING, link,
+ log_link_struct(LOG_WARNING, link,
"MESSAGE=%-*s: could not join netdev '%s': %s",
IFNAMSIZ,
link->ifname, link->network->bridge->ifname,
@@ -1169,7 +1169,7 @@ static int link_enter_join_netdev(Link *link) {
}
HASHMAP_FOREACH(netdev, link->network->stacked_netdevs, i) {
- log_struct_link(LOG_DEBUG, link,
+ log_link_struct(LOG_DEBUG, link,
"MESSAGE=%-*s: enslaving by '%s'",
IFNAMSIZ,
link->ifname, netdev->ifname, NETDEVIF(netdev),
@@ -1177,7 +1177,7 @@ static int link_enter_join_netdev(Link *link) {
r = netdev_join(netdev, link, &netdev_join_handler);
if (r < 0) {
- log_struct_link(LOG_WARNING, link,
+ log_link_struct(LOG_WARNING, link,
"MESSAGE=%-*s: could not join netdev '%s': %s",
IFNAMSIZ,
link->ifname, netdev->ifname,
@@ -1270,7 +1270,7 @@ static int link_initialized_and_synced(sd_rtnl *rtnl, sd_rtnl_message *m,
if (link->state != LINK_STATE_PENDING)
return 1;
- log_debug_link(link, "link state is up-to-date");
+ log_link_debug(link, "link state is up-to-date");
r = network_get(link->manager, link->udev_device, link->ifname,
&link->mac, &network);
@@ -1282,13 +1282,13 @@ static int link_initialized_and_synced(sd_rtnl *rtnl, sd_rtnl_message *m,
if (link->flags & IFF_LOOPBACK) {
if (network->ipv4ll)
- log_debug_link(link, "ignoring IPv4LL for loopback link");
+ log_link_debug(link, "ignoring IPv4LL for loopback link");
if (network->dhcp != DHCP_SUPPORT_NONE)
- log_debug_link(link, "ignoring DHCP clients for loopback link");
+ log_link_debug(link, "ignoring DHCP clients for loopback link");
if (network->dhcp_server)
- log_debug_link(link, "ignoring DHCP server for loopback link");
+ log_link_debug(link, "ignoring DHCP server for loopback link");
}
r = network_apply(link->manager, network, link);
@@ -1317,7 +1317,7 @@ int link_initialized(Link *link, struct udev_device *device) {
if (link->udev_device)
return 0;
- log_debug_link(link, "udev initialized link");
+ log_link_debug(link, "udev initialized link");
link->udev_device = udev_device_ref(device);
@@ -1382,28 +1382,28 @@ int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message,
r = sd_rtnl_message_addr_get_family(message, &address->family);
if (r < 0 || !IN_SET(address->family, AF_INET, AF_INET6)) {
- log_warning_link(link,
+ log_link_warning(link,
"rtnl: received address with invalid family, ignoring");
return 0;
}
r = sd_rtnl_message_addr_get_prefixlen(message, &address->prefixlen);
if (r < 0) {
- log_warning_link(link,
+ log_link_warning(link,
"rtnl: received address with invalid prefixlen, ignoring");
return 0;
}
r = sd_rtnl_message_addr_get_scope(message, &address->scope);
if (r < 0) {
- log_warning_link(link,
+ log_link_warning(link,
"rtnl: received address with invalid scope, ignoring");
return 0;
}
r = sd_rtnl_message_addr_get_flags(message, &address->flags);
if (r < 0) {
- log_warning_link(link,
+ log_link_warning(link,
"rtnl: received address with invalid flags, ignoring");
return 0;
}
@@ -1413,7 +1413,7 @@ int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message,
r = sd_rtnl_message_read_in_addr(message, IFA_LOCAL,
&address->in_addr.in);
if (r < 0) {
- log_warning_link(link,
+ log_link_warning(link,
"rtnl: received address without valid address, ignoring");
return 0;
}
@@ -1424,7 +1424,7 @@ int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message,
r = sd_rtnl_message_read_in6_addr(message, IFA_ADDRESS,
&address->in_addr.in6);
if (r < 0) {
- log_warning_link(link,
+ log_link_warning(link,
"rtnl: received address without valid address, ignoring");
return 0;
}
@@ -1437,7 +1437,7 @@ int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message,
if (!inet_ntop(address->family, &address->in_addr, buf,
INET6_ADDRSTRLEN)) {
- log_warning_link(link, "could not print address");
+ log_link_warning(link, "could not print address");
return 0;
}
@@ -1467,10 +1467,10 @@ int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message,
switch (type) {
case RTM_NEWADDR:
if (!address_dropped)
- log_debug_link(link, "added address: %s/%u (valid for %s)",
+ log_link_debug(link, "added address: %s/%u (valid for %s)",
buf, address->prefixlen, valid_str);
else
- log_debug_link(link, "updated address: %s/%u (valid for %s)",
+ log_link_debug(link, "updated address: %s/%u (valid for %s)",
buf, address->prefixlen, valid_str);
LIST_PREPEND(addresses, link->addresses, address);
@@ -1481,12 +1481,12 @@ int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message,
break;
case RTM_DELADDR:
if (address_dropped) {
- log_debug_link(link, "removed address: %s/%u (valid for %s)",
+ log_link_debug(link, "removed address: %s/%u (valid for %s)",
buf, address->prefixlen, valid_str);
link_save(link);
} else
- log_warning_link(link,
+ log_link_warning(link,
"removing non-existent address: %s/%u (valid for %s)",
buf, address->prefixlen, valid_str);
@@ -1516,7 +1516,7 @@ int link_add(Manager *m, sd_rtnl_message *message, Link **ret) {
link = *ret;
- log_debug_link(link, "link %d added", link->ifindex);
+ log_link_debug(link, "link %d added", link->ifindex);
r = sd_rtnl_message_new_addr(m->rtnl, &req, RTM_GETADDR, link->ifindex,
0);
@@ -1535,14 +1535,14 @@ int link_add(Manager *m, sd_rtnl_message *message, Link **ret) {
sprintf(ifindex_str, "n%d", link->ifindex);
device = udev_device_new_from_device_id(m->udev, ifindex_str);
if (!device) {
- log_warning_link(link,
+ log_link_warning(link,
"could not find udev device: %m");
return -errno;
}
if (udev_device_get_is_initialized(device) <= 0) {
/* not yet ready */
- log_debug_link(link, "link pending udev initialization...");
+ log_link_debug(link, "link pending udev initialization...");
return 0;
}
@@ -1574,13 +1574,13 @@ int link_update(Link *link, sd_rtnl_message *m) {
if (link->state == LINK_STATE_LINGER) {
link_ref(link);
- log_info_link(link, "link readded");
+ log_link_info(link, "link readded");
link->state = LINK_STATE_ENSLAVING;
}
r = sd_rtnl_message_read_string(m, IFLA_IFNAME, &ifname);
if (r >= 0 && !streq(ifname, link->ifname)) {
- log_info_link(link, "renamed to %s", ifname);
+ log_link_info(link, "renamed to %s", ifname);
free(link->ifname);
link->ifname = strdup(ifname);
@@ -1593,7 +1593,7 @@ int link_update(Link *link, sd_rtnl_message *m) {
link->mtu = mtu;
if (!link->original_mtu) {
link->original_mtu = mtu;
- log_debug_link(link, "saved original MTU: %"
+ log_link_debug(link, "saved original MTU: %"
PRIu32, link->original_mtu);
}
@@ -1601,7 +1601,7 @@ int link_update(Link *link, sd_rtnl_message *m) {
r = sd_dhcp_client_set_mtu(link->dhcp_client,
link->mtu);
if (r < 0) {
- log_warning_link(link,
+ log_link_warning(link,
"Could not update MTU in DHCP client: %s",
strerror(-r));
return r;
@@ -1619,7 +1619,7 @@ int link_update(Link *link, sd_rtnl_message *m) {
memcpy(link->mac.ether_addr_octet, mac.ether_addr_octet,
ETH_ALEN);
- log_debug_link(link, "MAC address: "
+ log_link_debug(link, "MAC address: "
"%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
mac.ether_addr_octet[0],
mac.ether_addr_octet[1],
@@ -1631,7 +1631,7 @@ int link_update(Link *link, sd_rtnl_message *m) {
if (link->ipv4ll) {
r = sd_ipv4ll_set_mac(link->ipv4ll, &link->mac);
if (r < 0) {
- log_warning_link(link,
+ log_link_warning(link,
"Could not update MAC address in IPv4LL client: %s",
strerror(-r));
return r;
@@ -1644,7 +1644,7 @@ int link_update(Link *link, sd_rtnl_message *m) {
sizeof (link->mac),
ARPHRD_ETHER);
if (r < 0) {
- log_warning_link(link,
+ log_link_warning(link,
"Could not update MAC address in DHCP client: %s",
strerror(-r));
return r;
@@ -1657,7 +1657,7 @@ int link_update(Link *link, sd_rtnl_message *m) {
sizeof (link->mac),
ARPHRD_ETHER);
if (r < 0) {
- log_warning_link(link,
+ log_link_warning(link,
"Could not update MAC address in DHCPv6 client: %s",
strerror(-r));
return r;
@@ -1676,7 +1676,7 @@ int link_update(Link *link, sd_rtnl_message *m) {
carrier_lost = had_carrier && !link_has_carrier(link);
if (carrier_gained) {
- log_info_link(link, "gained carrier");
+ log_link_info(link, "gained carrier");
if (link->network) {
r = link_acquire_conf(link);
@@ -1686,7 +1686,7 @@ int link_update(Link *link, sd_rtnl_message *m) {
}
}
} else if (carrier_lost) {
- log_info_link(link, "lost carrier");
+ log_link_info(link, "lost carrier");
r = link_stop_clients(link);
if (r < 0) {
@@ -1878,7 +1878,7 @@ int link_save(Link *link) {
return 0;
fail:
- log_error_link(link, "Failed to save link data to %s: %s", link->state_file, strerror(-r));
+ log_link_error(link, "Failed to save link data to %s: %s", link->state_file, strerror(-r));
unlink(link->state_file);
unlink(temp_path);
return r;
diff --git a/src/network/networkd-link.h b/src/network/networkd-link.h
index 5eb4b88931..61cdbf3132 100644
--- a/src/network/networkd-link.h
+++ b/src/network/networkd-link.h
@@ -132,14 +132,14 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_unref);
/* Macros which append INTERFACE= to the message */
-#define log_full_link(level, link, fmt, ...) log_meta_object(level, 0, __FILE__, __LINE__, __func__, "INTERFACE=", link->ifname, "%-*s: " fmt, IFNAMSIZ, link->ifname, ##__VA_ARGS__)
-#define log_debug_link(link, ...) log_full_link(LOG_DEBUG, link, ##__VA_ARGS__)
-#define log_info_link(link, ...) log_full_link(LOG_INFO, link, ##__VA_ARGS__)
-#define log_notice_link(link, ...) log_full_link(LOG_NOTICE, link, ##__VA_ARGS__)
-#define log_warning_link(link, ...) log_full_link(LOG_WARNING, link, ##__VA_ARGS__)
-#define log_error_link(link, ...) log_full_link(LOG_ERR, link, ##__VA_ARGS__)
-
-#define log_struct_link(level, link, ...) log_struct(level, "INTERFACE=%s", link->ifname, __VA_ARGS__)
+#define log_link_full(level, link, fmt, ...) log_object_internal(level, 0, __FILE__, __LINE__, __func__, "INTERFACE=", link->ifname, "%-*s: " fmt, IFNAMSIZ, link->ifname, ##__VA_ARGS__)
+#define log_link_debug(link, ...) log_link_full(LOG_DEBUG, link, ##__VA_ARGS__)
+#define log_link_info(link, ...) log_link_full(LOG_INFO, link, ##__VA_ARGS__)
+#define log_link_notice(link, ...) log_link_full(LOG_NOTICE, link, ##__VA_ARGS__)
+#define log_link_warning(link, ...) log_link_full(LOG_WARNING, link, ##__VA_ARGS__)
+#define log_link_error(link, ...) log_link_full(LOG_ERR, link, ##__VA_ARGS__)
+
+#define log_link_struct(level, link, ...) log_struct(level, "INTERFACE=%s", link->ifname, __VA_ARGS__)
#define ADDRESS_FMT_VAL(address) \
(address).s_addr & 0xFF, \
diff --git a/src/network/networkd-netdev-bond.c b/src/network/networkd-netdev-bond.c
index 46408213b7..88321ef84c 100644
--- a/src/network/networkd-netdev-bond.c
+++ b/src/network/networkd-netdev-bond.c
@@ -116,7 +116,7 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
r = sd_rtnl_message_append_u8(m, IFLA_BOND_MODE,
bond_mode_to_kernel(b->mode));
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_BOND_MODE attribute: %s",
strerror(-r));
return r;
@@ -127,7 +127,7 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
r = sd_rtnl_message_append_u8(m, IFLA_BOND_XMIT_HASH_POLICY,
bond_xmit_hash_policy_to_kernel(b->xmit_hash_policy));
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_BOND_XMIT_HASH_POLICY attribute: %s",
strerror(-r));
return r;
@@ -138,7 +138,7 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
b->mode == NETDEV_BOND_MODE_802_3AD) {
r = sd_rtnl_message_append_u8(m, IFLA_BOND_AD_LACP_RATE, b->lacp_rate );
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_BOND_AD_LACP_RATE attribute: %s",
strerror(-r));
return r;
@@ -148,7 +148,7 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
if (b->miimon != 0) {
r = sd_rtnl_message_append_u32(m, IFLA_BOND_MIIMON, b->miimon / USEC_PER_MSEC);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_BOND_BOND_MIIMON attribute: %s",
strerror(-r));
return r;
@@ -158,7 +158,7 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
if (b->downdelay != 0) {
r = sd_rtnl_message_append_u32(m, IFLA_BOND_DOWNDELAY, b->downdelay / USEC_PER_MSEC);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_BOND_DOWNDELAY attribute: %s",
strerror(-r));
return r;
@@ -168,7 +168,7 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
if (b->updelay != 0) {
r = sd_rtnl_message_append_u32(m, IFLA_BOND_UPDELAY, b->updelay / USEC_PER_MSEC);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_BOND_UPDELAY attribute: %s",
strerror(-r));
return r;
diff --git a/src/network/networkd-netdev-macvlan.c b/src/network/networkd-netdev-macvlan.c
index 2e5554a172..198fb575ee 100644
--- a/src/network/networkd-netdev-macvlan.c
+++ b/src/network/networkd-netdev-macvlan.c
@@ -48,7 +48,7 @@ static int netdev_macvlan_fill_message_create(NetDev *netdev, Link *link, sd_rtn
if (m->mode != _NETDEV_MACVLAN_MODE_INVALID) {
r = sd_rtnl_message_append_u32(req, IFLA_MACVLAN_MODE, m->mode);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_MACVLAN_MODE attribute: %s",
strerror(-r));
return r;
diff --git a/src/network/networkd-netdev-tunnel.c b/src/network/networkd-netdev-tunnel.c
index e5981a48d8..980c70ef55 100644
--- a/src/network/networkd-netdev-tunnel.c
+++ b/src/network/networkd-netdev-tunnel.c
@@ -45,7 +45,7 @@ static int netdev_ipip_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
r = sd_rtnl_message_append_u32(m, IFLA_IPTUN_LINK, link->ifindex);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_IPTUN_LINK attribute: %s",
strerror(-r));
return r;
@@ -53,7 +53,7 @@ static int netdev_ipip_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_LOCAL, &t->local.in);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_IPTUN_LOCAL attribute: %s",
strerror(-r));
return r;
@@ -61,7 +61,7 @@ static int netdev_ipip_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_REMOTE, &t->remote.in);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_IPTUN_REMOTE attribute: %s",
strerror(-r));
return r;
@@ -69,7 +69,7 @@ static int netdev_ipip_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
r = sd_rtnl_message_append_u8(m, IFLA_IPTUN_TTL, t->ttl);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_IPTUN_TTL attribute: %s",
strerror(-r));
return r;
@@ -77,7 +77,7 @@ static int netdev_ipip_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
r = sd_rtnl_message_append_u8(m, IFLA_IPTUN_PMTUDISC, t->pmtudisc);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_IPTUN_PMTUDISC attribute: %s",
strerror(-r));
return r;
@@ -98,7 +98,7 @@ static int netdev_sit_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me
r = sd_rtnl_message_append_u32(m, IFLA_IPTUN_LINK, link->ifindex);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_IPTUN_LINK attribute: %s",
strerror(-r));
return r;
@@ -106,7 +106,7 @@ static int netdev_sit_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me
r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_LOCAL, &t->local.in);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_IPTUN_LOCAL attribute: %s",
strerror(-r));
return r;
@@ -114,7 +114,7 @@ static int netdev_sit_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me
r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_REMOTE, &t->remote.in);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_IPTUN_REMOTE attribute: %s",
strerror(-r));
return r;
@@ -122,7 +122,7 @@ static int netdev_sit_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me
r = sd_rtnl_message_append_u8(m, IFLA_IPTUN_TTL, t->ttl);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_IPTUN_TTL attribute: %s",
strerror(-r));
return r;
@@ -130,7 +130,7 @@ static int netdev_sit_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me
r = sd_rtnl_message_append_u8(m, IFLA_IPTUN_PMTUDISC, t->pmtudisc);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_IPTUN_PMTUDISC attribute: %s",
strerror(-r));
return r;
@@ -151,7 +151,7 @@ static int netdev_gre_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me
r = sd_rtnl_message_append_u32(m, IFLA_GRE_LINK, link->ifindex);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_GRE_LINK attribute: %s",
strerror(-r));
return r;
@@ -159,7 +159,7 @@ static int netdev_gre_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me
r = sd_rtnl_message_append_in_addr(m, IFLA_GRE_LOCAL, &t->local.in);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_GRE_LOCAL attribute: %s",
strerror(-r));
return r;
@@ -167,7 +167,7 @@ static int netdev_gre_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me
r = sd_rtnl_message_append_in_addr(m, IFLA_GRE_REMOTE, &t->remote.in);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_GRE_REMOTE attribute: %s",
strerror(-r));
return r;
@@ -175,7 +175,7 @@ static int netdev_gre_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me
r = sd_rtnl_message_append_u8(m, IFLA_GRE_TTL, t->ttl);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_GRE_TTL attribute: %s",
strerror(-r));
return r;
@@ -183,7 +183,7 @@ static int netdev_gre_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me
r = sd_rtnl_message_append_u8(m, IFLA_GRE_TOS, t->tos);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_GRE_TOS attribute: %s",
strerror(-r));
return r;
@@ -191,7 +191,7 @@ static int netdev_gre_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me
r = sd_rtnl_message_append_u8(m, IFLA_GRE_PMTUDISC, t->pmtudisc);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_GRE_PMTUDISC attribute: %s",
strerror(-r));
return r;
@@ -212,7 +212,7 @@ static int netdev_vti_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me
r = sd_rtnl_message_append_u32(m, IFLA_VTI_LINK, link->ifindex);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_IPTUN_LINK attribute: %s",
strerror(-r));
return r;
@@ -220,7 +220,7 @@ static int netdev_vti_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me
r = sd_rtnl_message_append_in_addr(m, IFLA_VTI_LOCAL, &t->local.in);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_IPTUN_LOCAL attribute: %s",
strerror(-r));
return r;
@@ -228,7 +228,7 @@ static int netdev_vti_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me
r = sd_rtnl_message_append_in_addr(m, IFLA_VTI_REMOTE, &t->remote.in);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_IPTUN_REMOTE attribute: %s",
strerror(-r));
return r;
diff --git a/src/network/networkd-netdev-tuntap.c b/src/network/networkd-netdev-tuntap.c
index eaf5df4971..7767d75507 100644
--- a/src/network/networkd-netdev-tuntap.c
+++ b/src/network/networkd-netdev-tuntap.c
@@ -70,13 +70,13 @@ static int netdev_tuntap_add(NetDev *netdev, struct ifreq *ifr) {
fd = open(TUN_DEV, O_RDWR);
if (fd < 0) {
- log_error_netdev(netdev, "Failed to open tun dev: %m");
+ log_netdev_error(netdev, "Failed to open tun dev: %m");
return -errno;
}
r = ioctl(fd, TUNSETIFF, ifr);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"TUNSETIFF failed on tun dev: %s",
strerror(-r));
return r;
@@ -102,7 +102,7 @@ static int netdev_tuntap_add(NetDev *netdev, struct ifreq *ifr) {
r = ioctl(fd, TUNSETOWNER, uid);
if ( r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"TUNSETOWNER failed on tun dev: %s",
strerror(-r));
}
@@ -121,7 +121,7 @@ static int netdev_tuntap_add(NetDev *netdev, struct ifreq *ifr) {
r = ioctl(fd, TUNSETGROUP, gid);
if( r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"TUNSETGROUP failed on tun dev: %s",
strerror(-r));
return r;
@@ -131,7 +131,7 @@ static int netdev_tuntap_add(NetDev *netdev, struct ifreq *ifr) {
r = ioctl(fd, TUNSETPERSIST, 1);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"TUNSETPERSIST failed on tun dev: %s",
strerror(-r));
return r;
diff --git a/src/network/networkd-netdev-veth.c b/src/network/networkd-netdev-veth.c
index ca2bb0718a..859c26e931 100644
--- a/src/network/networkd-netdev-veth.c
+++ b/src/network/networkd-netdev-veth.c
@@ -38,7 +38,7 @@ static int netdev_veth_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
r = sd_rtnl_message_open_container(m, VETH_INFO_PEER);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append VETH_INFO_PEER attribute: %s",
strerror(-r));
return r;
@@ -55,7 +55,7 @@ static int netdev_veth_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
if (v->mac_peer) {
r = sd_rtnl_message_append_ether_addr(m, IFLA_ADDRESS, v->mac_peer);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_ADDRESS attribute: %s",
strerror(-r));
return r;
@@ -64,7 +64,7 @@ static int netdev_veth_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
r = sd_rtnl_message_close_container(m);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_INFO_DATA attribute: %s",
strerror(-r));
return r;
diff --git a/src/network/networkd-netdev-vlan.c b/src/network/networkd-netdev-vlan.c
index 13c4456733..665559f895 100644
--- a/src/network/networkd-netdev-vlan.c
+++ b/src/network/networkd-netdev-vlan.c
@@ -37,7 +37,7 @@ static int netdev_vlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
if (v->id <= VLANID_MAX) {
r = sd_rtnl_message_append_u16(req, IFLA_VLAN_ID, v->id);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_VLAN_ID attribute: %s",
strerror(-r));
return r;
diff --git a/src/network/networkd-netdev-vxlan.c b/src/network/networkd-netdev-vxlan.c
index 326ac547a3..7dec69d0f6 100644
--- a/src/network/networkd-netdev-vxlan.c
+++ b/src/network/networkd-netdev-vxlan.c
@@ -41,7 +41,7 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_
if (v->id <= VXLAN_VID_MAX) {
r = sd_rtnl_message_append_u32(m, IFLA_VXLAN_ID, v->id);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_VXLAN_ID attribute: %s",
strerror(-r));
return r;
@@ -50,7 +50,7 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_
r = sd_rtnl_message_append_in_addr(m, IFLA_VXLAN_GROUP, &v->group.in);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_VXLAN_GROUP attribute: %s",
strerror(-r));
return r;
@@ -58,7 +58,7 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_
r = sd_rtnl_message_append_u32(m, IFLA_VXLAN_LINK, link->ifindex);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_VXLAN_LINK attribute: %s",
strerror(-r));
return r;
@@ -67,7 +67,7 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_
if(v->ttl) {
r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_TTL, v->ttl);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_VXLAN_TTL attribute: %s",
strerror(-r));
return r;
@@ -77,7 +77,7 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_
if(v->tos) {
r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_TOS, v->tos);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_VXLAN_TOS attribute: %s",
strerror(-r));
return r;
@@ -86,7 +86,7 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_
r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_LEARNING, v->learning);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_VXLAN_LEARNING attribute: %s",
strerror(-r));
return r;
diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c
index bdb0b888a0..310b20ae3e 100644
--- a/src/network/networkd-netdev.c
+++ b/src/network/networkd-netdev.c
@@ -136,7 +136,7 @@ void netdev_drop(NetDev *netdev) {
netdev->state = NETDEV_STATE_LINGER;
- log_debug_netdev(netdev, "netdev removed");
+ log_netdev_debug(netdev, "netdev removed");
netdev_cancel_callbacks(netdev);
@@ -184,7 +184,7 @@ static int netdev_enslave_ready(NetDev *netdev, Link* link, sd_rtnl_message_hand
r = sd_rtnl_message_new_link(netdev->manager->rtnl, &req,
RTM_SETLINK, link->ifindex);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not allocate RTM_SETLINK message: %s",
strerror(-r));
return r;
@@ -192,7 +192,7 @@ static int netdev_enslave_ready(NetDev *netdev, Link* link, sd_rtnl_message_hand
r = sd_rtnl_message_append_u32(req, IFLA_MASTER, netdev->ifindex);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_MASTER attribute: %s",
strerror(-r));
return r;
@@ -200,7 +200,7 @@ static int netdev_enslave_ready(NetDev *netdev, Link* link, sd_rtnl_message_hand
r = sd_rtnl_call_async(netdev->manager->rtnl, req, callback, link, 0, NULL);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not send rtnetlink message: %s",
strerror(-r));
return r;
@@ -208,7 +208,7 @@ static int netdev_enslave_ready(NetDev *netdev, Link* link, sd_rtnl_message_hand
link_ref(link);
- log_debug_netdev(netdev, "enslaving link '%s'", link->ifname);
+ log_netdev_debug(netdev, "enslaving link '%s'", link->ifname);
return 0;
}
@@ -251,7 +251,7 @@ static int netdev_create_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userda
r = sd_rtnl_message_get_errno(m);
if (r == -EEXIST)
- log_debug_netdev(netdev, "netdev exists, using existing");
+ log_netdev_debug(netdev, "netdev exists, using existing");
else if (r < 0) {
log_warning_netdev(netdev, "netdev could not be created: %s", strerror(-r));
netdev_drop(netdev);
@@ -259,7 +259,7 @@ static int netdev_create_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userda
return 1;
}
- log_debug_netdev(netdev, "created");
+ log_netdev_debug(netdev, "created");
return 1;
}
@@ -288,7 +288,7 @@ int netdev_enslave(NetDev *netdev, Link *link, sd_rtnl_message_handler_t callbac
LIST_PREPEND(callbacks, netdev->callbacks, cb);
- log_debug_netdev(netdev, "will enslave '%s', when reday",
+ log_netdev_debug(netdev, "will enslave '%s', when reday",
link->ifname);
}
@@ -307,29 +307,29 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) {
r = sd_rtnl_message_get_type(message, &type);
if (r < 0) {
- log_error_netdev(netdev, "Could not get rtnl message type");
+ log_netdev_error(netdev, "Could not get rtnl message type");
return r;
}
if (type != RTM_NEWLINK) {
- log_error_netdev(netdev, "Can not set ifindex from unexpected rtnl message type");
+ log_netdev_error(netdev, "Can not set ifindex from unexpected rtnl message type");
return -EINVAL;
}
r = sd_rtnl_message_link_get_ifindex(message, &ifindex);
if (r < 0) {
- log_error_netdev(netdev, "Could not get ifindex: %s", strerror(-r));
+ log_netdev_error(netdev, "Could not get ifindex: %s", strerror(-r));
netdev_enter_failed(netdev);
return r;
} else if (ifindex <= 0) {
- log_error_netdev(netdev, "Got invalid ifindex: %d", ifindex);
+ log_netdev_error(netdev, "Got invalid ifindex: %d", ifindex);
netdev_enter_failed(netdev);
return r;
}
if (netdev->ifindex > 0) {
if (netdev->ifindex != ifindex) {
- log_error_netdev(netdev, "Could not set ifindex to %d, already set to %d",
+ log_netdev_error(netdev, "Could not set ifindex to %d, already set to %d",
ifindex, netdev->ifindex);
netdev_enter_failed(netdev);
return -EEXIST;
@@ -340,12 +340,12 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) {
r = sd_rtnl_message_read_string(message, IFLA_IFNAME, &received_name);
if (r < 0) {
- log_error_netdev(netdev, "Could not get IFNAME");
+ log_netdev_error(netdev, "Could not get IFNAME");
return r;
}
if (!streq(netdev->ifname, received_name)) {
- log_error_netdev(netdev, "Received newlink with wrong IFNAME %s",
+ log_netdev_error(netdev, "Received newlink with wrong IFNAME %s",
received_name);
netdev_enter_failed(netdev);
return r;
@@ -353,19 +353,19 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) {
r = sd_rtnl_message_enter_container(message, IFLA_LINKINFO);
if (r < 0) {
- log_error_netdev(netdev, "Could not get LINKINFO");
+ log_netdev_error(netdev, "Could not get LINKINFO");
return r;
}
r = sd_rtnl_message_read_string(message, IFLA_INFO_KIND, &received_kind);
if (r < 0) {
- log_error_netdev(netdev, "Could not get KIND");
+ log_netdev_error(netdev, "Could not get KIND");
return r;
}
r = sd_rtnl_message_exit_container(message);
if (r < 0) {
- log_error_netdev(netdev, "Could not exit container");
+ log_netdev_error(netdev, "Could not exit container");
return r;
}
@@ -375,14 +375,14 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) {
else {
kind = netdev_kind_to_string(netdev->kind);
if (!kind) {
- log_error_netdev(netdev, "Could not get kind");
+ log_netdev_error(netdev, "Could not get kind");
netdev_enter_failed(netdev);
return -EINVAL;
}
}
if (!streq(kind, received_kind)) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Received newlink with wrong KIND %s, "
"expected %s", received_kind, kind);
netdev_enter_failed(netdev);
@@ -391,7 +391,7 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) {
netdev->ifindex = ifindex;
- log_debug_netdev(netdev, "netdev has index %d", netdev->ifindex);
+ log_netdev_debug(netdev, "netdev has index %d", netdev->ifindex);
netdev_enter_ready(netdev);
@@ -459,13 +459,13 @@ static int netdev_create(NetDev *netdev, Link *link,
if (r < 0)
return r;
- log_debug_netdev(netdev, "created");
+ log_netdev_debug(netdev, "created");
} else {
_cleanup_rtnl_message_unref_ sd_rtnl_message *m = NULL;
r = sd_rtnl_message_new_link(netdev->manager->rtnl, &m, RTM_NEWLINK, 0);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not allocate RTM_NEWLINK message: %s",
strerror(-r));
return r;
@@ -473,7 +473,7 @@ static int netdev_create(NetDev *netdev, Link *link,
r = sd_rtnl_message_append_string(m, IFLA_IFNAME, netdev->ifname);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_IFNAME, attribute: %s",
strerror(-r));
return r;
@@ -482,7 +482,7 @@ static int netdev_create(NetDev *netdev, Link *link,
if (netdev->mac) {
r = sd_rtnl_message_append_ether_addr(m, IFLA_ADDRESS, netdev->mac);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_ADDRESS attribute: %s",
strerror(-r));
return r;
@@ -492,7 +492,7 @@ static int netdev_create(NetDev *netdev, Link *link,
if (netdev->mtu) {
r = sd_rtnl_message_append_u32(m, IFLA_MTU, netdev->mtu);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_MTU attribute: %s",
strerror(-r));
return r;
@@ -502,7 +502,7 @@ static int netdev_create(NetDev *netdev, Link *link,
if (link) {
r = sd_rtnl_message_append_u32(m, IFLA_LINK, link->ifindex);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Colud not append IFLA_LINK attribute: %s",
strerror(-r));
return r;
@@ -511,7 +511,7 @@ static int netdev_create(NetDev *netdev, Link *link,
r = sd_rtnl_message_open_container(m, IFLA_LINKINFO);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_LINKINFO attribute: %s",
strerror(-r));
return r;
@@ -520,7 +520,7 @@ static int netdev_create(NetDev *netdev, Link *link,
r = sd_rtnl_message_open_container_union(m, IFLA_INFO_DATA,
netdev_kind_to_string(netdev->kind));
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_INFO_DATA attribute: %s",
strerror(-r));
return r;
@@ -534,7 +534,7 @@ static int netdev_create(NetDev *netdev, Link *link,
r = sd_rtnl_message_close_container(m);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_LINKINFO attribute: %s",
strerror(-r));
return r;
@@ -542,7 +542,7 @@ static int netdev_create(NetDev *netdev, Link *link,
r = sd_rtnl_message_close_container(m);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not append IFLA_LINKINFO attribute: %s",
strerror(-r));
return r;
@@ -553,7 +553,7 @@ static int netdev_create(NetDev *netdev, Link *link,
r = sd_rtnl_call_async(netdev->manager->rtnl, m,
callback, link, 0, NULL);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not send rtnetlink message: %s",
strerror(-r));
return r;
@@ -565,7 +565,7 @@ static int netdev_create(NetDev *netdev, Link *link,
netdev_create_handler, netdev, 0,
NULL);
if (r < 0) {
- log_error_netdev(netdev,
+ log_netdev_error(netdev,
"Could not send rtnetlink message: %s",
strerror(-r));
return r;
@@ -576,7 +576,7 @@ static int netdev_create(NetDev *netdev, Link *link,
netdev->state = NETDEV_STATE_CREATING;
- log_debug_netdev(netdev, "creating");
+ log_netdev_debug(netdev, "creating");
}
return 0;
@@ -713,7 +713,7 @@ static int netdev_load_one(Manager *manager, const char *filename) {
LIST_HEAD_INIT(netdev->callbacks);
- log_debug_netdev(netdev, "loaded %s", netdev_kind_to_string(netdev->kind));
+ log_netdev_debug(netdev, "loaded %s", netdev_kind_to_string(netdev->kind));
switch (NETDEV_VTABLE(netdev)->create_type) {
case NETDEV_CREATE_MASTER:
diff --git a/src/network/networkd-netdev.h b/src/network/networkd-netdev.h
index 54339aec73..c1e05c21fb 100644
--- a/src/network/networkd-netdev.h
+++ b/src/network/networkd-netdev.h
@@ -192,12 +192,12 @@ const struct ConfigPerfItem* network_netdev_gperf_lookup(const char *key, unsign
/* Macros which append INTERFACE= to the message */
-#define log_full_netdev(level, netdev, fmt, ...) log_meta_object(level, 0, __FILE__, __LINE__, __func__, "INTERFACE=", netdev->ifname, "%-*s: " fmt, IFNAMSIZ, netdev->ifname, ##__VA_ARGS__)
-#define log_debug_netdev(netdev, ...) log_full_netdev(LOG_DEBUG, netdev, ##__VA_ARGS__)
+#define log_full_netdev(level, netdev, fmt, ...) log_object_internal(level, 0, __FILE__, __LINE__, __func__, "INTERFACE=", netdev->ifname, "%-*s: " fmt, IFNAMSIZ, netdev->ifname, ##__VA_ARGS__)
+#define log_netdev_debug(netdev, ...) log_full_netdev(LOG_DEBUG, netdev, ##__VA_ARGS__)
#define log_info_netdev(netdev, ...) log_full_netdev(LOG_INFO, netdev, ##__VA_ARGS__)
#define log_notice_netdev(netdev, ...) log_full_netdev(LOG_NOTICE, netdev, ##__VA_ARGS__)
#define log_warning_netdev(netdev, ...) log_full_netdev(LOG_WARNING, netdev,## __VA_ARGS__)
-#define log_error_netdev(netdev, ...) log_full_netdev(LOG_ERR, netdev, ##__VA_ARGS__)
+#define log_netdev_error(netdev, ...) log_full_netdev(LOG_ERR, netdev, ##__VA_ARGS__)
#define log_struct_netdev(level, netdev, ...) log_struct(level, "INTERFACE=%s", netdev->ifname, __VA_ARGS__)
diff --git a/src/network/networkd.h b/src/network/networkd.h
index 9acf31cd1d..263cc61eef 100644
--- a/src/network/networkd.h
+++ b/src/network/networkd.h
@@ -336,14 +336,14 @@ int address_pool_acquire(AddressPool *p, unsigned prefixlen, union in_addr_union
/* Macros which append INTERFACE= to the message */
-#define log_full_link(level, link, fmt, ...) log_meta_object(level, 0, __FILE__, __LINE__, __func__, "INTERFACE=", link->ifname, "%-*s: " fmt, IFNAMSIZ, link->ifname, ##__VA_ARGS__)
-#define log_debug_link(link, ...) log_full_link(LOG_DEBUG, link, ##__VA_ARGS__)
-#define log_info_link(link, ...) log_full_link(LOG_INFO, link, ##__VA_ARGS__)
-#define log_notice_link(link, ...) log_full_link(LOG_NOTICE, link, ##__VA_ARGS__)
-#define log_warning_link(link, ...) log_full_link(LOG_WARNING, link, ##__VA_ARGS__)
-#define log_error_link(link, ...) log_full_link(LOG_ERR, link, ##__VA_ARGS__)
-
-#define log_struct_link(level, link, ...) log_struct(level, "INTERFACE=%s", link->ifname, __VA_ARGS__)
+#define log_link_full(level, link, fmt, ...) log_object_internal(level, 0, __FILE__, __LINE__, __func__, "INTERFACE=", link->ifname, "%-*s: " fmt, IFNAMSIZ, link->ifname, ##__VA_ARGS__)
+#define log_link_debug(link, ...) log_link_full(LOG_DEBUG, link, ##__VA_ARGS__)
+#define log_link_info(link, ...) log_link_full(LOG_INFO, link, ##__VA_ARGS__)
+#define log_link_notice(link, ...) log_link_full(LOG_NOTICE, link, ##__VA_ARGS__)
+#define log_link_warning(link, ...) log_link_full(LOG_WARNING, link, ##__VA_ARGS__)
+#define log_link_error(link, ...) log_link_full(LOG_ERR, link, ##__VA_ARGS__)
+
+#define log_link_struct(level, link, ...) log_struct(level, "INTERFACE=%s", link->ifname, __VA_ARGS__)
#define ADDRESS_FMT_VAL(address) \
(address).s_addr & 0xFF, \
diff --git a/src/shared/env-util.c b/src/shared/env-util.c
index d90b878d19..fbdc73dd2c 100644
--- a/src/shared/env-util.c
+++ b/src/shared/env-util.c
@@ -425,7 +425,7 @@ char **strv_env_clean_log(char **e, const char *unit_id, const char *message) {
if (!env_assignment_is_valid(*p)) {
if (message)
- log_error_unit(unit_id, "Ignoring invalid environment '%s': %s", *p, message);
+ log_unit_error(unit_id, "Ignoring invalid environment '%s': %s", *p, message);
free(*p);
continue;
}
diff --git a/src/shared/log.c b/src/shared/log.c
index d87f43f5a4..dcbcd9d9c9 100644
--- a/src/shared/log.c
+++ b/src/shared/log.c
@@ -627,7 +627,7 @@ int log_dump_internal(
return log_dispatch(level, error, file, line, func, NULL, NULL, buffer);
}
-int log_metav(
+int log_internalv(
int level,
int error,
const char*file,
@@ -652,7 +652,7 @@ int log_metav(
return log_dispatch(level, error, file, line, func, NULL, NULL, buffer);
}
-int log_meta(
+int log_internal(
int level,
int error,
const char*file,
@@ -664,13 +664,13 @@ int log_meta(
va_list ap;
va_start(ap, format);
- r = log_metav(level, error, file, line, func, format, ap);
+ r = log_internalv(level, error, file, line, func, format, ap);
va_end(ap);
return r;
}
-int log_metav_object(
+int log_object_internalv(
int level,
int error,
const char*file,
@@ -697,7 +697,7 @@ int log_metav_object(
return log_dispatch(level, error, file, line, func, object_field, object, buffer);
}
-int log_meta_object(
+int log_object_internal(
int level,
int error,
const char*file,
@@ -711,7 +711,7 @@ int log_meta_object(
va_list ap;
va_start(ap, format);
- r = log_metav_object(level, error, file, line, func, object_field, object, format, ap);
+ r = log_object_internalv(level, error, file, line, func, object_field, object, format, ap);
va_end(ap);
return r;
@@ -756,7 +756,7 @@ void log_assert_failed_return(const char *text, const char *file, int line, cons
}
int log_oom_internal(const char *file, int line, const char *func) {
- log_meta(LOG_ERR, ENOMEM, file, line, func, "Out of memory.");
+ log_internal(LOG_ERR, ENOMEM, file, line, func, "Out of memory.");
return -ENOMEM;
}
diff --git a/src/shared/log.h b/src/shared/log.h
index 9dd68df500..278010432d 100644
--- a/src/shared/log.h
+++ b/src/shared/log.h
@@ -75,40 +75,40 @@ void log_close_console(void);
void log_parse_environment(void);
-int log_meta(
+int log_internal(
int level,
int error,
- const char*file,
+ const char *file,
int line,
const char *func,
const char *format, ...) _printf_(6,7);
-int log_metav(
+int log_internalv(
int level,
int error,
- const char*file,
+ const char *file,
int line,
const char *func,
const char *format,
va_list ap) _printf_(6,0);
-int log_meta_object(
+int log_object_internal(
int level,
int error,
- const char*file,
+ const char *file,
int line,
const char *func,
- const char *object_name,
+ const char *object_field,
const char *object,
const char *format, ...) _printf_(8,9);
-int log_metav_object(
+int log_object_internalv(
int level,
int error,
const char*file,
int line,
const char *func,
- const char *object_name,
+ const char *object_field,
const char *object,
const char *format,
va_list ap) _printf_(8,0);
@@ -130,7 +130,7 @@ int log_oom_internal(
int log_dump_internal(
int level,
int error,
- const char*file,
+ const char *file,
int line,
const char *func,
char *buffer);
@@ -158,7 +158,7 @@ void log_assert_failed_return(
#define log_full_errno(level, error, ...) \
do { \
if (log_get_max_level() >= (level)) \
- log_meta((level), error, __FILE__, __LINE__, __func__, __VA_ARGS__); \
+ log_internal((level), error, __FILE__, __LINE__, __func__, __VA_ARGS__); \
} while (false)
#define log_full(level, ...) log_full_errno(level, 0, __VA_ARGS__)
diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
index 6e4cdd694e..a2f853380c 100644
--- a/src/sysv-generator/sysv-generator.c
+++ b/src/sysv-generator/sysv-generator.c
@@ -192,7 +192,7 @@ static int generate_unit_file(SysvStub *s) {
STRV_FOREACH(p, s->wanted_by) {
r = add_symlink(s->name, *p);
if (r < 0)
- log_error_unit(s->name, "Failed to create 'Wants' symlink to %s: %s", *p, strerror(-r));
+ log_unit_error(s->name, "Failed to create 'Wants' symlink to %s: %s", *p, strerror(-r));
}
return 0;
@@ -320,7 +320,7 @@ static int load_sysv(SysvStub *s) {
if (feof(f))
break;
- log_error_unit(s->name,
+ log_unit_error(s->name,
"Failed to read configuration file '%s': %m",
s->path);
return -errno;
@@ -395,7 +395,7 @@ static int load_sysv(SysvStub *s) {
fn = strstrip(t+8);
if (!path_is_absolute(fn)) {
- log_error_unit(s->name,
+ log_unit_error(s->name,
"[%s:%u] PID file not absolute. Ignoring.",
s->path, line);
continue;
@@ -489,12 +489,12 @@ static int load_sysv(SysvStub *s) {
}
if (r < 0)
- log_error_unit(s->name,
+ log_unit_error(s->name,
"[%s:%u] Failed to add LSB Provides name %s, ignoring: %s",
s->path, line, m, strerror(-r));
}
if (!isempty(state_))
- log_error_unit(s->name,
+ log_unit_error(s->name,
"[%s:%u] Trailing garbage in Provides, ignoring.",
s->path, line);
@@ -517,7 +517,7 @@ static int load_sysv(SysvStub *s) {
r = sysv_translate_facility(n, basename(s->path), &m);
if (r < 0) {
- log_error_unit(s->name,
+ log_unit_error(s->name,
"[%s:%u] Failed to translate LSB dependency %s, ignoring: %s",
s->path, line, n, strerror(-r));
continue;
@@ -551,12 +551,12 @@ static int load_sysv(SysvStub *s) {
}
if (r < 0)
- log_error_unit(s->name,
+ log_unit_error(s->name,
"[%s:%u] Failed to add dependency on %s, ignoring: %s",
s->path, line, m, strerror(-r));
}
if (!isempty(state_))
- log_error_unit(s->name,
+ log_unit_error(s->name,
"[%s:%u] Trailing garbage in %*s, ignoring.",
s->path, line,
(int)(strchr(t, ':') - t), t);
diff --git a/src/udev/udev-builtin-kmod.c b/src/udev/udev-builtin-kmod.c
index f3d164763d..0949d9fad1 100644
--- a/src/udev/udev-builtin-kmod.c
+++ b/src/udev/udev-builtin-kmod.c
@@ -64,7 +64,7 @@ static int load_module(struct udev *udev, const char *alias) {
}
_printf_(6,0) static void udev_kmod_log(void *data, int priority, const char *file, int line, const char *fn, const char *format, va_list args) {
- log_metav(priority, 0, file, line, fn, format, args);
+ log_internalv(priority, 0, file, line, fn, format, args);
}
static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool test) {