From 1f084fe5811ce251d516a8022f8c7c27d0ef1f53 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 13 Apr 2010 08:52:48 +0200 Subject: remove "all_partitions" option We can not predict the major/minor of non-existing devices: $ grep . /sys/class/block/sd*/dev /sys/class/block/sda1/dev:259:524288 /sys/class/block/sda2/dev:259:262144 /sys/class/block/sda3/dev:259:786432 /sys/class/block/sda4/dev:259:131072 /sys/class/block/sda/dev:259:0 /sys/class/block/sdb/dev:259:655360 /sys/class/block/sdc/dev:259:393216 If this functionality is still needed for some broken hardware, it needs to be solved with a tool not part of the udev package. Because such option is unreliable and unsafe to use. --- udev/udev-node.c | 35 ----------------------------------- 1 file changed, 35 deletions(-) (limited to 'udev/udev-node.c') diff --git a/udev/udev-node.c b/udev/udev-node.c index 3b4eb5f00b..4492c2e393 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -365,8 +365,6 @@ void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) { struct udev *udev = udev_device_get_udev(dev); - int i; - int num; struct udev_list_entry *list_entry; int err = 0; @@ -380,23 +378,6 @@ int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) goto exit; } - /* create all_partitions if requested */ - num = udev_device_get_num_fake_partitions(dev); - if (num > 0) { - info(udev, "creating device partition nodes '%s[1-%i]'\n", udev_device_get_devnode(dev), num); - for (i = 1; i <= num; i++) { - char partitionname[UTIL_PATH_SIZE]; - dev_t part_devnum; - - snprintf(partitionname, sizeof(partitionname), "%s%d", - udev_device_get_devnode(dev), i); - partitionname[sizeof(partitionname)-1] = '\0'; - part_devnum = makedev(major(udev_device_get_devnum(dev)), - minor(udev_device_get_devnum(dev)) + i); - udev_node_mknod(dev, partitionname, part_devnum, mode, uid, gid); - } - } - /* create/update symlinks, add symlinks to name index */ udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) { if (udev_list_entry_get_flags(list_entry)) @@ -414,10 +395,8 @@ int udev_node_remove(struct udev_device *dev) struct udev *udev = udev_device_get_udev(dev); struct udev_list_entry *list_entry; const char *devnode; - char partitionname[UTIL_PATH_SIZE]; struct stat stats; int err = 0; - int num; /* remove/update symlinks, remove symlinks from name index */ udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) @@ -451,20 +430,6 @@ int udev_node_remove(struct udev_device *dev) udev_device_unref(dev_check); } - num = udev_device_get_num_fake_partitions(dev); - if (num > 0) { - int i; - - info(udev, "removing all_partitions '%s[1-%i]'\n", devnode, num); - if (num > 255) - return -1; - for (i = 1; i <= num; i++) { - snprintf(partitionname, sizeof(partitionname), "%s%d", devnode, i); - partitionname[sizeof(partitionname)-1] = '\0'; - util_unlink_secure(udev, partitionname); - } - } - util_delete_path(udev, devnode); return err; } -- cgit v1.2.3-54-g00ecf