mirror of
https://github.com/systemd/systemd.git
synced 2025-01-11 09:18:07 +03:00
hwdb: rename hwdb_bin_paths -> HWDB_BIN_PATHS
We usually use upper letters for constant definitions.
This commit is contained in:
parent
b73c86c695
commit
26823f980d
@ -82,7 +82,7 @@ struct trie_value_entry2_f {
|
||||
le16_t padding;
|
||||
} _packed_;
|
||||
|
||||
#define hwdb_bin_paths \
|
||||
#define HWDB_BIN_PATHS \
|
||||
"/etc/systemd/hwdb/hwdb.bin\0" \
|
||||
"/etc/udev/hwdb.bin\0" \
|
||||
"/usr/lib/systemd/hwdb/hwdb.bin\0" \
|
||||
|
@ -289,14 +289,14 @@ static int hwdb_new(const char *path, sd_hwdb **ret) {
|
||||
|
||||
hwdb->n_ref = 1;
|
||||
|
||||
/* Find hwdb.bin in the explicit path if provided, or iterate over hwdb_bin_paths otherwise */
|
||||
/* Find hwdb.bin in the explicit path if provided, or iterate over HWDB_BIN_PATHS otherwise */
|
||||
if (!isempty(path)) {
|
||||
log_debug("Trying to open \"%s\"...", path);
|
||||
hwdb->f = fopen(path, "re");
|
||||
if (!hwdb->f)
|
||||
return log_debug_errno(errno, "Failed to open %s: %m", path);
|
||||
} else {
|
||||
NULSTR_FOREACH(p, hwdb_bin_paths) {
|
||||
NULSTR_FOREACH(p, HWDB_BIN_PATHS) {
|
||||
log_debug("Trying to open \"%s\"...", p);
|
||||
hwdb->f = fopen(p, "re");
|
||||
if (hwdb->f) {
|
||||
|
@ -667,7 +667,7 @@ int hwdb_query(const char *modalias, const char *root) {
|
||||
assert(modalias);
|
||||
|
||||
if (!isempty(root))
|
||||
NULSTR_FOREACH(p, hwdb_bin_paths) {
|
||||
NULSTR_FOREACH(p, HWDB_BIN_PATHS) {
|
||||
_cleanup_free_ char *hwdb_bin = NULL;
|
||||
|
||||
hwdb_bin = path_join(root, p);
|
||||
@ -699,7 +699,7 @@ bool hwdb_should_reload(sd_hwdb *hwdb) {
|
||||
return false;
|
||||
|
||||
/* if hwdb.bin doesn't exist anywhere, we need to update */
|
||||
NULSTR_FOREACH(p, hwdb_bin_paths)
|
||||
NULSTR_FOREACH(p, HWDB_BIN_PATHS)
|
||||
if (stat(p, &st) >= 0) {
|
||||
found = true;
|
||||
break;
|
||||
|
@ -62,7 +62,7 @@ TEST(sd_hwdb_new_from_path) {
|
||||
ASSERT_RETURN_EXPECTED_SE(sd_hwdb_new_from_path("", &hwdb) == -EINVAL);
|
||||
assert_se(sd_hwdb_new_from_path("/path/that/should/not/exist", &hwdb) < 0);
|
||||
|
||||
NULSTR_FOREACH(hwdb_bin_path, hwdb_bin_paths) {
|
||||
NULSTR_FOREACH(hwdb_bin_path, HWDB_BIN_PATHS) {
|
||||
r = sd_hwdb_new_from_path(hwdb_bin_path, &hwdb);
|
||||
if (r >= 0)
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user