015-devtmpfs_ramfs.patch 2.5 KB

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