This reverts
b67f944. Lazy loading of device properties does not work for devices
that are received over netlink, as these are sealed. Reinstate the unconditional
loading of the device db.
Reported by: Mantas Mikulėnas <grawity@gmail.com>.
int device_add_property_aux(sd_device *device, const char *key, const char *value, bool db);
int device_add_property_internal(sd_device *device, const char *key, const char *value);
int device_read_uevent_file(sd_device *device);
+int device_read_db_aux(sd_device *device, bool force);
int device_set_syspath(sd_device *device, const char *_syspath, bool verify);
int device_set_ifindex(sd_device *device, const char *ifindex);
return 0;
}
+
+int device_read_db_force(sd_device *device) {
+ assert(device);
+
+ return device_read_db_aux(device, true);
+}
int device_tag_index(sd_device *dev, sd_device *dev_old, bool add);
int device_update_db(sd_device *device);
int device_delete_db(sd_device *device);
+int device_read_db_force(sd_device *device);
return 0;
}
-static int device_read_db(sd_device *device) {
+int device_read_db_aux(sd_device *device, bool force) {
_cleanup_free_ char *db = NULL;
char *path;
const char *id, *value;
INVALID_LINE,
} state = PRE_KEY;
- if (device->db_loaded || device->sealed)
+ if (device->db_loaded || (!force && device->sealed))
return 0;
r = device_get_id_filename(device, &id);
return 0;
}
+static int device_read_db(sd_device *device) {
+ return device_read_db_aux(device, false);
+}
+
_public_ int sd_device_get_is_initialized(sd_device *device, int *initialized) {
int r;
device_seal(udev_device->device);
}
+
+void udev_device_read_db(struct udev_device *udev_device) {
+ assert(udev_device);
+
+ device_read_db_force(udev_device->device);
+}
void udev_device_set_info_loaded(struct udev_device *device);
bool udev_device_get_db_persist(struct udev_device *udev_device);
void udev_device_set_db_persist(struct udev_device *udev_device);
+void udev_device_read_db(struct udev_device *udev_device);
/* libudev-device-private.c */
int udev_device_update_db(struct udev_device *udev_device);
return;
if (streq(udev_device_get_action(dev), "remove")) {
+ udev_device_read_db(dev);
+ udev_device_tag_index(dev, NULL, false);
+ udev_device_delete_db(dev);
+
if (major(udev_device_get_devnum(dev)) != 0)
udev_watch_end(event->udev, dev);
if (major(udev_device_get_devnum(dev)) != 0)
udev_node_remove(dev);
-
- udev_device_delete_db(dev);
- udev_device_tag_index(dev, NULL, false);
} else {
event->dev_db = udev_device_clone_with_db(dev);
if (event->dev_db != NULL) {