Re: struct class question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/29/05 18:01, James Bottomley wrote:
>>Thus we get the pretty flat sysfs class hierarchy:
>>/sys/class/<if>/<device>
> 
> That's by design.  The class contains a list of all the devices
> implementing the interface.

Ok, makes sense.

> Interface (class) is tied to struct device.  If it doesn't have a struct
> device, then it can't have a class and isn't a proper sysfs leaf.  If

Makes sense.

> the device doesn't exist or it can't be directly controlled, then we
> probably don't need a class for it, right?  As to whether it needs to

Yes, we don't need a struct device and/or struct class_device for it.

> exist at all if we can't do anything with it, I suppose that depends on
> whether it's necessary to the tree representation or not (a bit like
> channels in SCSI.  They have meaning, but no sysfs representation on
> their own).

Very good analogy.  In this respect I think we should represent
phys, ports, and expanders just as the discover process sees them,
in the same way, as you pointed out, channels are represented
even though the do not quite exist (but are an abstraction).

>>/sys/class/sas/
>>/sys/class/sas/ha0/
>>/sys/class/sas/ha1/
>>/sys/class/sas/ha1/phys/
>>/sys/class/sas/ha1/ports/
>>etc.
> 
> 
> No, this is where you go wrong.  The sysfs tree exists under the host<n>
> for scsi (and is parented to the PCI/etc device), so you can have
> something like
> 
> .../host1/
> .../host1/phys/
> .../host1/ports/

Is this

/sys/class/scsi_host/host1

Or is it (e.g.),

/sys/devices/pci0000:00/0000:00:1f.2/host1

?

> (and obviously you need to know where you're putting the targets under
> this).

True.

> So the rich deep tree is under devices and the class tree represents a
> flat look into that for devices implementing the specific interface.

In which case the flat class/ wouldn't represent phys, ports and expanders
as they do not have struct device/struct class_device; and not directly
controlled by the kernel;  just as "channel".

	Luben

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux