return udev_list_entry_get_value(list_entry);
}
-int udev_device_read_db(struct udev_device *udev_device, const char *dbfile)
+int udev_device_read_db(struct udev_device *udev_device)
{
char filename[UTIL_PATH_SIZE];
char line[UTIL_LINE_SIZE];
+ const char *id;
FILE *f;
- /* providing a database file will always force-load it */
- if (dbfile == NULL) {
- const char *id;
+ if (udev_device->db_loaded)
+ return 0;
- if (udev_device->db_loaded)
- return 0;
- udev_device->db_loaded = true;
+ udev_device->db_loaded = true;
- id = udev_device_get_id_filename(udev_device);
- if (id == NULL)
- return -1;
- strscpyl(filename, sizeof(filename), "/run/udev/data/", id, NULL);
- dbfile = filename;
- }
+ id = udev_device_get_id_filename(udev_device);
+ if (id == NULL)
+ return -1;
- f = fopen(dbfile, "re");
+ strscpyl(filename, sizeof(filename), "/run/udev/data/", id, NULL);
+
+ f = fopen(filename, "re");
if (f == NULL)
- return log_debug_errno(errno, "no db file to read %s: %m", dbfile);
+ return log_debug_errno(errno, "no db file to read %s: %m", filename);
/* devices with a database entry are initialized */
udev_device->is_initialized = true;
if (udev_device == NULL)
return NULL;
if (!udev_device->info_loaded)
- udev_device_read_db(udev_device, NULL);
+ udev_device_read_db(udev_device);
return udev_list_get_entry(&udev_device->devlinks_list);
}
return NULL;
if (!udev_device->info_loaded) {
udev_device_read_uevent_file(udev_device);
- udev_device_read_db(udev_device, NULL);
+ udev_device_read_db(udev_device);
}
if (!udev_device->devlinks_uptodate) {
char symlinks[UTIL_PATH_SIZE];
if (udev_device == NULL)
return 0;
if (!udev_device->info_loaded)
- udev_device_read_db(udev_device, NULL);
+ udev_device_read_db(udev_device);
if (udev_device->usec_initialized == 0)
return 0;
now_ts = now(CLOCK_MONOTONIC);
_public_ int udev_device_get_is_initialized(struct udev_device *udev_device)
{
if (!udev_device->info_loaded)
- udev_device_read_db(udev_device, NULL);
+ udev_device_read_db(udev_device);
return udev_device->is_initialized;
}
if (udev_device == NULL)
return NULL;
if (!udev_device->info_loaded)
- udev_device_read_db(udev_device, NULL);
+ udev_device_read_db(udev_device);
return udev_list_get_entry(&udev_device->tags_list);
}
if (udev_device == NULL)
return false;
if (!udev_device->info_loaded)
- udev_device_read_db(udev_device, NULL);
+ udev_device_read_db(udev_device);
list_entry = udev_device_get_tags_list_entry(udev_device);
if (udev_list_entry_get_by_name(list_entry, tag) != NULL)
return true;
int udev_device_get_devlink_priority(struct udev_device *udev_device)
{
if (!udev_device->info_loaded)
- udev_device_read_db(udev_device, NULL);
+ udev_device_read_db(udev_device);
return udev_device->devlink_priority;
}
int udev_device_get_watch_handle(struct udev_device *udev_device)
{
if (!udev_device->info_loaded)
- udev_device_read_db(udev_device, NULL);
+ udev_device_read_db(udev_device);
return udev_device->watch_handle;
}