Enhancement of /proc/partitions output (2.5.1-pre5)
From: Andreas Dilger <[email protected]>
> Please consider below patch which adds the starting sector and number of > sectors to /proc/partitions.
Please do not accept as-is. This breaks the format of /proc/partitions terribly, and all of the code that looks at it (fsck, mount, etc).
Indeed.
Rather add the start_sect and nr_sects parameters _after_ the name parameter, and it will be "mostly" ok.
No. It will still break things.
While we are at it, how about adding the partition type to the output?
The present /proc/partitions has minimal content.
Its only function is to report to user space which block devices are known to the kernel. User space is unable to figure that out on its own without an unreasonable amount of probing.
But once you know what devices exist, it is very easy for user space to report all desired properties of these devices.
Do you want starting sector and size of /dev/hde4?
# hdparm -g /dev/hde4
/dev/hde4:
geometry = 70780/16/63, sectors = 1670760, start = 69673905
Adding such stuff to the kernel would be especially unfortunate if, as I did in my version of the block layer, the unit becomes byte instead of sector. We would have to change again.
Andries
Quoted 9 lines · At 11:47 01/12/01, [email protected] wrote:
From: Andreas Dilger <[email protected]>
> Please consider below patch which adds the starting sector and
number ofQuoted 1 line
sectors to
/proc/partitions.Please do not accept as-is. This breaks the format of
/proc/partitionsterribly, and all of the code that looks at it (fsck, mount, etc).
Quoted 6 lines
Indeed.
Rather add the
start_sectandnr_sectsparameters _after_ the name parameter, and it will be "mostly" ok.No. It will still break things.
Sure. I anticipated it would break things but then again it is 2.5.1-pre5 and not 2.4.x.
Quoted 7 lines
While we are at it, how about adding the partition type to the output?
The present
/proc/partitionshas minimal content.
Its only function is to report to user space which block devices are known to the kernel. User space is unable to figure that out on its own without an unreasonable amount of probing.
Quoted 5 lines
But once you know what devices exist, it is very easy for user space to report all desired properties of these devices.
Do you want starting sector and size of/dev/hde4?# hdparm -g /dev/hde4
Ah, thanks! I didn't know that one.
Quoted 6 lines
/dev/hde4:
geometry = 70780/16/63, sectors = 1670760, start = 69673905Adding such stuff to the kernel would be especially unfortunate if, as I did in my version of the block layer, the unit becomes byte instead of sector. We would have to change again.
So you are going to change it anyway at some point? We could just make the changes at the same time in that case? If it is in bytes even better. Just give start byte and length, who cares about number of blocks anyway... (-; (Yes I can see there would be a problem with distinguishing the two but that can be solved.)
This is not a performance critical piece of code and having just the size of the partition is no way near as useful as having the start of it, too. And I agree with Andreas the partition type would be useful in the display, too.
If it really is only a list of available devices why show the size in blocks at all?
Utilities will adapt. That's what Documentation/Changes is for and this is a development kernel after all.
It's just the same as fairly recently my network refused to work because my network utilities disagreed with my kernel on how to communicate with each other...
Anton
Signature · 5 lines
"I've not lost my mind. It's backed up on tape somewhere." - Unknown -- Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @) Linux NTFS Maintainer / WWW: http://linux-ntfs.sf.net/ ICQ: 8561279 / WWW: http://www-stu.christs.cam.ac.uk/~aia21/
Quoted 8 lines · On Sat, Dec 01, 2001 at 11:47:34AM +0000, [email protected] wrote:
From: Andreas Dilger <[email protected]>
> Please consider below patch which adds the starting sector and number of > sectors to
/proc/partitions.Please do not accept as-is. This breaks the format of
/proc/partitionsterribly, and all of the code that looks at it (fsck, mount, etc).
Quoted 6 lines
Indeed.
Rather add the
start_sectandnr_sectsparameters _after_ the name parameter, and it will be "mostly" ok.No. It will still break things.
Why, all fields are defined quite well. So usertools can easily get the info they need based on 'column' number. If adding extra fields at the end breaks programs I guess these tools should be fixed.
RedHat kernels already have extended /proc/partitions: the sar patches... It would ne nice to add these to the 2.5 kernel.
-Marcel
Signature · 6 lines
======-------- Marcel J.E. Mol MESA Consulting B.V.
=======--------- ph. +31-(0)6-54724868 P.O. Box 112
=======--------- [email protected] 2630 AC Nootdorp
__==== www.mesa.nl ---____U_n_i_x______I_n_t_e_r_n_e_t____ The Netherlands ____
They couldn't think of a number, Linux user 1148 -- counter.li.org
so they gave me a name! -- Rupert Hine -- www.ruperthine.comQuoted 5 lines · On Sat, 1 Dec 2001 [email protected] wrote:
The present
/proc/partitionshas minimal content.
Its only function is to report to user space which block devices are known to the kernel. User space is unable to figure that out on its own without an unreasonable amount of probing.
Quoted 8 lines
But once you know what devices exist, it is very easy for user space to report all desired properties of these devices.
Do you want starting sector and size of/dev/hde4?# hdparm -g /dev/hde4
/dev/hde4:
geometry = 70780/16/63, sectors = 1670760, start = 69673905
Really? Do you run hdparm setuid root or allow read access of hde? In any case, allowing easy access from user space via hdparm trickes me as a major security issue. The geometry is in /proc/ide/hd?/geometry, but the other info is not readily available to other than root user in most systems. I think his intention was to make it more generally available. I don't see any reason to require root to see this information, and I think reducing the need for root is a good thing for security.
It would be highly desirable to define new proc data as subject to addition of more information per line at any time, and as long as the fields are added at the end of the line a parser can easily be written not to break. As you note, changing existing information presents other problems and will break things, since /proc/partitions was not defines as extensible.
I personally would have no problem adding this to 2.5, lots of things will change, but I agree that a change to 2.4 is not practical as a retrofit.
Signature · 3 lines
bill davidsen <[email protected]> CTO, TMR Associates, Inc Doing interesting things with little computers since 1979.