diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2009-04-30 09:23:42 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-09-15 12:50:49 -0400 |
commit | 2b2af54a5bb6f7e80ccf78f20084b93c398c3a8b (patch) | |
tree | bb27e3b16a2a8fadeea869033a406f0a19b63e29 /include | |
parent | ea5ffff57dce2f4c85ab056f4b0a202f71db2bdf (diff) |
Driver Core: devtmpfs - kernel-maintained tmpfs-based /dev
Devtmpfs lets the kernel create a tmpfs instance called devtmpfs
very early at kernel initialization, before any driver-core device
is registered. Every device with a major/minor will provide a
device node in devtmpfs.
Devtmpfs 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. Proper permissions
and user/group ownership, meaningful symlinks, all other policy still
needs to be applied by userspace.
If a node is created by devtmps, devtmpfs will remove the device node
when the device goes away. If the device node was created by
userspace, or the devtmpfs created node was replaced by userspace, it
will no longer be removed by devtmpfs.
If it is requested to auto-mount it, it 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.
With the commonly used dynamic device numbers, it solves the problem
where static devices nodes may point to the wrong devices.
It is intended to make the initial bootup logic simpler and more robust,
by de-coupling the creation of the inital environment, to reliably run
userspace processes, from a complex userspace bootstrap logic to provide
a working /dev.
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Jan Blunck <jblunck@suse.de>
Tested-By: Harald Hoyer <harald@redhat.com>
Tested-By: Scott James Remnant <scott@ubuntu.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/device.h | 10 | ||||
-rw-r--r-- | include/linux/shmem_fs.h | 3 |
2 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index 62ff53a67931..847b763e40e9 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -552,6 +552,16 @@ extern void put_device(struct device *dev); | |||
552 | 552 | ||
553 | extern void wait_for_device_probe(void); | 553 | extern void wait_for_device_probe(void); |
554 | 554 | ||
555 | #ifdef CONFIG_DEVTMPFS | ||
556 | extern int devtmpfs_create_node(struct device *dev); | ||
557 | extern int devtmpfs_delete_node(struct device *dev); | ||
558 | extern int devtmpfs_mount(const char *mountpoint); | ||
559 | #else | ||
560 | static inline int devtmpfs_create_node(struct device *dev) { return 0; } | ||
561 | static inline int devtmpfs_delete_node(struct device *dev) { return 0; } | ||
562 | static inline int devtmpfs_mount(const char *mountpoint) { return 0; } | ||
563 | #endif | ||
564 | |||
555 | /* drivers/base/power/shutdown.c */ | 565 | /* drivers/base/power/shutdown.c */ |
556 | extern void device_shutdown(void); | 566 | extern void device_shutdown(void); |
557 | 567 | ||
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h index 6d3f2f449ead..deee7afd8d66 100644 --- a/include/linux/shmem_fs.h +++ b/include/linux/shmem_fs.h | |||
@@ -38,6 +38,9 @@ static inline struct shmem_inode_info *SHMEM_I(struct inode *inode) | |||
38 | return container_of(inode, struct shmem_inode_info, vfs_inode); | 38 | return container_of(inode, struct shmem_inode_info, vfs_inode); |
39 | } | 39 | } |
40 | 40 | ||
41 | extern int init_tmpfs(void); | ||
42 | extern int shmem_fill_super(struct super_block *sb, void *data, int silent); | ||
43 | |||
41 | #ifdef CONFIG_TMPFS_POSIX_ACL | 44 | #ifdef CONFIG_TMPFS_POSIX_ACL |
42 | int shmem_check_acl(struct inode *, int); | 45 | int shmem_check_acl(struct inode *, int); |
43 | int shmem_acl_init(struct inode *, struct inode *); | 46 | int shmem_acl_init(struct inode *, struct inode *); |