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] make more file_operation structs static
Mark the static struct file_operations in drivers/char as const. Making them const prevents accidental bugs, and moves them to the .rodata section so that they no longer do any false sharing; in addition with the proper debug option they are then protected against corruption.. [akpm@osdl.org: build fix] Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
d459ec0baa
commit
62322d2554
@@ -1059,7 +1059,7 @@ ioctl_out:
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
static struct file_operations agp_fops =
|
||||
static const struct file_operations agp_fops =
|
||||
{
|
||||
.owner = THIS_MODULE,
|
||||
.llseek = no_llseek,
|
||||
|
||||
@@ -112,7 +112,7 @@ static int ac_ioctl(struct inode *, struct file *, unsigned int,
|
||||
unsigned long);
|
||||
static irqreturn_t ac_interrupt(int, void *, struct pt_regs *);
|
||||
|
||||
static struct file_operations ac_fops = {
|
||||
static const struct file_operations ac_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.llseek = no_llseek,
|
||||
.read = ac_read,
|
||||
|
||||
@@ -158,7 +158,7 @@ static int cs5535_gpio_open(struct inode *inode, struct file *file)
|
||||
return nonseekable_open(inode, file);
|
||||
}
|
||||
|
||||
static struct file_operations cs5535_gpio_fops = {
|
||||
static const struct file_operations cs5535_gpio_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.write = cs5535_gpio_write,
|
||||
.read = cs5535_gpio_read,
|
||||
|
||||
@@ -281,7 +281,7 @@ static unsigned int ds1286_poll(struct file *file, poll_table *wait)
|
||||
* The various file operations we support.
|
||||
*/
|
||||
|
||||
static struct file_operations ds1286_fops = {
|
||||
static const struct file_operations ds1286_fops = {
|
||||
.llseek = no_llseek,
|
||||
.read = ds1286_read,
|
||||
.poll = ds1286_poll,
|
||||
|
||||
@@ -282,7 +282,7 @@ get_rtc_status(char *buf)
|
||||
|
||||
/* The various file operations we support. */
|
||||
|
||||
static struct file_operations rtc_fops = {
|
||||
static const struct file_operations rtc_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.ioctl = rtc_ioctl,
|
||||
};
|
||||
|
||||
@@ -336,7 +336,7 @@ proc_therm_ds1620_read(char *buf, char **start, off_t offset,
|
||||
static struct proc_dir_entry *proc_therm_ds1620;
|
||||
#endif
|
||||
|
||||
static struct file_operations ds1620_fops = {
|
||||
static const struct file_operations ds1620_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = nonseekable_open,
|
||||
.read = ds1620_read,
|
||||
|
||||
@@ -483,7 +483,7 @@ static int dsp56k_release(struct inode *inode, struct file *file)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct file_operations dsp56k_fops = {
|
||||
static const struct file_operations dsp56k_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.read = dsp56k_read,
|
||||
.write = dsp56k_write,
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ static int dtlk_release(struct inode *, struct file *);
|
||||
static int dtlk_ioctl(struct inode *inode, struct file *file,
|
||||
unsigned int cmd, unsigned long arg);
|
||||
|
||||
static struct file_operations dtlk_fops =
|
||||
static const struct file_operations dtlk_fops =
|
||||
{
|
||||
.owner = THIS_MODULE,
|
||||
.read = dtlk_read,
|
||||
|
||||
@@ -285,7 +285,7 @@ efi_rtc_close(struct inode *inode, struct file *file)
|
||||
* The various file operations we support.
|
||||
*/
|
||||
|
||||
static struct file_operations efi_rtc_fops = {
|
||||
static const struct file_operations efi_rtc_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.ioctl = efi_rtc_ioctl,
|
||||
.open = efi_rtc_open,
|
||||
|
||||
@@ -86,7 +86,7 @@ static ssize_t zft_read (struct file *fp, char __user *buff,
|
||||
static ssize_t zft_write(struct file *fp, const char __user *buff,
|
||||
size_t req_len, loff_t *ppos);
|
||||
|
||||
static struct file_operations zft_cdev =
|
||||
static const struct file_operations zft_cdev =
|
||||
{
|
||||
.owner = THIS_MODULE,
|
||||
.read = zft_read,
|
||||
|
||||
@@ -482,7 +482,7 @@ static inline int gen_rtc_proc_init(void) { return 0; }
|
||||
* The various file operations we support.
|
||||
*/
|
||||
|
||||
static struct file_operations gen_rtc_fops = {
|
||||
static const struct file_operations gen_rtc_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
#ifdef CONFIG_GEN_RTC_X
|
||||
.read = gen_rtc_read,
|
||||
|
||||
+1
-1
@@ -553,7 +553,7 @@ hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, int kernel)
|
||||
return err;
|
||||
}
|
||||
|
||||
static struct file_operations hpet_fops = {
|
||||
static const struct file_operations hpet_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.llseek = no_llseek,
|
||||
.read = hpet_read,
|
||||
|
||||
@@ -149,7 +149,7 @@ out:
|
||||
}
|
||||
|
||||
|
||||
static struct file_operations rng_chrdev_ops = {
|
||||
static const struct file_operations rng_chrdev_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = rng_dev_open,
|
||||
.read = rng_dev_read,
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ static int i8k_open_fs(struct inode *inode, struct file *file);
|
||||
static int i8k_ioctl(struct inode *, struct file *, unsigned int,
|
||||
unsigned long);
|
||||
|
||||
static struct file_operations i8k_fops = {
|
||||
static const struct file_operations i8k_fops = {
|
||||
.open = i8k_open_fs,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
|
||||
@@ -233,7 +233,7 @@ static void *DevTableMem[IP2_MAX_BOARDS];
|
||||
/* This is the driver descriptor for the ip2ipl device, which is used to
|
||||
* download the loadware to the boards.
|
||||
*/
|
||||
static struct file_operations ip2_ipl = {
|
||||
static const struct file_operations ip2_ipl = {
|
||||
.owner = THIS_MODULE,
|
||||
.read = ip2_ipl_read,
|
||||
.write = ip2_ipl_write,
|
||||
|
||||
@@ -196,7 +196,7 @@ static int rtc_release(struct inode *inode, struct file *file)
|
||||
* The various file operations we support.
|
||||
*/
|
||||
|
||||
static struct file_operations rtc_fops = {
|
||||
static const struct file_operations rtc_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.ioctl = rtc_ioctl,
|
||||
.open = rtc_open,
|
||||
|
||||
@@ -765,7 +765,7 @@ static long compat_ipmi_ioctl(struct file *filep, unsigned int cmd,
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct file_operations ipmi_fops = {
|
||||
static const struct file_operations ipmi_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.ioctl = ipmi_ioctl,
|
||||
#ifdef CONFIG_COMPAT
|
||||
|
||||
@@ -807,7 +807,7 @@ static int ipmi_close(struct inode *ino, struct file *filep)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct file_operations ipmi_wdog_fops = {
|
||||
static const struct file_operations ipmi_wdog_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.read = ipmi_read,
|
||||
.poll = ipmi_poll,
|
||||
|
||||
@@ -748,7 +748,7 @@ static int stli_initpcibrd(int brdtype, struct pci_dev *devp);
|
||||
* will give access to the shared memory on the Stallion intelligent
|
||||
* board. This is also a very useful debugging tool.
|
||||
*/
|
||||
static struct file_operations stli_fsiomem = {
|
||||
static const struct file_operations stli_fsiomem = {
|
||||
.owner = THIS_MODULE,
|
||||
.read = stli_memread,
|
||||
.write = stli_memwrite,
|
||||
|
||||
@@ -357,7 +357,7 @@ DEB(printk("interrupt 0x%x %d\n",ITE_GPAISR, i));
|
||||
}
|
||||
}
|
||||
|
||||
static struct file_operations ite_gpio_fops = {
|
||||
static const struct file_operations ite_gpio_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.ioctl = ite_gpio_ioctl,
|
||||
.open = ite_gpio_open,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user