linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kay Sievers <kay.sievers@vrfy.org>
To: linux-hotplug@vger.kernel.org
Subject: [PATCH] apply all_partitions rule to main block device only
Date: Thu, 25 Mar 2004 00:53:28 +0000	[thread overview]
Message-ID: <20040325005328.GA28991@vrfy.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 160 bytes --]

Rules with NAME{all_partitions}= are now applied only to the parent of a
block device. We no longer need to exclude the partitions or sg* devices.

thanks,
Kay

[-- Attachment #2: 01-all_partitions.patch --]
[-- Type: text/plain, Size: 1756 bytes --]

===== namedev.c 1.136 vs edited =====
--- 1.136/namedev.c	Thu Mar 25 00:19:12 2004
+++ edited/namedev.c	Thu Mar 25 01:47:08 2004
@@ -619,8 +619,8 @@
 	 * possibly have a whitelist for these devices here...
 	 */
 	class_dev_parent = sysfs_get_classdev_parent(class_dev);
-	if (class_dev_parent) 
-		dbg("Really a partition");
+	if (class_dev_parent != NULL) 
+		dbg("given class device has a parent, use this instead");
 
 	tspec.tv_sec = 0;
 	tspec.tv_nsec = 10000000;  /* sleep 10 millisec */
@@ -628,24 +628,21 @@
 	while (loop--) {
 		if (udev_sleep)
 			nanosleep(&tspec, NULL);
+
 		if (class_dev_parent)
 			sysfs_device = sysfs_get_classdev_device(class_dev_parent);
 		else
 			sysfs_device = sysfs_get_classdev_device(class_dev);
-
 		if (sysfs_device != NULL)
 			goto device_found;
 	}
 	dbg("timed out waiting for device symlink, continuing on anyway...");
-	
+
 device_found:
         /* We have another issue with just the wait above - the sysfs part of
 	 * the kernel may not be quick enough to have created the link to the
 	 * device under the "bus" subsystem. Due to this, the sysfs_device->bus
 	 * will not contain the actual bus name :(
-	 *
-	 * Libsysfs now provides a new API sysfs_get_device_bus(), so use it
-	 * if needed
 	 */
         if (sysfs_device) {
 		if (sysfs_device->bus[0] != '\0')
@@ -828,6 +825,11 @@
 			}
 
 			if (dev->name[0] != '\0') {
+				/* apply all_partitions flag only at a main block device */
+				if (dev->partitions > 0 &&
+				    (udev->type != 'b' || udev->kernel_number[0] != '\0'))
+					continue;
+
 				info("configured rule in '%s' at line %i applied, '%s' becomes '%s'",
 				     dev->config_file, dev->config_line, udev->kernel_name, dev->name);
 				strfieldcpy(udev->name, dev->name);

             reply	other threads:[~2004-03-25  0:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-25  0:53 Kay Sievers [this message]
2004-03-27  1:21 ` [PATCH] apply all_partitions rule to main block device only Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040325005328.GA28991@vrfy.org \
    --to=kay.sievers@vrfy.org \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).