Merge pull request #22283 from yuwata/sd-device-suppress-log

sd-device: suppress log
This commit is contained in:
Daan De Meyer
2022-01-28 12:55:16 +00:00
committed by GitHub
2 changed files with 9 additions and 4 deletions
+4 -2
View File
@@ -273,9 +273,11 @@ int log_emergency_level(void);
})
#if LOG_TRACE
# define log_trace(...) log_debug(__VA_ARGS__)
# define log_trace(...) log_debug(__VA_ARGS__)
# define log_trace_errno(...) log_debug_errno(__VA_ARGS__)
#else
# define log_trace(...) do {} while (0)
# define log_trace(...) do {} while (0)
# define log_trace_errno(e, ...) (-ERRNO_VALUE(e))
#endif
/* Structured logging */
+5 -2
View File
@@ -188,8 +188,11 @@ int device_set_syspath(sd_device *device, const char *_syspath, bool verify) {
path = strjoina(syspath, "/uevent");
if (access(path, F_OK) < 0) {
if (errno == ENOENT)
/* this is not a valid device */
return log_debug_errno(SYNTHETIC_ERRNO(ENODEV),
/* This is not a valid device.
* Note, this condition is quite often satisfied when
* enumerating devices or finding a parent device.
* Hence, use log_trace_errno() here. */
return log_trace_errno(SYNTHETIC_ERRNO(ENODEV),
"sd-device: the uevent file \"%s\" does not exist.", path);
return log_debug_errno(errno, "sd-device: cannot access uevent file for %s: %m", syspath);