1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-09 01:18:19 +03:00

sd-device: remove debug log message when dirs are missing

This is a common case, and nothing noteworthy at all. For example, if we
establish an enumerator for listing all devices tagged by some tag, then
the per-tag dir is not going to exist if there are currently no devices
tagged that way, but that's a really common case, and doesn't really
deserve any mention, not even at debug level.
This commit is contained in:
Lennart Poettering 2024-07-17 15:56:59 +02:00
parent f499191c2e
commit a68c97a545

View File

@ -701,13 +701,11 @@ static int enumerator_scan_dir_and_add_devices(
dir = opendir(path);
if (!dir) {
bool ignore = errno == ENOENT;
/* This is necessarily racey, so ignore missing directories */
if (errno == ENOENT)
return 0;
/* this is necessarily racey, so ignore missing directories */
log_debug_errno(errno,
"sd-device-enumerator: Failed to open directory %s%s: %m",
path, ignore ? ", ignoring" : "");
return ignore ? 0 : -errno;
return log_debug_errno(errno, "sd-device-enumerator: Failed to open directory '%s': %m", path);
}
FOREACH_DIRENT_ALL(de, dir, return -errno) {
@ -767,12 +765,10 @@ static int enumerator_scan_dir(
dir = opendir(path);
if (!dir) {
bool ignore = errno == ENOENT;
if (errno == ENOENT)
return 0;
log_debug_errno(errno,
"sd-device-enumerator: Failed to open directory %s%s: %m",
path, ignore ? ", ignoring" : "");
return ignore ? 0 : -errno;
return log_debug_errno(errno, "sd-device-enumerator: Failed to open directory '%s': %m", path);
}
FOREACH_DIRENT_ALL(de, dir, return -errno) {
@ -804,12 +800,10 @@ static int enumerator_scan_devices_tag(sd_device_enumerator *enumerator, const c
dir = opendir(path);
if (!dir) {
bool ignore = errno == ENOENT;
if (errno == ENOENT)
return 0;
log_debug_errno(errno,
"sd-device-enumerator: Failed to open directory %s%s: %m",
path, ignore ? ", ignoring" : "");
return ignore ? 0 : -errno;
return log_debug_errno(errno, "sd-device-enumerator: Failed to open directory '%s': %m", path);
}
/* TODO: filter away subsystems? */
@ -892,12 +886,10 @@ static int parent_crawl_children(sd_device_enumerator *enumerator, const char *p
dir = opendir(path);
if (!dir) {
bool ignore = errno == ENOENT;
if (errno == ENOENT)
return 0;
log_debug_errno(errno,
"sd-device-enumerator: Failed to open directory %s%s: %m",
path, ignore ? ", ignoring" : "");
return ignore ? 0 : -errno;
return log_debug_errno(errno, "sd-device-enumerator: Failed to open directory '%s': %m", path);
}
FOREACH_DIRENT_ALL(de, dir, return -errno) {