tech-kern archive

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

Adding an ioctl to check for disklabel existence



Hey folks,

I am wondering, despite the fact that we are trying to phase out as many
uses of disklabels as fast as we can, if we should add an ioctl to the
disk devices that tells us if a label has been found.

Currently the only method to check a "blank" disk is to run

	disklabel -r $mydisk

and see it fail if no label is present. If you just ask for the label

	disklabel $mydisk

you will always get something. This happens because the kernel fakes a
"fictious" label on all disks if none is found. Now sometimes it is important
to know the difference.

So far all good. But there is a catch: some architectures have native
ways to store their partitions and no real userland support for those schemes.
The kernel converts internally from the native partitions to disklabel when
trying to read a disklabel, and sometimes even converts back on writes to the
disklabel.

This is a bit unfortunate, but back then likely was the easiest way to get
things going.

Userland, however, has no way (that I know of) to learn about such conversions.
The above recipe with "disklabel -r" will fail on such disks, as -r makes
disklabel check for a *real* disklabel and fail if there is none (and besides
arcon32, the userland disklabel binary does not know of any such magic
kernel conversion). [ side note: that acorn32 magic userland code should be
removed ]

Should we add a DIOCGDINFOREAL (or whatever we name it) disk ioctl that
returns the disklabel, but additionaly a flag indication if it is
fictious, real or generated from some other representation?

Or just extend and version DIOCGDINFO to provide that flag word in addition
to the disklabel?

Third alternative is to do nothing. The code where I ran into this in
sysinst can be fixed differently (and very localy in sysinst code).


Opinions?

Martin


Home | Main Index | Thread Index | Old Index