]> err.no Git - systemd/commitdiff
do not import the "uevent" file when we only read the db to get old symlinks
authorKay Sievers <kay.sievers@vrfy.org>
Wed, 5 Nov 2008 11:23:06 +0000 (12:23 +0100)
committerKay Sievers <kay.sievers@vrfy.org>
Wed, 5 Nov 2008 11:23:06 +0000 (12:23 +0100)
udev/lib/libudev-device.c
udev/lib/libudev-private.h
udev/udev-event.c

index 38af0e7c9411bb573c20d4a240d710fc2629c47a..eda3f5d97e26d8e3176849cc2432ca9f8b0cc2f0 100644 (file)
@@ -77,7 +77,7 @@ static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *f
        return util_path_encode(&filename[start], len - start);
 }
 
-static int device_read_db(struct udev_device *udev_device)
+int udev_device_read_db(struct udev_device *udev_device)
 {
        struct stat stats;
        char filename[UTIL_PATH_SIZE];
@@ -218,11 +218,11 @@ int udev_device_read_uevent_file(struct udev_device *udev_device)
        return 0;
 }
 
-void udev_device_load_info(struct udev_device *device)
+static void device_load_info(struct udev_device *device)
 {
        device->info_loaded = 1;
        udev_device_read_uevent_file(device);
-       device_read_db(device);
+       udev_device_read_db(device);
 }
 
 void udev_device_set_info_loaded(struct udev_device *device)
@@ -676,7 +676,7 @@ const char *udev_device_get_devnode(struct udev_device *udev_device)
        if (udev_device == NULL)
                return NULL;
        if (!udev_device->info_loaded)
-               udev_device_load_info(udev_device);
+               device_load_info(udev_device);
        return udev_device->devnode;
 }
 
@@ -739,7 +739,7 @@ struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *
        if (udev_device == NULL)
                return NULL;
        if (!udev_device->info_loaded)
-               udev_device_load_info(udev_device);
+               device_load_info(udev_device);
        return udev_list_get_entry(&udev_device->devlinks_list);
 }
 
@@ -766,7 +766,7 @@ struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device
        if (udev_device == NULL)
                return NULL;
        if (!udev_device->info_loaded)
-               udev_device_load_info(udev_device);
+               device_load_info(udev_device);
        if (!udev_device->devlinks_uptodate) {
                char symlinks[UTIL_PATH_SIZE];
                struct udev_list_entry *list_entry;
@@ -804,7 +804,7 @@ dev_t udev_device_get_devnum(struct udev_device *udev_device)
        if (udev_device == NULL)
                return makedev(0, 0);
        if (!udev_device->info_loaded)
-               udev_device_load_info(udev_device);
+               device_load_info(udev_device);
        return udev_device->devnum;
 }
 
@@ -1154,7 +1154,7 @@ int udev_device_set_timeout(struct udev_device *udev_device, int timeout)
 int udev_device_get_event_timeout(struct udev_device *udev_device)
 {
        if (!udev_device->info_loaded)
-               udev_device_load_info(udev_device);
+               device_load_info(udev_device);
        return udev_device->event_timeout;
 }
 
@@ -1190,7 +1190,7 @@ int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum)
 int udev_device_get_num_fake_partitions(struct udev_device *udev_device)
 {
        if (!udev_device->info_loaded)
-               udev_device_load_info(udev_device);
+               device_load_info(udev_device);
        return udev_device->num_fake_partitions;
 }
 
@@ -1203,7 +1203,7 @@ int udev_device_set_num_fake_partitions(struct udev_device *udev_device, int num
 int udev_device_get_devlink_priority(struct udev_device *udev_device)
 {
        if (!udev_device->info_loaded)
-               udev_device_load_info(udev_device);
+               device_load_info(udev_device);
        return udev_device->devlink_priority;
 }
 
@@ -1216,7 +1216,7 @@ int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio)
 int udev_device_get_ignore_remove(struct udev_device *udev_device)
 {
        if (!udev_device->info_loaded)
-               udev_device_load_info(udev_device);
+               device_load_info(udev_device);
        return udev_device->ignore_remove;
 }
 
index 5d6b94bf5b7f48e2bf3cba823319e6976b5a4c0b..2f8b8259b5ffa7d07e4846fe6c18b536d873102b 100644 (file)
@@ -63,7 +63,7 @@ extern struct udev_list_entry *udev_device_add_property(struct udev_device *udev
 extern struct udev_list_entry *udev_device_add_property_from_string(struct udev_device *udev_device, const char *property);
 extern char **udev_device_get_properties_envp(struct udev_device *udev_device);
 extern ssize_t udev_device_get_properties_monitor_buf(struct udev_device *udev_device, const char **buf);
-extern void udev_device_load_info(struct udev_device *udev_device);
+extern int udev_device_read_db(struct udev_device *udev_device);
 extern int udev_device_read_uevent_file(struct udev_device *udev_device);
 extern int udev_device_set_action(struct udev_device *udev_device, const char *action);
 extern int udev_device_set_driver(struct udev_device *udev_device, const char *driver);
index 1c640cf37d32b40bd2b5fa6bd5375c32c2054070..fe579b49c7f7065d4b1c9a827e785468a3e973eb 100644 (file)
@@ -585,8 +585,10 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules)
 
                /* read current database entry */
                dev_old = udev_device_new_from_syspath(event->udev, udev_device_get_syspath(dev));
-               if (dev_old != NULL)
-                       udev_device_load_info(dev_old);
+               if (dev_old != NULL) {
+                       udev_device_read_db(dev_old);
+                       udev_device_set_info_loaded(dev_old);
+               }
 
                /* update database, create node and symlinks */
                udev_device_update_db(dev);
@@ -642,7 +644,8 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules)
        /* remove device node */
        if (major(udev_device_get_devnum(dev)) != 0 && strcmp(udev_device_get_action(dev), "remove") == 0) {
                /* import database entry and delete it */
-               udev_device_load_info(dev);
+               udev_device_read_db(dev);
+               udev_device_set_info_loaded(dev);
                udev_device_delete_db(dev);
 
                if (udev_device_get_devnode(dev) == NULL) {