Commit f5e54d6e authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Linus Torvalds

[PATCH] mark address_space_operations const

Same as with already do with the file operations: keep them in .rodata and
prevents people from doing runtime patching.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Cc: Steven French <sfrench@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent a052b68b
...@@ -210,7 +210,7 @@ static int do_lo_send_aops(struct loop_device *lo, struct bio_vec *bvec, ...@@ -210,7 +210,7 @@ static int do_lo_send_aops(struct loop_device *lo, struct bio_vec *bvec,
{ {
struct file *file = lo->lo_backing_file; /* kudos to NFsckingS */ struct file *file = lo->lo_backing_file; /* kudos to NFsckingS */
struct address_space *mapping = file->f_mapping; struct address_space *mapping = file->f_mapping;
struct address_space_operations *aops = mapping->a_ops; const struct address_space_operations *aops = mapping->a_ops;
pgoff_t index; pgoff_t index;
unsigned offset, bv_offs; unsigned offset, bv_offs;
int len, ret; int len, ret;
...@@ -784,7 +784,7 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file, ...@@ -784,7 +784,7 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file,
error = -EINVAL; error = -EINVAL;
if (S_ISREG(inode->i_mode) || S_ISBLK(inode->i_mode)) { if (S_ISREG(inode->i_mode) || S_ISBLK(inode->i_mode)) {
struct address_space_operations *aops = mapping->a_ops; const struct address_space_operations *aops = mapping->a_ops;
/* /*
* If we can't read - sorry. If we only can't write - well, * If we can't read - sorry. If we only can't write - well,
* it's going to be read-only. * it's going to be read-only.
......
...@@ -191,7 +191,7 @@ static int ramdisk_set_page_dirty(struct page *page) ...@@ -191,7 +191,7 @@ static int ramdisk_set_page_dirty(struct page *page)
return 0; return 0;
} }
static struct address_space_operations ramdisk_aops = { static const struct address_space_operations ramdisk_aops = {
.readpage = ramdisk_readpage, .readpage = ramdisk_readpage,
.prepare_write = ramdisk_prepare_write, .prepare_write = ramdisk_prepare_write,
.commit_write = ramdisk_commit_write, .commit_write = ramdisk_commit_write,
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
*/ */
extern struct file_system_type v9fs_fs_type; extern struct file_system_type v9fs_fs_type;
extern struct address_space_operations v9fs_addr_operations; extern const struct address_space_operations v9fs_addr_operations;
extern const struct file_operations v9fs_file_operations; extern const struct file_operations v9fs_file_operations;
extern const struct file_operations v9fs_dir_operations; extern const struct file_operations v9fs_dir_operations;
extern struct dentry_operations v9fs_dentry_operations; extern struct dentry_operations v9fs_dentry_operations;
......
...@@ -103,6 +103,6 @@ UnmapAndUnlock: ...@@ -103,6 +103,6 @@ UnmapAndUnlock:
return retval; return retval;
} }
struct address_space_operations v9fs_addr_operations = { const struct address_space_operations v9fs_addr_operations = {
.readpage = v9fs_vfs_readpage, .readpage = v9fs_vfs_readpage,
}; };
...@@ -72,7 +72,7 @@ static sector_t _adfs_bmap(struct address_space *mapping, sector_t block) ...@@ -72,7 +72,7 @@ static sector_t _adfs_bmap(struct address_space *mapping, sector_t block)
return generic_block_bmap(mapping, block, adfs_get_block); return generic_block_bmap(mapping, block, adfs_get_block);
} }
static struct address_space_operations adfs_aops = { static const struct address_space_operations adfs_aops = {
.readpage = adfs_readpage, .readpage = adfs_readpage,
.writepage = adfs_writepage, .writepage = adfs_writepage,
.sync_page = block_sync_page, .sync_page = block_sync_page,
......
...@@ -195,9 +195,9 @@ extern struct inode_operations affs_symlink_inode_operations; ...@@ -195,9 +195,9 @@ extern struct inode_operations affs_symlink_inode_operations;
extern const struct file_operations affs_file_operations; extern const struct file_operations affs_file_operations;
extern const struct file_operations affs_file_operations_ofs; extern const struct file_operations affs_file_operations_ofs;
extern const struct file_operations affs_dir_operations; extern const struct file_operations affs_dir_operations;
extern struct address_space_operations affs_symlink_aops; extern const struct address_space_operations affs_symlink_aops;
extern struct address_space_operations affs_aops; extern const struct address_space_operations affs_aops;
extern struct address_space_operations affs_aops_ofs; extern const struct address_space_operations affs_aops_ofs;
extern struct dentry_operations affs_dentry_operations; extern struct dentry_operations affs_dentry_operations;
extern struct dentry_operations affs_dentry_operations_intl; extern struct dentry_operations affs_dentry_operations_intl;
......
...@@ -406,7 +406,7 @@ static sector_t _affs_bmap(struct address_space *mapping, sector_t block) ...@@ -406,7 +406,7 @@ static sector_t _affs_bmap(struct address_space *mapping, sector_t block)
{ {
return generic_block_bmap(mapping,block,affs_get_block); return generic_block_bmap(mapping,block,affs_get_block);
} }
struct address_space_operations affs_aops = { const struct address_space_operations affs_aops = {
.readpage = affs_readpage, .readpage = affs_readpage,
.writepage = affs_writepage, .writepage = affs_writepage,
.sync_page = block_sync_page, .sync_page = block_sync_page,
...@@ -759,7 +759,7 @@ out: ...@@ -759,7 +759,7 @@ out:
goto done; goto done;
} }
struct address_space_operations affs_aops_ofs = { const struct address_space_operations affs_aops_ofs = {
.readpage = affs_readpage_ofs, .readpage = affs_readpage_ofs,
//.writepage = affs_writepage_ofs, //.writepage = affs_writepage_ofs,
//.sync_page = affs_sync_page_ofs, //.sync_page = affs_sync_page_ofs,
......
...@@ -66,7 +66,7 @@ fail: ...@@ -66,7 +66,7 @@ fail:
return err; return err;
} }
struct address_space_operations affs_symlink_aops = { const struct address_space_operations affs_symlink_aops = {
.readpage = affs_symlink_readpage, .readpage = affs_symlink_readpage,
}; };
......
...@@ -35,7 +35,7 @@ struct inode_operations afs_file_inode_operations = { ...@@ -35,7 +35,7 @@ struct inode_operations afs_file_inode_operations = {
.getattr = afs_inode_getattr, .getattr = afs_inode_getattr,
}; };
struct address_space_operations afs_fs_aops = { const struct address_space_operations afs_fs_aops = {
.readpage = afs_file_readpage, .readpage = afs_file_readpage,
.sync_page = block_sync_page, .sync_page = block_sync_page,
.set_page_dirty = __set_page_dirty_nobuffers, .set_page_dirty = __set_page_dirty_nobuffers,
......
...@@ -69,7 +69,7 @@ extern const struct file_operations afs_dir_file_operations; ...@@ -69,7 +69,7 @@ extern const struct file_operations afs_dir_file_operations;
/* /*
* file.c * file.c
*/ */
extern struct address_space_operations afs_fs_aops; extern const struct address_space_operations afs_fs_aops;
extern struct inode_operations afs_file_inode_operations; extern struct inode_operations afs_file_inode_operations;
#ifdef AFS_CACHING_SUPPORT #ifdef AFS_CACHING_SUPPORT
......
...@@ -73,7 +73,7 @@ static struct inode_operations befs_dir_inode_operations = { ...@@ -73,7 +73,7 @@ static struct inode_operations befs_dir_inode_operations = {
.lookup = befs_lookup, .lookup = befs_lookup,
}; };
static struct address_space_operations befs_aops = { static const struct address_space_operations befs_aops = {
.readpage = befs_readpage, .readpage = befs_readpage,
.sync_page = block_sync_page, .sync_page = block_sync_page,
.bmap = befs_bmap, .bmap = befs_bmap,
......
...@@ -50,7 +50,7 @@ static inline struct bfs_inode_info *BFS_I(struct inode *inode) ...@@ -50,7 +50,7 @@ static inline struct bfs_inode_info *BFS_I(struct inode *inode)
/* file.c */ /* file.c */
extern struct inode_operations bfs_file_inops; extern struct inode_operations bfs_file_inops;
extern const struct file_operations bfs_file_operations; extern const struct file_operations bfs_file_operations;
extern struct address_space_operations bfs_aops; extern const struct address_space_operations bfs_aops;
/* dir.c */ /* dir.c */
extern struct inode_operations bfs_dir_inops; extern struct inode_operations bfs_dir_inops;
......
...@@ -153,7 +153,7 @@ static sector_t bfs_bmap(struct address_space *mapping, sector_t block) ...@@ -153,7 +153,7 @@ static sector_t bfs_bmap(struct address_space *mapping, sector_t block)
return generic_block_bmap(mapping, block, bfs_get_block); return generic_block_bmap(mapping, block, bfs_get_block);
} }
struct address_space_operations bfs_aops = { const struct address_space_operations bfs_aops = {
.readpage = bfs_readpage, .readpage = bfs_readpage,
.writepage = bfs_writepage, .writepage = bfs_writepage,
.sync_page = block_sync_page, .sync_page = block_sync_page,
......
...@@ -1095,7 +1095,7 @@ static long block_ioctl(struct file *file, unsigned cmd, unsigned long arg) ...@@ -1095,7 +1095,7 @@ static long block_ioctl(struct file *file, unsigned cmd, unsigned long arg)
return blkdev_ioctl(file->f_mapping->host, file, cmd, arg); return blkdev_ioctl(file->f_mapping->host, file, cmd, arg);
} }
struct address_space_operations def_blk_aops = { const struct address_space_operations def_blk_aops = {
.readpage = blkdev_readpage, .readpage = blkdev_readpage,
.writepage = blkdev_writepage, .writepage = blkdev_writepage,
.sync_page = block_sync_page, .sync_page = block_sync_page,
......
...@@ -2598,7 +2598,7 @@ int nobh_truncate_page(struct address_space *mapping, loff_t from) ...@@ -2598,7 +2598,7 @@ int nobh_truncate_page(struct address_space *mapping, loff_t from)
unsigned offset = from & (PAGE_CACHE_SIZE-1); unsigned offset = from & (PAGE_CACHE_SIZE-1);
unsigned to; unsigned to;
struct page *page; struct page *page;
struct address_space_operations *a_ops = mapping->a_ops; const struct address_space_operations *a_ops = mapping->a_ops;
char *kaddr; char *kaddr;
int ret = 0; int ret = 0;
......
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
#define TRUE 1 #define TRUE 1
#endif #endif
extern struct address_space_operations cifs_addr_ops; extern const struct address_space_operations cifs_addr_ops;
extern struct address_space_operations cifs_addr_ops_smallbuf; extern const struct address_space_operations cifs_addr_ops_smallbuf;
/* Functions related to super block operations */ /* Functions related to super block operations */
extern struct super_operations cifs_super_ops; extern struct super_operations cifs_super_ops;
......
...@@ -1942,7 +1942,7 @@ static int cifs_prepare_write(struct file *file, struct page *page, ...@@ -1942,7 +1942,7 @@ static int cifs_prepare_write(struct file *file, struct page *page,
return 0; return 0;
} }
struct address_space_operations cifs_addr_ops = { const struct address_space_operations cifs_addr_ops = {
.readpage = cifs_readpage, .readpage = cifs_readpage,
.readpages = cifs_readpages, .readpages = cifs_readpages,
.writepage = cifs_writepage, .writepage = cifs_writepage,
...@@ -1959,7 +1959,7 @@ struct address_space_operations cifs_addr_ops = { ...@@ -1959,7 +1959,7 @@ struct address_space_operations cifs_addr_ops = {
* contain the header plus one complete page of data. Otherwise, we need * contain the header plus one complete page of data. Otherwise, we need
* to leave cifs_readpages out of the address space operations. * to leave cifs_readpages out of the address space operations.
*/ */
struct address_space_operations cifs_addr_ops_smallbuf = { const struct address_space_operations cifs_addr_ops_smallbuf = {
.readpage = cifs_readpage, .readpage = cifs_readpage,
.writepage = cifs_writepage, .writepage = cifs_writepage,
.writepages = cifs_writepages, .writepages = cifs_writepages,
......
...@@ -50,6 +50,6 @@ fail: ...@@ -50,6 +50,6 @@ fail:
return error; return error;
} }
struct address_space_operations coda_symlink_aops = { const struct address_space_operations coda_symlink_aops = {
.readpage = coda_symlink_filler, .readpage = coda_symlink_filler,
}; };
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
extern struct super_block * configfs_sb; extern struct super_block * configfs_sb;
static struct address_space_operations configfs_aops = { static const struct address_space_operations configfs_aops = {
.readpage = simple_readpage, .readpage = simple_readpage,
.prepare_write = simple_prepare_write, .prepare_write = simple_prepare_write,
.commit_write = simple_commit_write .commit_write = simple_commit_write
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
static struct super_operations cramfs_ops; static struct super_operations cramfs_ops;
static struct inode_operations cramfs_dir_inode_operations; static struct inode_operations cramfs_dir_inode_operations;
static const struct file_operations cramfs_directory_operations; static const struct file_operations cramfs_directory_operations;
static struct address_space_operations cramfs_aops; static const struct address_space_operations cramfs_aops;
static DEFINE_MUTEX(read_mutex); static DEFINE_MUTEX(read_mutex);
...@@ -501,7 +501,7 @@ static int cramfs_readpage(struct file *file, struct page * page) ...@@ -501,7 +501,7 @@ static int cramfs_readpage(struct file *file, struct page * page)
return 0; return 0;
} }
static struct address_space_operations cramfs_aops = { static const struct address_space_operations cramfs_aops = {
.readpage = cramfs_readpage .readpage = cramfs_readpage
}; };
......
...@@ -21,7 +21,7 @@ static sector_t _efs_bmap(struct address_space *mapping, sector_t block) ...@@ -21,7 +21,7 @@ static sector_t _efs_bmap(struct address_space *mapping, sector_t block)
{ {
return generic_block_bmap(mapping,block,efs_get_block); return generic_block_bmap(mapping,block,efs_get_block);
} }
static struct address_space_operations efs_aops = { static const struct address_space_operations efs_aops = {
.readpage = efs_readpage, .readpage = efs_readpage,
.sync_page = block_sync_page, .sync_page = block_sync_page,
.bmap = _efs_bmap .bmap = _efs_bmap
......
...@@ -53,6 +53,6 @@ fail: ...@@ -53,6 +53,6 @@ fail:
return err; return err;
} }
struct address_space_operations efs_symlink_aops = { const struct address_space_operations efs_symlink_aops = {
.readpage = efs_symlink_readpage .readpage = efs_symlink_readpage
}; };
...@@ -162,9 +162,9 @@ extern const struct file_operations ext2_file_operations; ...@@ -162,9 +162,9 @@ extern const struct file_operations ext2_file_operations;
extern const struct file_operations ext2_xip_file_operations; extern const struct file_operations ext2_xip_file_operations;
/* inode.c */ /* inode.c */
extern struct address_space_operations ext2_aops; extern const struct address_space_operations ext2_aops;
extern struct address_space_operations ext2_aops_xip; extern const struct address_space_operations ext2_aops_xip;
extern struct address_space_operations ext2_nobh_aops; extern const struct address_space_operations ext2_nobh_aops;
/* namei.c */ /* namei.c */
extern struct inode_operations ext2_dir_inode_operations; extern struct inode_operations ext2_dir_inode_operations;
......
...@@ -684,7 +684,7 @@ ext2_writepages(struct address_space *mapping, struct writeback_control *wbc) ...@@ -684,7 +684,7 @@ ext2_writepages(struct address_space *mapping, struct writeback_control *wbc)
return mpage_writepages(mapping, wbc, ext2_get_block); return mpage_writepages(mapping, wbc, ext2_get_block);
} }
struct address_space_operations ext2_aops = { const struct address_space_operations ext2_aops = {
.readpage = ext2_readpage, .readpage = ext2_readpage,
.readpages = ext2_readpages, .readpages = ext2_readpages,
.writepage = ext2_writepage, .writepage = ext2_writepage,
...@@ -697,12 +697,12 @@ struct address_space_operations ext2_aops = { ...@@ -697,12 +697,12 @@ struct address_space_operations ext2_aops = {
.migratepage = buffer_migrate_page, .migratepage = buffer_migrate_page,
}; };
struct address_space_operations ext2_aops_xip = { const struct address_space_operations ext2_aops_xip = {
.bmap = ext2_bmap, .bmap = ext2_bmap,
.get_xip_page = ext2_get_xip_page, .get_xip_page = ext2_get_xip_page,
}; };
struct address_space_operations ext2_nobh_aops = { const struct address_space_operations ext2_nobh_aops = {
.readpage = ext2_readpage, .readpage = ext2_readpage,
.readpages = ext2_readpages, .readpages = ext2_readpages,
.writepage = ext2_nobh_writepage, .writepage = ext2_nobh_writepage,
......
...@@ -1698,7 +1698,7 @@ static int ext3_journalled_set_page_dirty(struct page *page) ...@@ -1698,7 +1698,7 @@ static int ext3_journalled_set_page_dirty(struct page *page)
return __set_page_dirty_nobuffers(page); return __set_page_dirty_nobuffers(page);
} }
static struct address_space_operations ext3_ordered_aops = { static const struct address_space_operations ext3_ordered_aops = {
.readpage = ext3_readpage, .readpage = ext3_readpage,
.readpages = ext3_readpages, .readpages = ext3_readpages,
.writepage = ext3_ordered_writepage, .writepage = ext3_ordered_writepage,
...@@ -1712,7 +1712,7 @@ static struct address_space_operations ext3_ordered_aops = { ...@@ -1712,7 +1712,7 @@ static struct address_space_operations ext3_ordered_aops = {
.migratepage = buffer_migrate_page, .migratepage = buffer_migrate_page,
}; };
static struct address_space_operations ext3_writeback_aops = { static const struct address_space_operations ext3_writeback_aops = {
.readpage = ext3_readpage, .readpage = ext3_readpage,
.readpages = ext3_readpages, .readpages = ext3_readpages,
.writepage = ext3_writeback_writepage, .writepage = ext3_writeback_writepage,
...@@ -1726,7 +1726,7 @@ static struct address_space_operations ext3_writeback_aops = { ...@@ -1726,7 +1726,7 @@ static struct address_space_operations ext3_writeback_aops = {
.migratepage = buffer_migrate_page, .migratepage = buffer_migrate_page,
}; };
static struct address_space_operations ext3_journalled_aops = { static const struct address_space_operations ext3_journalled_aops = {
.readpage = ext3_readpage, .readpage = ext3_readpage,
.readpages = ext3_readpages, .readpages = ext3_readpages,
.writepage = ext3_journalled_writepage, .writepage = ext3_journalled_writepage,
......
...@@ -196,7 +196,7 @@ static sector_t _fat_bmap(struct address_space *mapping, sector_t block) ...@@ -196,7 +196,7 @@ static sector_t _fat_bmap(struct address_space *mapping, sector_t block)
return generic_block_bmap(mapping, block, fat_get_block); return generic_block_bmap(mapping, block, fat_get_block);
} }
static struct address_space_operations fat_aops = { static const struct address_space_operations fat_aops = {
.readpage = fat_readpage, .readpage = fat_readpage,
.readpages = fat_readpages, .readpages = fat_readpages,
.writepage = fat_writepage, .writepage = fat_writepage,
......
...@@ -56,7 +56,7 @@ struct inode_operations vxfs_immed_symlink_iops = { ...@@ -56,7 +56,7 @@ struct inode_operations vxfs_immed_symlink_iops = {
/* /*
* Adress space operations for immed files and directories. * Adress space operations for immed files and directories.
*/ */
struct address_space_operations vxfs_immed_aops = { const struct address_space_operations vxfs_immed_aops = {
.readpage = vxfs_immed_readpage, .readpage = vxfs_immed_readpage,
}; };
......
...@@ -41,8 +41,8 @@ ...@@ -41,8 +41,8 @@
#include "vxfs_extern.h" #include "vxfs_extern.h"
extern struct address_space_operations vxfs_aops; extern const struct address_space_operations vxfs_aops;
extern struct address_space_operations vxfs_immed_aops; extern const struct address_space_operations vxfs_immed_aops;
extern struct inode_operations vxfs_immed_symlink_iops; extern struct inode_operations vxfs_immed_symlink_iops;
...@@ -295,7 +295,7 @@ vxfs_read_inode(struct inode *ip) ...@@ -295,7 +295,7 @@ vxfs_read_inode(struct inode *ip)
{ {
struct super_block *sbp = ip->i_sb; struct super_block *sbp = ip->i_sb;
struct vxfs_inode_info *vip; struct vxfs_inode_info *vip;
struct address_space_operations *aops; const struct address_space_operations *aops;
ino_t ino = ip->i_ino; ino_t ino = ip->i_ino;
if (!(vip = __vxfs_iget(ino, VXFS_SBI(sbp)->vsi_ilist))) if (!(vip = __vxfs_iget(ino, VXFS_SBI(sbp)->vsi_ilist)))
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
static int vxfs_readpage(struct file *, struct page *); static int vxfs_readpage(struct file *, struct page *);
static sector_t vxfs_bmap(struct address_space *, sector_t); static sector_t vxfs_bmap(struct address_space *, sector_t);
struct address_space_operations vxfs_aops = { const struct address_space_operations vxfs_aops = {
.readpage = vxfs_readpage, .readpage = vxfs_readpage,
.bmap = vxfs_bmap, .bmap = vxfs_bmap,
.sync_page = block_sync_page, .sync_page = block_sync_page,
......
...@@ -770,7 +770,7 @@ static const struct file_operations fuse_direct_io_file_operations = { ...@@ -770,7 +770,7 @@ static const struct file_operations fuse_direct_io_file_operations = {
/* no mmap and sendfile */ /* no mmap and sendfile */
}; };
static struct address_space_operations fuse_file_aops = { static const struct address_space_operations fuse_file_aops = {
.readpage = fuse_readpage, .readpage = fuse_readpage,
.prepare_write = fuse_prepare_write, .prepare_write = fuse_prepare_write,
.commit_write = fuse_commit_write, .commit_write = fuse_commit_write,
......
...@@ -182,8 +182,8 @@ extern void hfs_file_truncate(struct inode *); ...@@ -182,8 +182,8 @@ extern void hfs_file_truncate(struct inode *);
extern int hfs_get_block(struct inode *, sector_t, struct buffer_head *, int); extern int hfs_get_block(struct inode *, sector_t, struct buffer_head *, int);
/* inode.c */ /* inode.c */
extern struct address_space_operations hfs_aops; extern const struct address_space_operations hfs_aops;
extern struct address_space_operations hfs_btree_aops; extern const struct address_space_operations hfs_btree_aops;
extern struct inode *hfs_new_inode(struct inode *, struct qstr *, int); extern struct inode *hfs_new_inode(struct inode *, struct qstr *, int);
extern void hfs_inode_write_fork(struct inode *, struct hfs_extent *, __be32 *, __be32 *); extern void hfs_inode_write_fork(struct inode *, struct hfs_extent *, __be32 *, __be32 *);
......
...@@ -114,7 +114,7 @@ static int hfs_writepages(struct address_space *mapping, ...@@ -114,7 +114,7 @@ static int hfs_writepages(struct address_space *mapping,
return mpage_writepages(mapping, wbc, hfs_get_block); return mpage_writepages(mapping, wbc, hfs_get_block);
} }
struct address_space_operations hfs_btree_aops = { const struct address_space_operations hfs_btree_aops = {
.readpage = hfs_readpage, .readpage = hfs_readpage,
.writepage = hfs_writepage, .writepage = hfs_writepage,
.sync_page = block_sync_page, .sync_page = block_sync_page,
...@@ -124,7 +124,7 @@ struct address_space_operations hfs_btree_aops = { ...@@ -124,7 +124,7 @@ struct address_space_operations hfs_btree_aops = {
.releasepage = hfs_releasepage, .releasepage = hfs_releasepage,
}; };