From 2b8693c0617e972fc0b2fd1ebf8de97e15b656c3 Mon Sep 17 00:00:00 2001 From: Arjan van de Ven Date: Mon, 12 Feb 2007 00:55:32 -0800 Subject: [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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/block/DAC960.c | 2 +- drivers/block/acsi_slm.c | 2 +- drivers/block/aoe/aoechr.c | 2 +- drivers/block/paride/pg.c | 2 +- drivers/block/paride/pt.c | 2 +- drivers/block/pktcdvd.c | 6 +++--- 6 files changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers/block') diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index 7b2fa3d8f61c..92bf868ca056 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c @@ -7024,7 +7024,7 @@ static int DAC960_gam_ioctl(struct inode *inode, struct file *file, return -EINVAL; } -static struct file_operations DAC960_gam_fops = { +static const struct file_operations DAC960_gam_fops = { .owner = THIS_MODULE, .ioctl = DAC960_gam_ioctl }; diff --git a/drivers/block/acsi_slm.c b/drivers/block/acsi_slm.c index e04be94d195c..e2e043290963 100644 --- a/drivers/block/acsi_slm.c +++ b/drivers/block/acsi_slm.c @@ -269,7 +269,7 @@ static int slm_get_pagesize( int device, int *w, int *h ); static DEFINE_TIMER(slm_timer, slm_test_ready, 0, 0); -static struct file_operations slm_fops = { +static const struct file_operations slm_fops = { .owner = THIS_MODULE, .read = slm_read, .write = slm_write, diff --git a/drivers/block/aoe/aoechr.c b/drivers/block/aoe/aoechr.c index e22b4c9520a9..39e563ea0878 100644 --- a/drivers/block/aoe/aoechr.c +++ b/drivers/block/aoe/aoechr.c @@ -233,7 +233,7 @@ loop: } } -static struct file_operations aoe_fops = { +static const struct file_operations aoe_fops = { .write = aoechr_write, .read = aoechr_read, .open = aoechr_open, diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c index 9970aedbb5d9..d89e7d32a3b6 100644 --- a/drivers/block/paride/pg.c +++ b/drivers/block/paride/pg.c @@ -227,7 +227,7 @@ static struct class *pg_class; /* kernel glue structures */ -static struct file_operations pg_fops = { +static const struct file_operations pg_fops = { .owner = THIS_MODULE, .read = pg_read, .write = pg_write, diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c index c902b25e4869..9f4e67ee1eb0 100644 --- a/drivers/block/paride/pt.c +++ b/drivers/block/paride/pt.c @@ -232,7 +232,7 @@ static char pt_scratch[512]; /* scratch block buffer */ /* kernel glue structures */ -static struct file_operations pt_fops = { +static const struct file_operations pt_fops = { .owner = THIS_MODULE, .read = pt_read, .write = pt_write, diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index c0e89490e3d5..93fb6ed4ed52 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c @@ -435,7 +435,7 @@ static int pkt_debugfs_fops_open(struct inode *inode, struct file *file) return single_open(file, pkt_debugfs_seq_show, inode->i_private); } -static struct file_operations debug_fops = { +static const struct file_operations debug_fops = { .open = pkt_debugfs_fops_open, .read = seq_read, .llseek = seq_lseek, @@ -2725,7 +2725,7 @@ static int pkt_seq_open(struct inode *inode, struct file *file) return single_open(file, pkt_seq_show, PDE(inode)->data); } -static struct file_operations pkt_proc_fops = { +static const struct file_operations pkt_proc_fops = { .open = pkt_seq_open, .read = seq_read, .llseek = seq_lseek, @@ -3052,7 +3052,7 @@ static int pkt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cm } -static struct file_operations pkt_ctl_fops = { +static const struct file_operations pkt_ctl_fops = { .ioctl = pkt_ctl_ioctl, .owner = THIS_MODULE, }; -- cgit v1.2.3