summaryrefslogtreecommitdiff
path: root/udev_node.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2006-04-12 22:08:05 +0200
committerKay Sievers <kay.sievers@suse.de>2006-04-12 22:08:05 +0200
commitff9a488d8c559a2ee40e522cdc68b750670711e4 (patch)
treebe773a20aff7ccbae7ef8cc9b6e2cab33d3e27ad /udev_node.c
parent00a074480e4ab15e61f13f8791015fa0befcadce (diff)
remove old symlinks before creating current ones
This will prevent incorrect symlinks when a filesystem label is changed and the event is triggered again from sysfs.
Diffstat (limited to 'udev_node.c')
-rw-r--r--udev_node.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/udev_node.c b/udev_node.c
index 9d6e89cfa1..d2889a329e 100644
--- a/udev_node.c
+++ b/udev_node.c
@@ -90,7 +90,7 @@ exit:
return retval;
}
-int udev_node_add(struct udevice *udev)
+int udev_node_add(struct udevice *udev, struct udevice *udev_old)
{
char filename[PATH_SIZE];
struct name_entry *name_loop;
@@ -226,15 +226,12 @@ exit:
return retval;
}
-int udev_node_remove(struct udevice *udev)
+void udev_node_remove_symlinks(struct udevice *udev)
{
char filename[PATH_SIZE];
- char partitionname[PATH_SIZE];
struct name_entry *name_loop;
struct stat stats;
int retval;
- int i;
- int num;
if (!list_empty(&udev->symlink_list)) {
char symlinks[512] = "";
@@ -266,6 +263,17 @@ int udev_node_remove(struct udevice *udev)
if (symlinks[0] != '\0')
setenv("DEVLINKS", symlinks, 1);
}
+}
+
+int udev_node_remove(struct udevice *udev)
+{
+ char filename[PATH_SIZE];
+ char partitionname[PATH_SIZE];
+ struct stat stats;
+ int retval;
+ int num;
+
+ udev_node_remove_symlinks(udev);
snprintf(filename, sizeof(filename), "%s/%s", udev_root, udev->name);
filename[sizeof(filename)-1] = '\0';
@@ -288,6 +296,8 @@ int udev_node_remove(struct udevice *udev)
num = udev->partitions;
if (num > 0) {
+ int i;
+
info("removing all_partitions '%s[1-%i]'", filename, num);
if (num > 255) {
info("garbage from udev database, skip all_partitions removal");