Re: real_root_dev

From: Geert Uytterhoeven (geert@linux-m68k.org)
Date: Fri Oct 20 2000 - 15:53:41 EST


On Fri, 20 Oct 2000, Andries Brouwer wrote:
> On Thu, Oct 19, 2000 at 09:50:48PM +0200, Geert Uytterhoeven wrote:
> >
> > `real_root_dev' must be `int', not `kdev_t'.
> >
> > - if (MAJOR(real_root_dev) != RAMDISK_MAJOR
> > + if (MAJOR((kdev_t)real_root_dev) != RAMDISK_MAJOR
>
> Ach, Geert, how painful to behold!
>
> Never forget: a kdev_t is a pointer to a structure,
> and MAJOR takes a field of this structure.
> Casting an integer to a structure is ridiculous.
> There are functions to_kdev_t etc to do the conversion
> (and these may involve lookup in a hash table).

Well, that's what the _comments_ in <linux/kdev_t.h> say:

| However, for the time being we let kdev_t be almost the same as dev_t:
|
| typedef struct { unsigned short major, minor; } kdev_t;

But the actual definition is

| typedef unsigned short kdev_t;

Which is incompatible with taking the address of a kdev_t object and assuming
it has the same size as an int, which doesn't equal to any of the `admissible
operations on an object of type kdev_t', as per <linux/kdev_t.h>.

> Please keep the source as much as possible kdev_t clean.
> At some point in time, I hope 2.5.1, we must change,
> and all such cruft would have to be fixed again.

So what do you suggest to fix the bug related to sysctl of real_root_dev?
Just disable it completely?

Gr{oetje,eeting}s,

                                                Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds

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



This archive was generated by hypermail 2b29 : Mon Oct 23 2000 - 21:00:17 EST