You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
[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>
This commit is contained in:
committed by
Linus Torvalds
parent
fa027c2a0a
commit
d54b1fdb1d
@@ -1111,7 +1111,7 @@ static int cfg_release(struct inode *inode, struct file *file)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct file_operations config_fops = {
|
||||
static const struct file_operations config_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.llseek = no_llseek,
|
||||
.ioctl = i2o_cfg_ioctl,
|
||||
|
||||
@@ -1703,133 +1703,133 @@ static int i2o_seq_open_dev_name(struct inode *inode, struct file *file)
|
||||
return single_open(file, i2o_seq_show_dev_name, PDE(inode)->data);
|
||||
};
|
||||
|
||||
static struct file_operations i2o_seq_fops_lct = {
|
||||
static const struct file_operations i2o_seq_fops_lct = {
|
||||
.open = i2o_seq_open_lct,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static struct file_operations i2o_seq_fops_hrt = {
|
||||
static const struct file_operations i2o_seq_fops_hrt = {
|
||||
.open = i2o_seq_open_hrt,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static struct file_operations i2o_seq_fops_status = {
|
||||
static const struct file_operations i2o_seq_fops_status = {
|
||||
.open = i2o_seq_open_status,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static struct file_operations i2o_seq_fops_hw = {
|
||||
static const struct file_operations i2o_seq_fops_hw = {
|
||||
.open = i2o_seq_open_hw,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static struct file_operations i2o_seq_fops_ddm_table = {
|
||||
static const struct file_operations i2o_seq_fops_ddm_table = {
|
||||
.open = i2o_seq_open_ddm_table,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static struct file_operations i2o_seq_fops_driver_store = {
|
||||
static const struct file_operations i2o_seq_fops_driver_store = {
|
||||
.open = i2o_seq_open_driver_store,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static struct file_operations i2o_seq_fops_drivers_stored = {
|
||||
static const struct file_operations i2o_seq_fops_drivers_stored = {
|
||||
.open = i2o_seq_open_drivers_stored,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static struct file_operations i2o_seq_fops_groups = {
|
||||
static const struct file_operations i2o_seq_fops_groups = {
|
||||
.open = i2o_seq_open_groups,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static struct file_operations i2o_seq_fops_phys_device = {
|
||||
static const struct file_operations i2o_seq_fops_phys_device = {
|
||||
.open = i2o_seq_open_phys_device,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static struct file_operations i2o_seq_fops_claimed = {
|
||||
static const struct file_operations i2o_seq_fops_claimed = {
|
||||
.open = i2o_seq_open_claimed,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static struct file_operations i2o_seq_fops_users = {
|
||||
static const struct file_operations i2o_seq_fops_users = {
|
||||
.open = i2o_seq_open_users,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static struct file_operations i2o_seq_fops_priv_msgs = {
|
||||
static const struct file_operations i2o_seq_fops_priv_msgs = {
|
||||
.open = i2o_seq_open_priv_msgs,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static struct file_operations i2o_seq_fops_authorized_users = {
|
||||
static const struct file_operations i2o_seq_fops_authorized_users = {
|
||||
.open = i2o_seq_open_authorized_users,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static struct file_operations i2o_seq_fops_dev_name = {
|
||||
static const struct file_operations i2o_seq_fops_dev_name = {
|
||||
.open = i2o_seq_open_dev_name,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static struct file_operations i2o_seq_fops_dev_identity = {
|
||||
static const struct file_operations i2o_seq_fops_dev_identity = {
|
||||
.open = i2o_seq_open_dev_identity,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static struct file_operations i2o_seq_fops_ddm_identity = {
|
||||
static const struct file_operations i2o_seq_fops_ddm_identity = {
|
||||
.open = i2o_seq_open_ddm_identity,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static struct file_operations i2o_seq_fops_uinfo = {
|
||||
static const struct file_operations i2o_seq_fops_uinfo = {
|
||||
.open = i2o_seq_open_uinfo,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static struct file_operations i2o_seq_fops_sgl_limits = {
|
||||
static const struct file_operations i2o_seq_fops_sgl_limits = {
|
||||
.open = i2o_seq_open_sgl_limits,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static struct file_operations i2o_seq_fops_sensors = {
|
||||
static const struct file_operations i2o_seq_fops_sensors = {
|
||||
.open = i2o_seq_open_sensors,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
|
||||
@@ -169,7 +169,7 @@ static struct platform_driver hdpu_cpustate_driver = {
|
||||
/*
|
||||
* The various file operations we support.
|
||||
*/
|
||||
static struct file_operations cpustate_fops = {
|
||||
static const struct file_operations cpustate_fops = {
|
||||
owner:THIS_MODULE,
|
||||
open:cpustate_open,
|
||||
release:cpustate_release,
|
||||
|
||||
@@ -156,7 +156,7 @@ static struct inode *ibmasmfs_make_inode(struct super_block *sb, int mode)
|
||||
static struct dentry *ibmasmfs_create_file (struct super_block *sb,
|
||||
struct dentry *parent,
|
||||
const char *name,
|
||||
struct file_operations *fops,
|
||||
const struct file_operations *fops,
|
||||
void *data,
|
||||
int mode)
|
||||
{
|
||||
@@ -581,28 +581,28 @@ static ssize_t remote_settings_file_write(struct file *file, const char __user *
|
||||
return count;
|
||||
}
|
||||
|
||||
static struct file_operations command_fops = {
|
||||
static const struct file_operations command_fops = {
|
||||
.open = command_file_open,
|
||||
.release = command_file_close,
|
||||
.read = command_file_read,
|
||||
.write = command_file_write,
|
||||
};
|
||||
|
||||
static struct file_operations event_fops = {
|
||||
static const struct file_operations event_fops = {
|
||||
.open = event_file_open,
|
||||
.release = event_file_close,
|
||||
.read = event_file_read,
|
||||
.write = event_file_write,
|
||||
};
|
||||
|
||||
static struct file_operations r_heartbeat_fops = {
|
||||
static const struct file_operations r_heartbeat_fops = {
|
||||
.open = r_heartbeat_file_open,
|
||||
.release = r_heartbeat_file_close,
|
||||
.read = r_heartbeat_file_read,
|
||||
.write = r_heartbeat_file_write,
|
||||
};
|
||||
|
||||
static struct file_operations remote_settings_fops = {
|
||||
static const struct file_operations remote_settings_fops = {
|
||||
.open = remote_settings_file_open,
|
||||
.release = remote_settings_file_close,
|
||||
.read = remote_settings_file_read,
|
||||
|
||||
@@ -759,7 +759,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
|
||||
return ret;
|
||||
} /* memory_ioctl */
|
||||
|
||||
static struct file_operations mtd_fops = {
|
||||
static const struct file_operations mtd_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.llseek = mtd_lseek,
|
||||
.read = mtd_read,
|
||||
|
||||
@@ -3120,7 +3120,7 @@ static int bond_info_open(struct inode *inode, struct file *file)
|
||||
return res;
|
||||
}
|
||||
|
||||
static struct file_operations bond_info_fops = {
|
||||
static const struct file_operations bond_info_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = bond_info_open,
|
||||
.read = seq_read,
|
||||
|
||||
@@ -459,7 +459,7 @@ static int bpq_info_open(struct inode *inode, struct file *file)
|
||||
return seq_open(file, &bpq_seqops);
|
||||
}
|
||||
|
||||
static struct file_operations bpq_info_fops = {
|
||||
static const struct file_operations bpq_info_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = bpq_info_open,
|
||||
.read = seq_read,
|
||||
|
||||
@@ -2083,7 +2083,7 @@ static int scc_net_seq_open(struct inode *inode, struct file *file)
|
||||
return seq_open(file, &scc_net_seq_ops);
|
||||
}
|
||||
|
||||
static struct file_operations scc_net_seq_fops = {
|
||||
static const struct file_operations scc_net_seq_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = scc_net_seq_open,
|
||||
.read = seq_read,
|
||||
|
||||
@@ -804,7 +804,7 @@ static int yam_info_open(struct inode *inode, struct file *file)
|
||||
return seq_open(file, &yam_seqops);
|
||||
}
|
||||
|
||||
static struct file_operations yam_info_fops = {
|
||||
static const struct file_operations yam_info_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = yam_info_open,
|
||||
.read = seq_read,
|
||||
|
||||
@@ -1156,7 +1156,7 @@ static int ibmveth_proc_open(struct inode *inode, struct file *file)
|
||||
return rc;
|
||||
}
|
||||
|
||||
static struct file_operations ibmveth_proc_fops = {
|
||||
static const struct file_operations ibmveth_proc_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = ibmveth_proc_open,
|
||||
.read = seq_read,
|
||||
|
||||
@@ -385,7 +385,7 @@ static int vlsi_seq_open(struct inode *inode, struct file *file)
|
||||
return single_open(file, vlsi_seq_show, PDE(inode)->data);
|
||||
}
|
||||
|
||||
static struct file_operations vlsi_proc_fops = {
|
||||
static const struct file_operations vlsi_proc_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = vlsi_seq_open,
|
||||
.read = seq_read,
|
||||
|
||||
@@ -834,7 +834,7 @@ static int ppp_unattached_ioctl(struct ppp_file *pf, struct file *file,
|
||||
return err;
|
||||
}
|
||||
|
||||
static struct file_operations ppp_device_fops = {
|
||||
static const struct file_operations ppp_device_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.read = ppp_read,
|
||||
.write = ppp_write,
|
||||
|
||||
+1
-1
@@ -1043,7 +1043,7 @@ static int pppoe_seq_open(struct inode *inode, struct file *file)
|
||||
return seq_open(file, &pppoe_seq_ops);
|
||||
}
|
||||
|
||||
static struct file_operations pppoe_seq_fops = {
|
||||
static const struct file_operations pppoe_seq_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = pppoe_seq_open,
|
||||
.read = seq_read,
|
||||
|
||||
+1
-1
@@ -744,7 +744,7 @@ static int tun_chr_close(struct inode *inode, struct file *file)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct file_operations tun_fops = {
|
||||
static const struct file_operations tun_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.llseek = no_llseek,
|
||||
.read = do_sync_read,
|
||||
|
||||
@@ -311,7 +311,7 @@ static int cosa_chardev_ioctl(struct inode *inode, struct file *file,
|
||||
static int cosa_fasync(struct inode *inode, struct file *file, int on);
|
||||
#endif
|
||||
|
||||
static struct file_operations cosa_fops = {
|
||||
static const struct file_operations cosa_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.llseek = no_llseek,
|
||||
.read = cosa_read,
|
||||
|
||||
@@ -4430,53 +4430,53 @@ static int proc_BSSList_open( struct inode *inode, struct file *file );
|
||||
static int proc_config_open( struct inode *inode, struct file *file );
|
||||
static int proc_wepkey_open( struct inode *inode, struct file *file );
|
||||
|
||||
static struct file_operations proc_statsdelta_ops = {
|
||||
static const struct file_operations proc_statsdelta_ops = {
|
||||
.read = proc_read,
|
||||
.open = proc_statsdelta_open,
|
||||
.release = proc_close
|
||||
};
|
||||
|
||||
static struct file_operations proc_stats_ops = {
|
||||
static const struct file_operations proc_stats_ops = {
|
||||
.read = proc_read,
|
||||
.open = proc_stats_open,
|
||||
.release = proc_close
|
||||
};
|
||||
|
||||
static struct file_operations proc_status_ops = {
|
||||
static const struct file_operations proc_status_ops = {
|
||||
.read = proc_read,
|
||||
.open = proc_status_open,
|
||||
.release = proc_close
|
||||
};
|
||||
|
||||
static struct file_operations proc_SSID_ops = {
|
||||
static const struct file_operations proc_SSID_ops = {
|
||||
.read = proc_read,
|
||||
.write = proc_write,
|
||||
.open = proc_SSID_open,
|
||||
.release = proc_close
|
||||
};
|
||||
|
||||
static struct file_operations proc_BSSList_ops = {
|
||||
static const struct file_operations proc_BSSList_ops = {
|
||||
.read = proc_read,
|
||||
.write = proc_write,
|
||||
.open = proc_BSSList_open,
|
||||
.release = proc_close
|
||||
};
|
||||
|
||||
static struct file_operations proc_APList_ops = {
|
||||
static const struct file_operations proc_APList_ops = {
|
||||
.read = proc_read,
|
||||
.write = proc_write,
|
||||
.open = proc_APList_open,
|
||||
.release = proc_close
|
||||
};
|
||||
|
||||
static struct file_operations proc_config_ops = {
|
||||
static const struct file_operations proc_config_ops = {
|
||||
.read = proc_read,
|
||||
.write = proc_write,
|
||||
.open = proc_config_open,
|
||||
.release = proc_close
|
||||
};
|
||||
|
||||
static struct file_operations proc_wepkey_ops = {
|
||||
static const struct file_operations proc_wepkey_ops = {
|
||||
.read = proc_read,
|
||||
.write = proc_write,
|
||||
.open = proc_wepkey_open,
|
||||
|
||||
@@ -355,37 +355,37 @@ out_up:
|
||||
#undef fappend
|
||||
|
||||
|
||||
static struct file_operations devinfo_fops = {
|
||||
static const struct file_operations devinfo_fops = {
|
||||
.read = devinfo_read_file,
|
||||
.write = write_file_dummy,
|
||||
.open = open_file_generic,
|
||||
};
|
||||
|
||||
static struct file_operations spromdump_fops = {
|
||||
static const struct file_operations spromdump_fops = {
|
||||
.read = spromdump_read_file,
|
||||
.write = write_file_dummy,
|
||||
.open = open_file_generic,
|
||||
};
|
||||
|
||||
static struct file_operations drvinfo_fops = {
|
||||
static const struct file_operations drvinfo_fops = {
|
||||
.read = drvinfo_read_file,
|
||||
.write = write_file_dummy,
|
||||
.open = open_file_generic,
|
||||
};
|
||||
|
||||
static struct file_operations tsf_fops = {
|
||||
static const struct file_operations tsf_fops = {
|
||||
.read = tsf_read_file,
|
||||
.write = tsf_write_file,
|
||||
.open = open_file_generic,
|
||||
};
|
||||
|
||||
static struct file_operations txstat_fops = {
|
||||
static const struct file_operations txstat_fops = {
|
||||
.read = txstat_read_file,
|
||||
.write = write_file_dummy,
|
||||
.open = open_file_generic,
|
||||
};
|
||||
|
||||
static struct file_operations restart_fops = {
|
||||
static const struct file_operations restart_fops = {
|
||||
.write = restart_write_file,
|
||||
.open = open_file_generic,
|
||||
};
|
||||
|
||||
@@ -1160,7 +1160,7 @@ static int strip_seq_open(struct inode *inode, struct file *file)
|
||||
return seq_open(file, &strip_seq_ops);
|
||||
}
|
||||
|
||||
static struct file_operations strip_seq_fops = {
|
||||
static const struct file_operations strip_seq_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = strip_seq_open,
|
||||
.read = seq_read,
|
||||
|
||||
@@ -181,7 +181,7 @@ out:
|
||||
return retval;
|
||||
}
|
||||
|
||||
struct file_operations event_buffer_fops = {
|
||||
const struct file_operations event_buffer_fops = {
|
||||
.open = event_buffer_open,
|
||||
.release = event_buffer_release,
|
||||
.read = event_buffer_read,
|
||||
|
||||
@@ -41,7 +41,7 @@ void wake_up_buffer_waiter(void);
|
||||
/* add data to the event buffer */
|
||||
void add_event_entry(unsigned long data);
|
||||
|
||||
extern struct file_operations event_buffer_fops;
|
||||
extern const struct file_operations event_buffer_fops;
|
||||
|
||||
/* mutex between sync_cpu_buffers() and the
|
||||
* file reading code.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user