public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andries.Brouwer@cwi.nl
To: andersen@codepoet.org
Cc: alan@lxorguk.ukuu.org.uk, dalecki@evision.ag,
	linux-kernel@vger.kernel.org, torvalds@transmeta.com
Subject: Re: On re-working the major/minor system
Date: Sat, 8 Dec 2001 17:55:31 GMT	[thread overview]
Message-ID: <UTC200112081755.RAA240574.aeb@cwi.nl> (raw)

    From: Erik Andersen <andersen@codepoet.org>

    So we have POSIX, ls, tar, du, mknod, and mount and tons of other
    apps all with illicit insider knowledge of what a dev_t looks
    like.

    To currently, to do pretty much anything nifty related to devices
    in usespace, usespace has to peek under the kernel's skirt to
    know how to change a major and minor number into a dev_t and/or
    to sanely populate a struct stat.

    To change things, we 1) need some sortof sane interface by which
    userspace can refer sensibly to devices without resorting to evil
    illicit macros and 2) we certainly need some sort of a static
    mapping such that existing devices end up mapping to the same
    thing they always did or 3) we will need a flag day where we say
    that all pre-2.5.x created tarballs and user space apps are
    declared broken...

No flag day required. These things have been discussed
many times already, and there are easy and good solutions.

Code like

	dev_t dev;
	u64 d = dev;
	int major, minor;

	if (d & ~0xffffffff) {
		major = (d >> 32);
		minor = (d & 0xffffffff);
	} else if (d & ~0xffff) {
		major = (d >> 16);
		minor = (d & 0xffff);
	} else {
		major = (d >> 8);
		minor = (d & 0xff);
	}

will handle dev_t fine, regardless of whether it is 16, 32 or 64 bits.
You see that change of the size of dev_t does not change the values
of major and minor found in your tarballs.
We already use such code for isofs.

Andries

             reply	other threads:[~2001-12-08 17:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-08 17:55 Andries.Brouwer [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-12-09 21:37 On re-working the major/minor system Andries.Brouwer
2001-12-07 10:56 Linux/Pro -- clusters Martin Dalecki
2001-12-07 12:08 ` Alan Cox
2001-12-07 20:51   ` On re-working the major/minor system Erik Andersen
2001-12-07 21:21     ` H. Peter Anvin
2001-12-07 21:55       ` Erik Andersen
2001-12-07 22:04         ` H. Peter Anvin
2001-12-07 23:07           ` Erik Andersen
2001-12-07 23:12             ` H. Peter Anvin
2001-12-08 11:42               ` Alan Cox
2001-12-08 20:37                 ` H. Peter Anvin
2001-12-09 12:06         ` Kai Henningsen
2001-12-09 21:57           ` H. Peter Anvin
2001-12-11 20:45             ` Kai Henningsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=UTC200112081755.RAA240574.aeb@cwi.nl \
    --to=andries.brouwer@cwi.nl \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=andersen@codepoet.org \
    --cc=dalecki@evision.ag \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox