diff options
author | Jon Severinsson <jon@severinsson.net> | 2014-07-01 20:00:00 +0200 |
---|---|---|
committer | Jon Severinsson <jon@severinsson.net> | 2014-07-11 02:23:25 +0200 |
commit | 60f067b41061282b2cd5c4c10935910db9283c80 (patch) | |
tree | f41be399b30284aac463e5d7da1704c6760f4418 /src/libudev/libudev-hwdb.c | |
parent | 14228c0ddf1fe80e2ed0193f0cd1cdb06e5db522 (diff) | |
download | systemd-60f067b41061282b2cd5c4c10935910db9283c80.tar.gz |
Imported Upstream version 214
Diffstat (limited to 'src/libudev/libudev-hwdb.c')
-rw-r--r-- | src/libudev/libudev-hwdb.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/libudev/libudev-hwdb.c b/src/libudev/libudev-hwdb.c index de1cb83188..e0d4d7ca8f 100644 --- a/src/libudev/libudev-hwdb.c +++ b/src/libudev/libudev-hwdb.c @@ -277,38 +277,38 @@ _public_ struct udev_hwdb *udev_hwdb_new(struct udev *udev) { hwdb->f = fopen("/etc/udev/hwdb.bin", "re"); if (!hwdb->f) { - log_debug("error reading /etc/udev/hwdb.bin: %m"); + udev_dbg(udev, "error reading /etc/udev/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"); + udev_dbg(udev, "error reading /etc/udev/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"); + udev_dbg(udev, "error mapping /etc/udev/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"); + udev_dbg(udev, "error recognizing the format of /etc/udev/hwdb.bin"); udev_hwdb_unref(hwdb); return NULL; } - log_debug("=== trie on-disk ===\n"); - log_debug("tool version: %"PRIu64, le64toh(hwdb->head->tool_version)); - log_debug("file size: %8llu bytes\n", (unsigned long long) hwdb->st.st_size); - log_debug("header size %8"PRIu64" bytes\n", le64toh(hwdb->head->header_size)); - log_debug("strings %8"PRIu64" bytes\n", le64toh(hwdb->head->strings_len)); - log_debug("nodes %8"PRIu64" bytes\n", le64toh(hwdb->head->nodes_len)); + udev_dbg(udev, "=== trie on-disk ===\n"); + udev_dbg(udev, "tool version: %"PRIu64, le64toh(hwdb->head->tool_version)); + udev_dbg(udev, "file size: %8zu bytes\n", hwdb->st.st_size); + udev_dbg(udev, "header size %8"PRIu64" bytes\n", le64toh(hwdb->head->header_size)); + udev_dbg(udev, "strings %8"PRIu64" bytes\n", le64toh(hwdb->head->strings_len)); + udev_dbg(udev, "nodes %8"PRIu64" bytes\n", le64toh(hwdb->head->nodes_len)); return hwdb; } @@ -334,14 +334,14 @@ _public_ struct udev_hwdb *udev_hwdb_ref(struct udev_hwdb *hwdb) { * Drop a reference of a hwdb context. If the refcount reaches zero, * all resources of the hwdb context will be released. * - * Returns: the passed hwdb context if it has still an active reference, or #NULL otherwise. + * Returns: #NULL **/ _public_ struct udev_hwdb *udev_hwdb_unref(struct udev_hwdb *hwdb) { if (!hwdb) return NULL; hwdb->refcount--; if (hwdb->refcount > 0) - return hwdb; + return NULL; if (hwdb->map) munmap((void *)hwdb->map, hwdb->st.st_size); if (hwdb->f) |