Skip to content

Commit 2b8693c

Browse files
fenrus75Linus Torvalds
authored andcommitted
[PATCH] mark struct file_operations const 3
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 5dfe4c9 commit 2b8693c

58 files changed

Lines changed: 83 additions & 83 deletions

Some content is hidden

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

‎block/blktrace.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ static ssize_t blk_dropped_read(struct file *filp, char __user *buffer,
264264
return simple_read_from_buffer(buffer, count, ppos, buf, strlen(buf));
265265
}
266266

267-
static struct file_operations blk_dropped_fops = {
267+
static const struct file_operations blk_dropped_fops = {
268268
.owner = THIS_MODULE,
269269
.open = blk_dropped_open,
270270
.read = blk_dropped_read,

‎crypto/proc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static int crypto_info_open(struct inode *inode, struct file *file)
101101
return seq_open(file, &crypto_seq_ops);
102102
}
103103

104-
static struct file_operations proc_crypto_ops = {
104+
static const struct file_operations proc_crypto_ops = {
105105
.open = crypto_info_open,
106106
.read = seq_read,
107107
.llseek = seq_lseek,

‎drivers/acorn/char/i2c.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file,
238238
return -EINVAL;
239239
}
240240

241-
static struct file_operations rtc_fops = {
241+
static const struct file_operations rtc_fops = {
242242
.ioctl = rtc_ioctl,
243243
};
244244

‎drivers/block/DAC960.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7024,7 +7024,7 @@ static int DAC960_gam_ioctl(struct inode *inode, struct file *file,
70247024
return -EINVAL;
70257025
}
70267026

7027-
static struct file_operations DAC960_gam_fops = {
7027+
static const struct file_operations DAC960_gam_fops = {
70287028
.owner = THIS_MODULE,
70297029
.ioctl = DAC960_gam_ioctl
70307030
};

‎drivers/block/acsi_slm.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ static int slm_get_pagesize( int device, int *w, int *h );
269269

270270
static DEFINE_TIMER(slm_timer, slm_test_ready, 0, 0);
271271

272-
static struct file_operations slm_fops = {
272+
static const struct file_operations slm_fops = {
273273
.owner = THIS_MODULE,
274274
.read = slm_read,
275275
.write = slm_write,

‎drivers/block/aoe/aoechr.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ aoechr_read(struct file *filp, char __user *buf, size_t cnt, loff_t *off)
233233
}
234234
}
235235

236-
static struct file_operations aoe_fops = {
236+
static const struct file_operations aoe_fops = {
237237
.write = aoechr_write,
238238
.read = aoechr_read,
239239
.open = aoechr_open,

‎drivers/block/paride/pg.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ static struct class *pg_class;
227227

228228
/* kernel glue structures */
229229

230-
static struct file_operations pg_fops = {
230+
static const struct file_operations pg_fops = {
231231
.owner = THIS_MODULE,
232232
.read = pg_read,
233233
.write = pg_write,

‎drivers/block/paride/pt.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ static char pt_scratch[512]; /* scratch block buffer */
232232

233233
/* kernel glue structures */
234234

235-
static struct file_operations pt_fops = {
235+
static const struct file_operations pt_fops = {
236236
.owner = THIS_MODULE,
237237
.read = pt_read,
238238
.write = pt_write,

‎drivers/block/pktcdvd.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ static int pkt_debugfs_fops_open(struct inode *inode, struct file *file)
435435
return single_open(file, pkt_debugfs_seq_show, inode->i_private);
436436
}
437437

438-
static struct file_operations debug_fops = {
438+
static const struct file_operations debug_fops = {
439439
.open = pkt_debugfs_fops_open,
440440
.read = seq_read,
441441
.llseek = seq_lseek,
@@ -2725,7 +2725,7 @@ static int pkt_seq_open(struct inode *inode, struct file *file)
27252725
return single_open(file, pkt_seq_show, PDE(inode)->data);
27262726
}
27272727

2728-
static struct file_operations pkt_proc_fops = {
2728+
static const struct file_operations pkt_proc_fops = {
27292729
.open = pkt_seq_open,
27302730
.read = seq_read,
27312731
.llseek = seq_lseek,
@@ -3052,7 +3052,7 @@ static int pkt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cm
30523052
}
30533053

30543054

3055-
static struct file_operations pkt_ctl_fops = {
3055+
static const struct file_operations pkt_ctl_fops = {
30563056
.ioctl = pkt_ctl_ioctl,
30573057
.owner = THIS_MODULE,
30583058
};

‎drivers/bluetooth/hci_vhci.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ static int vhci_fasync(int fd, struct file *file, int on)
332332
return 0;
333333
}
334334

335-
static struct file_operations vhci_fops = {
335+
static const struct file_operations vhci_fops = {
336336
.owner = THIS_MODULE,
337337
.llseek = vhci_llseek,
338338
.read = vhci_read,

0 commit comments

Comments
 (0)