diff options
author | David Howells <dhowells@redhat.com> | 2006-09-27 04:50:16 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-27 11:26:14 -0400 |
commit | 5da6185bca064e35aa73a7c1f27488d2b96434f4 (patch) | |
tree | b854ad2105e177d4b4ec4bb6a5ac26d41ebe368f /fs | |
parent | 0ec76a110f432e98277e464b82ace8dd66571689 (diff) |
[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')
-rw-r--r-- | fs/char_dev.c | 20 |
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 @@ | |||
19 | #include <linux/kobj_map.h> | 19 | #include <linux/kobj_map.h> |
20 | #include <linux/cdev.h> | 20 | #include <linux/cdev.h> |
21 | #include <linux/mutex.h> | 21 | #include <linux/mutex.h> |
22 | #include <linux/backing-dev.h> | ||
22 | 23 | ||
23 | #ifdef CONFIG_KMOD | 24 | #ifdef CONFIG_KMOD |
24 | #include <linux/kmod.h> | 25 | #include <linux/kmod.h> |
25 | #endif | 26 | #endif |
26 | 27 | ||
28 | /* | ||
29 | * capabilities for /dev/mem, /dev/kmem and similar directly mappable character | ||
30 | * devices | ||
31 | * - permits shared-mmap for read, write and/or exec | ||
32 | * - does not permit private mmap in NOMMU mode (can't do COW) | ||
33 | * - no readahead or I/O queue unplugging required | ||
34 | */ | ||
35 | struct backing_dev_info directly_mappable_cdev_bdi = { | ||
36 | .capabilities = ( | ||
37 | #ifdef CONFIG_MMU | ||
38 | /* permit private copies of the data to be taken */ | ||
39 | BDI_CAP_MAP_COPY | | ||
40 | #endif | ||
41 | /* permit direct mmap, for read, write or exec */ | ||
42 | BDI_CAP_MAP_DIRECT | | ||
43 | BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP), | ||
44 | }; | ||
45 | |||
27 | static struct kobj_map *cdev_map; | 46 | static struct kobj_map *cdev_map; |
28 | 47 | ||
29 | static DEFINE_MUTEX(chrdevs_lock); | 48 | static DEFINE_MUTEX(chrdevs_lock); |
@@ -461,3 +480,4 @@ EXPORT_SYMBOL(cdev_del); | |||
461 | EXPORT_SYMBOL(cdev_add); | 480 | EXPORT_SYMBOL(cdev_add); |
462 | EXPORT_SYMBOL(register_chrdev); | 481 | EXPORT_SYMBOL(register_chrdev); |
463 | EXPORT_SYMBOL(unregister_chrdev); | 482 | EXPORT_SYMBOL(unregister_chrdev); |
483 | EXPORT_SYMBOL(directly_mappable_cdev_bdi); | ||