summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-03-06 18:22:35 +0100
committerAnthony G. Basile <blueness@gentoo.org>2015-03-18 20:38:26 -0400
commit93d2bf9fcb24d69db27084483c5181722bcc2df8 (patch)
treeeaf3caeb389ff4a852589fb447fc362494b15d8f /src
parent87a58f20434358efb217ca0583f7ebce2e1cc3b3 (diff)
udevd: event - make db loading lazy in REMOVE event handling
We were explicitly eagerly loading the db, then deletenig the backing file and then processing the rules/symlinks. Instead we delete the backnig db file as the last step and let the db loading be lazy as everywhere else. This may save us a bit of work in casese where the db is not needed, but more importantly it hides some implementation details of libudev-device form udevd. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src')
-rw-r--r--src/libudev/libudev-device-private.c1
-rw-r--r--src/udev/udev-event.c7
2 files changed, 4 insertions, 4 deletions
diff --git a/src/libudev/libudev-device-private.c b/src/libudev/libudev-device-private.c
index fb4c6e2940..b7c0004563 100644
--- a/src/libudev/libudev-device-private.c
+++ b/src/libudev/libudev-device-private.c
@@ -183,6 +183,7 @@ int udev_device_delete_db(struct udev_device *udev_device)
if (id == NULL)
return -1;
strscpyl(filename, sizeof(filename), "/run/udev/data/", id, NULL);
+
unlink(filename);
return 0;
}
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index eb53e0b1fd..7d6ba55243 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -811,10 +811,6 @@ void udev_event_execute_rules(struct udev_event *event,
return;
if (streq(udev_device_get_action(dev), "remove")) {
- udev_device_read_db(dev);
- udev_device_delete_db(dev);
- udev_device_tag_index(dev, NULL, false);
-
if (major(udev_device_get_devnum(dev)) != 0)
udev_watch_end(event->udev, dev);
@@ -825,6 +821,9 @@ void udev_event_execute_rules(struct udev_event *event,
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_shallow_clone(dev);
if (event->dev_db != NULL) {