From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kay Sievers Date: Wed, 03 Nov 2004 23:39:59 +0000 Subject: put "device" symlink into hotplug environment? Message-Id: <20041103233959.GA17546@vrfy.org> MIME-Version: 1 Content-Type: multipart/mixed; boundary="vkogqOf2sHV7VnPd" List-Id: To: linux-hotplug@vger.kernel.org --vkogqOf2sHV7VnPd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi Greg, what if we put the sysfs path of the physical device into the hotplug environment? All virtual devices will not have the key. This would solve all the wait for the "device" link issues and we can throw away one of the exception lists as the kernel will tell us if it is going to create a symlink. I get hotplug events like this now: physical backed device: ACTION=add SUBSYSTEM=net DEVPATH=/class/net/eth0 DEVSYSDEV=/devices/pci0000:00/0000:00:1e.0/0000:02:01.0 INTERFACE=eth0 SEQNUM=966 PATH=/sbin:/bin:/usr/sbin:/usr/bin HOME=/ virtual: ACTION=add SUBSYSTEM=net DEVPATH=/class/net/dummy0 INTERFACE=dummy0 SEQNUM=977 PATH=/sbin:/bin:/usr/sbin:/usr/bin HOME=/ The current patch is only for class-devices block-devices are not covered. Thanks, Kay --vkogqOf2sHV7VnPd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline; filename="kernel-DEVSYSDEV-01.patch" ===== drivers/base/class.c 1.54 vs edited ===== --- 1.54/drivers/base/class.c 2004-10-08 20:32:52 +02:00 +++ edited/drivers/base/class.c 2004-11-04 00:23:56 +01:00 @@ -283,8 +283,27 @@ static int class_hotplug(struct kset *ks { struct class_device *class_dev = to_class_dev(kobj); int retval = 0; + int i = 0; + int length = 0; pr_debug("%s - name = %s\n", __FUNCTION__, class_dev->class_id); + + if (class_dev->dev) { + /* add physical device backing this class to environment */ + char *dev = kobject_get_path(&class_dev->dev->kobj, GFP_KERNEL); + + add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, + &length, "DEVSYSDEV=%s", dev); + kfree(dev); + + /* terminate, set to next free slot, shrink available space */ + envp[i] = NULL; + envp = &envp[i]; + num_envp -= i; + buffer = &buffer[length]; + buffer_size -= length; + } + if (class_dev->class->hotplug) { /* have the bus specific function add its stuff */ retval = class_dev->class->hotplug (class_dev, envp, num_envp, --vkogqOf2sHV7VnPd-- ------------------------------------------------------- This SF.Net email is sponsored by: Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux. http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel