Skip to content

Commit d54b1fd

Browse files
fenrus75Linus Torvalds
authored andcommitted
[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>
1 parent fa027c2 commit d54b1fd

45 files changed

Lines changed: 89 additions & 89 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎drivers/message/i2o/i2o_config.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,7 @@ static int cfg_release(struct inode *inode, struct file *file)
11111111
return 0;
11121112
}
11131113

1114-
static struct file_operations config_fops = {
1114+
static const struct file_operations config_fops = {
11151115
.owner = THIS_MODULE,
11161116
.llseek = no_llseek,
11171117
.ioctl = i2o_cfg_ioctl,

‎drivers/message/i2o/i2o_proc.c‎

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,133 +1703,133 @@ static int i2o_seq_open_dev_name(struct inode *inode, struct file *file)
17031703
return single_open(file, i2o_seq_show_dev_name, PDE(inode)->data);
17041704
};
17051705

1706-
static struct file_operations i2o_seq_fops_lct = {
1706+
static const struct file_operations i2o_seq_fops_lct = {
17071707
.open = i2o_seq_open_lct,
17081708
.read = seq_read,
17091709
.llseek = seq_lseek,
17101710
.release = single_release,
17111711
};
17121712

1713-
static struct file_operations i2o_seq_fops_hrt = {
1713+
static const struct file_operations i2o_seq_fops_hrt = {
17141714
.open = i2o_seq_open_hrt,
17151715
.read = seq_read,
17161716
.llseek = seq_lseek,
17171717
.release = single_release,
17181718
};
17191719

1720-
static struct file_operations i2o_seq_fops_status = {
1720+
static const struct file_operations i2o_seq_fops_status = {
17211721
.open = i2o_seq_open_status,
17221722
.read = seq_read,
17231723
.llseek = seq_lseek,
17241724
.release = single_release,
17251725
};
17261726

1727-
static struct file_operations i2o_seq_fops_hw = {
1727+
static const struct file_operations i2o_seq_fops_hw = {
17281728
.open = i2o_seq_open_hw,
17291729
.read = seq_read,
17301730
.llseek = seq_lseek,
17311731
.release = single_release,
17321732
};
17331733

1734-
static struct file_operations i2o_seq_fops_ddm_table = {
1734+
static const struct file_operations i2o_seq_fops_ddm_table = {
17351735
.open = i2o_seq_open_ddm_table,
17361736
.read = seq_read,
17371737
.llseek = seq_lseek,
17381738
.release = single_release,
17391739
};
17401740

1741-
static struct file_operations i2o_seq_fops_driver_store = {
1741+
static const struct file_operations i2o_seq_fops_driver_store = {
17421742
.open = i2o_seq_open_driver_store,
17431743
.read = seq_read,
17441744
.llseek = seq_lseek,
17451745
.release = single_release,
17461746
};
17471747

1748-
static struct file_operations i2o_seq_fops_drivers_stored = {
1748+
static const struct file_operations i2o_seq_fops_drivers_stored = {
17491749
.open = i2o_seq_open_drivers_stored,
17501750
.read = seq_read,
17511751
.llseek = seq_lseek,
17521752
.release = single_release,
17531753
};
17541754

1755-
static struct file_operations i2o_seq_fops_groups = {
1755+
static const struct file_operations i2o_seq_fops_groups = {
17561756
.open = i2o_seq_open_groups,
17571757
.read = seq_read,
17581758
.llseek = seq_lseek,
17591759
.release = single_release,
17601760
};
17611761

1762-
static struct file_operations i2o_seq_fops_phys_device = {
1762+
static const struct file_operations i2o_seq_fops_phys_device = {
17631763
.open = i2o_seq_open_phys_device,
17641764
.read = seq_read,
17651765
.llseek = seq_lseek,
17661766
.release = single_release,
17671767
};
17681768

1769-
static struct file_operations i2o_seq_fops_claimed = {
1769+
static const struct file_operations i2o_seq_fops_claimed = {
17701770
.open = i2o_seq_open_claimed,
17711771
.read = seq_read,
17721772
.llseek = seq_lseek,
17731773
.release = single_release,
17741774
};
17751775

1776-
static struct file_operations i2o_seq_fops_users = {
1776+
static const struct file_operations i2o_seq_fops_users = {
17771777
.open = i2o_seq_open_users,
17781778
.read = seq_read,
17791779
.llseek = seq_lseek,
17801780
.release = single_release,
17811781
};
17821782

1783-
static struct file_operations i2o_seq_fops_priv_msgs = {
1783+
static const struct file_operations i2o_seq_fops_priv_msgs = {
17841784
.open = i2o_seq_open_priv_msgs,
17851785
.read = seq_read,
17861786
.llseek = seq_lseek,
17871787
.release = single_release,
17881788
};
17891789

1790-
static struct file_operations i2o_seq_fops_authorized_users = {
1790+
static const struct file_operations i2o_seq_fops_authorized_users = {
17911791
.open = i2o_seq_open_authorized_users,
17921792
.read = seq_read,
17931793
.llseek = seq_lseek,
17941794
.release = single_release,
17951795
};
17961796

1797-
static struct file_operations i2o_seq_fops_dev_name = {
1797+
static const struct file_operations i2o_seq_fops_dev_name = {
17981798
.open = i2o_seq_open_dev_name,
17991799
.read = seq_read,
18001800
.llseek = seq_lseek,
18011801
.release = single_release,
18021802
};
18031803

1804-
static struct file_operations i2o_seq_fops_dev_identity = {
1804+
static const struct file_operations i2o_seq_fops_dev_identity = {
18051805
.open = i2o_seq_open_dev_identity,
18061806
.read = seq_read,
18071807
.llseek = seq_lseek,
18081808
.release = single_release,
18091809
};
18101810

1811-
static struct file_operations i2o_seq_fops_ddm_identity = {
1811+
static const struct file_operations i2o_seq_fops_ddm_identity = {
18121812
.open = i2o_seq_open_ddm_identity,
18131813
.read = seq_read,
18141814
.llseek = seq_lseek,
18151815
.release = single_release,
18161816
};
18171817

1818-
static struct file_operations i2o_seq_fops_uinfo = {
1818+
static const struct file_operations i2o_seq_fops_uinfo = {
18191819
.open = i2o_seq_open_uinfo,
18201820
.read = seq_read,
18211821
.llseek = seq_lseek,
18221822
.release = single_release,
18231823
};
18241824

1825-
static struct file_operations i2o_seq_fops_sgl_limits = {
1825+
static const struct file_operations i2o_seq_fops_sgl_limits = {
18261826
.open = i2o_seq_open_sgl_limits,
18271827
.read = seq_read,
18281828
.llseek = seq_lseek,
18291829
.release = single_release,
18301830
};
18311831

1832-
static struct file_operations i2o_seq_fops_sensors = {
1832+
static const struct file_operations i2o_seq_fops_sensors = {
18331833
.open = i2o_seq_open_sensors,
18341834
.read = seq_read,
18351835
.llseek = seq_lseek,

‎drivers/misc/hdpuftrs/hdpu_cpustate.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ static struct platform_driver hdpu_cpustate_driver = {
169169
/*
170170
* The various file operations we support.
171171
*/
172-
static struct file_operations cpustate_fops = {
172+
static const struct file_operations cpustate_fops = {
173173
owner:THIS_MODULE,
174174
open:cpustate_open,
175175
release:cpustate_release,

‎drivers/misc/ibmasm/ibmasmfs.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static struct inode *ibmasmfs_make_inode(struct super_block *sb, int mode)
156156
static struct dentry *ibmasmfs_create_file (struct super_block *sb,
157157
struct dentry *parent,
158158
const char *name,
159-
struct file_operations *fops,
159+
const struct file_operations *fops,
160160
void *data,
161161
int mode)
162162
{
@@ -581,28 +581,28 @@ static ssize_t remote_settings_file_write(struct file *file, const char __user *
581581
return count;
582582
}
583583

584-
static struct file_operations command_fops = {
584+
static const struct file_operations command_fops = {
585585
.open = command_file_open,
586586
.release = command_file_close,
587587
.read = command_file_read,
588588
.write = command_file_write,
589589
};
590590

591-
static struct file_operations event_fops = {
591+
static const struct file_operations event_fops = {
592592
.open = event_file_open,
593593
.release = event_file_close,
594594
.read = event_file_read,
595595
.write = event_file_write,
596596
};
597597

598-
static struct file_operations r_heartbeat_fops = {
598+
static const struct file_operations r_heartbeat_fops = {
599599
.open = r_heartbeat_file_open,
600600
.release = r_heartbeat_file_close,
601601
.read = r_heartbeat_file_read,
602602
.write = r_heartbeat_file_write,
603603
};
604604

605-
static struct file_operations remote_settings_fops = {
605+
static const struct file_operations remote_settings_fops = {
606606
.open = remote_settings_file_open,
607607
.release = remote_settings_file_close,
608608
.read = remote_settings_file_read,

‎drivers/mtd/mtdchar.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
759759
return ret;
760760
} /* memory_ioctl */
761761

762-
static struct file_operations mtd_fops = {
762+
static const struct file_operations mtd_fops = {
763763
.owner = THIS_MODULE,
764764
.llseek = mtd_lseek,
765765
.read = mtd_read,

‎drivers/net/bonding/bond_main.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3120,7 +3120,7 @@ static int bond_info_open(struct inode *inode, struct file *file)
31203120
return res;
31213121
}
31223122

3123-
static struct file_operations bond_info_fops = {
3123+
static const struct file_operations bond_info_fops = {
31243124
.owner = THIS_MODULE,
31253125
.open = bond_info_open,
31263126
.read = seq_read,

‎drivers/net/hamradio/bpqether.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ static int bpq_info_open(struct inode *inode, struct file *file)
459459
return seq_open(file, &bpq_seqops);
460460
}
461461

462-
static struct file_operations bpq_info_fops = {
462+
static const struct file_operations bpq_info_fops = {
463463
.owner = THIS_MODULE,
464464
.open = bpq_info_open,
465465
.read = seq_read,

‎drivers/net/hamradio/scc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2083,7 +2083,7 @@ static int scc_net_seq_open(struct inode *inode, struct file *file)
20832083
return seq_open(file, &scc_net_seq_ops);
20842084
}
20852085

2086-
static struct file_operations scc_net_seq_fops = {
2086+
static const struct file_operations scc_net_seq_fops = {
20872087
.owner = THIS_MODULE,
20882088
.open = scc_net_seq_open,
20892089
.read = seq_read,

‎drivers/net/hamradio/yam.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ static int yam_info_open(struct inode *inode, struct file *file)
804804
return seq_open(file, &yam_seqops);
805805
}
806806

807-
static struct file_operations yam_info_fops = {
807+
static const struct file_operations yam_info_fops = {
808808
.owner = THIS_MODULE,
809809
.open = yam_info_open,
810810
.read = seq_read,

‎drivers/net/ibmveth.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1156,7 +1156,7 @@ static int ibmveth_proc_open(struct inode *inode, struct file *file)
11561156
return rc;
11571157
}
11581158

1159-
static struct file_operations ibmveth_proc_fops = {
1159+
static const struct file_operations ibmveth_proc_fops = {
11601160
.owner = THIS_MODULE,
11611161
.open = ibmveth_proc_open,
11621162
.read = seq_read,

0 commit comments

Comments
 (0)