sd-device: do not include file name directly in error messages
$ diff -u <(strings -n 10 build/libsystemd.so.0.40.0.0 | sort) <(strings -n 10 build/libsystemd.so.0.40.0 | sort)
--- /proc/self/fd/11 2025-05-31 15:17:16.968761963 +0200
+++ /proc/self/fd/12 2025-05-31 15:17:16.970159823 +0200
@@ -3860,11 +3860,6 @@
Failed to fstat() journal file '%s', ignoring: %m
Failed to fstat %s: %m
Failed to get basic: %m
-Failed to get device "ACTION" property, ignoring: %m
-Failed to get device "DEVNUM" property, ignoring: %m
-Failed to get device "DISKSEQ" property, ignoring: %m
-Failed to get device "IFINDEX" property, ignoring: %m
-Failed to get device "SEQNUM" property, ignoring: %m
Failed to get device "%s" property, ignoring: %m
Failed to get inode number of pidfd for pid %i: %m
Failed to get peer's socket address, ignoring: %m
$ ls -l build/libsystemd.so.0.40.0{,.0}
-rwxr-xr-x 1 zbyszek zbyszek 7631640 May 31 15:16 build/libsystemd.so.0.40.0
-rwxr-xr-x 1 zbyszek zbyszek 7635736 May 31 15:16 build/libsystemd.so.0.40.0.0
$ size build/libsystemd.so.0.40.0{,.0}
text data bss dec hex filename
1241382 56185 3554 1301121 13da81 build/libsystemd.so.0.40.0
1241606 56185 3554 1301345 13db61 build/libsystemd.so.0.40.0.0
So the savings are ~4kB, which is more than I expected.
This commit is contained in:
@@ -105,31 +105,31 @@ char** device_make_log_fields(sd_device *device) {
|
||||
|
||||
r = sd_device_get_devnum(device, &devnum);
|
||||
if (r < 0 && r != -ENOENT)
|
||||
log_device_debug_errno(device, r, "Failed to get device \"DEVNUM\" property, ignoring: %m");
|
||||
log_device_debug_errno(device, r, "Failed to get device \"%s\" property, ignoring: %m", "DEVNUM");
|
||||
if (r >= 0)
|
||||
(void) strv_extendf(&strv, "DEVNUM="DEVNUM_FORMAT_STR, DEVNUM_FORMAT_VAL(devnum));
|
||||
|
||||
r = sd_device_get_ifindex(device, &ifindex);
|
||||
if (r < 0 && r != -ENOENT)
|
||||
log_device_debug_errno(device, r, "Failed to get device \"IFINDEX\" property, ignoring: %m");
|
||||
log_device_debug_errno(device, r, "Failed to get device \"%s\" property, ignoring: %m", "IFINDEX");
|
||||
if (r >= 0)
|
||||
(void) strv_extendf(&strv, "IFINDEX=%i", ifindex);
|
||||
|
||||
r = sd_device_get_action(device, &action);
|
||||
if (r < 0 && r != -ENOENT)
|
||||
log_device_debug_errno(device, r, "Failed to get device \"ACTION\" property, ignoring: %m");
|
||||
log_device_debug_errno(device, r, "Failed to get device \"%s\" property, ignoring: %m", "ACTION");
|
||||
if (r >= 0)
|
||||
(void) strv_extendf(&strv, "ACTION=%s", device_action_to_string(action));
|
||||
|
||||
r = sd_device_get_seqnum(device, &seqnum);
|
||||
if (r < 0 && r != -ENOENT)
|
||||
log_device_debug_errno(device, r, "Failed to get device \"SEQNUM\" property, ignoring: %m");
|
||||
log_device_debug_errno(device, r, "Failed to get device \"%s\" property, ignoring: %m", "SEQNUM");
|
||||
if (r >= 0)
|
||||
(void) strv_extendf(&strv, "SEQNUM=%"PRIu64, seqnum);
|
||||
|
||||
r = sd_device_get_diskseq(device, &diskseq);
|
||||
if (r < 0 && r != -ENOENT)
|
||||
log_device_debug_errno(device, r, "Failed to get device \"DISKSEQ\" property, ignoring: %m");
|
||||
log_device_debug_errno(device, r, "Failed to get device \"%s\" property, ignoring: %m", "DISKSEQ");
|
||||
if (r >= 0)
|
||||
(void) strv_extendf(&strv, "DISKSEQ=%"PRIu64, diskseq);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user