Commit c5ef1c42 authored by Arjan van de Ven's avatar Arjan van de Ven Committed by Linus Torvalds
Browse files

[PATCH] mark struct inode_operations const 3



Many struct inode_operations in the kernel can be "const".  Marking them const
moves these to the .rodata section, which avoids false sharing with potential
dirty data.  In addition it'll catch accidental writes at compile time to
these shared resources.
Signed-off-by: default avatarArjan van de Ven <arjan@linux.intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 92e1d5be
......@@ -93,7 +93,7 @@ struct pid_entry {
int len;
char *name;
mode_t mode;
struct inode_operations *iop;
const struct inode_operations *iop;
const struct file_operations *fop;
union proc_op op;
};
......@@ -352,7 +352,7 @@ static int proc_setattr(struct dentry *dentry, struct iattr *attr)
return error;
}
static struct inode_operations proc_def_inode_operations = {
static const struct inode_operations proc_def_inode_operations = {
.setattr = proc_setattr,
};
......@@ -980,7 +980,7 @@ static int proc_pid_readlink(struct dentry * dentry, char __user * buffer, int b
return error;
}
static struct inode_operations proc_pid_link_inode_operations = {
static const struct inode_operations proc_pid_link_inode_operations = {
.readlink = proc_pid_readlink,
.follow_link = proc_pid_follow_link,
.setattr = proc_setattr,
......@@ -1416,7 +1416,7 @@ static const struct file_operations proc_fd_operations = {
/*
* proc directories can do almost nothing..
*/
static struct inode_operations proc_fd_inode_operations = {
static const struct inode_operations proc_fd_inode_operations = {
.lookup = proc_lookupfd,
.setattr = proc_setattr,
};
......@@ -1656,7 +1656,7 @@ static struct dentry *proc_attr_dir_lookup(struct inode *dir,
attr_dir_stuff, ARRAY_SIZE(attr_dir_stuff));
}
static struct inode_operations proc_attr_dir_inode_operations = {
static const struct inode_operations proc_attr_dir_inode_operations = {
.lookup = proc_attr_dir_lookup,
.getattr = pid_getattr,
.setattr = proc_setattr,
......@@ -1682,7 +1682,7 @@ static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd)
return ERR_PTR(vfs_follow_link(nd,tmp));
}
static struct inode_operations proc_self_inode_operations = {
static const struct inode_operations proc_self_inode_operations = {
.readlink = proc_self_readlink,
.follow_link = proc_self_follow_link,
};
......@@ -1835,7 +1835,7 @@ static int proc_pid_io_accounting(struct task_struct *task, char *buffer)
* Thread groups
*/
static const struct file_operations proc_task_operations;
static struct inode_operations proc_task_inode_operations;
static const struct inode_operations proc_task_inode_operations;
static struct pid_entry tgid_base_stuff[] = {
DIR("task", S_IRUGO|S_IXUGO, task),
......@@ -1904,7 +1904,7 @@ static struct dentry *proc_tgid_base_lookup(struct inode *dir, struct dentry *de
tgid_base_stuff, ARRAY_SIZE(tgid_base_stuff));
}
static struct inode_operations proc_tgid_base_inode_operations = {
static const struct inode_operations proc_tgid_base_inode_operations = {
.lookup = proc_tgid_base_lookup,
.getattr = pid_getattr,
.setattr = proc_setattr,
......@@ -2182,7 +2182,7 @@ static const struct file_operations proc_tid_base_operations = {
.readdir = proc_tid_base_readdir,
};
static struct inode_operations proc_tid_base_inode_operations = {
static const struct inode_operations proc_tid_base_inode_operations = {
.lookup = proc_tid_base_lookup,
.getattr = pid_getattr,
.setattr = proc_setattr,
......@@ -2408,7 +2408,7 @@ static int proc_task_getattr(struct vfsmount *mnt, struct dentry *dentry, struct
return 0;
}
static struct inode_operations proc_task_inode_operations = {
static const struct inode_operations proc_task_inode_operations = {
.lookup = proc_task_lookup,
.getattr = proc_task_getattr,
.setattr = proc_setattr,
......
......@@ -265,7 +265,7 @@ static int proc_getattr(struct vfsmount *mnt, struct dentry *dentry,
return 0;
}
static struct inode_operations proc_file_inode_operations = {
static const struct inode_operations proc_file_inode_operations = {
.setattr = proc_notify_change,
};
......@@ -357,7 +357,7 @@ static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd)
return NULL;
}
static struct inode_operations proc_link_inode_operations = {
static const struct inode_operations proc_link_inode_operations = {
.readlink = generic_readlink,
.follow_link = proc_follow_link,
};
......@@ -505,7 +505,7 @@ static const struct file_operations proc_dir_operations = {
/*
* proc directories can do almost nothing..
*/
static struct inode_operations proc_dir_inode_operations = {
static const struct inode_operations proc_dir_inode_operations = {
.lookup = proc_lookup,
.getattr = proc_getattr,
.setattr = proc_notify_change,
......
......@@ -144,7 +144,7 @@ static const struct file_operations proc_root_operations = {
/*
* proc root can do almost nothing..
*/
static struct inode_operations proc_root_inode_operations = {
static const struct inode_operations proc_root_inode_operations = {
.lookup = proc_root_lookup,
.getattr = proc_root_getattr,
};
......
......@@ -87,7 +87,7 @@ const struct file_operations qnx4_dir_operations =
.fsync = file_fsync,
};
struct inode_operations qnx4_dir_inode_operations =
const struct inode_operations qnx4_dir_inode_operations =
{
.lookup = qnx4_lookup,
#ifdef CONFIG_QNX4FS_RW
......
......@@ -33,7 +33,7 @@ const struct file_operations qnx4_file_operations =
#endif
};
struct inode_operations qnx4_file_inode_operations =
const struct inode_operations qnx4_file_inode_operations =
{
#ifdef CONFIG_QNX4FS_RW
.truncate = qnx4_truncate,
......
......@@ -45,6 +45,6 @@ const struct file_operations ramfs_file_operations = {
.llseek = generic_file_llseek,
};
struct inode_operations ramfs_file_inode_operations = {
const struct inode_operations ramfs_file_inode_operations = {
.getattr = simple_getattr,
};
......@@ -47,7 +47,7 @@ const struct file_operations ramfs_file_operations = {
.llseek = generic_file_llseek,
};
struct inode_operations ramfs_file_inode_operations = {
const struct inode_operations ramfs_file_inode_operations = {
.setattr = ramfs_nommu_setattr,
.getattr = simple_getattr,
};
......
......@@ -41,7 +41,7 @@
#define RAMFS_MAGIC 0x858458f6
static struct super_operations ramfs_ops;
static struct inode_operations ramfs_dir_inode_operations;
static const struct inode_operations ramfs_dir_inode_operations;
static struct backing_dev_info ramfs_backing_dev_info = {
.ra_pages = 0, /* No readahead */
......@@ -143,7 +143,7 @@ static int ramfs_symlink(struct inode * dir, struct dentry *dentry, const char *
return error;
}
static struct inode_operations ramfs_dir_inode_operations = {
static const struct inode_operations ramfs_dir_inode_operations = {
.create = ramfs_create,
.lookup = simple_lookup,
.link = simple_link,
......
......@@ -12,4 +12,4 @@
extern const struct address_space_operations ramfs_aops;
extern const struct file_operations ramfs_file_operations;
extern struct inode_operations ramfs_file_inode_operations;
extern const struct inode_operations ramfs_file_inode_operations;
......@@ -1556,7 +1556,7 @@ const struct file_operations reiserfs_file_operations = {
.splice_write = generic_file_splice_write,
};
struct inode_operations reiserfs_file_inode_operations = {
const struct inode_operations reiserfs_file_inode_operations = {
.truncate = reiserfs_vfs_truncate_file,
.setattr = reiserfs_setattr,
.setxattr = reiserfs_setxattr,
......
......@@ -1525,7 +1525,7 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
/*
* directories can handle most operations...
*/
struct inode_operations reiserfs_dir_inode_operations = {
const struct inode_operations reiserfs_dir_inode_operations = {
//&reiserfs_dir_operations, /* default_file_ops */
.create = reiserfs_create,
.lookup = reiserfs_lookup,
......@@ -1548,7 +1548,7 @@ struct inode_operations reiserfs_dir_inode_operations = {
* symlink operations.. same as page_symlink_inode_operations, with xattr
* stuff added
*/
struct inode_operations reiserfs_symlink_inode_operations = {
const struct inode_operations reiserfs_symlink_inode_operations = {
.readlink = generic_readlink,
.follow_link = page_follow_link_light,
.put_link = page_put_link,
......@@ -1564,7 +1564,7 @@ struct inode_operations reiserfs_symlink_inode_operations = {
/*
* special file operations.. just xattr/acl stuff
*/
struct inode_operations reiserfs_special_inode_operations = {
const struct inode_operations reiserfs_special_inode_operations = {
.setattr = reiserfs_setattr,
.setxattr = reiserfs_setxattr,
.getxattr = reiserfs_getxattr,
......
......@@ -468,7 +468,7 @@ static const struct file_operations romfs_dir_operations = {
.readdir = romfs_readdir,
};
static struct inode_operations romfs_dir_inode_operations = {
static const struct inode_operations romfs_dir_inode_operations = {
.lookup = romfs_lookup,
};
......
......@@ -42,7 +42,7 @@ const struct file_operations smb_dir_operations =
.open = smb_dir_open,
};
struct inode_operations smb_dir_inode_operations =
const struct inode_operations smb_dir_inode_operations =
{
.create = smb_create,
.lookup = smb_lookup,
......@@ -54,7 +54,7 @@ struct inode_operations smb_dir_inode_operations =
.setattr = smb_notify_change,
};
struct inode_operations smb_dir_inode_operations_unix =
const struct inode_operations smb_dir_inode_operations_unix =
{
.create = smb_create,
.lookup = smb_lookup,
......
......@@ -418,7 +418,7 @@ const struct file_operations smb_file_operations =
.sendfile = smb_file_sendfile,
};
struct inode_operations smb_file_inode_operations =
const struct inode_operations smb_file_inode_operations =
{
.permission = smb_file_permission,
.getattr = smb_getattr,
......
......@@ -36,8 +36,8 @@ extern int smb_proc_link(struct smb_sb_info *server, struct dentry *dentry, stru
extern void smb_install_null_ops(struct smb_ops *ops);
/* dir.c */
extern const struct file_operations smb_dir_operations;
extern struct inode_operations smb_dir_inode_operations;
extern struct inode_operations smb_dir_inode_operations_unix;
extern const struct inode_operations smb_dir_inode_operations;
extern const struct inode_operations smb_dir_inode_operations_unix;
extern void smb_new_dentry(struct dentry *dentry);
extern void smb_renew_times(struct dentry *dentry);
/* cache.c */
......@@ -65,7 +65,7 @@ extern int smb_notify_change(struct dentry *dentry, struct iattr *attr);
/* file.c */
extern const struct address_space_operations smb_file_aops;
extern const struct file_operations smb_file_operations;
extern struct inode_operations smb_file_inode_operations;
extern const struct inode_operations smb_file_inode_operations;
/* ioctl.c */
extern int smb_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);
/* smbiod.c */
......@@ -84,4 +84,4 @@ extern int smb_request_send_server(struct smb_sb_info *server);
extern int smb_request_recv(struct smb_sb_info *server);
/* symlink.c */
extern int smb_symlink(struct inode *inode, struct dentry *dentry, const char *oldname);
extern struct inode_operations smb_link_inode_operations;
extern const struct inode_operations smb_link_inode_operations;
......@@ -62,7 +62,7 @@ static void smb_put_link(struct dentry *dentry, struct nameidata *nd, void *p)
__putname(s);
}
struct inode_operations smb_link_inode_operations =
const struct inode_operations smb_link_inode_operations =
{
.readlink = generic_readlink,
.follow_link = smb_follow_link,
......
......@@ -296,7 +296,7 @@ static struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry,
return ERR_PTR(err);
}
struct inode_operations sysfs_dir_inode_operations = {
const struct inode_operations sysfs_dir_inode_operations = {
.lookup = sysfs_lookup,
.setattr = sysfs_setattr,
};
......
......@@ -29,7 +29,7 @@ static struct backing_dev_info sysfs_backing_dev_info = {
.capabilities = BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_WRITEBACK,
};
static struct inode_operations sysfs_inode_operations ={
static const struct inode_operations sysfs_inode_operations ={
.setattr = sysfs_setattr,
};
......
......@@ -181,7 +181,7 @@ static void sysfs_put_link(struct dentry *dentry, struct nameidata *nd, void *co
free_page((unsigned long)page);
}
struct inode_operations sysfs_symlink_inode_operations = {
const struct inode_operations sysfs_symlink_inode_operations = {
.readlink = generic_readlink,
.follow_link = sysfs_follow_link,
.put_link = sysfs_put_link,
......
......@@ -26,8 +26,8 @@ extern struct super_block * sysfs_sb;
extern const struct file_operations sysfs_dir_operations;
extern const struct file_operations sysfs_file_operations;
extern const struct file_operations bin_fops;
extern struct inode_operations sysfs_dir_inode_operations;
extern struct inode_operations sysfs_symlink_inode_operations;
extern const struct inode_operations sysfs_dir_inode_operations;
extern const struct inode_operations sysfs_symlink_inode_operations;
struct sysfs_symlink {
char * link_name;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment