public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Erik Andersen <andersen@codepoet.org>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: dalecki@evision.ag, Linus Torvalds <torvalds@transmeta.com>,
	linux-kernel@vger.kernel.org
Subject: On re-working the major/minor system
Date: Fri, 7 Dec 2001 13:51:01 -0700	[thread overview]
Message-ID: <20011207135100.A17683@codepoet.org> (raw)
In-Reply-To: <3C10A057.BD8E1252@evision-ventures.com> <E16CJnv-0005c0-00@the-village.bc.nu>
In-Reply-To: <E16CJnv-0005c0-00@the-village.bc.nu>

On Fri Dec 07, 2001 at 12:08:35PM +0000, Alan Cox wrote:
> > > major/minors for old stuff still end up leaking into user space and
> > > mattering there. I'm not sure the best option for that
> > 
> > Thta's no problem. But they should be used as hash values no the
> > syscall implementation level and nowhere else.
> 
> We have apps that "know" about specific major/minors that need changing and
> will take time - also some of them are closed source so unfixable.

Right.  Tons of apps have illicit insider knowledge of kernel
major/minor representation and NEED IT to do their job.  Try
running 'ls -l' on a device node.  Wow, it prints out major and
minor number.  You can pack up a tarball containing all of /dev
so tar has to has insider major/minor knowledge too -- as does
the structure of every existant tarball!  Check out, for example,
Section 10.1.1 (page 210) of the IEEE Std. 1003.1b-1993 (POSIX)
and you will see every tarball in existance stores 8 chars for
the major, and 8 chars for the minor....

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.   A couple of months ago I patched up mkfs.jffs2 so it
could create device nodes on the target filesystem that don't
really exist in the source directory (avoids the need to be root
when building filesystems).

Right now, you will find that a zillion user space apps currently
have little snippets of code looking like:

    /* FIXME:  MKDEV uses illicit insider knowledge of kernel 
     * major/minor representation...  */
    #define MINORBITS       8
    #define MKDEV(ma,mi)    (((ma) << MINORBITS) | (mi))

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...

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--

  reply	other threads:[~2001-12-07 20:51 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-03 18:12 Linux/Pro -- clusters Donald Becker
2001-12-04  1:55 ` Davide Libenzi
2001-12-04  2:09   ` Donald Becker
2001-12-04  2:23     ` Davide Libenzi
2001-12-04  2:34       ` Alexander Viro
2001-12-04  9:10     ` Alan Cox
2001-12-04  9:30       ` Thomas Langås
2001-12-04  9:45         ` Alan Cox
2001-12-04 11:34           ` Thomas Langås
2001-12-05 21:57         ` Linus Torvalds
2001-12-05 23:05           ` Andre Hedrick
2001-12-06  4:31             ` Daniel Phillips
2001-12-05 23:49           ` Alan Cox
2001-12-05 23:48             ` Andre Hedrick
2001-12-06 16:58             ` Linus Torvalds
2001-12-06 18:02               ` Alan Cox
2001-12-06 18:07                 ` Linus Torvalds
2001-12-06 18:12                   ` Kai Henningsen
2001-12-06 20:46                     ` Linus Torvalds
2001-12-06 22:40                     ` Alan Cox
2001-12-06 18:33                   ` Alan Cox
2001-12-06 18:55                     ` Linus Torvalds
2001-12-06 19:19                       ` Alan Cox
2001-12-06 20:37                         ` Linus Torvalds
2001-12-06 22:35                           ` Alan Cox
2001-12-06 22:34                             ` Linus Torvalds
2001-12-06 22:58                               ` Alexander Viro
2001-12-07 10:14                     ` Martin Dalecki
2001-12-07 10:37                       ` Alan Cox
2001-12-07 10:56                         ` Martin Dalecki
2001-12-07 12:08                           ` Alan Cox
2001-12-07 20:51                             ` Erik Andersen [this message]
2001-12-07 21:21                               ` On re-working the major/minor system 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
2001-12-06 18:38               ` Linux/Pro -- clusters Doug Ledford
2001-12-04 14:37     ` Daniel Phillips
2001-12-04 15:19       ` Jeff Garzik
2001-12-04 17:16         ` Daniel Phillips
2001-12-04 17:20           ` Jeff Garzik
2001-12-04 18:04           ` Alan Cox
2001-12-04 18:16             ` Daniel Phillips
2001-12-04 20:20               ` Andrew Morton
2001-12-05 13:11               ` Deep look into VFS Martin Dalecki
2001-12-05 15:19                 ` Alexander Viro
2001-12-05 15:30                   ` Martin Dalecki
  -- strict thread matches above, loose matches on Subject: below --
2001-12-08 17:55 On re-working the major/minor system Andries.Brouwer
2001-12-09 21:37 Andries.Brouwer

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=20011207135100.A17683@codepoet.org \
    --to=andersen@codepoet.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --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