public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] subclasses in sysfs to solve world peace
@ 2005-09-16  0:20 Greg KH
  2005-09-16  0:58 ` Dmitry Torokhov
                   ` (2 more replies)
  0 siblings, 3 replies; 27+ messages in thread
From: Greg KH @ 2005-09-16  0:20 UTC (permalink / raw)
  To: Dmitry Torokhov, linux-kernel, Kay Sievers, Vojtech Pavlik,
	Hannes Reinecke, Patrick Mochel, airlied

Ok, first off, I hate talking about architecture changes without showing
the code for what I am talking about first, but as this is an issue that
needs to be agreed upon by a wide range of developers, I'll just write
up what I am thinking about doing before actually doing it...

The problem:  We need a way to show complex class and class device
structures properly in sysfs.  Examples of these "complex" views are the
input layer's use of different input drivers for devices (usually the
same device), the video subsystem view of frame buffer devices and
monitors, and even the block layer with it's disks and partitions.

Proposed solutions in the past have been either add the ability to nest
classes themselves (as shown in Dmitry's recent proposal for fixing the
input layer), or add the ability to nest class_device structures (I
think others have tried to do this in the past, sorry for not
remembering the specifics.)  Both of these proposals don't really solve
the real problem, that of the fact that we need to come up with a
solution that all of the different subsystems can use properly.

So, here's my take on it.  Feel free to tell me what I messed up :)

I would like to add something called "subclasses" for lack of a better
term.  These subclasses would have both drivers, and devices associated
with them.  This would show up as the following tree of directories:

	/sys/class/input/
	|-- input0
	|   |-- event0
	|   `-- mouse0
	|-- input1
	|   |-- event1
	|   `-- ts0
	|-- mice
	`-- drivers
	    |-- event
	    |-- mouse
	    `-- ts

Here we have 3 struct class_devices like today, input0, input1, and
mice.  We also have struct subclass_drivers of event, mouse, and ts.
These will create the struct subclass_devices event0, mouse0, event1,
and ts0.  The "dev" node files will show up in the directories mice,
event0, mouse0, event1, and ts0, like you would expect them too.

So, this lets us create a solution for the input subsystem, but will it
also work for block and video?

For block, yes, I think so.  There is no requirement for a
subclass_driver to create the subclass devices.  Any code can create and
register with the class core a subclass device, just set up the parent
pointer and away you go.  So, in the following instance:
	/sys/class/block/
	`-- sda
	    |-- sda1
	    |-- sda2
	    `-- sda3

"block" would represent the struct class.
"sda" would represent the struct class_device.
"sda1", "sda2", and "sda3" would represent the different subclass
devices that are bound to the class device "sda".

And yes, before you all point out the class_interface logic, yes, the
subclass_driver stuff looks a lot like this idea.  Possibly we could
just get rid of the interface stuff and use the subclass_driver logic,
but I'd have to look at how people are using the interface logic before
I can give a confident answer about that.

Hotplug events would be simple with this scheme, the class stuff would
remain the same, and the devpath would just point to the subdir (hotplug
events would happen for both the class devices and the subclass
devices.)  And yes, udev and libsysfs would have to be changed to
support this, so we better get this right before pushing it out to the
world...

But, what about video devices?  David and Pat, we talked about this at
OLS, but Pat kept the paper we drew on, and the beer we were drinking at
the time has made my memory a bit fuzzy as to all of your requirements
for the video subsystem.  I remember things about frame buffers and
monitors and other things like that, but nothing specific, sorry.  Could
you outline your needs and I'll see if this proposed structure would
solve your issues?

Well, that was a very brief summary, of which I know there are lots of
questions for the areas I didn't explain well enough.  Comments?
Criticisms?  Want to see the code before commenting?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 27+ messages in thread
* Re: [RFC] subclasses in sysfs to solve world peace
@ 2005-09-16  1:45 David Lang
  0 siblings, 0 replies; 27+ messages in thread
From: David Lang @ 2005-09-16  1:45 UTC (permalink / raw)
  To: linux-kernel

Lee Revell wrote

> BTW the rate of kernel development is just insane these days, even
> compared to a year ago. It's quite encouraging. At this rate we're
> going to leave the "competition" in the dust.

no kidding, it wasn't that long ago that complete rc patches were just a 
couple meg, now the rc patch _changelog_ is 1.4MB

I know, part of this is due to the 'merge it all in the first two weeks' 
approach, but even so WOW!!

David Lang
-- 
There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies.
  -- C.A.R. Hoare

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2005-09-17  0:48 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-16  0:20 [RFC] subclasses in sysfs to solve world peace Greg KH
2005-09-16  0:58 ` Dmitry Torokhov
2005-09-16  1:46   ` Kay Sievers
2005-09-16  1:58     ` Dmitry Torokhov
2005-09-16 21:54   ` Greg KH
2005-09-16  1:04 ` Kay Sievers
2005-09-16  1:23   ` Dmitry Torokhov
2005-09-16  1:54     ` Kay Sievers
2005-09-16  2:03       ` Dmitry Torokhov
2005-09-16  2:14         ` Kay Sievers
2005-09-16  2:36           ` Dmitry Torokhov
2005-09-16  2:43             ` Kay Sievers
2005-09-16  3:10               ` Dmitry Torokhov
2005-09-16  7:21               ` Dmitry Torokhov
2005-09-16 21:48                 ` Greg KH
2005-09-16 22:55                   ` Dmitry Torokhov
2005-09-16  8:02     ` Vojtech Pavlik
2005-09-16 15:44       ` Dmitry Torokhov
2005-09-16 21:50         ` Greg KH
2005-09-16 22:56           ` Dmitry Torokhov
2005-09-17  0:48           ` Dave Airlie
2005-09-16 21:49     ` Greg KH
2005-09-16  7:59   ` Vojtech Pavlik
2005-09-16 21:55   ` Greg KH
2005-09-16 22:45     ` Dmitry Torokhov
2005-09-17  0:20 ` Antonino A. Daplas
  -- strict thread matches above, loose matches on Subject: below --
2005-09-16  1:45 David Lang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox