diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2007-03-17 10:08:25 +0100 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2007-03-17 10:08:25 +0100 |
commit | 31de3a2ba18ffa011f5054016ccc4a500cbe0cc3 (patch) | |
tree | f945058d7aad9cbe45fba6e496c73d948255e729 /udev_device.c | |
parent | d7fdcd61927e9439ad7079bb0967e0b6edac7646 (diff) |
read list of devices from index, make index private to database
Diffstat (limited to 'udev_device.c')
-rw-r--r-- | udev_device.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/udev_device.c b/udev_device.c index daf94a5772..4cd5526dea 100644 --- a/udev_device.c +++ b/udev_device.c @@ -33,11 +33,10 @@ #include "udev_rules.h" -struct udevice *udev_device_init(void) +struct udevice *udev_device_init(struct udevice *udev) { - struct udevice *udev; - - udev = malloc(sizeof(struct udevice)); + if (udev == NULL) + udev = malloc(sizeof(struct udevice)); if (udev == NULL) return NULL; memset(udev, 0x00, sizeof(struct udevice)); @@ -162,8 +161,8 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) goto exit; } - /* read current database entry, we may need to cleanup */ - udev_old = udev_device_init(); + /* read current database entry; cleanup, if it is known device */ + udev_old = udev_device_init(NULL); if (udev_old != NULL) { if (udev_db_get_device(udev_old, udev->dev->devpath) == 0) { info("device '%s' already in database, cleanup", udev->dev->devpath); @@ -241,7 +240,7 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) if (major(udev->devt) != 0 && strcmp(udev->action, "remove") == 0) { struct name_entry *name_loop; - /* import and delete database entry */ + /* import database entry, and delete it */ if (udev_db_get_device(udev, udev->dev->devpath) == 0) { udev_db_delete_device(udev); if (udev->ignore_remove) { |