public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Kay Sievers <kay.sievers@vrfy.org>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	Greg KH <greg@kroah.com>, Jan Blunck <jblunck@suse.de>
Subject: Re: [PATCH] driver-core: devtmpfs - driver core maintained /dev tmpfs
Date: Thu, 30 Apr 2009 22:29:00 -0700	[thread overview]
Message-ID: <20090430222900.c13b63d5.akpm@linux-foundation.org> (raw)
In-Reply-To: <1241097822.2516.3.camel@poy>

On Thu, 30 Apr 2009 15:23:42 +0200 Kay Sievers <kay.sievers@vrfy.org> wrote:

> From: Kay Sievers <kay.sievers@vrfy.org>
> Subject: driver-core: devtmpfs - driver core maintained /dev tmpfs
> 
> Devtmpfs lets the kernel create a tmpfs very early at kernel
> initialization, before any driver core device is registered. Every
> device with a major/minor will have a device node created in this
> tmpfs instance. After the rootfs is mounted by the kernel, the
> populated tmpfs is mounted at /dev. In initramfs, it can be moved
> to the manually mounted root filesystem before /sbin/init is
> executed.

Lol, devfs.

> The tmpfs instance can be changed and altered by userspace at any time,
> and in any way needed - just like today's udev-mounted tmpfs. Unmodified
> udev versions will run just fine on top of it, and will recognize an
> already existing kernel-created device node and use it.
> The default node permissions are root:root 0600. Only if none of these
> values have been changed by userspace, the driver core will remove the
> device node when the device goes away. If the device node was altered
> by udev, by applying the appropriate permissions and ownership, it will
> need to be removed by udev - just as it usually works today.
> 
> This makes init=/bin/sh work without any further userspace support.
> /dev will be fully populated and dynamic, and always reflect the current
> device state of the kernel. Especially in the face of the already
> implemented dynamic device numbers for block devices, this can be very
> helpful in a rescue situation, where static devices nodes no longer
> work.
> Custom, embedded-like systems should be able to use this as a dynamic
> /dev directory without any need for aditional userspace tools.
> 
> With the kernel populated /dev, existing initramfs or kernel-mount
> bootup logic can be optimized to be more efficient, and not to require a
> full coldplug run, which is currently needed to bootstrap the inital
> /dev directory content, before continuing bringing up the rest of
> the system. There will be no missed events to replay, because /dev is
> available before the first kernel device is registered with the core.
> A coldplug run can take, depending on the speed of the system and the
> amount of devices which need to be handled, from one to several seconds.
> 
> ...
> 
>  block/bsg.c                         |    6 
>  drivers/gpu/drm/drm_sysfs.c         |    7 
>  drivers/input/input.c               |    6 
>  drivers/media/dvb/dvb-core/dvbdev.c |   10 +
>  drivers/usb/core/usb.c              |   11 +

These five subsystems were updated, but there are so many others.  Why
these five in particular?

> +const char *device_get_nodename(struct device *dev, const char **tmp)
> +{
> +	char *s;
> +
> +	*tmp = NULL;
> +
> +	/* the device type may provide a specific name */
> +	if (dev->type && dev->type->nodename)
> +		*tmp = dev->type->nodename(dev);

dev->type->nodename() might have failed due to -ENOMEM, in which case
it seems wrong to assume that it returned NULL for <whatever reason you
thought it might want to return NULL>.

It's all a bit confused.

> +	if (*tmp)
> +		return *tmp;
> +
> +	/* the class may provide a specific name */
> +	if (dev->class && dev->class->nodename)
> +		*tmp = dev->class->nodename(dev);
> +	if (*tmp)
> +		return *tmp;
> +
> +	/* return name without allocation, tmp == NULL */
> +	if (strchr(dev_name(dev), '!') ==  NULL)

s/  / /

> +		return dev_name(dev);
> +
> +	/* replace '!' in the name with '/' */
> +	*tmp = kstrdup(dev_name(dev), GFP_KERNEL);
> +	if (!*tmp)
> +		return NULL;
> +	while ((s = strchr(*tmp, '!')))
> +		s[0] = '/';
> +	return *tmp;
> +}
>
> ...
>

  reply	other threads:[~2009-05-01  5:31 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-30 13:23 [PATCH] driver-core: devtmpfs - driver core maintained /dev tmpfs Kay Sievers
2009-05-01  5:29 ` Andrew Morton [this message]
2009-05-01  6:17   ` Greg KH
2009-05-01  6:43     ` Andrew Morton
2009-05-01  6:55       ` Greg KH
2009-05-01  7:03         ` Andrew Morton
2009-05-01 10:52           ` Kay Sievers
2009-05-01 11:38             ` Michael Tokarev
2009-05-01 11:44               ` Kay Sievers
2009-05-01 11:03         ` Alan Cox
2009-05-01 11:11           ` Kay Sievers
2009-05-01 13:18             ` Alan Cox
2009-05-01 13:24               ` Kay Sievers
2009-05-02  7:19                 ` Christoph Hellwig
2009-05-02 13:46                   ` Kay Sievers
2009-05-02 15:18                     ` Andy Lutomirski
2009-05-02 15:35                       ` Kay Sievers
2009-05-02 18:20                 ` Michael Riepe
2009-05-02 19:55                   ` Alan Jenkins
2009-05-02 21:47                     ` Kay Sievers
2009-05-04 16:20                       ` Lars Marowsky-Bree
2009-05-04 16:53                         ` Kay Sievers
2009-05-04 17:54                           ` Michael Riepe
2009-05-04 18:13                             ` Kay Sievers
2009-05-04 18:55                               ` Michael Riepe
2009-05-04 19:13                                 ` Kay Sievers
2009-05-04 19:30                                 ` Greg KH
2009-05-02  1:24         ` Brian Swetland
2009-05-02  1:48           ` Kay Sievers
2009-05-02  2:02             ` Brian Swetland
2009-05-02  2:28               ` Kay Sievers
2009-05-02  4:42                 ` Brian Swetland
2009-05-02 13:30                   ` Kay Sievers
2009-05-01 11:01     ` Alan Cox
2009-05-01 11:02       ` Kay Sievers
2009-05-01 11:16   ` Kay Sievers
2009-05-01 19:26     ` Andrew Morton
2009-05-01 21:59       ` Kay Sievers
2009-05-01 22:21         ` Andrew Morton
2009-05-01  6:57 ` Chris Wedgwood
2009-05-01 14:01   ` Greg KH
2009-05-01 15:43     ` Alan Jenkins
2009-05-01 16:04       ` Greg KH
2009-05-01 21:13         ` Alan Jenkins
2009-05-01 15:53     ` Chris Wedgwood
2009-05-01 16:09       ` Greg KH
2009-05-01 16:17         ` Chris Wedgwood
2009-05-01 10:19 ` Alan Jenkins
2009-05-01 11:13   ` Kay Sievers
2009-05-01 12:38     ` Alan Jenkins
2009-05-01 13:12       ` Alan Cox
2009-05-02 15:03         ` Kyle Moffett
2009-05-01 14:55       ` Kay Sievers
2009-05-01 11:41 ` Hugh Dickins
2009-05-01 11:59   ` Kay Sievers
2009-05-02  7:16 ` Christoph Hellwig
2009-05-02 11:34   ` Kay Sievers
2009-05-02 20:22     ` Alan Jenkins
2009-05-02 21:39       ` Kay Sievers
2009-05-02 22:04         ` Alan Jenkins
2009-05-03  7:29           ` Michael Tokarev
2009-05-02 21:41       ` Alan Jenkins
2009-05-02 21:54         ` Greg KH
2009-05-02 21:59         ` Kay Sievers
2009-05-02 16:59   ` Jeff Garzik
2009-05-02 17:57     ` Kay Sievers
2009-05-06 12:56 ` Kay Sievers
2009-05-07  1:41 ` Arjan van de Ven
2009-05-07  2:08   ` Kay Sievers
2009-05-07  2:25     ` Arjan van de Ven
2009-05-07  2:40       ` Kay Sievers
2009-05-14  9:28     ` Pavel Machek
2009-05-07  8:17 ` Eric W. Biederman
2009-05-07  9:28   ` Kay Sievers
2009-05-07 14:43     ` Theodore Tso
2009-05-07 15:13       ` Kay Sievers
2009-05-10  0:29     ` Eric W. Biederman
2009-05-10  0:56       ` Kay Sievers
2009-05-10  2:11         ` Eric W. Biederman

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=20090430222900.c13b63d5.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=greg@kroah.com \
    --cc=jblunck@suse.de \
    --cc=kay.sievers@vrfy.org \
    --cc=linux-kernel@vger.kernel.org \
    /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