[cgl_discussion] Re: parenting of devices

Patrick Mochel mochel at osdl.org
Wed Jul 9 12:40:44 PDT 2003


> It is true that one level of parenting is not particularly useful. It is 
> desireable to know, however, that a scsi disk is connected to a 
> particular fibre channel adaptor, and that fibre channel adaptor has a 
> host IEEE ID which is unique (even if positions change). It is also 
> desireable to know that a cdrom is attached to a USB device instead of a 
> SCSI device for the execution of policy methods.

The device path is already there and easily obtainable. When a device is 
inserted, /sbin/hotplug is called to notify userspace of the insertion. 
The device path is passed, but this call is largely useless WRT naming.

When the device is registered with its class(es), /sbin/hotplug is called 
again with the path to the class object in sysfs. Within that class 
directory should be a symlink that points to the device's physical 
directory. From this symlink, the physical path of the device can be 
derived (since the symlinks are made by traversing the parent objects to 
the root). 

All the pieces should be there, with the exception of a unique identifier 
for a device in the form of an attribute. But these, as you mentioned, can 
be obtained via other means for the time being.

Will this work for you? 


	-pat






More information about the cgl_discussion mailing list