[PATCH] mark struct file_operations const 6
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
d54b1fdb1d
commit
00977a59b9
@@ -223,7 +223,7 @@ static int fragmentation_open(struct inode *inode, struct file *file)
|
||||
return seq_open(file, &fragmentation_op);
|
||||
}
|
||||
|
||||
static struct file_operations fragmentation_file_operations = {
|
||||
static const struct file_operations fragmentation_file_operations = {
|
||||
.open = fragmentation_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
@@ -236,7 +236,7 @@ static int zoneinfo_open(struct inode *inode, struct file *file)
|
||||
return seq_open(file, &zoneinfo_op);
|
||||
}
|
||||
|
||||
static struct file_operations proc_zoneinfo_file_operations = {
|
||||
static const struct file_operations proc_zoneinfo_file_operations = {
|
||||
.open = zoneinfo_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
@@ -261,7 +261,7 @@ static int cpuinfo_open(struct inode *inode, struct file *file)
|
||||
return seq_open(file, &cpuinfo_op);
|
||||
}
|
||||
|
||||
static struct file_operations proc_cpuinfo_operations = {
|
||||
static const struct file_operations proc_cpuinfo_operations = {
|
||||
.open = cpuinfo_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
@@ -320,7 +320,7 @@ static int devinfo_open(struct inode *inode, struct file *filp)
|
||||
return seq_open(filp, &devinfo_ops);
|
||||
}
|
||||
|
||||
static struct file_operations proc_devinfo_operations = {
|
||||
static const struct file_operations proc_devinfo_operations = {
|
||||
.open = devinfo_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
@@ -332,7 +332,7 @@ static int vmstat_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return seq_open(file, &vmstat_op);
|
||||
}
|
||||
static struct file_operations proc_vmstat_file_operations = {
|
||||
static const struct file_operations proc_vmstat_file_operations = {
|
||||
.open = vmstat_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
@@ -363,7 +363,7 @@ static int partitions_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return seq_open(file, &partitions_op);
|
||||
}
|
||||
static struct file_operations proc_partitions_operations = {
|
||||
static const struct file_operations proc_partitions_operations = {
|
||||
.open = partitions_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
@@ -375,7 +375,7 @@ static int diskstats_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return seq_open(file, &diskstats_op);
|
||||
}
|
||||
static struct file_operations proc_diskstats_operations = {
|
||||
static const struct file_operations proc_diskstats_operations = {
|
||||
.open = diskstats_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
@@ -389,7 +389,7 @@ static int modules_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return seq_open(file, &modules_op);
|
||||
}
|
||||
static struct file_operations proc_modules_operations = {
|
||||
static const struct file_operations proc_modules_operations = {
|
||||
.open = modules_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
@@ -404,7 +404,7 @@ static int slabinfo_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return seq_open(file, &slabinfo_op);
|
||||
}
|
||||
static struct file_operations proc_slabinfo_operations = {
|
||||
static const struct file_operations proc_slabinfo_operations = {
|
||||
.open = slabinfo_open,
|
||||
.read = seq_read,
|
||||
.write = slabinfo_write,
|
||||
@@ -438,7 +438,7 @@ static int slabstats_release(struct inode *inode, struct file *file)
|
||||
return seq_release(inode, file);
|
||||
}
|
||||
|
||||
static struct file_operations proc_slabstats_operations = {
|
||||
static const struct file_operations proc_slabstats_operations = {
|
||||
.open = slabstats_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
@@ -551,7 +551,7 @@ static int stat_open(struct inode *inode, struct file *file)
|
||||
kfree(buf);
|
||||
return res;
|
||||
}
|
||||
static struct file_operations proc_stat_operations = {
|
||||
static const struct file_operations proc_stat_operations = {
|
||||
.open = stat_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
@@ -593,7 +593,7 @@ static int interrupts_open(struct inode *inode, struct file *filp)
|
||||
return seq_open(filp, &int_seq_ops);
|
||||
}
|
||||
|
||||
static struct file_operations proc_interrupts_operations = {
|
||||
static const struct file_operations proc_interrupts_operations = {
|
||||
.open = interrupts_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
@@ -650,7 +650,7 @@ static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf,
|
||||
return count;
|
||||
}
|
||||
|
||||
static struct file_operations proc_sysrq_trigger_operations = {
|
||||
static const struct file_operations proc_sysrq_trigger_operations = {
|
||||
.write = write_sysrq_trigger,
|
||||
};
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user