[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 <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Arjan van de Ven 2007-02-12 00:55:32 -08:00 • committed by Linus Torvalds
commit 2b8693c061
58 changed files with 83 additions and 83 deletions

View file

@ -1003,7 +1003,7 @@ capi_release(struct inode *inode, struct file *file)
return 0;
}
static struct file_operations capi_fops =
static const struct file_operations capi_fops =
{
.owner = THIS_MODULE,
.llseek = no_llseek,

View file

@ -113,14 +113,14 @@ static int seq_contrstats_open(struct inode *inode, struct file *file)
return seq_open(file, &seq_contrstats_ops);
}
static struct file_operations proc_controller_ops = {
static const struct file_operations proc_controller_ops = {
.open = seq_controller_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
static struct file_operations proc_contrstats_ops = {
static const struct file_operations proc_contrstats_ops = {
.open = seq_contrstats_open,
.read = seq_read,
.llseek = seq_lseek,
@ -218,14 +218,14 @@ seq_applstats_open(struct inode *inode, struct file *file)
return seq_open(file, &seq_applstats_ops);
}
static struct file_operations proc_applications_ops = {
static const struct file_operations proc_applications_ops = {
.open = seq_applications_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
static struct file_operations proc_applstats_ops = {
static const struct file_operations proc_applstats_ops = {
.open = seq_applstats_open,
.read = seq_read,
.llseek = seq_lseek,
@ -302,7 +302,7 @@ seq_capi_driver_open(struct inode *inode, struct file *file)
return err;
}
static struct file_operations proc_driver_ops = {
static const struct file_operations proc_driver_ops = {
.open = seq_capi_driver_open,
.read = seq_read,
.llseek = seq_lseek,

View file

@ -256,7 +256,7 @@ isdn_divert_ioctl(struct inode *inode, struct file *file,
#ifdef CONFIG_PROC_FS
static struct file_operations isdn_fops =
static const struct file_operations isdn_fops =
{
.owner = THIS_MODULE,
.llseek = no_llseek,

View file

@ -164,7 +164,7 @@ static ssize_t divas_maint_read(struct file *file, char __user *buf,
return (maint_read_write(buf, (int) count));
}
static struct file_operations divas_maint_fops = {
static const struct file_operations divas_maint_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.read = divas_maint_read,

View file

@ -131,7 +131,7 @@ static void remove_um_idi_proc(void)
}
}
static struct file_operations divas_idi_fops = {
static const struct file_operations divas_idi_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.read = um_idi_read,

View file

@ -663,7 +663,7 @@ static unsigned int divas_poll(struct file *file, poll_table * wait)
return (POLLIN | POLLRDNORM);
}
static struct file_operations divas_fops = {
static const struct file_operations divas_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.read = divas_read,

View file

@ -113,7 +113,7 @@ static int divas_close(struct inode *inode, struct file *file)
return (0);
}
static struct file_operations divas_fops = {
static const struct file_operations divas_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.read = divas_read,

View file

@ -367,7 +367,7 @@ hysdn_conf_close(struct inode *ino, struct file *filep)
/******************************************************/
/* table for conf filesystem functions defined above. */
/******************************************************/
static struct file_operations conf_fops =
static const struct file_operations conf_fops =
{
.llseek = no_llseek,
.read = hysdn_conf_read,

View file

@ -383,7 +383,7 @@ hysdn_log_poll(struct file *file, poll_table * wait)
/**************************************************/
/* table for log filesystem functions defined above. */
/**************************************************/
static struct file_operations log_fops =
static const struct file_operations log_fops =
{
.llseek = no_llseek,
.read = hysdn_log_read,

View file

@ -1822,7 +1822,7 @@ isdn_close(struct inode *ino, struct file *filep)
return 0;
}
static struct file_operations isdn_fops =
static const struct file_operations isdn_fops =
{
.owner = THIS_MODULE,
.llseek = no_llseek,