Re: [patch] convert the scsi layer to use struct device

James Bottomley
2008-03-17T13:55:55Z

On Mon, 2008-03-17 at 14:40 +0100, Kay Sievers wrote:
> On Mon, 2008-03-17 at 08:18 -0400, James Smart wrote:
> > Greg KH wrote:
> > > I take it you haven't even looked at how !SYSFS_DEPRECATED works today,
> > > have you? Try it and you will see that the namespace issue has been
> > > taken care of a long time ago :)
> >
> > You are right... but I would assume it can be answered without pushing
> > someone back into the internals of the code to figure it out.
>
> Oh, I already answered it in an earlier mail :)
> "these links don't exist with !SYSFS_DEPRECATED, because the
> class devices live in subdirectories, named after the class
> they come from, there is no namespace problem"
>
> This is how a LUN looks now:
> tree /sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host13/target13:0:0/13:0:0:0/
> /sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host13/target13:0:0/13:0:0:0/
> |-- block
> | `-- sdb
> | |-- subsystem -> ../../../../../../../../../../../class/block
>
> | |-- sdb1
> | | |-- subsystem -> ../../../../../../../../../../../../class/block
>
> | |-- sdb2
> | | |-- subsystem -> ../../../../../../../../../../../../class/block
>
> |-- bsg
> | `-- 13:0:0:0
> | |-- subsystem -> ../../../../../../../../../../../class/bsg
>
> |-- scsi_disk
> | `-- 13:0:0:0
> | |-- subsystem -> ../../../../../../../../../../../class/scsi_disk
>
> |-- scsi_generic
> | `-- sg2
> | |-- subsystem -> ../../../../../../../../../../../class/scsi_generic
>

So the real answer is that the backlink <class>:<class device> becomes
the directory hierarchy <class>/<class device>.

The uniqueness is hopefully solved essentially because the <class> name
has to be unique. As long as there's no clash with the actual device
property names (not necessarily a given) we're fine.

I suppose it means we have to be a bit more careful about sysfs device
file names from now on.

James