Skip to contentSkip to conversation

/sys/block vs. /sys/class/block

DISCUSSION Benjamin Herrenschmidt 8 participants 15 messages Dec 20, 2004 – Jan 6, 2005

lore
Share & tools
lore
#0 lore raw

I'm trying to understand why we have /sys/block instead
of /sys/class/block, and so far, I haven't found a single good argument justifying it... It just messes up the so far logical layout of sysfs for no apparent reason.

I also didn't find where /sys/block is created, but that's maybe because I didn't search too hard :) So I'm not coming up with a patch yet, but unless somebody can convince me it should stay here, I'll do so soon.

If the reason not to fix it is backward compatibility, then that would really be a shame we managed already to turn the brand new sysfs into a mess with no hope of fixing it... If there is really a problem there, maybe we could move it and keep a compat symlink for a few kernel revs... ?

Ben.

#1 lore raw
Quoted 9 lines · Benjamin Herrenschmidt

I'm trying to understand why we have /sys/block instead
of /sys/class/block, and so far, I haven't found a single good argument justifying it... It just messes up the so far logical layout of sysfs for no apparent reason.

I also didn't find where /sys/block is created, but that's maybe because I didn't search too hard :) So I'm not coming up with a patch yet, but unless somebody can convince me it should stay here, I'll do so soon.

Quoted 6 lines

If the reason not to fix it is backward compatibility, then that would really be a shame we managed already to turn the brand new sysfs into a mess with no hope of fixing it... If there is really a problem there, maybe we could move it and keep a compat symlink for a few kernel revs... ?

Seems like that's where it belongs.

The reason why it is in /sys/block is because it is apparently a "subsystem", and using decl_subsys - drivers/block/genhd.c

Nick

#2 lore raw
Quoted 5 lines

Seems like that's where it belongs.

The reason why it is in /sys/block is because it is apparently a "subsystem", and using decl_subsys - drivers/block/genhd.c

I'm not convinced ... If you look at how /sys is organized, it really doesn't make any sense ... block devives are really devices of "class block", wether we have a block "subsystem" in there is irrelevant imho.

Ben.

#3 lore raw
Quoted 10 lines · Benjamin Herrenschmidt
Quoted 4 lines

Seems like that's where it belongs.

The reason why it is in /sys/block is because it is apparently a "subsystem", and using decl_subsys - drivers/block/genhd.c

I'm not convinced ... If you look at how /sys is organized, it really doesn't make any sense ... block devives are really devices of "class block", wether we have a block "subsystem" in there is irrelevant imho.

Sorry to be unclear: I was agreeing with you ;)

I was just pointing out that the reason it is currently /sys/block is that decl_subsys call.

#4 lore raw
Quoted 13 lines · Nick Piggin
Quoted 11 lines · Benjamin Herrenschmidt
Quoted 5 lines

Seems like that's where it belongs.

The reason why it is in /sys/block is because it is apparently a "subsystem",
and using decl_subsys - drivers/block/genhd.c

I'm not convinced ... If you look at how /sys is organized, it really doesn't make any sense ... block devives are really devices of "class block", wether we have a block "subsystem" in there is irrelevant imho.

Quoted 4 lines

Sorry to be unclear: I was agreeing with you ;)

I was just pointing out that the reason it is currently /sys/block is that decl_subsys call.

Ditto, the question is how to move it with as little pain as possible... I think the symlink approach would be fine.

Signature · 1 line
Jens Axboe
#5 lore raw
Quoted 2 lines

Ditto, the question is how to move it with as little pain as possible... I think the symlink approach would be fine.

Wow.. I don't even have /sys/class/block (2.6.9-rc2)

Jan Engelhardt

Signature · 1 line
ENOSPC
#6 lore raw

(please follow list etiquette, don't trim cc lists)

Quoted 4 lines · Jan Engelhardt
Quoted 2 lines

Ditto, the question is how to move it with as little pain as possible... I think the symlink approach would be fine.

Wow.. I don't even have /sys/class/block (2.6.9-rc2)

That is Ben's point, it is currently misplaced.

Signature · 1 line
Jens Axboe
#7 lore raw
In reply to Benjamin Herrenschmidt
Quoted 4 lines · Benjamin Herrenschmidt

I'm trying to understand why we have /sys/block instead
of /sys/class/block, and so far, I haven't found a single good argument justifying it... It just messes up the so far logical layout of sysfs for no apparent reason.

Because /sys/block happened before /sys/class did. Al Viro converted the block layer before I got the struct class stuff working properly during 2.5.

And yes, I would like to convert the block layer to use the class stuff, but for right now, I can't as class devices don't allow sub-classes-devices, and getting to that work is _way_ down on my list of things to do.

thanks,

greg k-h

#8 lore raw
Quoted 6 lines · Greg KH
Quoted 4 lines · Benjamin Herrenschmidt

I'm trying to understand why we have /sys/block instead
of /sys/class/block, and so far, I haven't found a single good argument justifying it... It just messes up the so far logical layout of sysfs for no apparent reason.

Quoted 8 lines

Because /sys/block happened before /sys/class did. Al Viro converted the block layer before I got the struct class stuff working properly during 2.5.

And yes, I would like to convert the block layer to use the class stuff, but for right now, I can't as class devices don't allow sub-classes-devices, and getting to that work is _way_ down on my list of things to do.

but can't we at least artificially move it down to /sys/class anyway for the sake of a sane userland API ?

Ben.

#9 lore raw
Quoted 11 lines · Benjamin Herrenschmidt
Quoted 10 lines · Greg KH
Quoted 4 lines · Benjamin Herrenschmidt

I'm trying to understand why we have /sys/block instead
of /sys/class/block, and so far, I haven't found a single good argument justifying it... It just messes up the so far logical layout of sysfs for no apparent reason.

Because /sys/block happened before /sys/class did. Al Viro converted the block layer before I got the struct class stuff working properly during 2.5.

Quoted 7 lines
Quoted 4 lines

And yes, I would like to convert the block layer to use the class stuff, but for right now, I can't as class devices don't allow sub-classes-devices, and getting to that work is _way_ down on my list of things to do.

but can't we at least artificially move it down to /sys/class anyway for the sake of a sane userland API ?

Just as a note, libsysfs treats /sys/block as a class, as if under /sys/class. We felt that's where it belonged and that's where it will end up.... eventually.

Thanks,

Dan

#10 lore raw
In reply to Benjamin Herrenschmidt
Quoted 5 lines · On Tue, 21 Dec 2004 08:07:50 +0100 Benjamin Herrenschmidt…
Quoted 5 lines

Because /sys/block happened before /sys/class did. Al Viro converted the block layer before I got the struct class stuff working properly during 2.5.

Quoted 7 lines
Quoted 4 lines

And yes, I would like to convert the block layer to use the class stuff, but for right now, I can't as class devices don't allow sub-classes-devices, and getting to that work is _way_ down on my list of things to do.

but can't we at least artificially move it down to /sys/class anyway for the sake of a sane userland API ?

Can I then make the obvious suggestion: add a symlink in /sys/class linking to /sys/block and then reverse the symink once the above work has been done and /sys/class/block has been created?

Or is that too gross? :-)

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
#11 lore raw
Quoted 11 lines · Stephen Rothwell
Quoted 10 lines · On Tue, 21 Dec 2004 08:07:50 +0100 Benjamin Herrenschmidt…
Quoted 9 lines

Because /sys/block happened before /sys/class did. Al Viro converted the block layer before I got the struct class stuff working properly during 2.5.

And yes, I would like to convert the block layer to use the class stuff, but for right now, I can't as class devices don't allow sub-classes-devices, and getting to that work is _way_ down on my list of things to do.

Quoted 8 lines
Quoted 2 lines

but can't we at least artificially move it down to /sys/class anyway for the sake of a sane userland API ?

Can I then make the obvious suggestion: add a symlink in /sys/class linking to /sys/block and then reverse the symink once the above work has been done and /sys/class/block has been created?

Or is that too gross? :-)

It is gross.

But I guess I should ask, who really cares about this, so late in the sysfs structure game? Is /sys/block/ really a big problem for anyone? And if it is, I'd much rather someone make the required driver core changes to fix this up properly, than just put a symlink to paper over some userspace issue.

And as Dan said, libsysfs already handles /sys/block just like any other class structure, so a "sane" userland API already exists that fixes this issue for you.

thanks,

greg k-h

#12 lore raw

On Tue, Dec 21, 2004 at 10:20:57PM -0800, Greg KH wrote:

[snip]

Quoted 1 line

It is gross.

Indeed.

Quoted 5 lines

But I guess I should ask, who really cares about this, so late in the sysfs structure game? Is /sys/block/ really a big problem for anyone? And if it is, I'd much rather someone make the required driver core changes to fix this up properly, than just put a symlink to paper over some userspace issue.

Maybe because *for once* it'd be nice to actually have inconsistencies gotten rid of in their relative infancy instead of waiting 10 years and then having to explain them as existing only for hysterical raisins...

[snip]

Regards: David Weinehall

Signature · 3 lines
 /) David Weinehall <[email protected]> /) Northern lights wander      (\
//  Maintainer of the v2.0 kernel   //  Dance across the winter sky //
\)  http://www.acc.umu.se/~tao/    (/   Full colour fire           (/
#13 lore raw
Quoted 11 lines
Quoted 6 lines

But I guess I should ask, who really cares about this, so late in the sysfs structure game? Is /sys/block/ really a big problem for anyone? And if it is, I'd much rather someone make the required driver core changes to fix this up properly, than just put a symlink to paper over some userspace issue.

Maybe because *for once* it'd be nice to actually have inconsistencies gotten rid of in their relative infancy instead of waiting 10 years and then having to explain them as existing only for hysterical raisins...

Agreed.

Ben.

#14 lore raw
Quoted 7 lines · Benjamin Herrenschmidt
Quoted 7 lines
Quoted 6 lines

But I guess I should ask, who really cares about this, so late in the sysfs structure game? Is /sys/block/ really a big problem for anyone? And if it is, I'd much rather someone make the required driver core changes to fix this up properly, than just put a symlink to paper over some userspace issue.

Quoted 6 lines
Quoted 4 lines

Maybe because *for once* it'd be nice to actually have inconsistencies gotten rid of in their relative infancy instead of waiting 10 years and then having to explain them as existing only for hysterical raisins...

Agreed.

-ENOPATCH :)