Re: [PATCH] new system call mknod64

From: H. Peter Anvin (hpa@zytor.com)
Date: Tue Apr 22 2003 - 12:17:13 EST


Followup to: <20030422060013.GO16934@pegasys.ws>
By author: jw schultz <jw@pegasys.ws>
In newsgroup: linux.dev.kernel
>
> On Mon, Apr 21, 2003 at 07:52:04PM -0700, H. Peter Anvin wrote:
> > Jamie Lokier wrote:
> > >>
> > >>The main advantage with making it a struct is that it keep people from
> > >>doing stupid stuff like (int)dev where dev is a kdev_t... There is
> > >>all kinds of shit like that in the kernel...
> > >
> > > If you want that good quality 64-bit code, try making it a struct
> > > containing just a u64 :)
> > >
> >
> > Perhaps:
> >
> > #if BITS_PER_LONG == 64
> > typedef struct { u64 val; } kdev_t;
> >
> > /* Macros for major minor mkdev */
> > #else
> > typedef struct { u32 major, minor; } kdev_t;
> >
> > /* Macros... */
> > #endif
> >
>
> or a union?
> typedef union { u64 dev; struct { u32 major, minor; } d; } kdev_t;
>

No... what I want to avoid, again, are idiots^Wpeople doing:

      foo = (int) dev->dev;

... or something like that.

        -hpa

-- 
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
Architectures needed: ia64 m68k mips64 ppc ppc64 s390 s390x sh v850 x86-64
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Apr 23 2003 - 22:00:33 EST