[PATCH] mark struct file_operations const 5
Many struct file_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: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
fa027c2a0a
commit
d54b1fdb1d
@@ -156,7 +156,7 @@ static struct inode *ibmasmfs_make_inode(struct super_block *sb, int mode)
|
||||
static struct dentry *ibmasmfs_create_file (struct super_block *sb,
|
||||
struct dentry *parent,
|
||||
const char *name,
|
||||
struct file_operations *fops,
|
||||
const struct file_operations *fops,
|
||||
void *data,
|
||||
int mode)
|
||||
{
|
||||
@@ -581,28 +581,28 @@ static ssize_t remote_settings_file_write(struct file *file, const char __user *
|
||||
return count;
|
||||
}
|
||||
|
||||
static struct file_operations command_fops = {
|
||||
static const struct file_operations command_fops = {
|
||||
.open = command_file_open,
|
||||
.release = command_file_close,
|
||||
.read = command_file_read,
|
||||
.write = command_file_write,
|
||||
};
|
||||
|
||||
static struct file_operations event_fops = {
|
||||
static const struct file_operations event_fops = {
|
||||
.open = event_file_open,
|
||||
.release = event_file_close,
|
||||
.read = event_file_read,
|
||||
.write = event_file_write,
|
||||
};
|
||||
|
||||
static struct file_operations r_heartbeat_fops = {
|
||||
static const struct file_operations r_heartbeat_fops = {
|
||||
.open = r_heartbeat_file_open,
|
||||
.release = r_heartbeat_file_close,
|
||||
.read = r_heartbeat_file_read,
|
||||
.write = r_heartbeat_file_write,
|
||||
};
|
||||
|
||||
static struct file_operations remote_settings_fops = {
|
||||
static const struct file_operations remote_settings_fops = {
|
||||
.open = remote_settings_file_open,
|
||||
.release = remote_settings_file_close,
|
||||
.read = remote_settings_file_read,
|
||||
|
Reference in New Issue
Block a user