sd-device/device-util.h
sd-device/sd-device.c
sd-hwdb/hwdb-internal.h
- sd-hwdb/hwdb-util.c
- sd-hwdb/hwdb-util.h
sd-hwdb/sd-hwdb.c
sd-netlink/generic-netlink.c
sd-netlink/generic-netlink.h
#include <stdint.h>
+#include "def.h"
+#include "hashmap.h"
#include "sparse-endian.h"
#define HWDB_SIG { 'K', 'S', 'L', 'P', 'H', 'H', 'R', 'H' }
+struct sd_hwdb {
+ unsigned n_ref;
+
+ FILE *f;
+ struct stat st;
+ union {
+ struct trie_header_f *head;
+ const char *map;
+ };
+
+ OrderedHashmap *properties;
+ Iterator properties_iterator;
+ bool properties_modified;
+};
+
/* on-disk trie objects */
struct trie_header_f {
uint8_t signature[8];
le16_t file_priority;
le16_t padding;
} _packed_;
+
+#define hwdb_bin_paths \
+ "/etc/systemd/hwdb/hwdb.bin\0" \
+ "/etc/udev/hwdb.bin\0" \
+ "/usr/lib/systemd/hwdb/hwdb.bin\0" \
+ _CONF_PATHS_SPLIT_USR_NULSTR("systemd/hwdb/hwdb.bin") \
+ UDEVLIBEXECDIR "/hwdb.bin\0"
#include "fd-util.h"
#include "hashmap.h"
#include "hwdb-internal.h"
-#include "hwdb-util.h"
#include "nulstr-util.h"
#include "string-util.h"
#include "time-util.h"
-struct sd_hwdb {
- unsigned n_ref;
-
- FILE *f;
- struct stat st;
- union {
- struct trie_header_f *head;
- const char *map;
- };
-
- OrderedHashmap *properties;
- Iterator properties_iterator;
- bool properties_modified;
-};
-
struct linebuf {
char bytes[LINE_MAX];
size_t size;
return 0;
}
-static const char hwdb_bin_paths[] =
- "/etc/systemd/hwdb/hwdb.bin\0"
- "/etc/udev/hwdb.bin\0"
- "/usr/lib/systemd/hwdb/hwdb.bin\0"
-#if HAVE_SPLIT_USR
- "/lib/systemd/hwdb/hwdb.bin\0"
-#endif
- UDEVLIBEXECDIR "/hwdb.bin\0";
-
_public_ int sd_hwdb_new(sd_hwdb **ret) {
_cleanup_(sd_hwdb_unrefp) sd_hwdb *hwdb = NULL;
const char *hwdb_bin_path;
DEFINE_PUBLIC_TRIVIAL_REF_UNREF_FUNC(sd_hwdb, sd_hwdb, hwdb_free)
-bool hwdb_validate(sd_hwdb *hwdb) {
- bool found = false;
- const char* p;
- struct stat st;
-
- if (!hwdb)
- return false;
- if (!hwdb->f)
- return false;
-
- /* if hwdb.bin doesn't exist anywhere, we need to update */
- NULSTR_FOREACH(p, hwdb_bin_paths)
- if (stat(p, &st) >= 0) {
- found = true;
- break;
- }
- if (!found)
- return true;
-
- if (timespec_load(&hwdb->st.st_mtim) != timespec_load(&st.st_mtim))
- return true;
- return false;
-}
-
static int properties_prepare(sd_hwdb *hwdb, const char *modalias) {
assert(hwdb);
assert(modalias);
#include "hwdb-util.h"
#include "label.h"
#include "mkdir.h"
+#include "nulstr-util.h"
#include "path-util.h"
#include "sort-util.h"
#include "strbuf.h"
uint16_t file_priority = 1;
int r = 0, err;
- /* The argument 'compat' controls the format version of database. If false, then hwdb.bin will be created with
- * additional information such that priority, line number, and filename of database source. If true, then hwdb.bin
- * will be created without the information. systemd-hwdb command should set the argument false, and 'udevadm hwdb'
- * command should set it true. */
+ /* The argument 'compat' controls the format version of database. If false, then hwdb.bin will be
+ * created with additional information such that priority, line number, and filename of database
+ * source. If true, then hwdb.bin will be created without the information. systemd-hwdb command
+ * should set the argument false, and 'udevadm hwdb' command should set it true. */
trie = new0(struct trie, 1);
if (!trie)
return 0;
}
+
+bool hwdb_validate(sd_hwdb *hwdb) {
+ bool found = false;
+ const char* p;
+ struct stat st;
+
+ if (!hwdb)
+ return false;
+ if (!hwdb->f)
+ return false;
+
+ /* if hwdb.bin doesn't exist anywhere, we need to update */
+ NULSTR_FOREACH(p, hwdb_bin_paths)
+ if (stat(p, &st) >= 0) {
+ found = true;
+ break;
+ }
+ if (!found)
+ return true;
+
+ if (timespec_load(&hwdb->st.st_mtim) != timespec_load(&st.st_mtim))
+ return true;
+ return false;
+}
group-record.h
hostname-setup.c
hostname-setup.h
+ hwdb-util.c
+ hwdb-util.h
id128-print.c
id128-print.h
idn-util.c