diff options
author | Christoph Hellwig <hch@lst.de> | 2015-01-14 04:42:32 -0500 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2015-01-20 16:02:58 -0500 |
commit | b4caecd48005fbed3949dde6c1cb233142fd69e9 (patch) | |
tree | 1fdd9b7c15568c79eb3c1ed84a39858ddbcbc88b /fs/char_dev.c | |
parent | 97b713ba3ebaa6c8d84c2c720f5468a7c6a6eb4e (diff) |
fs: introduce f_op->mmap_capabilities for nommu mmap support
Since "BDI: Provide backing device capability information [try #3]" the
backing_dev_info structure also provides flags for the kind of mmap
operation available in a nommu environment, which is entirely unrelated
to it's original purpose.
Introduce a new nommu-only file operation to provide this information to
the nommu mmap code instead. Splitting this from the backing_dev_info
structure allows to remove lots of backing_dev_info instance that aren't
otherwise needed, and entirely gets rid of the concept of providing a
backing_dev_info for a character device. It also removes the need for
the mtd_inodefs filesystem.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Tejun Heo <tj@kernel.org>
Acked-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'fs/char_dev.c')
-rw-r--r-- | fs/char_dev.c | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/fs/char_dev.c b/fs/char_dev.c index 67b2007f10fe..ea06a3d0364c 100644 --- a/fs/char_dev.c +++ b/fs/char_dev.c | |||
@@ -24,27 +24,6 @@ | |||
24 | 24 | ||
25 | #include "internal.h" | 25 | #include "internal.h" |
26 | 26 | ||
27 | /* | ||
28 | * capabilities for /dev/mem, /dev/kmem and similar directly mappable character | ||
29 | * devices | ||
30 | * - permits shared-mmap for read, write and/or exec | ||
31 | * - does not permit private mmap in NOMMU mode (can't do COW) | ||
32 | * - no readahead or I/O queue unplugging required | ||
33 | */ | ||
34 | struct backing_dev_info directly_mappable_cdev_bdi = { | ||
35 | .name = "char", | ||
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 | /* no writeback happens */ | ||
45 | BDI_CAP_NO_ACCT_AND_WRITEBACK), | ||
46 | }; | ||
47 | |||
48 | static struct kobj_map *cdev_map; | 27 | static struct kobj_map *cdev_map; |
49 | 28 | ||
50 | static DEFINE_MUTEX(chrdevs_lock); | 29 | static DEFINE_MUTEX(chrdevs_lock); |
@@ -575,8 +554,6 @@ static struct kobject *base_probe(dev_t dev, int *part, void *data) | |||
575 | void __init chrdev_init(void) | 554 | void __init chrdev_init(void) |
576 | { | 555 | { |
577 | cdev_map = kobj_map_init(base_probe, &chrdevs_lock); | 556 | cdev_map = kobj_map_init(base_probe, &chrdevs_lock); |
578 | if (bdi_init(&directly_mappable_cdev_bdi)) | ||
579 | panic("Failed to init directly mappable cdev bdi"); | ||
580 | } | 557 | } |
581 | 558 | ||
582 | 559 | ||
@@ -590,4 +567,3 @@ EXPORT_SYMBOL(cdev_del); | |||
590 | EXPORT_SYMBOL(cdev_add); | 567 | EXPORT_SYMBOL(cdev_add); |
591 | EXPORT_SYMBOL(__register_chrdev); | 568 | EXPORT_SYMBOL(__register_chrdev); |
592 | EXPORT_SYMBOL(__unregister_chrdev); | 569 | EXPORT_SYMBOL(__unregister_chrdev); |
593 | EXPORT_SYMBOL(directly_mappable_cdev_bdi); | ||