Re: Flaw in the driver-model implementation of attributes

Alan Stern (stern@rowland.harvard.edu)
Mon, 16 Jun 2003 15:36:09 -0400 (EDT)


On Mon, 16 Jun 2003, Russell King wrote:

> Have you noticed the two symlinks which are created from the class
> device. For example:
>
> /sysfs/class/pcmcia_socket/
> |-- pcmcia_socket0
> | |-- device -> ../../../devices/pci0/0000:00:01.0
> | |-- driver -> ../../../bus/pci/drivers/yenta_cardbus
> | `-- status
> `-- pcmcia_socket1
> |-- device -> ../../../devices/pci0/0000:00:01.1
> |-- driver -> ../../../bus/pci/drivers/yenta_cardbus
> `-- status
>
> This means you can access the physical device attributes using (eg):
> /sysfs/class/pcmcia_socket/pcmcia_socket0/device/resource
> the driver attributes:
> /sysfs/class/pcmcia_socket/pcmcia_socket0/driver/...
> and the class attributes:
> /sysfs/class/pcmcia_socket/pcmcia_socket0/...
>
> You don't have to try to work out where in /sys/bus and /sys/devices the
> driver and device respectively are - that's already done for you.

This doesn't provide any really good place to put device attributes that
are owned by the driver. They can't go in
/sysfs/class/pcmcia_socket/pcmcia_socket0/device/...
because the driver doesn't own the device. They can't go in
/sysfs/class/pcmcia_socket/pcmcia_socket0/driver/...
because they aren't attributes of the _driver_, they're attributes of the
_device_. And they certainly aren't class attributes.

So where would you put them? You'd have to create another subdirectory of
/sysfs/class/pcmcia_socket/pcmcia_socket0/
owned by the driver. No really good name for this subdirectory spings
to mind, and it's still kind of awkward. But doable.

Alan Stern

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