mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] tmpfs: depend on shmem
@ 2009-09-08 20:25 Hugh Dickins
  2009-09-08 22:51 ` Matt Mackall
  0 siblings, 1 reply; 2+ messages in thread
From: Hugh Dickins @ 2009-09-08 20:25 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Matt Mackall, linux-kernel

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>
---

 fs/Kconfig         |    1 +
 include/linux/mm.h |   11 +----------
 mm/shmem.c         |    5 +++++
 3 files changed, 7 insertions(+), 10 deletions(-)

--- mmotm/fs/Kconfig	2009-09-05 14:40:15.000000000 +0100
+++ linux/fs/Kconfig	2009-09-08 16:37:54.000000000 +0100
@@ -110,6 +110,7 @@ source "fs/sysfs/Kconfig"
 
 config TMPFS
 	bool "Virtual memory file system support (former shm fs)"
+	depends on SHMEM
 	help
 	  Tmpfs is a file system which keeps all files in virtual memory.
 
--- mmotm/include/linux/mm.h	2009-09-05 14:40:16.000000000 +0100
+++ linux/include/linux/mm.h	2009-09-08 16:37:54.000000000 +0100
@@ -711,17 +711,8 @@ extern void pagefault_out_of_memory(void
 
 extern void show_free_areas(void);
 
-#ifdef CONFIG_SHMEM
-extern int shmem_lock(struct file *file, int lock, struct user_struct *user);
-#else
-static inline int shmem_lock(struct file *file, int lock,
-			    struct user_struct *user)
-{
-	return 0;
-}
-#endif
+int shmem_lock(struct file *file, int lock, struct user_struct *user);
 struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags);
-
 int shmem_zero_setup(struct vm_area_struct *);
 
 #ifndef CONFIG_MMU
--- mmotm/mm/shmem.c	2009-09-05 14:40:16.000000000 +0100
+++ linux/mm/shmem.c	2009-09-08 16:37:54.000000000 +0100
@@ -2596,6 +2596,11 @@ int shmem_unuse(swp_entry_t entry, struc
 	return 0;
 }
 
+int shmem_lock(struct file *file, int lock, struct user_struct *user)
+{
+	return 0;
+}
+
 #define shmem_vm_ops				generic_file_vm_ops
 #define shmem_file_operations			ramfs_file_operations
 #define shmem_get_inode(sb, mode, dev, flags)	ramfs_get_inode(sb, mode, dev)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] tmpfs: depend on shmem
  2009-09-08 20:25 [PATCH] tmpfs: depend on shmem Hugh Dickins
@ 2009-09-08 22:51 ` Matt Mackall
  0 siblings, 0 replies; 2+ messages in thread
From: Matt Mackall @ 2009-09-08 22:51 UTC (permalink / raw)
  To: Hugh Dickins; +Cc: Andrew Morton, linux-kernel

On Tue, 2009-09-08 at 21:25 +0100, Hugh Dickins wrote:
> 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.

Fair enough.

> 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.

Might as well, on the principle of one less ifdef.

> Signed-off-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>

Acked-by: Matt Mackall <mpm@selenic.com>

-- 
http://selenic.com : development and support for Mercurial and Linux



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-09-08 22:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-08 20:25 [PATCH] tmpfs: depend on shmem Hugh Dickins
2009-09-08 22:51 ` Matt Mackall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®