On Sat, Sep 04, 2004 at 02:54:33AM +0200, Greg KH wrote: > > How about you just add the ability to send hotplug calls across netlink? > Make it so the kobject_hotplug() function does both the exec() call, and > a netlink call (based on a config option for those people who like to > configure such stuff.) > > That way, programs who want to listen to netlink messages to get hotplug > events do so, and so does programs who want to do the /etc/hotplug.d/ > type of notification? > > Oh, and attributes. How about we just change kobject_hotplug() to be: > int kobject_hotplug(const char *action, struct kobject *kobj, struct attribute *attr); > and if we set attr to be a valid pointer, we make the DEVPATH paramater > contain the attribute name at the end of it. If we add this to the kobject_hotplug function, how do we prevent the execution of /sbin/hotplug for ksets that have positive hotplug filters? So I've created a new function for now: int kobj_notify(const char *signal, struct kobject *kobj, struct attribute *attr) which can be used from the subsystems. This function is also called for the normal /sbin/hotplug event. (The subsystems may provide a additional environment for the /sbin/hotplug events, this is ignored by now.) Here is the debug output of a simple listener, while inserting a USB-memory-stick, mounting, unmounting and removing it: [root@pim kdbusd]# ./kdbusd main: [1094349091] 'add' from '/org/kernel/devices/pci0000:00/0000:00:1d.1/usb3/3-1' main: [1094349091] 'add' from '/org/kernel/devices/pci0000:00/0000:00:1d.1/usb3/3-1/3-1:1.0' main: [1094349091] 'add' from '/org/kernel/class/scsi_host/host2' main: [1094349091] 'add' from '/org/kernel/devices/pci0000:00/0000:00:1d.1/usb3/3-1/3-1:1.0/host2/2:0:0:0' main: [1094349091] 'add' from '/org/kernel/block/sda' main: [1094349091] 'add' from '/org/kernel/class/scsi_device/2:0:0:0' main: [1094349091] 'add' from '/org/kernel/class/scsi_generic/sg0' main: [1094349092] 'add' from '/org/kernel/block/sda/sda1' main: [1094349094] 'claim' from '/org/kernel/block/sda/sda1' main: [1094349101] 'release' from '/org/kernel/block/sda/sda1' main: [1094349106] 'remove' from '/org/kernel/class/scsi_generic/sg0' main: [1094349106] 'remove' from '/org/kernel/class/scsi_device/2:0:0:0' main: [1094349106] 'remove' from '/org/kernel/block/sda/sda1' main: [1094349106] 'remove' from '/org/kernel/block/sda' main: [1094349106] 'remove' from '/org/kernel/devices/pci0000:00/0000:00:1d.1/usb3/3-1/3-1:1.0/host2/2:0:0:0' main: [1094349106] 'remove' from '/org/kernel/class/scsi_host/host2' main: [1094349106] 'remove' from '/org/kernel/devices/pci0000:00/0000:00:1d.1/usb3/3-1/3-1:1.0' main: [1094349106] 'remove' from '/org/kernel/devices/pci0000:00/0000:00:1d.1/usb3/3-1' Thanks, Kay