X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=udev_node.c;h=2a30fe32223351a76ef1f594de1e9d7f48dea608;hp=9d6e89cfa12772c3dd24a8baadb188d7440a43bf;hb=d7fea966f196e2eb5cd87b5e738bd4f39878c548;hpb=a4d5ca644ed8bc59274967c17981d7448a075c07 diff --git a/udev_node.c b/udev_node.c index 9d6e89cfa..2a30fe322 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,11 @@ 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] = ""; @@ -253,10 +249,12 @@ int udev_node_remove(struct udevice *udev) } info("removing symlink '%s'", filename); - unlink(filename); + if (!udev->test_run) { + unlink(filename); - if (strchr(filename, '/')) - delete_path(filename); + if (strchr(filename, '/')) + delete_path(filename); + } strlcat(symlinks, filename, sizeof(symlinks)); strlcat(symlinks, " ", sizeof(symlinks)); @@ -266,6 +264,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 +297,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");