lkml.org 
[lkml]   [2000]   [Oct]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: real_root_dev
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/

\
 
 \ /
  Last update: 2005-03-22 12:41    [W:0.117 / U:0.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site