Re: losetup and dev_t

Andries.Brouwer@cwi.nl
Wed, 28 Jan 1998 12:21:18 +0100 (MET)


From martin@mira.isdn.cs.tu-berlin.de Wed Jan 28 08:27:40 1998

> For the time being this probably means that one has to do
> sed 's/dev_t/unsigned short/'
> when using kernel include files that will be compiled with glibc.

Why not use kdev_t?

Heresy!
kdev_t is a secret, hidden type.
Nobody outside the kernel ever gets a kdev_t.
Nobody inside the kernel but outside <linux/kdev_t.h> knows what it is.

(Two years ago or so I have been running a kernel where it was
a pointer; hope to do so soon again. Will submit some patches
polishing kernel parts where integers and kdev_t's are mixed up.
The worst sinners are ps2esdi.c and rocket.c.)

So what to do outside the kernel? Thickets of #ifdef's testing
kernel version and libc version and architecture?

<aj@arthur.rhein-neckar.de> asked: Why not use __kernel_dev_t?
And that is what I ended up doing:

#include <asm/posix_types.h>
#define dev_t __kernel_dev_t
#include <linux/loop.h>

Not pretty, but as far as I can see it works on all architectures
and all libc's and all kernels since 1.3.79.

Andries