Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tmpfs: depend on shmem

CONFIG_SHMEM off gives you (ramfs masquerading as) tmpfs, even when
CONFIG_TMPFS is off: that's a little anomalous, and I'd intended to make
more sense of it by removing CONFIG_TMPFS altogether, always enabling its
code when CONFIG_SHMEM; but so many defconfigs have CONFIG_SHMEM on
CONFIG_TMPFS off that we'd better leave that as is.

But there is no point in asking for CONFIG_TMPFS if CONFIG_SHMEM is off:
make TMPFS depend on SHMEM, which also prevents TMPFS_POSIX_ACL
shmem_acl.o being pointlessly built into the kernel when SHMEM is off.

And a selfish change, to prevent the world from being rebuilt when I
switch between CONFIG_SHMEM on and off: the only CONFIG_SHMEM in the
header files is mm.h shmem_lock() - give that a shmem.c stub instead.

Signed-off-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Acked-by: Matt Mackall <mpm@selenic.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Hugh Dickins and committed by
Linus Torvalds
3f96b79a cdf7b341

+7 -10
+1
fs/Kconfig
··· 109 109 110 110 config TMPFS 111 111 bool "Virtual memory file system support (former shm fs)" 112 + depends on SHMEM 112 113 help 113 114 Tmpfs is a file system which keeps all files in virtual memory. 114 115
+1 -10
include/linux/mm.h
··· 702 702 703 703 extern void show_free_areas(void); 704 704 705 - #ifdef CONFIG_SHMEM 706 - extern int shmem_lock(struct file *file, int lock, struct user_struct *user); 707 - #else 708 - static inline int shmem_lock(struct file *file, int lock, 709 - struct user_struct *user) 710 - { 711 - return 0; 712 - } 713 - #endif 705 + int shmem_lock(struct file *file, int lock, struct user_struct *user); 714 706 struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags); 715 - 716 707 int shmem_zero_setup(struct vm_area_struct *); 717 708 718 709 #ifndef CONFIG_MMU
+5
mm/shmem.c
··· 2593 2593 return 0; 2594 2594 } 2595 2595 2596 + int shmem_lock(struct file *file, int lock, struct user_struct *user) 2597 + { 2598 + return 0; 2599 + } 2600 + 2596 2601 #define shmem_vm_ops generic_file_vm_ops 2597 2602 #define shmem_file_operations ramfs_file_operations 2598 2603 #define shmem_get_inode(sb, mode, dev, flags) ramfs_get_inode(sb, mode, dev)