summaryrefslogtreecommitdiffstats
path: root/fs/char_dev.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2006-09-27 01:50:16 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-27 08:26:14 -0700
commit5da6185bca064e35aa73a7c1f27488d2b96434f4 (patch)
treeb854ad2105e177d4b4ec4bb6a5ac26d41ebe368f /fs/char_dev.c
parent0ec76a110f432e98277e464b82ace8dd66571689 (diff)
downloadlinux-5da6185bca064e35aa73a7c1f27488d2b96434f4.tar.bz2
[PATCH] NOMMU: Set BDI capabilities for /dev/mem and /dev/kmem
Set the backing device info capabilities for /dev/mem and /dev/kmem to permit direct sharing under no-MMU conditions and full mapping capabilities under MMU conditions. Make the BDI used by these available to all directly mappable character devices. Also comment the capabilities for /dev/zero. [akpm@osdl.org: ifdef reductions] Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/char_dev.c')
-rw-r--r--fs/char_dev.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/fs/char_dev.c b/fs/char_dev.c
index 3483d3cf8087..0009346d827f 100644
--- a/fs/char_dev.c
+++ b/fs/char_dev.c
@@ -19,11 +19,30 @@
#include <linux/kobj_map.h>
#include <linux/cdev.h>
#include <linux/mutex.h>
+#include <linux/backing-dev.h>
#ifdef CONFIG_KMOD
#include <linux/kmod.h>
#endif
+/*
+ * capabilities for /dev/mem, /dev/kmem and similar directly mappable character
+ * devices
+ * - permits shared-mmap for read, write and/or exec
+ * - does not permit private mmap in NOMMU mode (can't do COW)
+ * - no readahead or I/O queue unplugging required
+ */
+struct backing_dev_info directly_mappable_cdev_bdi = {
+ .capabilities = (
+#ifdef CONFIG_MMU
+ /* permit private copies of the data to be taken */
+ BDI_CAP_MAP_COPY |
+#endif
+ /* permit direct mmap, for read, write or exec */
+ BDI_CAP_MAP_DIRECT |
+ BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP),
+};
+
static struct kobj_map *cdev_map;
static DEFINE_MUTEX(chrdevs_lock);
@@ -461,3 +480,4 @@ EXPORT_SYMBOL(cdev_del);
EXPORT_SYMBOL(cdev_add);
EXPORT_SYMBOL(register_chrdev);
EXPORT_SYMBOL(unregister_chrdev);
+EXPORT_SYMBOL(directly_mappable_cdev_bdi);