systemd: move hwdb.bin to /run

This commit is contained in:
Stefan Saraev 2013-10-22 20:05:59 +03:00
parent 6c5015393b
commit aabb4fdf41

View File

@ -0,0 +1,75 @@
From d7a9ce1ab7fb5aa2f3715c66c12047561bdff95b Mon Sep 17 00:00:00 2001
From: Stefan Saraev <stefan@saraev.ca>
Date: Tue, 22 Oct 2013 19:40:25 +0300
Subject: [PATCH] move hwdb.bin to /run
---
src/libudev/libudev-hwdb.c | 12 ++++++------
src/udev/udevadm-hwdb.c | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/libudev/libudev-hwdb.c b/src/libudev/libudev-hwdb.c
index de1cb83..bac85ff 100644
--- a/src/libudev/libudev-hwdb.c
+++ b/src/libudev/libudev-hwdb.c
@@ -275,30 +275,30 @@ _public_ struct udev_hwdb *udev_hwdb_new(struct udev *udev) {
hwdb->refcount = 1;
udev_list_init(udev, &hwdb->properties_list, true);
- hwdb->f = fopen("/etc/udev/hwdb.bin", "re");
+ hwdb->f = fopen("/run/hwdb.bin", "re");
if (!hwdb->f) {
- log_debug("error reading /etc/udev/hwdb.bin: %m");
+ log_debug("error reading /run/hwdb.bin: %m");
udev_hwdb_unref(hwdb);
return NULL;
}
if (fstat(fileno(hwdb->f), &hwdb->st) < 0 ||
(size_t)hwdb->st.st_size < offsetof(struct trie_header_f, strings_len) + 8) {
- log_debug("error reading /etc/udev/hwdb.bin: %m");
+ log_debug("error reading /run/hwdb.bin: %m");
udev_hwdb_unref(hwdb);
return NULL;
}
hwdb->map = mmap(0, hwdb->st.st_size, PROT_READ, MAP_SHARED, fileno(hwdb->f), 0);
if (hwdb->map == MAP_FAILED) {
- log_debug("error mapping /etc/udev/hwdb.bin: %m");
+ log_debug("error mapping /run/hwdb.bin: %m");
udev_hwdb_unref(hwdb);
return NULL;
}
if (memcmp(hwdb->map, sig, sizeof(hwdb->head->signature)) != 0 ||
(size_t)hwdb->st.st_size != le64toh(hwdb->head->file_size)) {
- log_debug("error recognizing the format of /etc/udev/hwdb.bin");
+ log_debug("error recognizing the format of /run/hwdb.bin");
udev_hwdb_unref(hwdb);
return NULL;
}
@@ -358,7 +358,7 @@ bool udev_hwdb_validate(struct udev_hwdb *hwdb) {
return false;
if (!hwdb->f)
return false;
- if (stat("/etc/udev/hwdb.bin", &st) < 0)
+ if (stat("/run/hwdb.bin", &st) < 0)
return true;
if (timespec_load(&hwdb->st.st_mtim) != timespec_load(&st.st_mtim))
return true;
diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c
index e4b4a27..31101f9 100644
--- a/src/udev/udevadm-hwdb.c
+++ b/src/udev/udevadm-hwdb.c
@@ -629,7 +629,7 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) {
log_debug("strings dedup'ed: %8zu bytes (%8zu)\n",
trie->strings->dedup_len, trie->strings->dedup_count);
- if (asprintf(&hwdb_bin, "%s/etc/udev/hwdb.bin", root) < 0) {
+ if (asprintf(&hwdb_bin, "%s/run/hwdb.bin", root) < 0) {
rc = EXIT_FAILURE;
goto out;
}
--
1.7.2.5