Lines Matching refs:hwdb
20 #include "sd-hwdb.h"
23 #include "hwdb-util.h"
27 * SECTION:libudev-hwdb
42 sd_hwdb *hwdb;
53 * Returns: a hwdb context.
57 struct udev_hwdb *hwdb;
66 hwdb = new0(struct udev_hwdb, 1);
67 if (!hwdb)
70 hwdb->refcount = 1;
71 hwdb->hwdb = hwdb_internal;
74 udev_list_init(udev, &hwdb->properties_list, true);
76 return hwdb;
81 * @hwdb: context
83 * Take a reference of a hwdb context.
87 _public_ struct udev_hwdb *udev_hwdb_ref(struct udev_hwdb *hwdb) {
88 if (!hwdb)
90 hwdb->refcount++;
91 return hwdb;
96 * @hwdb: context
98 * Drop a reference of a hwdb context. If the refcount reaches zero,
99 * all resources of the hwdb context will be released.
103 _public_ struct udev_hwdb *udev_hwdb_unref(struct udev_hwdb *hwdb) {
104 if (!hwdb)
106 hwdb->refcount--;
107 if (hwdb->refcount > 0)
109 sd_hwdb_unref(hwdb->hwdb);
110 udev_list_cleanup(&hwdb->properties_list);
111 free(hwdb);
117 * @hwdb: context
128 _public_ struct udev_list_entry *udev_hwdb_get_properties_list_entry(struct udev_hwdb *hwdb, const char *modalias, unsigned int flags) {
131 if (!hwdb || !modalias) {
136 udev_list_cleanup(&hwdb->properties_list);
138 SD_HWDB_FOREACH_PROPERTY(hwdb->hwdb, modalias, key, value) {
139 if (udev_list_entry_add(&hwdb->properties_list, key, value) == NULL) {
145 return udev_list_get_entry(&hwdb->properties_list);