8ff7f9da6a25135948df73a750db9517eb372aec
[openwrt.git] / target / linux / generic / patches-2.6.34 / 015-devtmpfs_ramfs.patch
1 From: Peter Korsgaard <jacmet@sunsite.dk>
2
3 Make devtmpfs available on (embedded) configurations without SHMEM/TMPFS,
4 using ramfs instead.
5
6 Saves ~15KB.
7
8 Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
9 Acked-by: Kay Sievers <kay.sievers@vrfy.org>
10 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
11 --- a/drivers/base/Kconfig
12 +++ b/drivers/base/Kconfig
13 @@ -18,9 +18,9 @@ config UEVENT_HELPER_PATH
14  
15  config DEVTMPFS
16         bool "Maintain a devtmpfs filesystem to mount at /dev"
17 -       depends on HOTPLUG && SHMEM && TMPFS
18 +       depends on HOTPLUG
19         help
20 -         This creates a tmpfs filesystem instance early at bootup.
21 +         This creates a tmpfs/ramfs filesystem instance early at bootup.
22           In this filesystem, the kernel driver core maintains device
23           nodes with their default names and permissions for all
24           registered devices with an assigned major/minor number.
25 @@ -33,6 +33,9 @@ config DEVTMPFS
26           functional /dev without any further help. It also allows simple
27           rescue systems, and reliably handles dynamic major/minor numbers.
28  
29 +         Notice: if CONFIG_TMPFS isn't enabled, the simpler ramfs
30 +         file system will be used instead.
31 +
32  config DEVTMPFS_MOUNT
33         bool "Automount devtmpfs at /dev, after the kernel mounted the rootfs"
34         depends on DEVTMPFS
35 --- a/drivers/base/devtmpfs.c
36 +++ b/drivers/base/devtmpfs.c
37 @@ -20,6 +20,7 @@
38  #include <linux/namei.h>
39  #include <linux/fs.h>
40  #include <linux/shmem_fs.h>
41 +#include <linux/ramfs.h>
42  #include <linux/cred.h>
43  #include <linux/sched.h>
44  #include <linux/init_task.h>
45 @@ -45,7 +46,11 @@ __setup("devtmpfs.mount=", mount_param);
46  static int dev_get_sb(struct file_system_type *fs_type, int flags,
47                       const char *dev_name, void *data, struct vfsmount *mnt)
48  {
49 +#ifdef CONFIG_TMPFS
50         return get_sb_single(fs_type, flags, data, shmem_fill_super, mnt);
51 +#else
52 +       return get_sb_single(fs_type, flags, data, ramfs_fill_super, mnt);
53 +#endif
54  }
55  
56  static struct file_system_type dev_fs_type = {
57 --- a/fs/ramfs/inode.c
58 +++ b/fs/ramfs/inode.c
59 @@ -214,7 +214,7 @@ static int ramfs_parse_options(char *dat
60         return 0;
61  }
62  
63 -static int ramfs_fill_super(struct super_block * sb, void * data, int silent)
64 +int ramfs_fill_super(struct super_block *sb, void *data, int silent)
65  {
66         struct ramfs_fs_info *fsi;
67         struct inode *inode = NULL;
68 --- a/include/linux/ramfs.h
69 +++ b/include/linux/ramfs.h
70 @@ -20,4 +20,6 @@ extern const struct file_operations ramf
71  extern const struct vm_operations_struct generic_file_vm_ops;
72  extern int __init init_rootfs(void);
73  
74 +int ramfs_fill_super(struct super_block *sb, void *data, int silent);
75 +
76  #endif