[8401] in linux-scsi channel archive

home help back first fref pref prev next nref lref last post

Re: MKDEV and major numbers

daemon@ATHENA.MIT.EDU (Marc SCHAEFER)
Sat Mar 18 11:16:00 2000

To: linux-scsi@vger.rutgers.edu
From: Marc SCHAEFER <schaefer@alphanet.ch>
Date:	18 Mar 2000 08:50:51 +0100
Message-ID: <8avcgr$9bf$1@vulcan.alphanet.ch>

Stanley Wu <wudragon2@yahoo.com> wrote:
> I'm not aware of MAKDEV script, but MKDEV is a kernel
> function call. It takes the major and minor number as
> parameters and should make a devcie instance, I think.

Infact, as far as I know, MKDEV will transform a major/minor
pair into a kdev_t, the opaque structure used internally in
the kernel.

Then, you use MAJOR(x) and MINOR(y) to get back those values.
Infact, I have never really used MKDEV, MAJOR or MINOR at
all, so my explanation might be a bit flaky.

For me, those functions should stricly be reserved in the
user-space-to-kernel-space translations (e.g. stat(),
or open-a-device-special-file).

The only case you can see a MKDEV in drivers/scsi/*.[ch]
seems to be for partition table validation in sd devices,
presumably because it uses a high level function needing
a kdev_t or something.

What is important is that, in the general case, to access
a device from user-space, you need an entry in /dev, created
with the mknod command.

You could also use one of the reserved majors
(see Documentation/devices.txt) so that you can have
static entries in /dev. Once the device driver is distributed
seriously, you can register officially the number.

SCSI device which are character-devices are 'sg' and 'st', look
in drivers/scsi.


-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.rutgers.edu

home help back first fref pref prev next nref lref last post