LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* Patch series to mark struct file_operations and struct inode_operations const
@ 2007-01-14  0:51 Arjan van de Ven
  2007-01-14  0:51 ` [patch 00/12] Fix ppc64's writing to struct file_operations Arjan van de Ven
                   ` (12 more replies)
  0 siblings, 13 replies; 17+ messages in thread
From: Arjan van de Ven @ 2007-01-14  0:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm

Hi,

today a sizable portion of the "struct file_operations" variables in the
kernel are const, but by far not all. Nor are any of the struct
inode_operations const. Marking these read-only datastructures const has
the advantage of reducing false sharing of these, often hot,
datastructures. In addition there have been cases where drivers or
filesystems accidentally and incorrectly wrote to such a struct
forgetting that it's a shared datastructure. By marking these const, the
compiler will warn/error on such instances.

The series is split up for size, there isn't really any logical order
for such a simple search-and-replace operation.

Greetings,
   Arjan van de Ven


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [patch 00/12] Fix ppc64's writing to struct file_operations
  2007-01-14  0:51 Patch series to mark struct file_operations and struct inode_operations const Arjan van de Ven
@ 2007-01-14  0:51 ` Arjan van de Ven
  2007-01-14 14:54   ` Alan
  2007-01-14  0:52 ` [patch 01/12] mark struct file_operations const 1 Arjan van de Ven
                   ` (11 subsequent siblings)
  12 siblings, 1 reply; 17+ messages in thread
From: Arjan van de Ven @ 2007-01-14  0:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm

From: Arjan van de Ven <arjan@linux.intel.com>
Subject: [patch 00/12] Fix ppc64's writing to struct file_operations

the ppc64 code needlessly wrote to a struct file_operations variable;
this patch turns this into a compile time initialization instead.


Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>

Index: linux-2.6/arch/powerpc/kernel/lparcfg.c
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/lparcfg.c
+++ linux-2.6/arch/powerpc/kernel/lparcfg.c
@@ -570,6 +570,7 @@ static int lparcfg_open(struct inode *in
 struct file_operations lparcfg_fops = {
 	.owner		= THIS_MODULE,
 	.read		= seq_read,
+	.write		= lparcfg_write,
 	.open		= lparcfg_open,
 	.release	= single_release,
 };
@@ -581,10 +582,8 @@ int __init lparcfg_init(void)
 
 	/* Allow writing if we have FW_FEATURE_SPLPAR */
 	if (firmware_has_feature(FW_FEATURE_SPLPAR) &&
-			!firmware_has_feature(FW_FEATURE_ISERIES)) {
-		lparcfg_fops.write = lparcfg_write;
+			!firmware_has_feature(FW_FEATURE_ISERIES))
 		mode |= S_IWUSR;
-	}
 
 	ent = create_proc_entry("ppc64/lparcfg", mode, NULL);
 	if (ent) {



^ permalink raw reply	[flat|nested] 17+ messages in thread

* [patch 01/12] mark struct file_operations const 1
  2007-01-14  0:51 Patch series to mark struct file_operations and struct inode_operations const Arjan van de Ven
  2007-01-14  0:51 ` [patch 00/12] Fix ppc64's writing to struct file_operations Arjan van de Ven
@ 2007-01-14  0:52 ` Arjan van de Ven
  2007-01-14  0:53 ` [patch 02/12] mark struct file_operations const 2 Arjan van de Ven
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Arjan van de Ven @ 2007-01-14  0:52 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm

From: Arjan van de Ven <arjan@linux.intel.com>
Subject: [patch 01/12] mark struct file_operations const

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>
Index: linux-2.6/include/linux/atalk.h
===================================================================
--- linux-2.6.orig/include/linux/atalk.h
+++ linux-2.6/include/linux/atalk.h
@@ -182,7 +182,7 @@ extern rwlock_t atalk_interfaces_lock;
 
 extern struct atalk_route atrtr_default;
 
-extern struct file_operations atalk_seq_arp_fops;
+extern const struct file_operations atalk_seq_arp_fops;
 
 extern int sysctl_aarp_expiry_time;
 extern int sysctl_aarp_tick_time;
Index: linux-2.6/include/linux/cpuset.h
===================================================================
--- linux-2.6.orig/include/linux/cpuset.h
+++ linux-2.6/include/linux/cpuset.h
@@ -55,7 +55,7 @@ extern int cpuset_excl_nodes_overlap(con
 extern int cpuset_memory_pressure_enabled;
 extern void __cpuset_memory_pressure_bump(void);
 
-extern struct file_operations proc_cpuset_operations;
+extern const struct file_operations proc_cpuset_operations;
 extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer);
 
 extern void cpuset_lock(void);
Index: linux-2.6/include/linux/random.h
===================================================================
--- linux-2.6.orig/include/linux/random.h
+++ linux-2.6/include/linux/random.h
@@ -63,7 +63,7 @@ extern u64 secure_dccp_sequence_number(_
 				       __be16 sport, __be16 dport);
 
 #ifndef MODULE
-extern struct file_operations random_fops, urandom_fops;
+extern const struct file_operations random_fops, urandom_fops;
 #endif
 
 unsigned int get_random_int(void);
Index: linux-2.6/include/linux/security.h
===================================================================
--- linux-2.6.orig/include/linux/security.h
+++ linux-2.6/include/linux/security.h
@@ -2130,7 +2130,7 @@ extern int mod_reg_security	(const char 
 extern int mod_unreg_security	(const char *name, struct security_operations *ops);
 extern struct dentry *securityfs_create_file(const char *name, mode_t mode,
 					     struct dentry *parent, void *data,
-					     struct file_operations *fops);
+					     const struct file_operations *fops);
 extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent);
 extern void securityfs_remove(struct dentry *dentry);
 
Index: linux-2.6/include/net/ax25.h
===================================================================
--- linux-2.6.orig/include/net/ax25.h
+++ linux-2.6/include/net/ax25.h
@@ -377,7 +377,7 @@ extern int  ax25_check_iframes_acked(ax2
 /* ax25_route.c */
 extern void ax25_rt_device_down(struct net_device *);
 extern int  ax25_rt_ioctl(unsigned int, void __user *);
-extern struct file_operations ax25_route_fops;
+extern const struct file_operations ax25_route_fops;
 extern ax25_route *ax25_get_route(ax25_address *addr, struct net_device *dev);
 extern int  ax25_rt_autobind(ax25_cb *, ax25_address *);
 extern struct sk_buff *ax25_rt_build_path(struct sk_buff *, ax25_address *, ax25_address *, ax25_digi *);
@@ -430,7 +430,7 @@ extern unsigned long ax25_display_timer(
 extern int  ax25_uid_policy;
 extern ax25_uid_assoc *ax25_findbyuid(uid_t);
 extern int __must_check ax25_uid_ioctl(int, struct sockaddr_ax25 *);
-extern struct file_operations ax25_uid_fops;
+extern const struct file_operations ax25_uid_fops;
 extern void ax25_uid_free(void);
 
 /* sysctl_net_ax25.c */
Index: linux-2.6/include/net/netfilter/nf_conntrack_expect.h
===================================================================
--- linux-2.6.orig/include/net/netfilter/nf_conntrack_expect.h
+++ linux-2.6/include/net/netfilter/nf_conntrack_expect.h
@@ -8,7 +8,7 @@
 
 extern struct list_head nf_conntrack_expect_list;
 extern struct kmem_cache *nf_conntrack_expect_cachep;
-extern struct file_operations exp_file_ops;
+extern const struct file_operations exp_file_ops;
 
 struct nf_conntrack_expect
 {
Index: linux-2.6/include/net/netrom.h
===================================================================
--- linux-2.6.orig/include/net/netrom.h
+++ linux-2.6/include/net/netrom.h
@@ -215,8 +215,8 @@ extern struct net_device *nr_dev_get(ax2
 extern int  nr_rt_ioctl(unsigned int, void __user *);
 extern void nr_link_failed(ax25_cb *, int);
 extern int  nr_route_frame(struct sk_buff *, ax25_cb *);
-extern struct file_operations nr_nodes_fops;
-extern struct file_operations nr_neigh_fops;
+extern const struct file_operations nr_nodes_fops;
+extern const struct file_operations nr_neigh_fops;
 extern void nr_rt_free(void);
 
 /* nr_subr.c */
Index: linux-2.6/include/net/rose.h
===================================================================
--- linux-2.6.orig/include/net/rose.h
+++ linux-2.6/include/net/rose.h
@@ -189,9 +189,9 @@ extern void rose_enquiry_response(struct
 
 /* rose_route.c */
 extern struct rose_neigh rose_loopback_neigh;
-extern struct file_operations rose_neigh_fops;
-extern struct file_operations rose_nodes_fops;
-extern struct file_operations rose_routes_fops;
+extern const struct file_operations rose_neigh_fops;
+extern const struct file_operations rose_nodes_fops;
+extern const struct file_operations rose_routes_fops;
 
 extern void rose_add_loopback_neigh(void);
 extern int __must_check rose_add_loopback_node(rose_address *);
Index: linux-2.6/include/sound/pcm.h
===================================================================
--- linux-2.6.orig/include/sound/pcm.h
+++ linux-2.6/include/sound/pcm.h
@@ -443,7 +443,7 @@ struct snd_pcm_notify {
  *  Registering
  */
 
-extern struct file_operations snd_pcm_f_ops[2];
+extern const struct file_operations snd_pcm_f_ops[2];
 
 int snd_pcm_new(struct snd_card *card, char *id, int device,
 		int playback_count, int capture_count,



^ permalink raw reply	[flat|nested] 17+ messages in thread

* [patch 02/12] mark struct file_operations const 2
  2007-01-14  0:51 Patch series to mark struct file_operations and struct inode_operations const Arjan van de Ven
  2007-01-14  0:51 ` [patch 00/12] Fix ppc64's writing to struct file_operations Arjan van de Ven
  2007-01-14  0:52 ` [patch 01/12] mark struct file_operations const 1 Arjan van de Ven
@ 2007-01-14  0:53 ` Arjan van de Ven
  2007-01-14  0:53 ` [patch 03/12] mark struct file_operations const 3 Arjan van de Ven
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Arjan van de Ven @ 2007-01-14  0:53 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm

From: Arjan van de Ven <arjan@linux.intel.com>
Subject: [patch 02/12] mark struct file_operations const

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>

Index: linux-2.6/arch/arm/common/rtctime.c
===================================================================
--- linux-2.6.orig/arch/arm/common/rtctime.c
+++ linux-2.6/arch/arm/common/rtctime.c
@@ -329,7 +329,7 @@ static int rtc_fasync(int fd, struct fil
 	return fasync_helper(fd, file, on, &rtc_async_queue);
 }
 
-static struct file_operations rtc_fops = {
+static const struct file_operations rtc_fops = {
 	.owner		= THIS_MODULE,
 	.llseek		= no_llseek,
 	.read		= rtc_read,
Index: linux-2.6/arch/arm/kernel/apm.c
===================================================================
--- linux-2.6.orig/arch/arm/kernel/apm.c
+++ linux-2.6/arch/arm/kernel/apm.c
@@ -446,7 +446,7 @@ static int apm_open(struct inode * inode
 	return as ? 0 : -ENOMEM;
 }
 
-static struct file_operations apm_bios_fops = {
+static const struct file_operations apm_bios_fops = {
 	.owner		= THIS_MODULE,
 	.read		= apm_read,
 	.poll		= apm_poll,
Index: linux-2.6/arch/arm/mach-at91rm9200/clock.c
===================================================================
--- linux-2.6.orig/arch/arm/mach-at91rm9200/clock.c
+++ linux-2.6/arch/arm/mach-at91rm9200/clock.c
@@ -407,7 +407,7 @@ static int at91_clk_open(struct inode *i
 	return single_open(file, at91_clk_show, NULL);
 }
 
-static struct file_operations at91_clk_operations = {
+static const struct file_operations at91_clk_operations = {
 	.open		= at91_clk_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
Index: linux-2.6/arch/avr32/mm/tlb.c
===================================================================
--- linux-2.6.orig/arch/avr32/mm/tlb.c
+++ linux-2.6/arch/avr32/mm/tlb.c
@@ -360,7 +360,7 @@ static int tlb_open(struct inode *inode,
 	return seq_open(file, &tlb_ops);
 }
 
-static struct file_operations proc_tlb_operations = {
+static const struct file_operations proc_tlb_operations = {
 	.open		= tlb_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
Index: linux-2.6/arch/cris/arch-v10/drivers/ds1302.c
===================================================================
--- linux-2.6.orig/arch/cris/arch-v10/drivers/ds1302.c
+++ linux-2.6/arch/cris/arch-v10/drivers/ds1302.c
@@ -499,7 +499,7 @@ print_rtc_status(void)
 
 /* 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,
 }; 
Index: linux-2.6/arch/cris/arch-v10/drivers/eeprom.c
===================================================================
--- linux-2.6.orig/arch/cris/arch-v10/drivers/eeprom.c
+++ linux-2.6/arch/cris/arch-v10/drivers/eeprom.c
@@ -172,7 +172,7 @@ static const char eeprom_name[] = "eepro
 static struct eeprom_type eeprom;
 
 /* This is the exported file-operations structure for this device. */
-struct file_operations eeprom_fops =
+const struct file_operations eeprom_fops =
 {
   .llseek  = eeprom_lseek,
   .read    = eeprom_read,
Index: linux-2.6/arch/cris/arch-v10/drivers/gpio.c
===================================================================
--- linux-2.6.orig/arch/cris/arch-v10/drivers/gpio.c
+++ linux-2.6/arch/cris/arch-v10/drivers/gpio.c
@@ -838,7 +838,7 @@ gpio_leds_ioctl(unsigned int cmd, unsign
 	return 0;
 }
 
-struct file_operations gpio_fops = {
+const struct file_operations gpio_fops = {
 	.owner       = THIS_MODULE,
 	.poll        = gpio_poll,
 	.ioctl       = gpio_ioctl,
Index: linux-2.6/arch/cris/arch-v10/drivers/i2c.c
===================================================================
--- linux-2.6.orig/arch/cris/arch-v10/drivers/i2c.c
+++ linux-2.6/arch/cris/arch-v10/drivers/i2c.c
@@ -692,7 +692,7 @@ i2c_ioctl(struct inode *inode, struct fi
 	return 0;
 }
 
-static struct file_operations i2c_fops = {
+static const struct file_operations i2c_fops = {
 	.owner    = THIS_MODULE,
 	.ioctl    = i2c_ioctl,
 	.open     = i2c_open,
Index: linux-2.6/arch/cris/arch-v10/drivers/pcf8563.c
===================================================================
--- linux-2.6.orig/arch/cris/arch-v10/drivers/pcf8563.c
+++ linux-2.6/arch/cris/arch-v10/drivers/pcf8563.c
@@ -56,7 +56,7 @@ static const unsigned char days_in_month
 
 int pcf8563_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
 
-static struct file_operations pcf8563_fops = {
+static const struct file_operations pcf8563_fops = {
 	.owner = THIS_MODULE,
 	.ioctl = pcf8563_ioctl,
 };
Index: linux-2.6/arch/cris/arch-v32/drivers/cryptocop.c
===================================================================
--- linux-2.6.orig/arch/cris/arch-v32/drivers/cryptocop.c
+++ linux-2.6/arch/cris/arch-v32/drivers/cryptocop.c
@@ -266,7 +266,7 @@ static void print_user_dma_lists(struct 
 
 
 
-struct file_operations cryptocop_fops = {
+const struct file_operations cryptocop_fops = {
 	owner: THIS_MODULE,
 	open: cryptocop_open,
 	release: cryptocop_release,
Index: linux-2.6/arch/cris/arch-v32/drivers/gpio.c
===================================================================
--- linux-2.6.orig/arch/cris/arch-v32/drivers/gpio.c
+++ linux-2.6/arch/cris/arch-v32/drivers/gpio.c
@@ -705,7 +705,7 @@ gpio_leds_ioctl(unsigned int cmd, unsign
 	return 0;
 }
 
-struct file_operations gpio_fops = {
+const struct file_operations gpio_fops = {
 	.owner       = THIS_MODULE,
 	.poll        = gpio_poll,
 	.ioctl       = gpio_ioctl,
Index: linux-2.6/arch/cris/arch-v32/drivers/i2c.c
===================================================================
--- linux-2.6.orig/arch/cris/arch-v32/drivers/i2c.c
+++ linux-2.6/arch/cris/arch-v32/drivers/i2c.c
@@ -573,7 +573,7 @@ i2c_ioctl(struct inode *inode, struct fi
 	return 0;
 }
 
-static struct file_operations i2c_fops = {
+static const struct file_operations i2c_fops = {
 	owner:    THIS_MODULE,
 	ioctl:    i2c_ioctl,
 	open:     i2c_open,
Index: linux-2.6/arch/cris/arch-v32/drivers/pcf8563.c
===================================================================
--- linux-2.6.orig/arch/cris/arch-v32/drivers/pcf8563.c
+++ linux-2.6/arch/cris/arch-v32/drivers/pcf8563.c
@@ -50,7 +50,7 @@ int pcf8563_ioctl(struct inode *, struct
 int pcf8563_open(struct inode *, struct file *);
 int pcf8563_release(struct inode *, struct file *);
 
-static struct file_operations pcf8563_fops = {
+static const struct file_operations pcf8563_fops = {
 	owner: THIS_MODULE,
 	ioctl: pcf8563_ioctl,
 	open: pcf8563_open,
Index: linux-2.6/arch/cris/arch-v32/drivers/sync_serial.c
===================================================================
--- linux-2.6.orig/arch/cris/arch-v32/drivers/sync_serial.c
+++ linux-2.6/arch/cris/arch-v32/drivers/sync_serial.c
@@ -187,7 +187,7 @@ static struct sync_port ports[]=
 
 #define NUMBER_OF_PORTS (sizeof(ports)/sizeof(sync_port))
 
-static struct file_operations sync_serial_fops = {
+static const struct file_operations sync_serial_fops = {
 	.owner   = THIS_MODULE,
 	.write   = sync_serial_write,
 	.read    = sync_serial_read,
Index: linux-2.6/arch/cris/kernel/profile.c
===================================================================
--- linux-2.6.orig/arch/cris/kernel/profile.c
+++ linux-2.6/arch/cris/kernel/profile.c
@@ -50,7 +50,7 @@ write_cris_profile(struct file *file, co
   memset(sample_buffer, 0, SAMPLE_BUFFER_SIZE);
 }
 
-static struct file_operations cris_proc_profile_operations = {
+static const struct file_operations cris_proc_profile_operations = {
 	.read		= read_cris_profile,
 	.write		= write_cris_profile,
 };
Index: linux-2.6/arch/i386/kernel/apm.c
===================================================================
--- linux-2.6.orig/arch/i386/kernel/apm.c
+++ linux-2.6/arch/i386/kernel/apm.c
@@ -1894,7 +1894,7 @@ static int __init apm_setup(char *str)
 __setup("apm=", apm_setup);
 #endif
 
-static struct file_operations apm_bios_fops = {
+static const struct file_operations apm_bios_fops = {
 	.owner		= THIS_MODULE,
 	.read		= do_read,
 	.poll		= do_poll,
Index: linux-2.6/arch/i386/kernel/cpu/mtrr/if.c
===================================================================
--- linux-2.6.orig/arch/i386/kernel/cpu/mtrr/if.c
+++ linux-2.6/arch/i386/kernel/cpu/mtrr/if.c
@@ -339,7 +339,7 @@ static int mtrr_open(struct inode *inode
 	return single_open(file, mtrr_seq_show, NULL);
 }
 
-static struct file_operations mtrr_fops = {
+static const struct file_operations mtrr_fops = {
 	.owner   = THIS_MODULE,
 	.open	 = mtrr_open, 
 	.read    = seq_read,
Index: linux-2.6/arch/i386/kernel/cpuid.c
===================================================================
--- linux-2.6.orig/arch/i386/kernel/cpuid.c
+++ linux-2.6/arch/i386/kernel/cpuid.c
@@ -148,7 +148,7 @@ static int cpuid_open(struct inode *inod
 /*
  * File operations we support
  */
-static struct file_operations cpuid_fops = {
+static const struct file_operations cpuid_fops = {
 	.owner = THIS_MODULE,
 	.llseek = cpuid_seek,
 	.read = cpuid_read,
Index: linux-2.6/arch/i386/kernel/microcode.c
===================================================================
--- linux-2.6.orig/arch/i386/kernel/microcode.c
+++ linux-2.6/arch/i386/kernel/microcode.c
@@ -451,7 +451,7 @@ static ssize_t microcode_write (struct f
 	return ret;
 }
 
-static struct file_operations microcode_fops = {
+static const struct file_operations microcode_fops = {
 	.owner		= THIS_MODULE,
 	.write		= microcode_write,
 	.open		= microcode_open,
Index: linux-2.6/arch/i386/kernel/msr.c
===================================================================
--- linux-2.6.orig/arch/i386/kernel/msr.c
+++ linux-2.6/arch/i386/kernel/msr.c
@@ -230,7 +230,7 @@ static int msr_open(struct inode *inode,
 /*
  * File operations we support
  */
-static struct file_operations msr_fops = {
+static const struct file_operations msr_fops = {
 	.owner = THIS_MODULE,
 	.llseek = msr_seek,
 	.read = msr_read,
Index: linux-2.6/arch/ia64/hp/common/sba_iommu.c
===================================================================
--- linux-2.6.orig/arch/ia64/hp/common/sba_iommu.c
+++ linux-2.6/arch/ia64/hp/common/sba_iommu.c
@@ -1881,7 +1881,7 @@ ioc_open(struct inode *inode, struct fil
 	return seq_open(file, &ioc_seq_ops);
 }
 
-static struct file_operations ioc_fops = {
+static const struct file_operations ioc_fops = {
 	.open    = ioc_open,
 	.read    = seq_read,
 	.llseek  = seq_lseek,
Index: linux-2.6/arch/ia64/kernel/perfmon.c
===================================================================
--- linux-2.6.orig/arch/ia64/kernel/perfmon.c
+++ linux-2.6/arch/ia64/kernel/perfmon.c
@@ -621,7 +621,7 @@ EXPORT_PER_CPU_SYMBOL_GPL(pfm_syst_info)
 
 
 /* forward declaration */
-static struct file_operations pfm_file_ops;
+static const struct file_operations pfm_file_ops;
 
 /*
  * forward declarations
@@ -2126,7 +2126,7 @@ pfm_no_open(struct inode *irrelevant, st
 
 
 
-static struct file_operations pfm_file_ops = {
+static const struct file_operations pfm_file_ops = {
 	.llseek   = no_llseek,
 	.read     = pfm_read,
 	.write    = pfm_write,
@@ -6597,7 +6597,7 @@ found:
 	return 0;
 }
 
-static struct file_operations pfm_proc_fops = {
+static const struct file_operations pfm_proc_fops = {
 	.open		= pfm_proc_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
Index: linux-2.6/arch/ia64/kernel/salinfo.c
===================================================================
--- linux-2.6.orig/arch/ia64/kernel/salinfo.c
+++ linux-2.6/arch/ia64/kernel/salinfo.c
@@ -352,7 +352,7 @@ retry:
 	return size;
 }
 
-static struct file_operations salinfo_event_fops = {
+static const struct file_operations salinfo_event_fops = {
 	.open  = salinfo_event_open,
 	.read  = salinfo_event_read,
 };
@@ -568,7 +568,7 @@ salinfo_log_write(struct file *file, con
 	return count;
 }
 
-static struct file_operations salinfo_data_fops = {
+static const struct file_operations salinfo_data_fops = {
 	.open    = salinfo_log_open,
 	.release = salinfo_log_release,
 	.read    = salinfo_log_read,
Index: linux-2.6/arch/ia64/sn/kernel/sn2/sn2_smp.c
===================================================================
--- linux-2.6.orig/arch/ia64/sn/kernel/sn2/sn2_smp.c
+++ linux-2.6/arch/ia64/sn/kernel/sn2/sn2_smp.c
@@ -455,7 +455,7 @@ static int sn2_ptc_proc_open(struct inod
 	return seq_open(file, &sn2_ptc_seq_ops);
 }
 
-static struct file_operations proc_sn2_ptc_operations = {
+static const struct file_operations proc_sn2_ptc_operations = {
 	.open = sn2_ptc_proc_open,
 	.read = seq_read,
 	.llseek = seq_lseek,
Index: linux-2.6/arch/ia64/sn/kernel/sn2/sn_hwperf.c
===================================================================
--- linux-2.6.orig/arch/ia64/sn/kernel/sn2/sn_hwperf.c
+++ linux-2.6/arch/ia64/sn/kernel/sn2/sn_hwperf.c
@@ -865,7 +865,7 @@ error:
 	return r;
 }
 
-static struct file_operations sn_hwperf_fops = {
+static const struct file_operations sn_hwperf_fops = {
 	.ioctl = sn_hwperf_ioctl,
 };
 
Index: linux-2.6/arch/m68k/bvme6000/rtc.c
===================================================================
--- linux-2.6.orig/arch/m68k/bvme6000/rtc.c
+++ linux-2.6/arch/m68k/bvme6000/rtc.c
@@ -159,7 +159,7 @@ static int rtc_release(struct inode *ino
  *	The various file operations we support.
  */
 
-static struct file_operations rtc_fops = {
+static const struct file_operations rtc_fops = {
 	.ioctl =	rtc_ioctl,
 	.open =		rtc_open,
 	.release =	rtc_release,
Index: linux-2.6/arch/m68k/mvme16x/rtc.c
===================================================================
--- linux-2.6.orig/arch/m68k/mvme16x/rtc.c
+++ linux-2.6/arch/m68k/mvme16x/rtc.c
@@ -147,7 +147,7 @@ static int rtc_release(struct inode *ino
  *	The various file operations we support.
  */
 
-static struct file_operations rtc_fops = {
+static const struct file_operations rtc_fops = {
 	.ioctl =	rtc_ioctl,
 	.open =		rtc_open,
 	.release =	rtc_release,
Index: linux-2.6/arch/mips/basler/excite/excite_iodev.c
===================================================================
--- linux-2.6.orig/arch/mips/basler/excite/excite_iodev.c
+++ linux-2.6/arch/mips/basler/excite/excite_iodev.c
@@ -48,7 +48,7 @@ static DECLARE_WAIT_QUEUE_HEAD(wq);
 
 
 
-static struct file_operations fops =
+static const struct file_operations fops =
 {
 	.owner		= THIS_MODULE,
 	.open		= iodev_open,
Index: linux-2.6/arch/mips/kernel/apm.c
===================================================================
--- linux-2.6.orig/arch/mips/kernel/apm.c
+++ linux-2.6/arch/mips/kernel/apm.c
@@ -379,7 +379,7 @@ static int apm_open(struct inode * inode
 	return as ? 0 : -ENOMEM;
 }
 
-static struct file_operations apm_bios_fops = {
+static const struct file_operations apm_bios_fops = {
 	.owner		= THIS_MODULE,
 	.read		= apm_read,
 	.poll		= apm_poll,
Index: linux-2.6/arch/mips/kernel/rtlx.c
===================================================================
--- linux-2.6.orig/arch/mips/kernel/rtlx.c
+++ linux-2.6/arch/mips/kernel/rtlx.c
@@ -476,7 +476,7 @@ static ssize_t file_write(struct file *f
 	return rtlx_write(minor, (void *)buffer, count, 1);
 }
 
-static struct file_operations rtlx_fops = {
+static const struct file_operations rtlx_fops = {
 	.owner =   THIS_MODULE,
 	.open =    file_open,
 	.release = file_release,
Index: linux-2.6/arch/mips/kernel/vpe.c
===================================================================
--- linux-2.6.orig/arch/mips/kernel/vpe.c
+++ linux-2.6/arch/mips/kernel/vpe.c
@@ -1202,7 +1202,7 @@ static ssize_t vpe_write(struct file *fi
 	return ret;
 }
 
-static struct file_operations vpe_fops = {
+static const struct file_operations vpe_fops = {
 	.owner = THIS_MODULE,
 	.open = vpe_open,
 	.release = vpe_release,
Index: linux-2.6/arch/mips/sibyte/sb1250/bcm1250_tbprof.c
===================================================================
--- linux-2.6.orig/arch/mips/sibyte/sb1250/bcm1250_tbprof.c
+++ linux-2.6/arch/mips/sibyte/sb1250/bcm1250_tbprof.c
@@ -374,7 +374,7 @@ static long sbprof_tb_ioctl(struct file 
 	return error;
 }
 
-static struct file_operations sbprof_tb_fops = {
+static const struct file_operations sbprof_tb_fops = {
 	.owner		= THIS_MODULE,
 	.open		= sbprof_tb_open,
 	.release	= sbprof_tb_release,
Index: linux-2.6/arch/parisc/kernel/perf.c
===================================================================
--- linux-2.6.orig/arch/parisc/kernel/perf.c
+++ linux-2.6/arch/parisc/kernel/perf.c
@@ -479,7 +479,7 @@ static long perf_ioctl(struct file *file
 	return error;
 }
 
-static struct file_operations perf_fops = {
+static const struct file_operations perf_fops = {
 	.llseek = no_llseek,
 	.read = perf_read,
 	.write = perf_write,
Index: linux-2.6/arch/powerpc/kernel/lparcfg.c
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/lparcfg.c
+++ linux-2.6/arch/powerpc/kernel/lparcfg.c
@@ -567,7 +567,7 @@ static int lparcfg_open(struct inode *in
 	return single_open(file, lparcfg_data, NULL);
 }
 
-struct file_operations lparcfg_fops = {
+const struct file_operations lparcfg_fops = {
 	.owner		= THIS_MODULE,
 	.read		= seq_read,
 	.write		= lparcfg_write,
Index: linux-2.6/arch/powerpc/kernel/nvram_64.c
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/nvram_64.c
+++ linux-2.6/arch/powerpc/kernel/nvram_64.c
@@ -179,7 +179,7 @@ static int dev_nvram_ioctl(struct inode 
 	}
 }
 
-struct file_operations nvram_fops = {
+const struct file_operations nvram_fops = {
 	.owner =	THIS_MODULE,
 	.llseek =	dev_nvram_llseek,
 	.read =		dev_nvram_read,
Index: linux-2.6/arch/powerpc/kernel/proc_ppc64.c
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/proc_ppc64.c
+++ linux-2.6/arch/powerpc/kernel/proc_ppc64.c
@@ -33,7 +33,7 @@ static ssize_t page_map_read( struct fil
 			      loff_t *ppos);
 static int     page_map_mmap( struct file *file, struct vm_area_struct *vma );
 
-static struct file_operations page_map_fops = {
+static const struct file_operations page_map_fops = {
 	.llseek	= page_map_seek,
 	.read	= page_map_read,
 	.mmap	= page_map_mmap
Index: linux-2.6/arch/powerpc/kernel/rtas_flash.c
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/rtas_flash.c
+++ linux-2.6/arch/powerpc/kernel/rtas_flash.c
@@ -702,7 +702,7 @@ static int initialize_flash_pde_data(con
 }
 
 static struct proc_dir_entry *create_flash_pde(const char *filename,
-					       struct file_operations *fops)
+					       const struct file_operations *fops)
 {
 	struct proc_dir_entry *ent = NULL;
 
@@ -716,21 +716,21 @@ static struct proc_dir_entry *create_fla
 	return ent;
 }
 
-static struct file_operations rtas_flash_operations = {
+static const struct file_operations rtas_flash_operations = {
 	.read		= rtas_flash_read,
 	.write		= rtas_flash_write,
 	.open		= rtas_excl_open,
 	.release	= rtas_flash_release,
 };
 
-static struct file_operations manage_flash_operations = {
+static const struct file_operations manage_flash_operations = {
 	.read		= manage_flash_read,
 	.write		= manage_flash_write,
 	.open		= rtas_excl_open,
 	.release	= rtas_excl_release,
 };
 
-static struct file_operations validate_flash_operations = {
+static const struct file_operations validate_flash_operations = {
 	.read		= validate_flash_read,
 	.write		= validate_flash_write,
 	.open		= rtas_excl_open,
Index: linux-2.6/arch/powerpc/kernel/rtas-proc.c
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/rtas-proc.c
+++ linux-2.6/arch/powerpc/kernel/rtas-proc.c
@@ -160,7 +160,7 @@ static int sensors_open(struct inode *in
 	return single_open(file, ppc_rtas_sensors_show, NULL);
 }
 
-struct file_operations ppc_rtas_sensors_operations = {
+const struct file_operations ppc_rtas_sensors_operations = {
 	.open		= sensors_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -172,7 +172,7 @@ static int poweron_open(struct inode *in
 	return single_open(file, ppc_rtas_poweron_show, NULL);
 }
 
-struct file_operations ppc_rtas_poweron_operations = {
+const struct file_operations ppc_rtas_poweron_operations = {
 	.open		= poweron_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -185,7 +185,7 @@ static int progress_open(struct inode *i
 	return single_open(file, ppc_rtas_progress_show, NULL);
 }
 
-struct file_operations ppc_rtas_progress_operations = {
+const struct file_operations ppc_rtas_progress_operations = {
 	.open		= progress_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -198,7 +198,7 @@ static int clock_open(struct inode *inod
 	return single_open(file, ppc_rtas_clock_show, NULL);
 }
 
-struct file_operations ppc_rtas_clock_operations = {
+const struct file_operations ppc_rtas_clock_operations = {
 	.open		= clock_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -211,7 +211,7 @@ static int tone_freq_open(struct inode *
 	return single_open(file, ppc_rtas_tone_freq_show, NULL);
 }
 
-struct file_operations ppc_rtas_tone_freq_operations = {
+const struct file_operations ppc_rtas_tone_freq_operations = {
 	.open		= tone_freq_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -224,7 +224,7 @@ static int tone_volume_open(struct inode
 	return single_open(file, ppc_rtas_tone_volume_show, NULL);
 }
 
-struct file_operations ppc_rtas_tone_volume_operations = {
+const struct file_operations ppc_rtas_tone_volume_operations = {
 	.open		= tone_volume_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -237,7 +237,7 @@ static int rmo_buf_open(struct inode *in
 	return single_open(file, ppc_rtas_rmo_buf_show, NULL);
 }
 
-struct file_operations ppc_rtas_rmo_buf_ops = {
+const struct file_operations ppc_rtas_rmo_buf_ops = {
 	.open		= rmo_buf_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
Index: linux-2.6/arch/powerpc/platforms/cell/spufs/file.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/cell/spufs/file.c
+++ linux-2.6/arch/powerpc/platforms/cell/spufs/file.c
@@ -144,7 +144,7 @@ spufs_mem_mmap(struct file *file, struct
 	return 0;
 }
 
-static struct file_operations spufs_mem_fops = {
+static const struct file_operations spufs_mem_fops = {
 	.open	 = spufs_mem_open,
 	.read    = spufs_mem_read,
 	.write   = spufs_mem_write,
@@ -249,7 +249,7 @@ static int spufs_cntl_open(struct inode 
 					spufs_cntl_set, "0x%08lx");
 }
 
-static struct file_operations spufs_cntl_fops = {
+static const struct file_operations spufs_cntl_fops = {
 	.open = spufs_cntl_open,
 	.release = simple_attr_close,
 	.read = simple_attr_read,
@@ -309,7 +309,7 @@ spufs_regs_write(struct file *file, cons
 	return ret;
 }
 
-static struct file_operations spufs_regs_fops = {
+static const struct file_operations spufs_regs_fops = {
 	.open	 = spufs_regs_open,
 	.read    = spufs_regs_read,
 	.write   = spufs_regs_write,
@@ -360,7 +360,7 @@ spufs_fpcr_write(struct file *file, cons
 	return ret;
 }
 
-static struct file_operations spufs_fpcr_fops = {
+static const struct file_operations spufs_fpcr_fops = {
 	.open = spufs_regs_open,
 	.read = spufs_fpcr_read,
 	.write = spufs_fpcr_write,
@@ -426,7 +426,7 @@ static ssize_t spufs_mbox_read(struct fi
 	return count;
 }
 
-static struct file_operations spufs_mbox_fops = {
+static const struct file_operations spufs_mbox_fops = {
 	.open	= spufs_pipe_open,
 	.read	= spufs_mbox_read,
 };
@@ -452,7 +452,7 @@ static ssize_t spufs_mbox_stat_read(stru
 	return 4;
 }
 
-static struct file_operations spufs_mbox_stat_fops = {
+static const struct file_operations spufs_mbox_stat_fops = {
 	.open	= spufs_pipe_open,
 	.read	= spufs_mbox_stat_read,
 };
@@ -559,7 +559,7 @@ static unsigned int spufs_ibox_poll(stru
 	return mask;
 }
 
-static struct file_operations spufs_ibox_fops = {
+static const struct file_operations spufs_ibox_fops = {
 	.open	= spufs_pipe_open,
 	.read	= spufs_ibox_read,
 	.poll	= spufs_ibox_poll,
@@ -585,7 +585,7 @@ static ssize_t spufs_ibox_stat_read(stru
 	return 4;
 }
 
-static struct file_operations spufs_ibox_stat_fops = {
+static const struct file_operations spufs_ibox_stat_fops = {
 	.open	= spufs_pipe_open,
 	.read	= spufs_ibox_stat_read,
 };
@@ -692,7 +692,7 @@ static unsigned int spufs_wbox_poll(stru
 	return mask;
 }
 
-static struct file_operations spufs_wbox_fops = {
+static const struct file_operations spufs_wbox_fops = {
 	.open	= spufs_pipe_open,
 	.write	= spufs_wbox_write,
 	.poll	= spufs_wbox_poll,
@@ -718,7 +718,7 @@ static ssize_t spufs_wbox_stat_read(stru
 	return 4;
 }
 
-static struct file_operations spufs_wbox_stat_fops = {
+static const struct file_operations spufs_wbox_stat_fops = {
 	.open	= spufs_pipe_open,
 	.read	= spufs_wbox_stat_read,
 };
@@ -823,7 +823,7 @@ static int spufs_signal1_mmap(struct fil
 	return 0;
 }
 
-static struct file_operations spufs_signal1_fops = {
+static const struct file_operations spufs_signal1_fops = {
 	.open = spufs_signal1_open,
 	.read = spufs_signal1_read,
 	.write = spufs_signal1_write,
@@ -934,7 +934,7 @@ static int spufs_signal2_mmap(struct fil
 #define spufs_signal2_mmap NULL
 #endif /* !SPUFS_MMAP_4K */
 
-static struct file_operations spufs_signal2_fops = {
+static const struct file_operations spufs_signal2_fops = {
 	.open = spufs_signal2_open,
 	.read = spufs_signal2_read,
 	.write = spufs_signal2_write,
@@ -1037,7 +1037,7 @@ static int spufs_mss_open(struct inode *
 	return nonseekable_open(inode, file);
 }
 
-static struct file_operations spufs_mss_fops = {
+static const struct file_operations spufs_mss_fops = {
 	.open	 = spufs_mss_open,
 	.mmap	 = spufs_mss_mmap,
 };
@@ -1076,7 +1076,7 @@ static int spufs_psmap_open(struct inode
 	return nonseekable_open(inode, file);
 }
 
-static struct file_operations spufs_psmap_fops = {
+static const struct file_operations spufs_psmap_fops = {
 	.open	 = spufs_psmap_open,
 	.mmap	 = spufs_psmap_mmap,
 };
@@ -1393,7 +1393,7 @@ static int spufs_mfc_fasync(int fd, stru
 	return fasync_helper(fd, file, on, &ctx->mfc_fasync);
 }
 
-static struct file_operations spufs_mfc_fops = {
+static const struct file_operations spufs_mfc_fops = {
 	.open	 = spufs_mfc_open,
 	.read	 = spufs_mfc_read,
 	.write	 = spufs_mfc_write,
@@ -1650,7 +1650,7 @@ static ssize_t spufs_mbox_info_read(stru
 	return ret;
 }
 
-static struct file_operations spufs_mbox_info_fops = {
+static const struct file_operations spufs_mbox_info_fops = {
 	.open = spufs_info_open,
 	.read = spufs_mbox_info_read,
 	.llseek  = generic_file_llseek,
@@ -1688,7 +1688,7 @@ static ssize_t spufs_ibox_info_read(stru
 	return ret;
 }
 
-static struct file_operations spufs_ibox_info_fops = {
+static const struct file_operations spufs_ibox_info_fops = {
 	.open = spufs_info_open,
 	.read = spufs_ibox_info_read,
 	.llseek  = generic_file_llseek,
@@ -1729,7 +1729,7 @@ static ssize_t spufs_wbox_info_read(stru
 	return ret;
 }
 
-static struct file_operations spufs_wbox_info_fops = {
+static const struct file_operations spufs_wbox_info_fops = {
 	.open = spufs_info_open,
 	.read = spufs_wbox_info_read,
 	.llseek  = generic_file_llseek,
@@ -1779,7 +1779,7 @@ static ssize_t spufs_dma_info_read(struc
 	return ret;
 }
 
-static struct file_operations spufs_dma_info_fops = {
+static const struct file_operations spufs_dma_info_fops = {
 	.open = spufs_info_open,
 	.read = spufs_dma_info_read,
 };
@@ -1830,7 +1830,7 @@ static ssize_t spufs_proxydma_info_read(
 	return ret;
 }
 
-static struct file_operations spufs_proxydma_info_fops = {
+static const struct file_operations spufs_proxydma_info_fops = {
 	.open = spufs_info_open,
 	.read = spufs_proxydma_info_read,
 };
Index: linux-2.6/arch/powerpc/platforms/cell/spufs/inode.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/cell/spufs/inode.c
+++ linux-2.6/arch/powerpc/platforms/cell/spufs/inode.c
@@ -224,7 +224,7 @@ struct inode_operations spufs_dir_inode_
 	.lookup = simple_lookup,
 };
 
-struct file_operations spufs_context_fops = {
+const struct file_operations spufs_context_fops = {
 	.open		= dcache_dir_open,
 	.release	= spufs_dir_close,
 	.llseek		= dcache_dir_lseek,
@@ -372,7 +372,7 @@ static int spufs_gang_close(struct inode
 	return dcache_dir_close(inode, file);
 }
 
-struct file_operations spufs_gang_fops = {
+const struct file_operations spufs_gang_fops = {
 	.open		= dcache_dir_open,
 	.release	= spufs_gang_close,
 	.llseek		= dcache_dir_lseek,
Index: linux-2.6/arch/powerpc/platforms/iseries/lpevents.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/iseries/lpevents.c
+++ linux-2.6/arch/powerpc/platforms/iseries/lpevents.c
@@ -308,7 +308,7 @@ static int proc_lpevents_open(struct ino
 	return single_open(file, proc_lpevents_show, NULL);
 }
 
-static struct file_operations proc_lpevents_operations = {
+static const struct file_operations proc_lpevents_operations = {
 	.open		= proc_lpevents_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
Index: linux-2.6/arch/powerpc/platforms/iseries/mf.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/iseries/mf.c
+++ linux-2.6/arch/powerpc/platforms/iseries/mf.c
@@ -1224,7 +1224,7 @@ out:
 	return rc;
 }
 
-static struct file_operations proc_vmlinux_operations = {
+static const struct file_operations proc_vmlinux_operations = {
 	.write		= proc_mf_change_vmlinux,
 };
 
Index: linux-2.6/arch/powerpc/platforms/iseries/proc.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/iseries/proc.c
+++ linux-2.6/arch/powerpc/platforms/iseries/proc.c
@@ -101,7 +101,7 @@ static int proc_titantod_open(struct ino
 	return single_open(file, proc_titantod_show, NULL);
 }
 
-static struct file_operations proc_titantod_operations = {
+static const struct file_operations proc_titantod_operations = {
 	.open		= proc_titantod_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
Index: linux-2.6/arch/powerpc/platforms/iseries/viopath.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/iseries/viopath.c
+++ linux-2.6/arch/powerpc/platforms/iseries/viopath.c
@@ -173,7 +173,7 @@ static int proc_viopath_open(struct inod
 	return single_open(file, proc_viopath_show, NULL);
 }
 
-static struct file_operations proc_viopath_operations = {
+static const struct file_operations proc_viopath_operations = {
 	.open		= proc_viopath_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
Index: linux-2.6/arch/powerpc/platforms/pseries/eeh.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/pseries/eeh.c
+++ linux-2.6/arch/powerpc/platforms/pseries/eeh.c
@@ -1065,7 +1065,7 @@ static int proc_eeh_open(struct inode *i
 	return single_open(file, proc_eeh_show, NULL);
 }
 
-static struct file_operations proc_eeh_operations = {
+static const struct file_operations proc_eeh_operations = {
 	.open      = proc_eeh_open,
 	.read      = seq_read,
 	.llseek    = seq_lseek,
Index: linux-2.6/arch/powerpc/platforms/pseries/hvCall_inst.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/pseries/hvCall_inst.c
+++ linux-2.6/arch/powerpc/platforms/pseries/hvCall_inst.c
@@ -90,7 +90,7 @@ static int hcall_inst_seq_open(struct in
 	return rc;
 }
 
-static struct file_operations hcall_inst_seq_fops = {
+static const struct file_operations hcall_inst_seq_fops = {
 	.open = hcall_inst_seq_open,
 	.read = seq_read,
 	.llseek = seq_lseek,
Index: linux-2.6/arch/powerpc/platforms/pseries/reconfig.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/pseries/reconfig.c
+++ linux-2.6/arch/powerpc/platforms/pseries/reconfig.c
@@ -499,7 +499,7 @@ out:
 	return rv ? rv : count;
 }
 
-static struct file_operations ofdt_fops = {
+static const struct file_operations ofdt_fops = {
 	.write = ofdt_write
 };
 
Index: linux-2.6/arch/powerpc/platforms/pseries/rtasd.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/pseries/rtasd.c
+++ linux-2.6/arch/powerpc/platforms/pseries/rtasd.c
@@ -331,7 +331,7 @@ static unsigned int rtas_log_poll(struct
 	return 0;
 }
 
-struct file_operations proc_rtas_log_operations = {
+const struct file_operations proc_rtas_log_operations = {
 	.read =		rtas_log_read,
 	.poll =		rtas_log_poll,
 	.open =		rtas_log_open,
Index: linux-2.6/arch/powerpc/platforms/pseries/scanlog.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/pseries/scanlog.c
+++ linux-2.6/arch/powerpc/platforms/pseries/scanlog.c
@@ -184,7 +184,7 @@ static int scanlog_release(struct inode 
 	return 0;
 }
 
-struct file_operations scanlog_fops = {
+const struct file_operations scanlog_fops = {
 	.owner		= THIS_MODULE,
 	.read		= scanlog_read,
 	.write		= scanlog_write,
Index: linux-2.6/arch/ppc/8xx_io/cs4218_tdm.c
===================================================================
--- linux-2.6.orig/arch/ppc/8xx_io/cs4218_tdm.c
+++ linux-2.6/arch/ppc/8xx_io/cs4218_tdm.c
@@ -1712,7 +1712,7 @@ static int mixer_ioctl(struct inode *ino
 }
 
 
-static struct file_operations mixer_fops =
+static const struct file_operations mixer_fops =
 {
 	.owner =	THIS_MODULE,
 	.llseek =	sound_lseek,
@@ -2299,7 +2299,7 @@ static int sq_ioctl(struct inode *inode,
 
 
 
-static struct file_operations sq_fops =
+static const struct file_operations sq_fops =
 {
 	.owner =	THIS_MODULE,
 	.llseek =	sound_lseek,
@@ -2434,7 +2434,7 @@ static ssize_t state_read(struct file *f
 }
 
 
-static struct file_operations state_fops =
+static const struct file_operations state_fops =
 {
 	.owner =	THIS_MODULE,
 	.llseek =	sound_lseek,
Index: linux-2.6/arch/s390/hypfs/inode.c
===================================================================
--- linux-2.6.orig/arch/s390/hypfs/inode.c
+++ linux-2.6/arch/s390/hypfs/inode.c
@@ -35,7 +35,7 @@ struct hypfs_sb_info {
 	struct mutex lock;		/* lock to protect update process */
 };
 
-static struct file_operations hypfs_file_ops;
+static const struct file_operations hypfs_file_ops;
 static struct file_system_type hypfs_type;
 static struct super_operations hypfs_s_ops;
 
@@ -435,7 +435,7 @@ struct dentry *hypfs_create_str(struct s
 	return dentry;
 }
 
-static struct file_operations hypfs_file_ops = {
+static const struct file_operations hypfs_file_ops = {
 	.open		= hypfs_open,
 	.release	= hypfs_release,
 	.read		= do_sync_read,
Index: linux-2.6/arch/s390/kernel/debug.c
===================================================================
--- linux-2.6.orig/arch/s390/kernel/debug.c
+++ linux-2.6/arch/s390/kernel/debug.c
@@ -167,7 +167,7 @@ DECLARE_MUTEX(debug_lock);
 
 static int initialized;
 
-static struct file_operations debug_file_ops = {
+static const struct file_operations debug_file_ops = {
 	.owner   = THIS_MODULE,
 	.read    = debug_output,
 	.write   = debug_input,
Index: linux-2.6/arch/sh/boards/landisk/landisk_pwb.c
===================================================================
--- linux-2.6.orig/arch/sh/boards/landisk/landisk_pwb.c
+++ linux-2.6/arch/sh/boards/landisk/landisk_pwb.c
@@ -150,7 +150,7 @@ static irqreturn_t sw_interrupt(int irq,
 	return IRQ_HANDLED;
 }
 
-static struct file_operations swdrv_fops = {
+static const struct file_operations swdrv_fops = {
 	.read = swdrv_read,	/* read */
 	.write = swdrv_write,	/* write */
 	.open = swdrv_open,	/* open */
Index: linux-2.6/arch/sh/kernel/apm.c
===================================================================
--- linux-2.6.orig/arch/sh/kernel/apm.c
+++ linux-2.6/arch/sh/kernel/apm.c
@@ -385,7 +385,7 @@ static int apm_open(struct inode * inode
 	return as ? 0 : -ENOMEM;
 }
 
-static struct file_operations apm_bios_fops = {
+static const struct file_operations apm_bios_fops = {
 	.owner		= THIS_MODULE,
 	.read		= apm_read,
 	.poll		= apm_poll,
Index: linux-2.6/arch/sh/mm/cache-debugfs.c
===================================================================
--- linux-2.6.orig/arch/sh/mm/cache-debugfs.c
+++ linux-2.6/arch/sh/mm/cache-debugfs.c
@@ -114,7 +114,7 @@ static int cache_debugfs_open(struct ino
 	return single_open(file, cache_seq_show, inode->i_private);
 }
 
-static struct file_operations cache_debugfs_fops = {
+static const struct file_operations cache_debugfs_fops = {
 	.owner		= THIS_MODULE,
 	.open		= cache_debugfs_open,
 	.read		= seq_read,
Index: linux-2.6/arch/sh/mm/pmb.c
===================================================================
--- linux-2.6.orig/arch/sh/mm/pmb.c
+++ linux-2.6/arch/sh/mm/pmb.c
@@ -378,7 +378,7 @@ static int pmb_debugfs_open(struct inode
 	return single_open(file, pmb_seq_show, NULL);
 }
 
-static struct file_operations pmb_debugfs_fops = {
+static const struct file_operations pmb_debugfs_fops = {
 	.owner		= THIS_MODULE,
 	.open		= pmb_debugfs_open,
 	.read		= seq_read,
Index: linux-2.6/arch/sh/oprofile/op_model_sh7750.c
===================================================================
--- linux-2.6.orig/arch/sh/oprofile/op_model_sh7750.c
+++ linux-2.6/arch/sh/oprofile/op_model_sh7750.c
@@ -187,7 +187,7 @@ static ssize_t sh7750_write_count(struct
 	return count;
 }
 
-static struct file_operations count_fops = {
+static const struct file_operations count_fops = {
 	.read		= sh7750_read_count,
 	.write		= sh7750_write_count,
 };
Index: linux-2.6/arch/sparc/kernel/apc.c
===================================================================
--- linux-2.6.orig/arch/sparc/kernel/apc.c
+++ linux-2.6/arch/sparc/kernel/apc.c
@@ -127,7 +127,7 @@ static int apc_ioctl(struct inode *inode
 	return 0;
 }
 
-static struct file_operations apc_fops = {
+static const struct file_operations apc_fops = {
 	.ioctl =	apc_ioctl,
 	.open =		apc_open,
 	.release =	apc_release,
Index: linux-2.6/arch/sparc64/kernel/time.c
===================================================================
--- linux-2.6.orig/arch/sparc64/kernel/time.c
+++ linux-2.6/arch/sparc64/kernel/time.c
@@ -1327,7 +1327,7 @@ static int mini_rtc_release(struct inode
 }
 
 
-static struct file_operations mini_rtc_fops = {
+static const struct file_operations mini_rtc_fops = {
 	.owner		= THIS_MODULE,
 	.ioctl		= mini_rtc_ioctl,
 	.open		= mini_rtc_open,
Index: linux-2.6/arch/sparc64/solaris/socksys.c
===================================================================
--- linux-2.6.orig/arch/sparc64/solaris/socksys.c
+++ linux-2.6/arch/sparc64/solaris/socksys.c
@@ -55,7 +55,7 @@ extern void mykfree(void *);
 
 static unsigned int (*sock_poll)(struct file *, poll_table *);
 
-static struct file_operations socksys_file_ops = {
+static const struct file_operations socksys_file_ops = {
 	/* Currently empty */
 };
 
@@ -163,7 +163,7 @@ static unsigned int socksys_poll(struct 
 	return mask;
 }
 	
-static struct file_operations socksys_fops = {
+static const struct file_operations socksys_fops = {
 	.open =		socksys_open,
 	.release =	socksys_release,
 };
Index: linux-2.6/arch/um/drivers/harddog_kern.c
===================================================================
--- linux-2.6.orig/arch/um/drivers/harddog_kern.c
+++ linux-2.6/arch/um/drivers/harddog_kern.c
@@ -138,7 +138,7 @@ static int harddog_ioctl(struct inode *i
 	}
 }
 
-static struct file_operations harddog_fops = {
+static const struct file_operations harddog_fops = {
 	.owner		= THIS_MODULE,
 	.write		= harddog_write,
 	.ioctl		= harddog_ioctl,
Index: linux-2.6/arch/v850/kernel/rte_cb_leds.c
===================================================================
--- linux-2.6.orig/arch/v850/kernel/rte_cb_leds.c
+++ linux-2.6/arch/v850/kernel/rte_cb_leds.c
@@ -117,7 +117,7 @@ static loff_t leds_dev_lseek (struct fil
 	return 0;
 }
 
-static struct file_operations leds_fops = {
+static const struct file_operations leds_fops = {
 	.read		= leds_dev_read,
 	.write		= leds_dev_write,
 	.llseek		= leds_dev_lseek
Index: linux-2.6/arch/x86_64/kernel/mce.c
===================================================================
--- linux-2.6.orig/arch/x86_64/kernel/mce.c
+++ linux-2.6/arch/x86_64/kernel/mce.c
@@ -516,7 +516,7 @@ static int mce_ioctl(struct inode *i, st
 	} 
 }
 
-static struct file_operations mce_chrdev_ops = {
+static const struct file_operations mce_chrdev_ops = {
 	.read = mce_read,
 	.ioctl = mce_ioctl,
 };



^ permalink raw reply	[flat|nested] 17+ messages in thread

* [patch 03/12] mark struct file_operations const 3
  2007-01-14  0:51 Patch series to mark struct file_operations and struct inode_operations const Arjan van de Ven
                   ` (2 preceding siblings ...)
  2007-01-14  0:53 ` [patch 02/12] mark struct file_operations const 2 Arjan van de Ven
@ 2007-01-14  0:53 ` Arjan van de Ven
  2007-01-14  0:54 ` [patch 04/12] mark struct file_operations const 4 Arjan van de Ven
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Arjan van de Ven @ 2007-01-14  0:53 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm

From: Arjan van de Ven <arjan@linux.intel.com>
Subject: [patch 03/12] mark struct file_operations const

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>

Index: linux-2.6/block/blktrace.c
===================================================================
--- linux-2.6.orig/block/blktrace.c
+++ linux-2.6/block/blktrace.c
@@ -264,7 +264,7 @@ static ssize_t blk_dropped_read(struct f
 	return simple_read_from_buffer(buffer, count, ppos, buf, strlen(buf));
 }
 
-static struct file_operations blk_dropped_fops = {
+static const struct file_operations blk_dropped_fops = {
 	.owner =	THIS_MODULE,
 	.open =		blk_dropped_open,
 	.read =		blk_dropped_read,
Index: linux-2.6/crypto/proc.c
===================================================================
--- linux-2.6.orig/crypto/proc.c
+++ linux-2.6/crypto/proc.c
@@ -101,7 +101,7 @@ static int crypto_info_open(struct inode
 	return seq_open(file, &crypto_seq_ops);
 }
         
-static struct file_operations proc_crypto_ops = {
+static const struct file_operations proc_crypto_ops = {
 	.open		= crypto_info_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
Index: linux-2.6/drivers/acorn/char/i2c.c
===================================================================
--- linux-2.6.orig/drivers/acorn/char/i2c.c
+++ linux-2.6/drivers/acorn/char/i2c.c
@@ -238,7 +238,7 @@ static int rtc_ioctl(struct inode *inode
 	return -EINVAL;
 }
 
-static struct file_operations rtc_fops = {
+static const struct file_operations rtc_fops = {
 	.ioctl	= rtc_ioctl,
 };
 
Index: linux-2.6/drivers/block/acsi_slm.c
===================================================================
--- linux-2.6.orig/drivers/block/acsi_slm.c
+++ linux-2.6/drivers/block/acsi_slm.c
@@ -269,7 +269,7 @@ static int slm_get_pagesize( int device,
 
 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,
Index: linux-2.6/drivers/block/aoe/aoechr.c
===================================================================
--- linux-2.6.orig/drivers/block/aoe/aoechr.c
+++ linux-2.6/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,
Index: linux-2.6/drivers/block/DAC960.c
===================================================================
--- linux-2.6.orig/drivers/block/DAC960.c
+++ linux-2.6/drivers/block/DAC960.c
@@ -7025,7 +7025,7 @@ static int DAC960_gam_ioctl(struct inode
   return -EINVAL;
 }
 
-static struct file_operations DAC960_gam_fops = {
+static const struct file_operations DAC960_gam_fops = {
 	.owner		= THIS_MODULE,
 	.ioctl		= DAC960_gam_ioctl
 };
Index: linux-2.6/drivers/block/paride/pg.c
===================================================================
--- linux-2.6.orig/drivers/block/paride/pg.c
+++ linux-2.6/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,
Index: linux-2.6/drivers/block/paride/pt.c
===================================================================
--- linux-2.6.orig/drivers/block/paride/pt.c
+++ linux-2.6/drivers/block/paride/pt.c
@@ -232,7 +232,7 @@ static char pt_scratch[512];	/* scratch 
 
 /* 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,
Index: linux-2.6/drivers/block/pktcdvd.c
===================================================================
--- linux-2.6.orig/drivers/block/pktcdvd.c
+++ linux-2.6/drivers/block/pktcdvd.c
@@ -447,7 +447,7 @@ static int pkt_debugfs_fops_open(struct 
 	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,
@@ -2737,7 +2737,7 @@ static int pkt_seq_open(struct inode *in
 	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,
@@ -3064,7 +3064,7 @@ static int pkt_ctl_ioctl(struct inode *i
 }
 
 
-static struct file_operations pkt_ctl_fops = {
+static const struct file_operations pkt_ctl_fops = {
 	.ioctl	 = pkt_ctl_ioctl,
 	.owner	 = THIS_MODULE,
 };
Index: linux-2.6/drivers/bluetooth/hci_vhci.c
===================================================================
--- linux-2.6.orig/drivers/bluetooth/hci_vhci.c
+++ linux-2.6/drivers/bluetooth/hci_vhci.c
@@ -332,7 +332,7 @@ static int vhci_fasync(int fd, struct fi
 	return 0;
 }
 
-static struct file_operations vhci_fops = {
+static const struct file_operations vhci_fops = {
 	.owner		= THIS_MODULE,
 	.llseek		= vhci_llseek,
 	.read		= vhci_read,
Index: linux-2.6/drivers/cdrom/viocd.c
===================================================================
--- linux-2.6.orig/drivers/cdrom/viocd.c
+++ linux-2.6/drivers/cdrom/viocd.c
@@ -176,7 +176,7 @@ static int proc_viocd_open(struct inode 
 	return single_open(file, proc_viocd_show, NULL);
 }
 
-static struct file_operations proc_viocd_operations = {
+static const struct file_operations proc_viocd_operations = {
 	.open		= proc_viocd_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
Index: linux-2.6/drivers/char/briq_panel.c
===================================================================
--- linux-2.6.orig/drivers/char/briq_panel.c
+++ linux-2.6/drivers/char/briq_panel.c
@@ -187,7 +187,7 @@ static ssize_t briq_panel_write(struct f
 	return len;
 }
 
-static struct file_operations briq_panel_fops = {
+static const struct file_operations briq_panel_fops = {
 	.owner		= THIS_MODULE,
 	.read		= briq_panel_read,
 	.write		= briq_panel_write,
Index: linux-2.6/drivers/char/drm/drm_drv.c
===================================================================
--- linux-2.6.orig/drivers/char/drm/drm_drv.c
+++ linux-2.6/drivers/char/drm/drm_drv.c
@@ -371,7 +371,7 @@ void drm_exit(struct drm_driver *driver)
 EXPORT_SYMBOL(drm_exit);
 
 /** File operations structure */
-static struct file_operations drm_stub_fops = {
+static const struct file_operations drm_stub_fops = {
 	.owner = THIS_MODULE,
 	.open = drm_stub_open
 };
Index: linux-2.6/drivers/char/drm/i810_dma.c
===================================================================
--- linux-2.6.orig/drivers/char/drm/i810_dma.c
+++ linux-2.6/drivers/char/drm/i810_dma.c
@@ -112,7 +112,7 @@ static int i810_mmap_buffers(struct file
 	return 0;
 }
 
-static struct file_operations i810_buffer_fops = {
+static const struct file_operations i810_buffer_fops = {
 	.open = drm_open,
 	.release = drm_release,
 	.ioctl = drm_ioctl,
Index: linux-2.6/drivers/char/drm/i830_dma.c
===================================================================
--- linux-2.6.orig/drivers/char/drm/i830_dma.c
+++ linux-2.6/drivers/char/drm/i830_dma.c
@@ -114,7 +114,7 @@ static int i830_mmap_buffers(struct file
 	return 0;
 }
 
-static struct file_operations i830_buffer_fops = {
+static const struct file_operations i830_buffer_fops = {
 	.open = drm_open,
 	.release = drm_release,
 	.ioctl = drm_ioctl,
Index: linux-2.6/drivers/char/generic_nvram.c
===================================================================
--- linux-2.6.orig/drivers/char/generic_nvram.c
+++ linux-2.6/drivers/char/generic_nvram.c
@@ -117,7 +117,7 @@ static int nvram_ioctl(struct inode *ino
 	return 0;
 }
 
-struct file_operations nvram_fops = {
+const struct file_operations nvram_fops = {
 	.owner		= THIS_MODULE,
 	.llseek		= nvram_llseek,
 	.read		= read_nvram,
Index: linux-2.6/drivers/char/mbcs.c
===================================================================
--- linux-2.6.orig/drivers/char/mbcs.c
+++ linux-2.6/drivers/char/mbcs.c
@@ -46,7 +46,7 @@ LIST_HEAD(soft_list);
 /*
  * file operations
  */
-struct file_operations mbcs_ops = {
+const struct file_operations mbcs_ops = {
 	.open = mbcs_open,
 	.llseek = mbcs_sram_llseek,
 	.read = mbcs_sram_read,
Index: linux-2.6/drivers/char/mspec.c
===================================================================
--- linux-2.6.orig/drivers/char/mspec.c
+++ linux-2.6/drivers/char/mspec.c
@@ -291,7 +291,7 @@ uncached_mmap(struct file *file, struct 
 	return mspec_mmap(file, vma, MSPEC_UNCACHED);
 }
 
-static struct file_operations fetchop_fops = {
+static const struct file_operations fetchop_fops = {
 	.owner = THIS_MODULE,
 	.mmap = fetchop_mmap
 };
@@ -302,7 +302,7 @@ static struct miscdevice fetchop_miscdev
 	.fops = &fetchop_fops
 };
 
-static struct file_operations cached_fops = {
+static const struct file_operations cached_fops = {
 	.owner = THIS_MODULE,
 	.mmap = cached_mmap
 };
@@ -313,7 +313,7 @@ static struct miscdevice cached_miscdev 
 	.fops = &cached_fops
 };
 
-static struct file_operations uncached_fops = {
+static const struct file_operations uncached_fops = {
 	.owner = THIS_MODULE,
 	.mmap = uncached_mmap
 };
Index: linux-2.6/drivers/char/random.c
===================================================================
--- linux-2.6.orig/drivers/char/random.c
+++ linux-2.6/drivers/char/random.c
@@ -1117,14 +1117,14 @@ random_ioctl(struct inode * inode, struc
 	}
 }
 
-struct file_operations random_fops = {
+const struct file_operations random_fops = {
 	.read  = random_read,
 	.write = random_write,
 	.poll  = random_poll,
 	.ioctl = random_ioctl,
 };
 
-struct file_operations urandom_fops = {
+const struct file_operations urandom_fops = {
 	.read  = urandom_read,
 	.write = random_write,
 	.ioctl = random_ioctl,
Index: linux-2.6/drivers/char/tpm/tpm_bios.c
===================================================================
--- linux-2.6.orig/drivers/char/tpm/tpm_bios.c
+++ linux-2.6/drivers/char/tpm/tpm_bios.c
@@ -443,7 +443,7 @@ static int tpm_ascii_bios_measurements_o
 	return err;
 }
 
-struct file_operations tpm_ascii_bios_measurements_ops = {
+const struct file_operations tpm_ascii_bios_measurements_ops = {
 	.open = tpm_ascii_bios_measurements_open,
 	.read = seq_read,
 	.llseek = seq_lseek,
@@ -476,7 +476,7 @@ static int tpm_binary_bios_measurements_
 	return err;
 }
 
-struct file_operations tpm_binary_bios_measurements_ops = {
+const struct file_operations tpm_binary_bios_measurements_ops = {
 	.open = tpm_binary_bios_measurements_open,
 	.read = seq_read,
 	.llseek = seq_lseek,
Index: linux-2.6/drivers/char/viotape.c
===================================================================
--- linux-2.6.orig/drivers/char/viotape.c
+++ linux-2.6/drivers/char/viotape.c
@@ -872,7 +872,7 @@ free_op:
 	return ret;
 }
 
-struct file_operations viotap_fops = {
+const struct file_operations viotap_fops = {
 	owner: THIS_MODULE,
 	read: viotap_read,
 	write: viotap_write,
Index: linux-2.6/drivers/char/watchdog/iTCO_wdt.c
===================================================================
--- linux-2.6.orig/drivers/char/watchdog/iTCO_wdt.c
+++ linux-2.6/drivers/char/watchdog/iTCO_wdt.c
@@ -539,7 +539,7 @@ static int iTCO_wdt_ioctl (struct inode 
  *	Kernel Interfaces
  */
 
-static struct file_operations iTCO_wdt_fops = {
+static const struct file_operations iTCO_wdt_fops = {
 	.owner =	THIS_MODULE,
 	.llseek =	no_llseek,
 	.write =	iTCO_wdt_write,
Index: linux-2.6/drivers/char/watchdog/omap_wdt.c
===================================================================
--- linux-2.6.orig/drivers/char/watchdog/omap_wdt.c
+++ linux-2.6/drivers/char/watchdog/omap_wdt.c
@@ -230,7 +230,7 @@ omap_wdt_ioctl(struct inode *inode, stru
 	}
 }
 
-static struct file_operations omap_wdt_fops = {
+static const struct file_operations omap_wdt_fops = {
 	.owner = THIS_MODULE,
 	.write = omap_wdt_write,
 	.ioctl = omap_wdt_ioctl,
Index: linux-2.6/drivers/char/watchdog/pc87413_wdt.c
===================================================================
--- linux-2.6.orig/drivers/char/watchdog/pc87413_wdt.c
+++ linux-2.6/drivers/char/watchdog/pc87413_wdt.c
@@ -526,7 +526,7 @@ static int pc87413_notify_sys(struct not
 
 /* -- Module's structures ---------------------------------------*/
 
-static struct file_operations pc87413_fops = {
+static const struct file_operations pc87413_fops = {
 	.owner		= THIS_MODULE,
 	.llseek		= no_llseek,
 	.write		= pc87413_write,
Index: linux-2.6/drivers/char/watchdog/pnx4008_wdt.c
===================================================================
--- linux-2.6.orig/drivers/char/watchdog/pnx4008_wdt.c
+++ linux-2.6/drivers/char/watchdog/pnx4008_wdt.c
@@ -238,7 +238,7 @@ static int pnx4008_wdt_release(struct in
 	return 0;
 }
 
-static struct file_operations pnx4008_wdt_fops = {
+static const struct file_operations pnx4008_wdt_fops = {
 	.owner = THIS_MODULE,
 	.llseek = no_llseek,
 	.write = pnx4008_wdt_write,
Index: linux-2.6/drivers/char/watchdog/rm9k_wdt.c
===================================================================
--- linux-2.6.orig/drivers/char/watchdog/rm9k_wdt.c
+++ linux-2.6/drivers/char/watchdog/rm9k_wdt.c
@@ -95,7 +95,7 @@ MODULE_PARM_DESC(nowayout, "Watchdog can
 
 
 /* Kernel interfaces */
-static struct file_operations fops = {
+static const struct file_operations fops = {
 	.owner		= THIS_MODULE,
 	.open		= wdt_gpi_open,
 	.release	= wdt_gpi_release,
Index: linux-2.6/drivers/char/watchdog/smsc37b787_wdt.c
===================================================================
--- linux-2.6.orig/drivers/char/watchdog/smsc37b787_wdt.c
+++ linux-2.6/drivers/char/watchdog/smsc37b787_wdt.c
@@ -510,7 +510,7 @@ static int wb_smsc_wdt_notify_sys(struct
 
 /* -- Module's structures ---------------------------------------*/
 
-static struct file_operations wb_smsc_wdt_fops =
+static const struct file_operations wb_smsc_wdt_fops =
 {
 	.owner          = THIS_MODULE,
 	.llseek		= no_llseek,
Index: linux-2.6/drivers/char/watchdog/w83697hf_wdt.c
===================================================================
--- linux-2.6.orig/drivers/char/watchdog/w83697hf_wdt.c
+++ linux-2.6/drivers/char/watchdog/w83697hf_wdt.c
@@ -323,7 +323,7 @@ wdt_notify_sys(struct notifier_block *th
  *	Kernel Interfaces
  */
 
-static struct file_operations wdt_fops = {
+static const struct file_operations wdt_fops = {
 	.owner		= THIS_MODULE,
 	.llseek		= no_llseek,
 	.write		= wdt_write,
Index: linux-2.6/drivers/i2c/chips/tps65010.c
===================================================================
--- linux-2.6.orig/drivers/i2c/chips/tps65010.c
+++ linux-2.6/drivers/i2c/chips/tps65010.c
@@ -308,7 +308,7 @@ static int dbg_tps_open(struct inode *in
 	return single_open(file, dbg_show, inode->i_private);
 }
 
-static struct file_operations debug_fops = {
+static const struct file_operations debug_fops = {
 	.open		= dbg_tps_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
Index: linux-2.6/drivers/i2c/i2c-dev.c
===================================================================
--- linux-2.6.orig/drivers/i2c/i2c-dev.c
+++ linux-2.6/drivers/i2c/i2c-dev.c
@@ -392,7 +392,7 @@ static int i2cdev_release(struct inode *
 	return 0;
 }
 
-static struct file_operations i2cdev_fops = {
+static const struct file_operations i2cdev_fops = {
 	.owner		= THIS_MODULE,
 	.llseek		= no_llseek,
 	.read		= i2cdev_read,
Index: linux-2.6/drivers/ide/ide-proc.c
===================================================================
--- linux-2.6.orig/drivers/ide/ide-proc.c
+++ linux-2.6/drivers/ide/ide-proc.c
@@ -549,7 +549,7 @@ static int ide_drivers_open(struct inode
 	return single_open(file, &ide_drivers_show, NULL);
 }
 
-static struct file_operations ide_drivers_operations = {
+static const struct file_operations ide_drivers_operations = {
 	.open		= ide_drivers_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
Index: linux-2.6/drivers/ide/ide-tape.c
===================================================================
--- linux-2.6.orig/drivers/ide/ide-tape.c
+++ linux-2.6/drivers/ide/ide-tape.c
@@ -4779,7 +4779,7 @@ static ide_driver_t idetape_driver = {
 /*
  *	Our character device supporting functions, passed to register_chrdev.
  */
-static struct file_operations idetape_fops = {
+static const struct file_operations idetape_fops = {
 	.owner		= THIS_MODULE,
 	.read		= idetape_chrdev_read,
 	.write		= idetape_chrdev_write,
Index: linux-2.6/drivers/ieee1394/dv1394.c
===================================================================
--- linux-2.6.orig/drivers/ieee1394/dv1394.c
+++ linux-2.6/drivers/ieee1394/dv1394.c
@@ -2147,7 +2147,7 @@ out:
 }
 
 static struct cdev dv1394_cdev;
-static struct file_operations dv1394_fops=
+static const struct file_operations dv1394_fops=
 {
 	.owner =	THIS_MODULE,
 	.poll =         dv1394_poll,
Index: linux-2.6/drivers/ieee1394/raw1394.c
===================================================================
--- linux-2.6.orig/drivers/ieee1394/raw1394.c
+++ linux-2.6/drivers/ieee1394/raw1394.c
@@ -3003,7 +3003,7 @@ static struct hpsb_highlevel raw1394_hig
 };
 
 static struct cdev raw1394_cdev;
-static struct file_operations raw1394_fops = {
+static const struct file_operations raw1394_fops = {
 	.owner = THIS_MODULE,
 	.read = raw1394_read,
 	.write = raw1394_write,
Index: linux-2.6/drivers/ieee1394/video1394.c
===================================================================
--- linux-2.6.orig/drivers/ieee1394/video1394.c
+++ linux-2.6/drivers/ieee1394/video1394.c
@@ -1269,7 +1269,7 @@ static long video1394_compat_ioctl(struc
 #endif
 
 static struct cdev video1394_cdev;
-static struct file_operations video1394_fops=
+static const struct file_operations video1394_fops=
 {
 	.owner =	THIS_MODULE,
 	.unlocked_ioctl = video1394_ioctl,
Index: linux-2.6/drivers/infiniband/core/ucma.c
===================================================================
--- linux-2.6.orig/drivers/infiniband/core/ucma.c
+++ linux-2.6/drivers/infiniband/core/ucma.c
@@ -833,7 +833,7 @@ static int ucma_close(struct inode *inod
 	return 0;
 }
 
-static struct file_operations ucma_fops = {
+static const struct file_operations ucma_fops = {
 	.owner 	 = THIS_MODULE,
 	.open 	 = ucma_open,
 	.release = ucma_close,
Index: linux-2.6/drivers/infiniband/core/ucm.c
===================================================================
--- linux-2.6.orig/drivers/infiniband/core/ucm.c
+++ linux-2.6/drivers/infiniband/core/ucm.c
@@ -1221,7 +1221,7 @@ static void ib_ucm_release_class_dev(str
 	kfree(dev);
 }
 
-static struct file_operations ucm_fops = {
+static const struct file_operations ucm_fops = {
 	.owner 	 = THIS_MODULE,
 	.open 	 = ib_ucm_open,
 	.release = ib_ucm_close,
Index: linux-2.6/drivers/infiniband/core/user_mad.c
===================================================================
--- linux-2.6.orig/drivers/infiniband/core/user_mad.c
+++ linux-2.6/drivers/infiniband/core/user_mad.c
@@ -771,7 +771,7 @@ static int ib_umad_close(struct inode *i
 	return 0;
 }
 
-static struct file_operations umad_fops = {
+static const struct file_operations umad_fops = {
 	.owner 	 	= THIS_MODULE,
 	.read 	 	= ib_umad_read,
 	.write 	 	= ib_umad_write,
@@ -846,7 +846,7 @@ static int ib_umad_sm_close(struct inode
 	return ret;
 }
 
-static struct file_operations umad_sm_fops = {
+static const struct file_operations umad_sm_fops = {
 	.owner 	 = THIS_MODULE,
 	.open 	 = ib_umad_sm_open,
 	.release = ib_umad_sm_close
Index: linux-2.6/drivers/infiniband/core/uverbs_main.c
===================================================================
--- linux-2.6.orig/drivers/infiniband/core/uverbs_main.c
+++ linux-2.6/drivers/infiniband/core/uverbs_main.c
@@ -375,7 +375,7 @@ static int ib_uverbs_event_close(struct 
 	return 0;
 }
 
-static struct file_operations uverbs_event_fops = {
+static const struct file_operations uverbs_event_fops = {
 	.owner	 = THIS_MODULE,
 	.read 	 = ib_uverbs_event_read,
 	.poll    = ib_uverbs_event_poll,
@@ -679,14 +679,14 @@ static int ib_uverbs_close(struct inode 
 	return 0;
 }
 
-static struct file_operations uverbs_fops = {
+static const struct file_operations uverbs_fops = {
 	.owner 	 = THIS_MODULE,
 	.write 	 = ib_uverbs_write,
 	.open 	 = ib_uverbs_open,
 	.release = ib_uverbs_close
 };
 
-static struct file_operations uverbs_mmap_fops = {
+static const struct file_operations uverbs_mmap_fops = {
 	.owner 	 = THIS_MODULE,
 	.write 	 = ib_uverbs_write,
 	.mmap    = ib_uverbs_mmap,
Index: linux-2.6/drivers/infiniband/hw/ipath/ipath_diag.c
===================================================================
--- linux-2.6.orig/drivers/infiniband/hw/ipath/ipath_diag.c
+++ linux-2.6/drivers/infiniband/hw/ipath/ipath_diag.c
@@ -59,7 +59,7 @@ static ssize_t ipath_diag_read(struct fi
 static ssize_t ipath_diag_write(struct file *fp, const char __user *data,
 				size_t count, loff_t *off);
 
-static struct file_operations diag_file_ops = {
+static const struct file_operations diag_file_ops = {
 	.owner = THIS_MODULE,
 	.write = ipath_diag_write,
 	.read = ipath_diag_read,
@@ -71,7 +71,7 @@ static ssize_t ipath_diagpkt_write(struc
 				   const char __user *data,
 				   size_t count, loff_t *off);
 
-static struct file_operations diagpkt_file_ops = {
+static const struct file_operations diagpkt_file_ops = {
 	.owner = THIS_MODULE,
 	.write = ipath_diagpkt_write,
 };
Index: linux-2.6/drivers/infiniband/hw/ipath/ipath_file_ops.c
===================================================================
--- linux-2.6.orig/drivers/infiniband/hw/ipath/ipath_file_ops.c
+++ linux-2.6/drivers/infiniband/hw/ipath/ipath_file_ops.c
@@ -54,7 +54,7 @@ static ssize_t ipath_write(struct file *
 static unsigned int ipath_poll(struct file *, struct poll_table_struct *);
 static int ipath_mmap(struct file *, struct vm_area_struct *);
 
-static struct file_operations ipath_file_ops = {
+static const struct file_operations ipath_file_ops = {
 	.owner = THIS_MODULE,
 	.write = ipath_write,
 	.open = ipath_open,
@@ -2153,7 +2153,7 @@ bail:
 
 static struct class *ipath_class;
 
-static int init_cdev(int minor, char *name, struct file_operations *fops,
+static int init_cdev(int minor, char *name, const struct file_operations *fops,
 		     struct cdev **cdevp, struct class_device **class_devp)
 {
 	const dev_t dev = MKDEV(IPATH_MAJOR, minor);
@@ -2210,7 +2210,7 @@ done:
 	return ret;
 }
 
-int ipath_cdev_init(int minor, char *name, struct file_operations *fops,
+int ipath_cdev_init(int minor, char *name, const struct file_operations *fops,
 		    struct cdev **cdevp, struct class_device **class_devp)
 {
 	return init_cdev(minor, name, fops, cdevp, class_devp);
Index: linux-2.6/drivers/infiniband/hw/ipath/ipath_fs.c
===================================================================
--- linux-2.6.orig/drivers/infiniband/hw/ipath/ipath_fs.c
+++ linux-2.6/drivers/infiniband/hw/ipath/ipath_fs.c
@@ -47,7 +47,7 @@
 static struct super_block *ipath_super;
 
 static int ipathfs_mknod(struct inode *dir, struct dentry *dentry,
-			 int mode, struct file_operations *fops,
+			 int mode, const struct file_operations *fops,
 			 void *data)
 {
 	int error;
@@ -81,7 +81,7 @@ bail:
 
 static int create_file(const char *name, mode_t mode,
 		       struct dentry *parent, struct dentry **dentry,
-		       struct file_operations *fops, void *data)
+		       const struct file_operations *fops, void *data)
 {
 	int error;
 
@@ -105,7 +105,7 @@ static ssize_t atomic_stats_read(struct 
 				       sizeof ipath_stats);
 }
 
-static struct file_operations atomic_stats_ops = {
+static const struct file_operations atomic_stats_ops = {
 	.read = atomic_stats_read,
 };
 
@@ -127,7 +127,7 @@ static ssize_t atomic_counters_read(stru
 				       sizeof counters);
 }
 
-static struct file_operations atomic_counters_ops = {
+static const struct file_operations atomic_counters_ops = {
 	.read = atomic_counters_read,
 };
 
@@ -166,7 +166,7 @@ static ssize_t atomic_node_info_read(str
 				       sizeof nodeinfo);
 }
 
-static struct file_operations atomic_node_info_ops = {
+static const struct file_operations atomic_node_info_ops = {
 	.read = atomic_node_info_read,
 };
 
@@ -291,7 +291,7 @@ static ssize_t atomic_port_info_read(str
 				       sizeof portinfo);
 }
 
-static struct file_operations atomic_port_info_ops = {
+static const struct file_operations atomic_port_info_ops = {
 	.read = atomic_port_info_read,
 };
 
@@ -394,7 +394,7 @@ bail:
 	return ret;
 }
 
-static struct file_operations flash_ops = {
+static const struct file_operations flash_ops = {
 	.read = flash_read,
 	.write = flash_write,
 };
Index: linux-2.6/drivers/infiniband/hw/ipath/ipath_kernel.h
===================================================================
--- linux-2.6.orig/drivers/infiniband/hw/ipath/ipath_kernel.h
+++ linux-2.6/drivers/infiniband/hw/ipath/ipath_kernel.h
@@ -593,7 +593,7 @@ void ipath_shutdown_device(struct ipath_
 void ipath_disarm_senderrbufs(struct ipath_devdata *);
 
 struct file_operations;
-int ipath_cdev_init(int minor, char *name, struct file_operations *fops,
+int ipath_cdev_init(int minor, char *name, const struct file_operations *fops,
 		    struct cdev **cdevp, struct class_device **class_devp);
 void ipath_cdev_cleanup(struct cdev **cdevp,
 			struct class_device **class_devp);
Index: linux-2.6/drivers/infiniband/ulp/ipoib/ipoib_fs.c
===================================================================
--- linux-2.6.orig/drivers/infiniband/ulp/ipoib/ipoib_fs.c
+++ linux-2.6/drivers/infiniband/ulp/ipoib/ipoib_fs.c
@@ -146,7 +146,7 @@ static int ipoib_mcg_open(struct inode *
 	return 0;
 }
 
-static struct file_operations ipoib_mcg_fops = {
+static const struct file_operations ipoib_mcg_fops = {
 	.owner   = THIS_MODULE,
 	.open    = ipoib_mcg_open,
 	.read    = seq_read,
@@ -252,7 +252,7 @@ static int ipoib_path_open(struct inode 
 	return 0;
 }
 
-static struct file_operations ipoib_path_fops = {
+static const struct file_operations ipoib_path_fops = {
 	.owner   = THIS_MODULE,
 	.open    = ipoib_path_open,
 	.read    = seq_read,
Index: linux-2.6/drivers/input/input.c
===================================================================
--- linux-2.6.orig/drivers/input/input.c
+++ linux-2.6/drivers/input/input.c
@@ -482,7 +482,7 @@ static int input_proc_devices_open(struc
 	return seq_open(file, &input_devices_seq_ops);
 }
 
-static struct file_operations input_devices_fileops = {
+static const struct file_operations input_devices_fileops = {
 	.owner		= THIS_MODULE,
 	.open		= input_proc_devices_open,
 	.poll		= input_proc_devices_poll,
@@ -533,7 +533,7 @@ static int input_proc_handlers_open(stru
 	return seq_open(file, &input_handlers_seq_ops);
 }
 
-static struct file_operations input_handlers_fileops = {
+static const struct file_operations input_handlers_fileops = {
 	.owner		= THIS_MODULE,
 	.open		= input_proc_handlers_open,
 	.read		= seq_read,
@@ -1142,7 +1142,7 @@ static int input_open_file(struct inode 
 	return err;
 }
 
-static struct file_operations input_fops = {
+static const struct file_operations input_fops = {
 	.owner = THIS_MODULE,
 	.open = input_open_file,
 };
Index: linux-2.6/drivers/input/misc/hp_sdc_rtc.c
===================================================================
--- linux-2.6.orig/drivers/input/misc/hp_sdc_rtc.c
+++ linux-2.6/drivers/input/misc/hp_sdc_rtc.c
@@ -670,7 +670,7 @@ static int hp_sdc_rtc_ioctl(struct inode
 #endif
 }
 
-static struct file_operations hp_sdc_rtc_fops = {
+static const struct file_operations hp_sdc_rtc_fops = {
         .owner =	THIS_MODULE,
         .llseek =	no_llseek,
         .read =		hp_sdc_rtc_read,
Index: linux-2.6/drivers/input/misc/uinput.c
===================================================================
--- linux-2.6.orig/drivers/input/misc/uinput.c
+++ linux-2.6/drivers/input/misc/uinput.c
@@ -627,7 +627,7 @@ static long uinput_ioctl(struct file *fi
 	return retval;
 }
 
-static struct file_operations uinput_fops = {
+static const struct file_operations uinput_fops = {
 	.owner		= THIS_MODULE,
 	.open		= uinput_open,
 	.release	= uinput_release,
Index: linux-2.6/drivers/input/serio/serio_raw.c
===================================================================
--- linux-2.6.orig/drivers/input/serio/serio_raw.c
+++ linux-2.6/drivers/input/serio/serio_raw.c
@@ -234,7 +234,7 @@ static unsigned int serio_raw_poll(struc
 	return 0;
 }
 
-static struct file_operations serio_raw_fops = {
+static const struct file_operations serio_raw_fops = {
 	.owner =	THIS_MODULE,
 	.open =		serio_raw_open,
 	.release =	serio_raw_release,
Index: linux-2.6/drivers/isdn/capi/capi.c
===================================================================
--- linux-2.6.orig/drivers/isdn/capi/capi.c
+++ linux-2.6/drivers/isdn/capi/capi.c
@@ -988,7 +988,7 @@ capi_release(struct inode *inode, struct
 	return 0;
 }
 
-static struct file_operations capi_fops =
+static const struct file_operations capi_fops =
 {
 	.owner		= THIS_MODULE,
 	.llseek		= no_llseek,
Index: linux-2.6/drivers/isdn/capi/kcapi_proc.c
===================================================================
--- linux-2.6.orig/drivers/isdn/capi/kcapi_proc.c
+++ linux-2.6/drivers/isdn/capi/kcapi_proc.c
@@ -113,14 +113,14 @@ static int seq_contrstats_open(struct in
 	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, 
 	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
 	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,
Index: linux-2.6/drivers/isdn/divert/divert_procfs.c
===================================================================
--- linux-2.6.orig/drivers/isdn/divert/divert_procfs.c
+++ linux-2.6/drivers/isdn/divert/divert_procfs.c
@@ -256,7 +256,7 @@ isdn_divert_ioctl(struct inode *inode, s
 
 
 #ifdef CONFIG_PROC_FS
-static struct file_operations isdn_fops =
+static const struct file_operations isdn_fops =
 {
 	.owner          = THIS_MODULE,
 	.llseek         = no_llseek,
Index: linux-2.6/drivers/isdn/hardware/eicon/divamnt.c
===================================================================
--- linux-2.6.orig/drivers/isdn/hardware/eicon/divamnt.c
+++ linux-2.6/drivers/isdn/hardware/eicon/divamnt.c
@@ -164,7 +164,7 @@ static ssize_t divas_maint_read(struct f
 	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,
Index: linux-2.6/drivers/isdn/hardware/eicon/divasi.c
===================================================================
--- linux-2.6.orig/drivers/isdn/hardware/eicon/divasi.c
+++ linux-2.6/drivers/isdn/hardware/eicon/divasi.c
@@ -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,
Index: linux-2.6/drivers/isdn/hardware/eicon/divasmain.c
===================================================================
--- linux-2.6.orig/drivers/isdn/hardware/eicon/divasmain.c
+++ linux-2.6/drivers/isdn/hardware/eicon/divasmain.c
@@ -663,7 +663,7 @@ static unsigned int divas_poll(struct fi
 	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,
Index: linux-2.6/drivers/isdn/hardware/eicon/divasproc.c
===================================================================
--- linux-2.6.orig/drivers/isdn/hardware/eicon/divasproc.c
+++ linux-2.6/drivers/isdn/hardware/eicon/divasproc.c
@@ -113,7 +113,7 @@ static int divas_close(struct inode *ino
 	return (0);
 }
 
-static struct file_operations divas_fops = {
+static const struct file_operations divas_fops = {
 	.owner   = THIS_MODULE,
 	.llseek  = no_llseek,
 	.read    = divas_read,
Index: linux-2.6/drivers/isdn/hysdn/hysdn_procconf.c
===================================================================
--- linux-2.6.orig/drivers/isdn/hysdn/hysdn_procconf.c
+++ linux-2.6/drivers/isdn/hysdn/hysdn_procconf.c
@@ -367,7 +367,7 @@ hysdn_conf_close(struct inode *ino, stru
 /******************************************************/
 /* 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,
Index: linux-2.6/drivers/isdn/hysdn/hysdn_proclog.c
===================================================================
--- linux-2.6.orig/drivers/isdn/hysdn/hysdn_proclog.c
+++ linux-2.6/drivers/isdn/hysdn/hysdn_proclog.c
@@ -383,7 +383,7 @@ hysdn_log_poll(struct file *file, poll_t
 /**************************************************/
 /* 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,
Index: linux-2.6/drivers/isdn/i4l/isdn_common.c
===================================================================
--- linux-2.6.orig/drivers/isdn/i4l/isdn_common.c
+++ linux-2.6/drivers/isdn/i4l/isdn_common.c
@@ -1822,7 +1822,7 @@ isdn_close(struct inode *ino, struct fil
 	return 0;
 }
 
-static struct file_operations isdn_fops =
+static const struct file_operations isdn_fops =
 {
 	.owner		= THIS_MODULE,
 	.llseek		= no_llseek,



^ permalink raw reply	[flat|nested] 17+ messages in thread

* [patch 04/12] mark struct file_operations const 4
  2007-01-14  0:51 Patch series to mark struct file_operations and struct inode_operations const Arjan van de Ven
                   ` (3 preceding siblings ...)
  2007-01-14  0:53 ` [patch 03/12] mark struct file_operations const 3 Arjan van de Ven
@ 2007-01-14  0:54 ` Arjan van de Ven
  2007-01-14  0:54 ` [patch 05/12] mark struct file_operations const 5 Arjan van de Ven
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Arjan van de Ven @ 2007-01-14  0:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm

From: Arjan van de Ven <arjan@linux.intel.com>
Subject: [patch 04/12] mark struct file_operations const

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>

Index: linux-2.6/drivers/macintosh/adb.c
===================================================================
--- linux-2.6.orig/drivers/macintosh/adb.c
+++ linux-2.6/drivers/macintosh/adb.c
@@ -885,7 +885,7 @@ out:
 	return ret;
 }
 
-static struct file_operations adb_fops = {
+static const struct file_operations adb_fops = {
 	.owner		= THIS_MODULE,
 	.llseek		= no_llseek,
 	.read		= adb_read,
Index: linux-2.6/drivers/macintosh/ans-lcd.c
===================================================================
--- linux-2.6.orig/drivers/macintosh/ans-lcd.c
+++ linux-2.6/drivers/macintosh/ans-lcd.c
@@ -121,7 +121,7 @@ anslcd_open( struct inode * inode, struc
 	return 0;
 }
 
-struct file_operations anslcd_fops = {
+const struct file_operations anslcd_fops = {
 	.write	= anslcd_write,
 	.ioctl	= anslcd_ioctl,
 	.open	= anslcd_open,
Index: linux-2.6/drivers/macintosh/apm_emu.c
===================================================================
--- linux-2.6.orig/drivers/macintosh/apm_emu.c
+++ linux-2.6/drivers/macintosh/apm_emu.c
@@ -501,7 +501,7 @@ static int apm_emu_get_info(char *buf, c
 	return p - buf;
 }
 
-static struct file_operations apm_bios_fops = {
+static const struct file_operations apm_bios_fops = {
 	.owner		= THIS_MODULE,
 	.read		= do_read,
 	.poll		= do_poll,
Index: linux-2.6/drivers/macintosh/nvram.c
===================================================================
--- linux-2.6.orig/drivers/macintosh/nvram.c
+++ linux-2.6/drivers/macintosh/nvram.c
@@ -100,7 +100,7 @@ static int nvram_ioctl(struct inode *ino
 	return 0;
 }
 
-struct file_operations nvram_fops = {
+const struct file_operations nvram_fops = {
 	.owner		= THIS_MODULE,
 	.llseek		= nvram_llseek,
 	.read		= read_nvram,
Index: linux-2.6/drivers/macintosh/smu.c
===================================================================
--- linux-2.6.orig/drivers/macintosh/smu.c
+++ linux-2.6/drivers/macintosh/smu.c
@@ -1277,7 +1277,7 @@ static int smu_release(struct inode *ino
 }
 
 
-static struct file_operations smu_device_fops = {
+static const struct file_operations smu_device_fops = {
 	.llseek		= no_llseek,
 	.read		= smu_read,
 	.write		= smu_write,
Index: linux-2.6/drivers/macintosh/via-pmu68k.c
===================================================================
--- linux-2.6.orig/drivers/macintosh/via-pmu68k.c
+++ linux-2.6/drivers/macintosh/via-pmu68k.c
@@ -1040,7 +1040,7 @@ static int pmu_ioctl(struct inode * inod
 	return -EINVAL;
 }
 
-static struct file_operations pmu_device_fops = {
+static const struct file_operations pmu_device_fops = {
 	.read		= pmu_read,
 	.write		= pmu_write,
 	.ioctl		= pmu_ioctl,
Index: linux-2.6/drivers/macintosh/via-pmu.c
===================================================================
--- linux-2.6.orig/drivers/macintosh/via-pmu.c
+++ linux-2.6/drivers/macintosh/via-pmu.c
@@ -2673,7 +2673,7 @@ pmu_ioctl(struct inode * inode, struct f
 	return error;
 }
 
-static struct file_operations pmu_device_fops = {
+static const struct file_operations pmu_device_fops = {
 	.read		= pmu_read,
 	.write		= pmu_write,
 	.poll		= pmu_fpoll,
Index: linux-2.6/drivers/md/dm-ioctl.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-ioctl.c
+++ linux-2.6/drivers/md/dm-ioctl.c
@@ -1473,7 +1473,7 @@ static int ctl_ioctl(struct inode *inode
 	return r;
 }
 
-static struct file_operations _ctl_fops = {
+static const struct file_operations _ctl_fops = {
 	.ioctl	 = ctl_ioctl,
 	.owner	 = THIS_MODULE,
 };
Index: linux-2.6/drivers/md/md.c
===================================================================
--- linux-2.6.orig/drivers/md/md.c
+++ linux-2.6/drivers/md/md.c
@@ -4917,7 +4917,7 @@ static unsigned int mdstat_poll(struct f
 	return mask;
 }
 
-static struct file_operations md_seq_fops = {
+static const struct file_operations md_seq_fops = {
 	.owner		= THIS_MODULE,
 	.open           = md_seq_open,
 	.read           = seq_read,
Index: linux-2.6/drivers/media/common/saa7146_fops.c
===================================================================
--- linux-2.6.orig/drivers/media/common/saa7146_fops.c
+++ linux-2.6/drivers/media/common/saa7146_fops.c
@@ -416,7 +416,7 @@ static ssize_t fops_write(struct file *f
 	}
 }
 
-static struct file_operations video_fops =
+static const struct file_operations video_fops =
 {
 	.owner		= THIS_MODULE,
 	.open		= fops_open,
Index: linux-2.6/drivers/media/radio/dsbr100.c
===================================================================
--- linux-2.6.orig/drivers/media/radio/dsbr100.c
+++ linux-2.6/drivers/media/radio/dsbr100.c
@@ -144,7 +144,7 @@ struct dsbr100_device {
 
 
 /* File system interface */
-static struct file_operations usb_dsbr100_fops = {
+static const struct file_operations usb_dsbr100_fops = {
 	.owner =	THIS_MODULE,
 	.open =		usb_dsbr100_open,
 	.release =     	usb_dsbr100_close,
Index: linux-2.6/drivers/media/radio/miropcm20-radio.c
===================================================================
--- linux-2.6.orig/drivers/media/radio/miropcm20-radio.c
+++ linux-2.6/drivers/media/radio/miropcm20-radio.c
@@ -216,7 +216,7 @@ static struct pcm20_device pcm20_unit = 
 	.muted  = 1,
 };
 
-static struct file_operations pcm20_fops = {
+static const struct file_operations pcm20_fops = {
 	.owner		= THIS_MODULE,
 	.open           = video_exclusive_open,
 	.release        = video_exclusive_release,
Index: linux-2.6/drivers/media/radio/miropcm20-rds.c
===================================================================
--- linux-2.6.orig/drivers/media/radio/miropcm20-rds.c
+++ linux-2.6/drivers/media/radio/miropcm20-rds.c
@@ -105,7 +105,7 @@ static ssize_t rds_f_read(struct file *f
 	}
 }
 
-static struct file_operations rds_fops = {
+static const struct file_operations rds_fops = {
 	.owner		= THIS_MODULE,
 	.read		= rds_f_read,
 	.open		= rds_f_open,
Index: linux-2.6/drivers/media/radio/radio-aimslab.c
===================================================================
--- linux-2.6.orig/drivers/media/radio/radio-aimslab.c
+++ linux-2.6/drivers/media/radio/radio-aimslab.c
@@ -358,7 +358,7 @@ static int rt_ioctl(struct inode *inode,
 
 static struct rt_device rtrack_unit;
 
-static struct file_operations rtrack_fops = {
+static const struct file_operations rtrack_fops = {
 	.owner		= THIS_MODULE,
 	.open           = video_exclusive_open,
 	.release        = video_exclusive_release,
Index: linux-2.6/drivers/media/radio/radio-aztech.c
===================================================================
--- linux-2.6.orig/drivers/media/radio/radio-aztech.c
+++ linux-2.6/drivers/media/radio/radio-aztech.c
@@ -314,7 +314,7 @@ static int az_ioctl(struct inode *inode,
 
 static struct az_device aztech_unit;
 
-static struct file_operations aztech_fops = {
+static const struct file_operations aztech_fops = {
 	.owner		= THIS_MODULE,
 	.open           = video_exclusive_open,
 	.release        = video_exclusive_release,
Index: linux-2.6/drivers/media/radio/radio-cadet.c
===================================================================
--- linux-2.6.orig/drivers/media/radio/radio-cadet.c
+++ linux-2.6/drivers/media/radio/radio-cadet.c
@@ -507,7 +507,7 @@ cadet_poll(struct file *file, struct pol
 }
 
 
-static struct file_operations cadet_fops = {
+static const struct file_operations cadet_fops = {
 	.owner		= THIS_MODULE,
 	.open		= cadet_open,
 	.release       	= cadet_release,
Index: linux-2.6/drivers/media/radio/radio-gemtek.c
===================================================================
--- linux-2.6.orig/drivers/media/radio/radio-gemtek.c
+++ linux-2.6/drivers/media/radio/radio-gemtek.c
@@ -296,7 +296,7 @@ static int gemtek_ioctl(struct inode *in
 
 static struct gemtek_device gemtek_unit;
 
-static struct file_operations gemtek_fops = {
+static const struct file_operations gemtek_fops = {
 	.owner		= THIS_MODULE,
 	.open           = video_exclusive_open,
 	.release        = video_exclusive_release,
Index: linux-2.6/drivers/media/radio/radio-gemtek-pci.c
===================================================================
--- linux-2.6.orig/drivers/media/radio/radio-gemtek-pci.c
+++ linux-2.6/drivers/media/radio/radio-gemtek-pci.c
@@ -346,7 +346,7 @@ MODULE_DEVICE_TABLE( pci, gemtek_pci_id 
 
 static int mx = 1;
 
-static struct file_operations gemtek_pci_fops = {
+static const struct file_operations gemtek_pci_fops = {
 	.owner		= THIS_MODULE,
 	.open           = video_exclusive_open,
 	.release        = video_exclusive_release,
Index: linux-2.6/drivers/media/radio/radio-maestro.c
===================================================================
--- linux-2.6.orig/drivers/media/radio/radio-maestro.c
+++ linux-2.6/drivers/media/radio/radio-maestro.c
@@ -99,7 +99,7 @@ static struct pci_driver maestro_r_drive
 	.remove		= __devexit_p(maestro_remove),
 };
 
-static struct file_operations maestro_fops = {
+static const struct file_operations maestro_fops = {
 	.owner		= THIS_MODULE,
 	.open           = video_exclusive_open,
 	.release        = video_exclusive_release,
Index: linux-2.6/drivers/media/radio/radio-maxiradio.c
===================================================================
--- linux-2.6.orig/drivers/media/radio/radio-maxiradio.c
+++ linux-2.6/drivers/media/radio/radio-maxiradio.c
@@ -91,7 +91,7 @@ module_param(radio_nr, int, 0);
 static int radio_ioctl(struct inode *inode, struct file *file,
 		       unsigned int cmd, unsigned long arg);
 
-static struct file_operations maxiradio_fops = {
+static const struct file_operations maxiradio_fops = {
 	.owner		= THIS_MODULE,
 	.open           = video_exclusive_open,
 	.release        = video_exclusive_release,
Index: linux-2.6/drivers/media/radio/radio-rtrack2.c
===================================================================
--- linux-2.6.orig/drivers/media/radio/radio-rtrack2.c
+++ linux-2.6/drivers/media/radio/radio-rtrack2.c
@@ -262,7 +262,7 @@ static int rt_ioctl(struct inode *inode,
 
 static struct rt_device rtrack2_unit;
 
-static struct file_operations rtrack2_fops = {
+static const struct file_operations rtrack2_fops = {
 	.owner		= THIS_MODULE,
 	.open           = video_exclusive_open,
 	.release        = video_exclusive_release,
Index: linux-2.6/drivers/media/radio/radio-sf16fmi.c
===================================================================
--- linux-2.6.orig/drivers/media/radio/radio-sf16fmi.c
+++ linux-2.6/drivers/media/radio/radio-sf16fmi.c
@@ -265,7 +265,7 @@ static int fmi_ioctl(struct inode *inode
 
 static struct fmi_device fmi_unit;
 
-static struct file_operations fmi_fops = {
+static const struct file_operations fmi_fops = {
 	.owner		= THIS_MODULE,
 	.open           = video_exclusive_open,
 	.release        = video_exclusive_release,
Index: linux-2.6/drivers/media/radio/radio-sf16fmr2.c
===================================================================
--- linux-2.6.orig/drivers/media/radio/radio-sf16fmr2.c
+++ linux-2.6/drivers/media/radio/radio-sf16fmr2.c
@@ -410,7 +410,7 @@ static int fmr2_ioctl(struct inode *inod
 
 static struct fmr2_device fmr2_unit;
 
-static struct file_operations fmr2_fops = {
+static const struct file_operations fmr2_fops = {
 	.owner          = THIS_MODULE,
 	.open           = video_exclusive_open,
 	.release        = video_exclusive_release,
Index: linux-2.6/drivers/media/radio/radio-terratec.c
===================================================================
--- linux-2.6.orig/drivers/media/radio/radio-terratec.c
+++ linux-2.6/drivers/media/radio/radio-terratec.c
@@ -338,7 +338,7 @@ static int tt_ioctl(struct inode *inode,
 
 static struct tt_device terratec_unit;
 
-static struct file_operations terratec_fops = {
+static const struct file_operations terratec_fops = {
 	.owner		= THIS_MODULE,
 	.open           = video_exclusive_open,
 	.release        = video_exclusive_release,
Index: linux-2.6/drivers/media/radio/radio-trust.c
===================================================================
--- linux-2.6.orig/drivers/media/radio/radio-trust.c
+++ linux-2.6/drivers/media/radio/radio-trust.c
@@ -325,7 +325,7 @@ static int tr_ioctl(struct inode *inode,
 	return video_usercopy(inode, file, cmd, arg, tr_do_ioctl);
 }
 
-static struct file_operations trust_fops = {
+static const struct file_operations trust_fops = {
 	.owner		= THIS_MODULE,
 	.open           = video_exclusive_open,
 	.release        = video_exclusive_release,
Index: linux-2.6/drivers/media/radio/radio-typhoon.c
===================================================================
--- linux-2.6.orig/drivers/media/radio/radio-typhoon.c
+++ linux-2.6/drivers/media/radio/radio-typhoon.c
@@ -318,7 +318,7 @@ static struct typhoon_device typhoon_uni
 	.mutefreq	= CONFIG_RADIO_TYPHOON_MUTEFREQ,
 };
 
-static struct file_operations typhoon_fops = {
+static const struct file_operations typhoon_fops = {
 	.owner		= THIS_MODULE,
 	.open           = video_exclusive_open,
 	.release        = video_exclusive_release,
Index: linux-2.6/drivers/media/radio/radio-zoltrix.c
===================================================================
--- linux-2.6.orig/drivers/media/radio/radio-zoltrix.c
+++ linux-2.6/drivers/media/radio/radio-zoltrix.c
@@ -373,7 +373,7 @@ static int zol_ioctl(struct inode *inode
 
 static struct zol_device zoltrix_unit;
 
-static struct file_operations zoltrix_fops =
+static const struct file_operations zoltrix_fops =
 {
 	.owner		= THIS_MODULE,
 	.open           = video_exclusive_open,
Index: linux-2.6/drivers/media/video/arv.c
===================================================================
--- linux-2.6.orig/drivers/media/video/arv.c
+++ linux-2.6/drivers/media/video/arv.c
@@ -742,7 +742,7 @@ void ar_release(struct video_device *vfd
  * Video4Linux Module functions
  *
  ****************************************************************************/
-static struct file_operations ar_fops = {
+static const struct file_operations ar_fops = {
 	.owner		= THIS_MODULE,
 	.open		= video_exclusive_open,
 	.release	= video_exclusive_release,
Index: linux-2.6/drivers/media/video/bt8xx/bttv-driver.c
===================================================================
--- linux-2.6.orig/drivers/media/video/bt8xx/bttv-driver.c
+++ linux-2.6/drivers/media/video/bt8xx/bttv-driver.c
@@ -3174,7 +3174,7 @@ bttv_mmap(struct file *file, struct vm_a
 	return videobuf_mmap_mapper(bttv_queue(fh),vma);
 }
 
-static struct file_operations bttv_fops =
+static const struct file_operations bttv_fops =
 {
 	.owner	  = THIS_MODULE,
 	.open	  = bttv_open,
@@ -3332,7 +3332,7 @@ static unsigned int radio_poll(struct fi
 	return cmd.result;
 }
 
-static struct file_operations radio_fops =
+static const struct file_operations radio_fops =
 {
 	.owner	  = THIS_MODULE,
 	.open	  = radio_open,
Index: linux-2.6/drivers/media/video/bw-qcam.c
===================================================================
--- linux-2.6.orig/drivers/media/video/bw-qcam.c
+++ linux-2.6/drivers/media/video/bw-qcam.c
@@ -871,7 +871,7 @@ static ssize_t qcam_read(struct file *fi
 	return len;
 }
 
-static struct file_operations qcam_fops = {
+static const struct file_operations qcam_fops = {
 	.owner		= THIS_MODULE,
 	.open           = video_exclusive_open,
 	.release        = video_exclusive_release,
Index: linux-2.6/drivers/media/video/cafe_ccic.c
===================================================================
--- linux-2.6.orig/drivers/media/video/cafe_ccic.c
+++ linux-2.6/drivers/media/video/cafe_ccic.c
@@ -1715,7 +1715,7 @@ static void cafe_v4l_dev_release(struct 
  * clone it for specific real devices.
  */
 
-static struct file_operations cafe_v4l_fops = {
+static const struct file_operations cafe_v4l_fops = {
 	.owner = THIS_MODULE,
 	.open = cafe_v4l_open,
 	.release = cafe_v4l_release,
@@ -1969,7 +1969,7 @@ static ssize_t cafe_dfs_read_regs(struct
 			s - cafe_debug_buf);
 }
 
-static struct file_operations cafe_dfs_reg_ops = {
+static const struct file_operations cafe_dfs_reg_ops = {
 	.owner = THIS_MODULE,
 	.read = cafe_dfs_read_regs,
 	.open = cafe_dfs_open
@@ -1995,7 +1995,7 @@ static ssize_t cafe_dfs_read_cam(struct 
 			s - cafe_debug_buf);
 }
 
-static struct file_operations cafe_dfs_cam_ops = {
+static const struct file_operations cafe_dfs_cam_ops = {
 	.owner = THIS_MODULE,
 	.read = cafe_dfs_read_cam,
 	.open = cafe_dfs_open
Index: linux-2.6/drivers/media/video/cpia2/cpia2_v4l.c
===================================================================
--- linux-2.6.orig/drivers/media/video/cpia2/cpia2_v4l.c
+++ linux-2.6/drivers/media/video/cpia2/cpia2_v4l.c
@@ -1924,7 +1924,7 @@ static void reset_camera_struct_v4l(stru
 /***
  * The v4l video device structure initialized for this device
  ***/
-static struct file_operations fops_template = {
+static const struct file_operations fops_template = {
 	.owner		= THIS_MODULE,
 	.open		= cpia2_open,
 	.release	= cpia2_close,
Index: linux-2.6/drivers/media/video/cpia.c
===================================================================
--- linux-2.6.orig/drivers/media/video/cpia.c
+++ linux-2.6/drivers/media/video/cpia.c
@@ -3791,7 +3791,7 @@ static int cpia_mmap(struct file *file, 
 	return 0;
 }
 
-static struct file_operations cpia_fops = {
+static const struct file_operations cpia_fops = {
 	.owner		= THIS_MODULE,
 	.open		= cpia_open,
 	.release       	= cpia_close,
Index: linux-2.6/drivers/media/video/c-qcam.c
===================================================================
--- linux-2.6.orig/drivers/media/video/c-qcam.c
+++ linux-2.6/drivers/media/video/c-qcam.c
@@ -684,7 +684,7 @@ static ssize_t qcam_read(struct file *fi
 }
 
 /* video device template */
-static struct file_operations qcam_fops = {
+static const struct file_operations qcam_fops = {
 	.owner		= THIS_MODULE,
 	.open           = video_exclusive_open,
 	.release        = video_exclusive_release,
Index: linux-2.6/drivers/media/video/cx88/cx88-blackbird.c
===================================================================
--- linux-2.6.orig/drivers/media/video/cx88/cx88-blackbird.c
+++ linux-2.6/drivers/media/video/cx88/cx88-blackbird.c
@@ -1051,7 +1051,7 @@ mpeg_mmap(struct file *file, struct vm_a
 	return videobuf_mmap_mapper(&fh->mpegq, vma);
 }
 
-static struct file_operations mpeg_fops =
+static const struct file_operations mpeg_fops =
 {
 	.owner	       = THIS_MODULE,
 	.open	       = mpeg_open,
Index: linux-2.6/drivers/media/video/cx88/cx88-video.c
===================================================================
--- linux-2.6.orig/drivers/media/video/cx88/cx88-video.c
+++ linux-2.6/drivers/media/video/cx88/cx88-video.c
@@ -1808,7 +1808,7 @@ static irqreturn_t cx8800_irq(int irq, v
 /* ----------------------------------------------------------- */
 /* exported stuff                                              */
 
-static struct file_operations video_fops =
+static const struct file_operations video_fops =
 {
 	.owner	       = THIS_MODULE,
 	.open	       = video_open,
@@ -1839,7 +1839,7 @@ static struct video_device cx8800_vbi_te
 	.minor         = -1,
 };
 
-static struct file_operations radio_fops =
+static const struct file_operations radio_fops =
 {
 	.owner         = THIS_MODULE,
 	.open          = video_open,
Index: linux-2.6/drivers/media/video/dabusb.c
===================================================================
--- linux-2.6.orig/drivers/media/video/dabusb.c
+++ linux-2.6/drivers/media/video/dabusb.c
@@ -696,7 +696,7 @@ static int dabusb_ioctl (struct inode *i
 	return ret;
 }
 
-static struct file_operations dabusb_fops =
+static const struct file_operations dabusb_fops =
 {
 	.owner =	THIS_MODULE,
 	.llseek =	no_llseek,
Index: linux-2.6/drivers/media/video/em28xx/em28xx-video.c
===================================================================
--- linux-2.6.orig/drivers/media/video/em28xx/em28xx-video.c
+++ linux-2.6/drivers/media/video/em28xx/em28xx-video.c
@@ -1480,7 +1480,7 @@ static int em28xx_v4l2_ioctl(struct inod
 	return ret;
 }
 
-static struct file_operations em28xx_v4l_fops = {
+static const struct file_operations em28xx_v4l_fops = {
 	.owner = THIS_MODULE,
 	.open = em28xx_v4l2_open,
 	.release = em28xx_v4l2_close,
Index: linux-2.6/drivers/media/video/et61x251/et61x251_core.c
===================================================================
--- linux-2.6.orig/drivers/media/video/et61x251/et61x251_core.c
+++ linux-2.6/drivers/media/video/et61x251/et61x251_core.c
@@ -2454,7 +2454,7 @@ static int et61x251_ioctl(struct inode* 
 }
 
 
-static struct file_operations et61x251_fops = {
+static const struct file_operations et61x251_fops = {
 	.owner = THIS_MODULE,
 	.open =    et61x251_open,
 	.release = et61x251_release,
Index: linux-2.6/drivers/media/video/meye.c
===================================================================
--- linux-2.6.orig/drivers/media/video/meye.c
+++ linux-2.6/drivers/media/video/meye.c
@@ -1748,7 +1748,7 @@ static int meye_mmap(struct file *file, 
 	return 0;
 }
 
-static struct file_operations meye_fops = {
+static const struct file_operations meye_fops = {
 	.owner		= THIS_MODULE,
 	.open		= meye_open,
 	.release	= meye_release,
Index: linux-2.6/drivers/media/video/ov511.c
===================================================================
--- linux-2.6.orig/drivers/media/video/ov511.c
+++ linux-2.6/drivers/media/video/ov511.c
@@ -4653,7 +4653,7 @@ ov51x_v4l1_mmap(struct file *file, struc
 	return 0;
 }
 
-static struct file_operations ov511_fops = {
+static const struct file_operations ov511_fops = {
 	.owner =	THIS_MODULE,
 	.open =		ov51x_v4l1_open,
 	.release =	ov51x_v4l1_close,
Index: linux-2.6/drivers/media/video/pms.c
===================================================================
--- linux-2.6.orig/drivers/media/video/pms.c
+++ linux-2.6/drivers/media/video/pms.c
@@ -881,7 +881,7 @@ static ssize_t pms_read(struct file *fil
 	return len;
 }
 
-static struct file_operations pms_fops = {
+static const struct file_operations pms_fops = {
 	.owner		= THIS_MODULE,
 	.open           = video_exclusive_open,
 	.release        = video_exclusive_release,
Index: linux-2.6/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
===================================================================
--- linux-2.6.orig/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
+++ linux-2.6/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
@@ -986,7 +986,7 @@ static unsigned int pvr2_v4l2_poll(struc
 }
 
 
-static struct file_operations vdev_fops = {
+static const struct file_operations vdev_fops = {
 	.owner      = THIS_MODULE,
 	.open       = pvr2_v4l2_open,
 	.release    = pvr2_v4l2_release,
Index: linux-2.6/drivers/media/video/pwc/pwc-if.c
===================================================================
--- linux-2.6.orig/drivers/media/video/pwc/pwc-if.c
+++ linux-2.6/drivers/media/video/pwc/pwc-if.c
@@ -152,7 +152,7 @@ static int  pwc_video_ioctl(struct inode
 			    unsigned int ioctlnr, unsigned long arg);
 static int  pwc_video_mmap(struct file *file, struct vm_area_struct *vma);
 
-static struct file_operations pwc_fops = {
+static const struct file_operations pwc_fops = {
 	.owner =	THIS_MODULE,
 	.open =		pwc_video_open,
 	.release =     	pwc_video_close,
Index: linux-2.6/drivers/media/video/saa5246a.c
===================================================================
--- linux-2.6.orig/drivers/media/video/saa5246a.c
+++ linux-2.6/drivers/media/video/saa5246a.c
@@ -817,7 +817,7 @@ static void __exit cleanup_saa_5246a (vo
 module_init(init_saa_5246a);
 module_exit(cleanup_saa_5246a);
 
-static struct file_operations saa_fops = {
+static const struct file_operations saa_fops = {
 	.owner	 = THIS_MODULE,
 	.open	 = saa5246a_open,
 	.release = saa5246a_release,
Index: linux-2.6/drivers/media/video/saa5249.c
===================================================================
--- linux-2.6.orig/drivers/media/video/saa5249.c
+++ linux-2.6/drivers/media/video/saa5249.c
@@ -699,7 +699,7 @@ static void __exit cleanup_saa_5249 (voi
 module_init(init_saa_5249);
 module_exit(cleanup_saa_5249);
 
-static struct file_operations saa_fops = {
+static const struct file_operations saa_fops = {
 	.owner		= THIS_MODULE,
 	.open		= saa5249_open,
 	.release       	= saa5249_release,
Index: linux-2.6/drivers/media/video/saa7134/saa7134-empress.c
===================================================================
--- linux-2.6.orig/drivers/media/video/saa7134/saa7134-empress.c
+++ linux-2.6/drivers/media/video/saa7134/saa7134-empress.c
@@ -319,7 +319,7 @@ static int ts_ioctl(struct inode *inode,
 	return video_usercopy(inode, file, cmd, arg, ts_do_ioctl);
 }
 
-static struct file_operations ts_fops =
+static const struct file_operations ts_fops =
 {
 	.owner	  = THIS_MODULE,
 	.open	  = ts_open,
Index: linux-2.6/drivers/media/video/saa7134/saa7134-oss.c
===================================================================
--- linux-2.6.orig/drivers/media/video/saa7134/saa7134-oss.c
+++ linux-2.6/drivers/media/video/saa7134/saa7134-oss.c
@@ -563,7 +563,7 @@ static unsigned int dsp_poll(struct file
 	return mask;
 }
 
-struct file_operations saa7134_dsp_fops = {
+const struct file_operations saa7134_dsp_fops = {
 	.owner   = THIS_MODULE,
 	.open    = dsp_open,
 	.release = dsp_release,
@@ -804,7 +804,7 @@ static int mixer_ioctl(struct inode *ino
 	}
 }
 
-struct file_operations saa7134_mixer_fops = {
+const struct file_operations saa7134_mixer_fops = {
 	.owner   = THIS_MODULE,
 	.open    = mixer_open,
 	.release = mixer_release,
Index: linux-2.6/drivers/media/video/saa7134/saa7134-video.c
===================================================================
--- linux-2.6.orig/drivers/media/video/saa7134/saa7134-video.c
+++ linux-2.6/drivers/media/video/saa7134/saa7134-video.c
@@ -2336,7 +2336,7 @@ static int radio_ioctl(struct inode *ino
 	return video_usercopy(inode, file, cmd, arg, radio_do_ioctl);
 }
 
-static struct file_operations video_fops =
+static const struct file_operations video_fops =
 {
 	.owner	  = THIS_MODULE,
 	.open	  = video_open,
@@ -2349,7 +2349,7 @@ static struct file_operations video_fops
 	.llseek   = no_llseek,
 };
 
-static struct file_operations radio_fops =
+static const struct file_operations radio_fops =
 {
 	.owner	  = THIS_MODULE,
 	.open	  = video_open,
Index: linux-2.6/drivers/media/video/se401.c
===================================================================
--- linux-2.6.orig/drivers/media/video/se401.c
+++ linux-2.6/drivers/media/video/se401.c
@@ -1185,7 +1185,7 @@ static int se401_mmap(struct file *file,
 	return 0;
 }
 
-static struct file_operations se401_fops = {
+static const struct file_operations se401_fops = {
 	.owner =	THIS_MODULE,
 	.open =         se401_open,
 	.release =      se401_close,
Index: linux-2.6/drivers/media/video/sn9c102/sn9c102_core.c
===================================================================
--- linux-2.6.orig/drivers/media/video/sn9c102/sn9c102_core.c
+++ linux-2.6/drivers/media/video/sn9c102/sn9c102_core.c
@@ -2736,7 +2736,7 @@ static int sn9c102_ioctl(struct inode* i
 
 /*****************************************************************************/
 
-static struct file_operations sn9c102_fops = {
+static const struct file_operations sn9c102_fops = {
 	.owner = THIS_MODULE,
 	.open =    sn9c102_open,
 	.release = sn9c102_release,
Index: linux-2.6/drivers/media/video/stradis.c
===================================================================
--- linux-2.6.orig/drivers/media/video/stradis.c
+++ linux-2.6/drivers/media/video/stradis.c
@@ -1901,7 +1901,7 @@ static int saa_release(struct inode *ino
 	return 0;
 }
 
-static struct file_operations saa_fops = {
+static const struct file_operations saa_fops = {
 	.owner = THIS_MODULE,
 	.open = saa_open,
 	.release = saa_release,
Index: linux-2.6/drivers/media/video/stv680.c
===================================================================
--- linux-2.6.orig/drivers/media/video/stv680.c
+++ linux-2.6/drivers/media/video/stv680.c
@@ -1380,7 +1380,7 @@ static ssize_t stv680_read (struct file 
 	return realcount;
 }				/* stv680_read */
 
-static struct file_operations stv680_fops = {
+static const struct file_operations stv680_fops = {
 	.owner =	THIS_MODULE,
 	.open =		stv_open,
 	.release =     	stv_close,
Index: linux-2.6/drivers/media/video/tvmixer.c
===================================================================
--- linux-2.6.orig/drivers/media/video/tvmixer.c
+++ linux-2.6/drivers/media/video/tvmixer.c
@@ -228,7 +228,7 @@ static struct i2c_driver driver = {
 	.detach_client   = tvmixer_clients,
 };
 
-static struct file_operations tvmixer_fops = {
+static const struct file_operations tvmixer_fops = {
 	.owner		= THIS_MODULE,
 	.llseek         = no_llseek,
 	.ioctl          = tvmixer_ioctl,
Index: linux-2.6/drivers/media/video/usbvideo/usbvideo.c
===================================================================
--- linux-2.6.orig/drivers/media/video/usbvideo/usbvideo.c
+++ linux-2.6/drivers/media/video/usbvideo/usbvideo.c
@@ -945,7 +945,7 @@ static int usbvideo_find_struct(struct u
 	return rv;
 }
 
-static struct file_operations usbvideo_fops = {
+static const struct file_operations usbvideo_fops = {
 	.owner =  THIS_MODULE,
 	.open =   usbvideo_v4l_open,
 	.release =usbvideo_v4l_close,
Index: linux-2.6/drivers/media/video/usbvideo/vicam.c
===================================================================
--- linux-2.6.orig/drivers/media/video/usbvideo/vicam.c
+++ linux-2.6/drivers/media/video/usbvideo/vicam.c
@@ -1234,7 +1234,7 @@ static inline void vicam_create_proc_ent
 static inline void vicam_destroy_proc_entry(void *ptr) { }
 #endif
 
-static struct file_operations vicam_fops = {
+static const struct file_operations vicam_fops = {
 	.owner		= THIS_MODULE,
 	.open		= vicam_open,
 	.release	= vicam_close,
Index: linux-2.6/drivers/media/video/usbvision/usbvision-video.c
===================================================================
--- linux-2.6.orig/drivers/media/video/usbvision/usbvision-video.c
+++ linux-2.6/drivers/media/video/usbvision/usbvision-video.c
@@ -1476,7 +1476,7 @@ static int usbvision_vbi_ioctl(struct in
 //
 
 // Video template
-static struct file_operations usbvision_fops = {
+static const struct file_operations usbvision_fops = {
 	.owner             = THIS_MODULE,
 	.open		= usbvision_v4l2_open,
 	.release	= usbvision_v4l2_close,
@@ -1497,7 +1497,7 @@ static struct video_device usbvision_vid
 
 
 // Radio template
-static struct file_operations usbvision_radio_fops = {
+static const struct file_operations usbvision_radio_fops = {
 	.owner             = THIS_MODULE,
 	.open		= usbvision_radio_open,
 	.release	= usbvision_radio_close,
@@ -1518,7 +1518,7 @@ static struct video_device usbvision_rad
 
 
 // vbi template
-static struct file_operations usbvision_vbi_fops = {
+static const struct file_operations usbvision_vbi_fops = {
 	.owner             = THIS_MODULE,
 	.open		= usbvision_vbi_open,
 	.release	= usbvision_vbi_close,
Index: linux-2.6/drivers/media/video/videodev.c
===================================================================
--- linux-2.6.orig/drivers/media/video/videodev.c
+++ linux-2.6/drivers/media/video/videodev.c
@@ -1561,7 +1561,7 @@ out:
 }
 
 
-static struct file_operations video_fops;
+static const struct file_operations video_fops;
 
 /**
  *	video_register_device - register video4linux devices
@@ -1709,7 +1709,7 @@ void video_unregister_device(struct vide
 /*
  * Video fs operations
  */
-static struct file_operations video_fops=
+static const struct file_operations video_fops=
 {
 	.owner		= THIS_MODULE,
 	.llseek		= no_llseek,
Index: linux-2.6/drivers/media/video/vino.c
===================================================================
--- linux-2.6.orig/drivers/media/video/vino.c
+++ linux-2.6/drivers/media/video/vino.c
@@ -4390,7 +4390,7 @@ static int vino_ioctl(struct inode *inod
 // __initdata
 static int vino_init_stage = 0;
 
-static struct file_operations vino_fops = {
+static const struct file_operations vino_fops = {
 	.owner		= THIS_MODULE,
 	.open		= vino_open,
 	.release	= vino_close,
Index: linux-2.6/drivers/media/video/vivi.c
===================================================================
--- linux-2.6.orig/drivers/media/video/vivi.c
+++ linux-2.6/drivers/media/video/vivi.c
@@ -1285,7 +1285,7 @@ vivi_mmap(struct file *file, struct vm_a
 	return ret;
 }
 
-static struct file_operations vivi_fops = {
+static const struct file_operations vivi_fops = {
 	.owner		= THIS_MODULE,
 	.open           = vivi_open,
 	.release        = vivi_release,
Index: linux-2.6/drivers/media/video/w9966.c
===================================================================
--- linux-2.6.orig/drivers/media/video/w9966.c
+++ linux-2.6/drivers/media/video/w9966.c
@@ -183,7 +183,7 @@ static int w9966_v4l_ioctl(struct inode 
 static ssize_t w9966_v4l_read(struct file *file, char __user *buf,
 			      size_t count, loff_t *ppos);
 
-static struct file_operations w9966_fops = {
+static const struct file_operations w9966_fops = {
 	.owner		= THIS_MODULE,
 	.open           = video_exclusive_open,
 	.release        = video_exclusive_release,
Index: linux-2.6/drivers/media/video/w9968cf.c
===================================================================
--- linux-2.6.orig/drivers/media/video/w9968cf.c
+++ linux-2.6/drivers/media/video/w9968cf.c
@@ -399,7 +399,7 @@ MODULE_PARM_DESC(specific_debug,
  ****************************************************************************/
 
 /* Video4linux interface */
-static struct file_operations w9968cf_fops;
+static const struct file_operations w9968cf_fops;
 static int w9968cf_open(struct inode*, struct file*);
 static int w9968cf_release(struct inode*, struct file*);
 static int w9968cf_mmap(struct file*, struct vm_area_struct*);
@@ -3466,7 +3466,7 @@ ioctl_fail:
 }
 
 
-static struct file_operations w9968cf_fops = {
+static const struct file_operations w9968cf_fops = {
 	.owner =   THIS_MODULE,
 	.open =    w9968cf_open,
 	.release = w9968cf_release,
Index: linux-2.6/drivers/media/video/zc0301/zc0301_core.c
===================================================================
--- linux-2.6.orig/drivers/media/video/zc0301/zc0301_core.c
+++ linux-2.6/drivers/media/video/zc0301/zc0301_core.c
@@ -1871,7 +1871,7 @@ static int zc0301_ioctl(struct inode* in
 }
 
 
-static struct file_operations zc0301_fops = {
+static const struct file_operations zc0301_fops = {
 	.owner =   THIS_MODULE,
 	.open =    zc0301_open,
 	.release = zc0301_release,
Index: linux-2.6/drivers/media/video/zoran_driver.c
===================================================================
--- linux-2.6.orig/drivers/media/video/zoran_driver.c
+++ linux-2.6/drivers/media/video/zoran_driver.c
@@ -4680,7 +4680,7 @@ zoran_mmap (struct file           *file,
 	return 0;
 }
 
-static struct file_operations zoran_fops = {
+static const struct file_operations zoran_fops = {
 	.owner = THIS_MODULE,
 	.open = zoran_open,
 	.release = zoran_close,
Index: linux-2.6/drivers/media/video/zoran_procfs.c
===================================================================
--- linux-2.6.orig/drivers/media/video/zoran_procfs.c
+++ linux-2.6/drivers/media/video/zoran_procfs.c
@@ -186,7 +186,7 @@ static ssize_t zoran_write(struct file *
 	return count;
 }
 
-static struct file_operations zoran_operations = {
+static const struct file_operations zoran_operations = {
 	.open		= zoran_open,
 	.read		= seq_read,
 	.write		= zoran_write,
Index: linux-2.6/drivers/message/fusion/mptctl.c
===================================================================
--- linux-2.6.orig/drivers/message/fusion/mptctl.c
+++ linux-2.6/drivers/message/fusion/mptctl.c
@@ -2718,7 +2718,7 @@ mptctl_hp_targetinfo(unsigned long arg)
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 
-static struct file_operations mptctl_fops = {
+static const struct file_operations mptctl_fops = {
 	.owner =	THIS_MODULE,
 	.llseek =	no_llseek,
 	.release =	mptctl_release,



^ permalink raw reply	[flat|nested] 17+ messages in thread

* [patch 05/12] mark struct file_operations const 5
  2007-01-14  0:51 Patch series to mark struct file_operations and struct inode_operations const Arjan van de Ven
                   ` (4 preceding siblings ...)
  2007-01-14  0:54 ` [patch 04/12] mark struct file_operations const 4 Arjan van de Ven
@ 2007-01-14  0:54 ` Arjan van de Ven
  2007-01-14  0:55 ` [patch 06/12] mark struct file_operations const 6 Arjan van de Ven
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Arjan van de Ven @ 2007-01-14  0:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm

From: Arjan van de Ven <arjan@linux.intel.com>
Subject: [patch 05/12] mark struct file_operations const

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>

Index: linux-2.6/drivers/message/i2o/i2o_config.c
===================================================================
--- linux-2.6.orig/drivers/message/i2o/i2o_config.c
+++ linux-2.6/drivers/message/i2o/i2o_config.c
@@ -1111,7 +1111,7 @@ static int cfg_release(struct inode *ino
 	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,
Index: linux-2.6/drivers/message/i2o/i2o_proc.c
===================================================================
--- linux-2.6.orig/drivers/message/i2o/i2o_proc.c
+++ linux-2.6/drivers/message/i2o/i2o_proc.c
@@ -1703,133 +1703,133 @@ static int i2o_seq_open_dev_name(struct 
 	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,
Index: linux-2.6/drivers/misc/hdpuftrs/hdpu_cpustate.c
===================================================================
--- linux-2.6.orig/drivers/misc/hdpuftrs/hdpu_cpustate.c
+++ linux-2.6/drivers/misc/hdpuftrs/hdpu_cpustate.c
@@ -169,7 +169,7 @@ static struct platform_driver hdpu_cpust
 /*
  *	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,
Index: linux-2.6/drivers/misc/ibmasm/ibmasmfs.c
===================================================================
--- linux-2.6.orig/drivers/misc/ibmasm/ibmasmfs.c
+++ linux-2.6/drivers/misc/ibmasm/ibmasmfs.c
@@ -156,7 +156,7 @@ static struct inode *ibmasmfs_make_inode
 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_writ
 	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,
Index: linux-2.6/drivers/mtd/mtdchar.c
===================================================================
--- linux-2.6.orig/drivers/mtd/mtdchar.c
+++ linux-2.6/drivers/mtd/mtdchar.c
@@ -760,7 +760,7 @@ static int mtd_ioctl(struct inode *inode
 	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,
Index: linux-2.6/drivers/net/bonding/bond_main.c
===================================================================
--- linux-2.6.orig/drivers/net/bonding/bond_main.c
+++ linux-2.6/drivers/net/bonding/bond_main.c
@@ -3122,7 +3122,7 @@ static int bond_info_open(struct inode *
 	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,
Index: linux-2.6/drivers/net/hamradio/bpqether.c
===================================================================
--- linux-2.6.orig/drivers/net/hamradio/bpqether.c
+++ linux-2.6/drivers/net/hamradio/bpqether.c
@@ -459,7 +459,7 @@ static int bpq_info_open(struct inode *i
 	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,
Index: linux-2.6/drivers/net/hamradio/scc.c
===================================================================
--- linux-2.6.orig/drivers/net/hamradio/scc.c
+++ linux-2.6/drivers/net/hamradio/scc.c
@@ -2083,7 +2083,7 @@ static int scc_net_seq_open(struct inode
 	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,
Index: linux-2.6/drivers/net/hamradio/yam.c
===================================================================
--- linux-2.6.orig/drivers/net/hamradio/yam.c
+++ linux-2.6/drivers/net/hamradio/yam.c
@@ -804,7 +804,7 @@ static int yam_info_open(struct inode *i
 	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,
Index: linux-2.6/drivers/net/ibmveth.c
===================================================================
--- linux-2.6.orig/drivers/net/ibmveth.c
+++ linux-2.6/drivers/net/ibmveth.c
@@ -1156,7 +1156,7 @@ static int ibmveth_proc_open(struct inod
 	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,
Index: linux-2.6/drivers/net/irda/vlsi_ir.c
===================================================================
--- linux-2.6.orig/drivers/net/irda/vlsi_ir.c
+++ linux-2.6/drivers/net/irda/vlsi_ir.c
@@ -385,7 +385,7 @@ static int vlsi_seq_open(struct inode *i
 	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,
Index: linux-2.6/drivers/net/ppp_generic.c
===================================================================
--- linux-2.6.orig/drivers/net/ppp_generic.c
+++ linux-2.6/drivers/net/ppp_generic.c
@@ -834,7 +834,7 @@ static int ppp_unattached_ioctl(struct p
 	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,
Index: linux-2.6/drivers/net/pppoe.c
===================================================================
--- linux-2.6.orig/drivers/net/pppoe.c
+++ linux-2.6/drivers/net/pppoe.c
@@ -1043,7 +1043,7 @@ static int pppoe_seq_open(struct inode *
 	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,
Index: linux-2.6/drivers/net/tun.c
===================================================================
--- linux-2.6.orig/drivers/net/tun.c
+++ linux-2.6/drivers/net/tun.c
@@ -744,7 +744,7 @@ static int tun_chr_close(struct inode *i
 	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,
Index: linux-2.6/drivers/net/wan/cosa.c
===================================================================
--- linux-2.6.orig/drivers/net/wan/cosa.c
+++ linux-2.6/drivers/net/wan/cosa.c
@@ -311,7 +311,7 @@ static int cosa_chardev_ioctl(struct ino
 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,
Index: linux-2.6/drivers/net/wireless/airo.c
===================================================================
--- linux-2.6.orig/drivers/net/wireless/airo.c
+++ linux-2.6/drivers/net/wireless/airo.c
@@ -4430,53 +4430,53 @@ static int proc_BSSList_open( struct ino
 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,
Index: linux-2.6/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c
===================================================================
--- linux-2.6.orig/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c
+++ linux-2.6/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c
@@ -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,
 };
Index: linux-2.6/drivers/net/wireless/strip.c
===================================================================
--- linux-2.6.orig/drivers/net/wireless/strip.c
+++ linux-2.6/drivers/net/wireless/strip.c
@@ -1160,7 +1160,7 @@ static int strip_seq_open(struct inode *
 	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,
Index: linux-2.6/drivers/oprofile/event_buffer.c
===================================================================
--- linux-2.6.orig/drivers/oprofile/event_buffer.c
+++ linux-2.6/drivers/oprofile/event_buffer.c
@@ -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,
Index: linux-2.6/drivers/oprofile/event_buffer.h
===================================================================
--- linux-2.6.orig/drivers/oprofile/event_buffer.h
+++ linux-2.6/drivers/oprofile/event_buffer.h
@@ -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.
Index: linux-2.6/drivers/oprofile/oprofile_files.c
===================================================================
--- linux-2.6.orig/drivers/oprofile/oprofile_files.c
+++ linux-2.6/drivers/oprofile/oprofile_files.c
@@ -44,7 +44,7 @@ static ssize_t depth_write(struct file *
 }
 
 
-static struct file_operations depth_fops = {
+static const struct file_operations depth_fops = {
 	.read		= depth_read,
 	.write		= depth_write
 };
@@ -56,7 +56,7 @@ static ssize_t pointer_size_read(struct 
 }
 
 
-static struct file_operations pointer_size_fops = {
+static const struct file_operations pointer_size_fops = {
 	.read		= pointer_size_read,
 };
 
@@ -67,7 +67,7 @@ static ssize_t cpu_type_read(struct file
 }
  
  
-static struct file_operations cpu_type_fops = {
+static const struct file_operations cpu_type_fops = {
 	.read		= cpu_type_read,
 };
  
@@ -101,7 +101,7 @@ static ssize_t enable_write(struct file 
 }
 
  
-static struct file_operations enable_fops = {
+static const struct file_operations enable_fops = {
 	.read		= enable_read,
 	.write		= enable_write,
 };
@@ -114,7 +114,7 @@ static ssize_t dump_write(struct file * 
 }
 
 
-static struct file_operations dump_fops = {
+static const struct file_operations dump_fops = {
 	.write		= dump_write,
 };
  
Index: linux-2.6/drivers/oprofile/oprofilefs.c
===================================================================
--- linux-2.6.orig/drivers/oprofile/oprofilefs.c
+++ linux-2.6/drivers/oprofile/oprofilefs.c
@@ -115,14 +115,14 @@ static int default_open(struct inode * i
 }
 
 
-static struct file_operations ulong_fops = {
+static const struct file_operations ulong_fops = {
 	.read		= ulong_read_file,
 	.write		= ulong_write_file,
 	.open		= default_open,
 };
 
 
-static struct file_operations ulong_ro_fops = {
+static const struct file_operations ulong_ro_fops = {
 	.read		= ulong_read_file,
 	.open		= default_open,
 };
@@ -182,7 +182,7 @@ static ssize_t atomic_read_file(struct f
 }
  
 
-static struct file_operations atomic_ro_fops = {
+static const struct file_operations atomic_ro_fops = {
 	.read		= atomic_read_file,
 	.open		= default_open,
 };
Index: linux-2.6/drivers/parisc/ccio-dma.c
===================================================================
--- linux-2.6.orig/drivers/parisc/ccio-dma.c
+++ linux-2.6/drivers/parisc/ccio-dma.c
@@ -1091,7 +1091,7 @@ static int ccio_proc_info_open(struct in
 	return single_open(file, &ccio_proc_info, NULL);
 }
 
-static struct file_operations ccio_proc_info_fops = {
+static const struct file_operations ccio_proc_info_fops = {
 	.owner = THIS_MODULE,
 	.open = ccio_proc_info_open,
 	.read = seq_read,
@@ -1127,7 +1127,7 @@ static int ccio_proc_bitmap_open(struct 
 	return single_open(file, &ccio_proc_bitmap_info, NULL);
 }
 
-static struct file_operations ccio_proc_bitmap_fops = {
+static const struct file_operations ccio_proc_bitmap_fops = {
 	.owner = THIS_MODULE,
 	.open = ccio_proc_bitmap_open,
 	.read = seq_read,
Index: linux-2.6/drivers/parisc/eisa_eeprom.c
===================================================================
--- linux-2.6.orig/drivers/parisc/eisa_eeprom.c
+++ linux-2.6/drivers/parisc/eisa_eeprom.c
@@ -97,7 +97,7 @@ static int eisa_eeprom_release(struct in
 /*
  *	The various file operations we support.
  */
-static struct file_operations eisa_eeprom_fops = {
+static const struct file_operations eisa_eeprom_fops = {
 	.owner =	THIS_MODULE,
 	.llseek =	eisa_eeprom_llseek,
 	.read =		eisa_eeprom_read,
Index: linux-2.6/drivers/parisc/sba_iommu.c
===================================================================
--- linux-2.6.orig/drivers/parisc/sba_iommu.c
+++ linux-2.6/drivers/parisc/sba_iommu.c
@@ -1799,7 +1799,7 @@ sba_proc_open(struct inode *i, struct fi
 	return single_open(f, &sba_proc_info, NULL);
 }
 
-static struct file_operations sba_proc_fops = {
+static const struct file_operations sba_proc_fops = {
 	.owner = THIS_MODULE,
 	.open = sba_proc_open,
 	.read = seq_read,
@@ -1831,7 +1831,7 @@ sba_proc_bitmap_open(struct inode *i, st
 	return single_open(f, &sba_proc_bitmap_info, NULL);
 }
 
-static struct file_operations sba_proc_bitmap_fops = {
+static const struct file_operations sba_proc_bitmap_fops = {
 	.owner = THIS_MODULE,
 	.open = sba_proc_bitmap_open,
 	.read = seq_read,
Index: linux-2.6/drivers/pci/hotplug/cpqphp_sysfs.c
===================================================================
--- linux-2.6.orig/drivers/pci/hotplug/cpqphp_sysfs.c
+++ linux-2.6/drivers/pci/hotplug/cpqphp_sysfs.c
@@ -202,7 +202,7 @@ static int release(struct inode *inode, 
 	return 0;
 }
 
-static struct file_operations debug_ops = {
+static const struct file_operations debug_ops = {
 	.owner = THIS_MODULE,
 	.open = open,
 	.llseek = lseek,
Index: linux-2.6/drivers/pci/proc.c
===================================================================
--- linux-2.6.orig/drivers/pci/proc.c
+++ linux-2.6/drivers/pci/proc.c
@@ -287,7 +287,7 @@ static int proc_bus_pci_release(struct i
 }
 #endif /* HAVE_PCI_MMAP */
 
-static struct file_operations proc_bus_pci_operations = {
+static const struct file_operations proc_bus_pci_operations = {
 	.llseek		= proc_bus_pci_lseek,
 	.read		= proc_bus_pci_read,
 	.write		= proc_bus_pci_write,
@@ -456,7 +456,7 @@ static int proc_bus_pci_dev_open(struct 
 {
 	return seq_open(file, &proc_bus_pci_devices_op);
 }
-static struct file_operations proc_bus_pci_dev_operations = {
+static const struct file_operations proc_bus_pci_dev_operations = {
 	.open		= proc_bus_pci_dev_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
Index: linux-2.6/drivers/pcmcia/pcmcia_ioctl.c
===================================================================
--- linux-2.6.orig/drivers/pcmcia/pcmcia_ioctl.c
+++ linux-2.6/drivers/pcmcia/pcmcia_ioctl.c
@@ -766,7 +766,7 @@ free_out:
 
 /*====================================================================*/
 
-static struct file_operations ds_fops = {
+static const struct file_operations ds_fops = {
 	.owner		= THIS_MODULE,
 	.open		= ds_open,
 	.release	= ds_release,
Index: linux-2.6/drivers/pnp/isapnp/proc.c
===================================================================
--- linux-2.6.orig/drivers/pnp/isapnp/proc.c
+++ linux-2.6/drivers/pnp/isapnp/proc.c
@@ -85,7 +85,7 @@ static ssize_t isapnp_proc_bus_read(stru
 	return nbytes;
 }
 
-static struct file_operations isapnp_proc_bus_file_operations =
+static const struct file_operations isapnp_proc_bus_file_operations =
 {
 	.llseek		= isapnp_proc_bus_lseek,
 	.read		= isapnp_proc_bus_read,
Index: linux-2.6/drivers/rtc/rtc-dev.c
===================================================================
--- linux-2.6.orig/drivers/rtc/rtc-dev.c
+++ linux-2.6/drivers/rtc/rtc-dev.c
@@ -384,7 +384,7 @@ static int rtc_dev_fasync(int fd, struct
 	return fasync_helper(fd, file, on, &rtc->async_queue);
 }
 
-static struct file_operations rtc_dev_fops = {
+static const struct file_operations rtc_dev_fops = {
 	.owner		= THIS_MODULE,
 	.llseek		= no_llseek,
 	.read		= rtc_dev_read,
Index: linux-2.6/drivers/rtc/rtc-proc.c
===================================================================
--- linux-2.6.orig/drivers/rtc/rtc-proc.c
+++ linux-2.6/drivers/rtc/rtc-proc.c
@@ -96,7 +96,7 @@ static int rtc_proc_release(struct inode
 	return res;
 }
 
-static struct file_operations rtc_proc_fops = {
+static const struct file_operations rtc_proc_fops = {
 	.open		= rtc_proc_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
Index: linux-2.6/drivers/s390/block/dasd_eer.c
===================================================================
--- linux-2.6.orig/drivers/s390/block/dasd_eer.c
+++ linux-2.6/drivers/s390/block/dasd_eer.c
@@ -650,7 +650,7 @@ static unsigned int dasd_eer_poll(struct
 	return mask;
 }
 
-static struct file_operations dasd_eer_fops = {
+static const struct file_operations dasd_eer_fops = {
 	.open		= &dasd_eer_open,
 	.release	= &dasd_eer_close,
 	.read		= &dasd_eer_read,
Index: linux-2.6/drivers/s390/block/dasd_proc.c
===================================================================
--- linux-2.6.orig/drivers/s390/block/dasd_proc.c
+++ linux-2.6/drivers/s390/block/dasd_proc.c
@@ -147,7 +147,7 @@ static int dasd_devices_open(struct inod
 	return seq_open(file, &dasd_devices_seq_ops);
 }
 
-static struct file_operations dasd_devices_file_ops = {
+static const struct file_operations dasd_devices_file_ops = {
 	.open		= dasd_devices_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
Index: linux-2.6/drivers/s390/char/fs3270.c
===================================================================
--- linux-2.6.orig/drivers/s390/char/fs3270.c
+++ linux-2.6/drivers/s390/char/fs3270.c
@@ -493,7 +493,7 @@ fs3270_close(struct inode *inode, struct
 	return 0;
 }
 
-static struct file_operations fs3270_fops = {
+static const struct file_operations fs3270_fops = {
 	.owner		 = THIS_MODULE,		/* owner */
 	.read		 = fs3270_read,		/* read */
 	.write		 = fs3270_write,	/* write */
Index: linux-2.6/drivers/s390/char/monreader.c
===================================================================
--- linux-2.6.orig/drivers/s390/char/monreader.c
+++ linux-2.6/drivers/s390/char/monreader.c
@@ -576,7 +576,7 @@ mon_poll(struct file *filp, struct poll_
 	return 0;
 }
 
-static struct file_operations mon_fops = {
+static const struct file_operations mon_fops = {
 	.owner   = THIS_MODULE,
 	.open    = &mon_open,
 	.release = &mon_close,
Index: linux-2.6/drivers/s390/char/monwriter.c
===================================================================
--- linux-2.6.orig/drivers/s390/char/monwriter.c
+++ linux-2.6/drivers/s390/char/monwriter.c
@@ -255,7 +255,7 @@ out_error:
 	return rc;
 }
 
-static struct file_operations monwrite_fops = {
+static const struct file_operations monwrite_fops = {
 	.owner	 = THIS_MODULE,
 	.open	 = &monwrite_open,
 	.release = &monwrite_close,
Index: linux-2.6/drivers/s390/char/tape_char.c
===================================================================
--- linux-2.6.orig/drivers/s390/char/tape_char.c
+++ linux-2.6/drivers/s390/char/tape_char.c
@@ -39,7 +39,7 @@ static int tapechar_ioctl(struct inode *
 static long tapechar_compat_ioctl(struct file *, unsigned int,
 			  unsigned long);
 
-static struct file_operations tape_fops =
+static const struct file_operations tape_fops =
 {
 	.owner = THIS_MODULE,
 	.read = tapechar_read,
Index: linux-2.6/drivers/s390/char/tape_proc.c
===================================================================
--- linux-2.6.orig/drivers/s390/char/tape_proc.c
+++ linux-2.6/drivers/s390/char/tape_proc.c
@@ -109,7 +109,7 @@ static int tape_proc_open(struct inode *
 	return seq_open(file, &tape_proc_seq);
 }
 
-static struct file_operations tape_proc_ops =
+static const struct file_operations tape_proc_ops =
 {
 	.open		= tape_proc_open,
 	.read		= seq_read,
Index: linux-2.6/drivers/s390/char/vmcp.c
===================================================================
--- linux-2.6.orig/drivers/s390/char/vmcp.c
+++ linux-2.6/drivers/s390/char/vmcp.c
@@ -173,7 +173,7 @@ static long vmcp_ioctl(struct file *file
 	}
 }
 
-static struct file_operations vmcp_fops = {
+static const struct file_operations vmcp_fops = {
 	.owner		= THIS_MODULE,
 	.open		= &vmcp_open,
 	.release	= &vmcp_release,
Index: linux-2.6/drivers/s390/char/vmlogrdr.c
===================================================================
--- linux-2.6.orig/drivers/s390/char/vmlogrdr.c
+++ linux-2.6/drivers/s390/char/vmlogrdr.c
@@ -89,7 +89,7 @@ static int vmlogrdr_release(struct inode
 static ssize_t vmlogrdr_read (struct file *filp, char __user *data,
 			      size_t count, loff_t * ppos);
 
-static struct file_operations vmlogrdr_fops = {
+static const struct file_operations vmlogrdr_fops = {
 	.owner   = THIS_MODULE,
 	.open    = vmlogrdr_open,
 	.release = vmlogrdr_release,
Index: linux-2.6/drivers/s390/char/vmwatchdog.c
===================================================================
--- linux-2.6.orig/drivers/s390/char/vmwatchdog.c
+++ linux-2.6/drivers/s390/char/vmwatchdog.c
@@ -228,7 +228,7 @@ static ssize_t vmwdt_write(struct file *
 	return count;
 }
 
-static struct file_operations vmwdt_fops = {
+static const struct file_operations vmwdt_fops = {
 	.open    = &vmwdt_open,
 	.release = &vmwdt_close,
 	.ioctl   = &vmwdt_ioctl,
Index: linux-2.6/drivers/s390/cio/blacklist.c
===================================================================
--- linux-2.6.orig/drivers/s390/cio/blacklist.c
+++ linux-2.6/drivers/s390/cio/blacklist.c
@@ -364,7 +364,7 @@ cio_ignore_proc_open(struct inode *inode
 	return seq_open(file, &cio_ignore_proc_seq_ops);
 }
 
-static struct file_operations cio_ignore_proc_fops = {
+static const struct file_operations cio_ignore_proc_fops = {
 	.open    = cio_ignore_proc_open,
 	.read    = seq_read,
 	.llseek  = seq_lseek,
Index: linux-2.6/drivers/s390/crypto/zcrypt_api.c
===================================================================
--- linux-2.6.orig/drivers/s390/crypto/zcrypt_api.c
+++ linux-2.6/drivers/s390/crypto/zcrypt_api.c
@@ -807,7 +807,7 @@ long zcrypt_compat_ioctl(struct file *fi
 /**
  * Misc device file operations.
  */
-static struct file_operations zcrypt_fops = {
+static const struct file_operations zcrypt_fops = {
 	.owner		= THIS_MODULE,
 	.read		= zcrypt_read,
 	.write		= zcrypt_write,
Index: linux-2.6/drivers/s390/net/qeth_proc.c
===================================================================
--- linux-2.6.orig/drivers/s390/net/qeth_proc.c
+++ linux-2.6/drivers/s390/net/qeth_proc.c
@@ -161,7 +161,7 @@ qeth_procfile_open(struct inode *inode, 
 	return seq_open(file, &qeth_procfile_seq_ops);
 }
 
-static struct file_operations qeth_procfile_fops = {
+static const struct file_operations qeth_procfile_fops = {
 	.owner   = THIS_MODULE,
 	.open    = qeth_procfile_open,
 	.read    = seq_read,
@@ -273,7 +273,7 @@ qeth_perf_procfile_open(struct inode *in
 	return seq_open(file, &qeth_perf_procfile_seq_ops);
 }
 
-static struct file_operations qeth_perf_procfile_fops = {
+static const struct file_operations qeth_perf_procfile_fops = {
 	.owner   = THIS_MODULE,
 	.open    = qeth_perf_procfile_open,
 	.read    = seq_read,
Index: linux-2.6/drivers/s390/scsi/zfcp_aux.c
===================================================================
--- linux-2.6.orig/drivers/s390/scsi/zfcp_aux.c
+++ linux-2.6/drivers/s390/scsi/zfcp_aux.c
@@ -61,7 +61,7 @@ static long zfcp_cfdc_dev_ioctl(struct f
 	_IOWR(ZFCP_CFDC_IOC_MAGIC, 0, struct zfcp_cfdc_sense_data)
 
 
-static struct file_operations zfcp_cfdc_fops = {
+static const struct file_operations zfcp_cfdc_fops = {
 	.unlocked_ioctl = zfcp_cfdc_dev_ioctl,
 #ifdef CONFIG_COMPAT
 	.compat_ioctl = zfcp_cfdc_dev_ioctl



^ permalink raw reply	[flat|nested] 17+ messages in thread

* [patch 06/12] mark struct file_operations const 6
  2007-01-14  0:51 Patch series to mark struct file_operations and struct inode_operations const Arjan van de Ven
                   ` (5 preceding siblings ...)
  2007-01-14  0:54 ` [patch 05/12] mark struct file_operations const 5 Arjan van de Ven
@ 2007-01-14  0:55 ` Arjan van de Ven
  2007-01-14  0:56 ` [patch 07/12] mark struct file_operations const 7 Arjan van de Ven
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Arjan van de Ven @ 2007-01-14  0:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm

From: Arjan van de Ven <arjan@linux.intel.com>
Subject: [patch 06/12] mark struct file_operations const

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>

Index: linux-2.6/drivers/sbus/char/bpp.c
===================================================================
--- linux-2.6.orig/drivers/sbus/char/bpp.c
+++ linux-2.6/drivers/sbus/char/bpp.c
@@ -846,7 +846,7 @@ static int bpp_ioctl(struct inode *inode
       return errno;
 }
 
-static struct file_operations bpp_fops = {
+static const struct file_operations bpp_fops = {
 	.owner =	THIS_MODULE,
 	.read =		bpp_read,
 	.write =	bpp_write,
Index: linux-2.6/drivers/sbus/char/cpwatchdog.c
===================================================================
--- linux-2.6.orig/drivers/sbus/char/cpwatchdog.c
+++ linux-2.6/drivers/sbus/char/cpwatchdog.c
@@ -459,7 +459,7 @@ static irqreturn_t wd_interrupt(int irq,
 	return IRQ_HANDLED;
 }
 
-static struct file_operations wd_fops = {
+static const struct file_operations wd_fops = {
 	.owner =	THIS_MODULE,
 	.ioctl =	wd_ioctl,
 	.compat_ioctl =	wd_compat_ioctl,
Index: linux-2.6/drivers/sbus/char/display7seg.c
===================================================================
--- linux-2.6.orig/drivers/sbus/char/display7seg.c
+++ linux-2.6/drivers/sbus/char/display7seg.c
@@ -166,7 +166,7 @@ static long d7s_ioctl(struct file *file,
 	return error;
 }
 
-static struct file_operations d7s_fops = {
+static const struct file_operations d7s_fops = {
 	.owner =		THIS_MODULE,
 	.unlocked_ioctl =	d7s_ioctl,
 	.compat_ioctl =		d7s_ioctl,
Index: linux-2.6/drivers/sbus/char/envctrl.c
===================================================================
--- linux-2.6.orig/drivers/sbus/char/envctrl.c
+++ linux-2.6/drivers/sbus/char/envctrl.c
@@ -705,7 +705,7 @@ envctrl_release(struct inode *inode, str
 	return 0;
 }
 
-static struct file_operations envctrl_fops = {
+static const struct file_operations envctrl_fops = {
 	.owner =		THIS_MODULE,
 	.read =			envctrl_read,
 	.unlocked_ioctl =	envctrl_ioctl,
Index: linux-2.6/drivers/sbus/char/flash.c
===================================================================
--- linux-2.6.orig/drivers/sbus/char/flash.c
+++ linux-2.6/drivers/sbus/char/flash.c
@@ -142,7 +142,7 @@ flash_release(struct inode *inode, struc
 	return 0;
 }
 
-static struct file_operations flash_fops = {
+static const struct file_operations flash_fops = {
 	/* no write to the Flash, use mmap
 	 * and play flash dependent tricks.
 	 */
Index: linux-2.6/drivers/sbus/char/jsflash.c
===================================================================
--- linux-2.6.orig/drivers/sbus/char/jsflash.c
+++ linux-2.6/drivers/sbus/char/jsflash.c
@@ -431,7 +431,7 @@ static int jsf_release(struct inode *ino
 	return 0;
 }
 
-static struct file_operations jsf_fops = {
+static const struct file_operations jsf_fops = {
 	.owner =	THIS_MODULE,
 	.llseek =	jsf_lseek,
 	.read =		jsf_read,
Index: linux-2.6/drivers/sbus/char/openprom.c
===================================================================
--- linux-2.6.orig/drivers/sbus/char/openprom.c
+++ linux-2.6/drivers/sbus/char/openprom.c
@@ -704,7 +704,7 @@ static int openprom_release(struct inode
 	return 0;
 }
 
-static struct file_operations openprom_fops = {
+static const struct file_operations openprom_fops = {
 	.owner =	THIS_MODULE,
 	.llseek =	no_llseek,
 	.ioctl =	openprom_ioctl,
Index: linux-2.6/drivers/sbus/char/riowatchdog.c
===================================================================
--- linux-2.6.orig/drivers/sbus/char/riowatchdog.c
+++ linux-2.6/drivers/sbus/char/riowatchdog.c
@@ -193,7 +193,7 @@ static ssize_t riowd_write(struct file *
 	return 0;
 }
 
-static struct file_operations riowd_fops = {
+static const struct file_operations riowd_fops = {
 	.owner =	THIS_MODULE,
 	.ioctl =	riowd_ioctl,
 	.open =		riowd_open,
Index: linux-2.6/drivers/sbus/char/rtc.c
===================================================================
--- linux-2.6.orig/drivers/sbus/char/rtc.c
+++ linux-2.6/drivers/sbus/char/rtc.c
@@ -233,7 +233,7 @@ static int rtc_release(struct inode *ino
 	return 0;
 }
 
-static struct file_operations rtc_fops = {
+static const struct file_operations rtc_fops = {
 	.owner =	THIS_MODULE,
 	.llseek =	no_llseek,
 	.ioctl =	rtc_ioctl,
Index: linux-2.6/drivers/sbus/char/uctrl.c
===================================================================
--- linux-2.6.orig/drivers/sbus/char/uctrl.c
+++ linux-2.6/drivers/sbus/char/uctrl.c
@@ -224,7 +224,7 @@ static irqreturn_t uctrl_interrupt(int i
 	return IRQ_HANDLED;
 }
 
-static struct file_operations uctrl_fops = {
+static const struct file_operations uctrl_fops = {
 	.owner =	THIS_MODULE,
 	.llseek =	no_llseek,
 	.ioctl =	uctrl_ioctl,
Index: linux-2.6/drivers/sbus/char/vfc_dev.c
===================================================================
--- linux-2.6.orig/drivers/sbus/char/vfc_dev.c
+++ linux-2.6/drivers/sbus/char/vfc_dev.c
@@ -44,7 +44,7 @@
 #include "vfc.h"
 #include <asm/vfc_ioctls.h>
 
-static struct file_operations vfc_fops;
+static const struct file_operations vfc_fops;
 struct vfc_dev **vfc_dev_lst;
 static char vfcstr[]="vfc";
 static unsigned char saa9051_init_array[VFC_SAA9051_NR] = {
@@ -633,7 +633,7 @@ static int vfc_mmap(struct file *file, s
 }
 
 
-static struct file_operations vfc_fops = {
+static const struct file_operations vfc_fops = {
 	.owner =	THIS_MODULE,
 	.llseek =	no_llseek,
 	.ioctl =	vfc_ioctl,
Index: linux-2.6/drivers/scsi/3w-9xxx.c
===================================================================
--- linux-2.6.orig/drivers/scsi/3w-9xxx.c
+++ linux-2.6/drivers/scsi/3w-9xxx.c
@@ -197,7 +197,7 @@ static struct class_device_attribute *tw
 };
 
 /* File operations struct for character device */
-static struct file_operations twa_fops = {
+static const struct file_operations twa_fops = {
 	.owner		= THIS_MODULE,
 	.ioctl		= twa_chrdev_ioctl,
 	.open		= twa_chrdev_open,
Index: linux-2.6/drivers/scsi/3w-xxxx.c
===================================================================
--- linux-2.6.orig/drivers/scsi/3w-xxxx.c
+++ linux-2.6/drivers/scsi/3w-xxxx.c
@@ -1049,7 +1049,7 @@ static int tw_chrdev_open(struct inode *
 } /* End tw_chrdev_open() */
 
 /* File operations struct for character device */
-static struct file_operations tw_fops = {
+static const struct file_operations tw_fops = {
 	.owner		= THIS_MODULE,
 	.ioctl		= tw_chrdev_ioctl,
 	.open		= tw_chrdev_open,
Index: linux-2.6/drivers/scsi/aacraid/linit.c
===================================================================
--- linux-2.6.orig/drivers/scsi/aacraid/linit.c
+++ linux-2.6/drivers/scsi/aacraid/linit.c
@@ -768,7 +768,7 @@ static struct class_device_attribute *aa
 };
 
 
-static struct file_operations aac_cfg_fops = {
+static const struct file_operations aac_cfg_fops = {
 	.owner		= THIS_MODULE,
 	.ioctl		= aac_cfg_ioctl,
 #ifdef CONFIG_COMPAT
Index: linux-2.6/drivers/scsi/ch.c
===================================================================
--- linux-2.6.orig/drivers/scsi/ch.c
+++ linux-2.6/drivers/scsi/ch.c
@@ -129,7 +129,7 @@ static struct scsi_driver ch_template =
 	},
 };
 
-static struct file_operations changer_fops =
+static const struct file_operations changer_fops =
 {
 	.owner        = THIS_MODULE,
 	.open         = ch_open,
Index: linux-2.6/drivers/scsi/dpt_i2o.c
===================================================================
--- linux-2.6.orig/drivers/scsi/dpt_i2o.c
+++ linux-2.6/drivers/scsi/dpt_i2o.c
@@ -116,7 +116,7 @@ static int sys_tbl_len = 0;
 static adpt_hba* hba_chain = NULL;
 static int hba_count = 0;
 
-static struct file_operations adpt_fops = {
+static const struct file_operations adpt_fops = {
 	.ioctl		= adpt_ioctl,
 	.open		= adpt_open,
 	.release	= adpt_close
Index: linux-2.6/drivers/scsi/gdth.c
===================================================================
--- linux-2.6.orig/drivers/scsi/gdth.c
+++ linux-2.6/drivers/scsi/gdth.c
@@ -687,7 +687,7 @@ MODULE_AUTHOR("Achim Leubner");
 MODULE_LICENSE("GPL");
 
 /* ioctl interface */
-static struct file_operations gdth_fops = {
+static const struct file_operations gdth_fops = {
     .ioctl   = gdth_ioctl,
     .open    = gdth_open,
     .release = gdth_close,
Index: linux-2.6/drivers/scsi/megaraid/megaraid_mm.c
===================================================================
--- linux-2.6.orig/drivers/scsi/megaraid/megaraid_mm.c
+++ linux-2.6/drivers/scsi/megaraid/megaraid_mm.c
@@ -67,7 +67,7 @@ static struct list_head adapters_list_g;
 
 static wait_queue_head_t wait_q;
 
-static struct file_operations lsi_fops = {
+static const struct file_operations lsi_fops = {
 	.open	= mraid_mm_open,
 	.ioctl	= mraid_mm_ioctl,
 #ifdef CONFIG_COMPAT
Index: linux-2.6/drivers/scsi/megaraid/megaraid_sas.c
===================================================================
--- linux-2.6.orig/drivers/scsi/megaraid/megaraid_sas.c
+++ linux-2.6/drivers/scsi/megaraid/megaraid_sas.c
@@ -2913,7 +2913,7 @@ megasas_mgmt_compat_ioctl(struct file *f
 /*
  * File operations structure for management interface
  */
-static struct file_operations megasas_mgmt_fops = {
+static const struct file_operations megasas_mgmt_fops = {
 	.owner = THIS_MODULE,
 	.open = megasas_mgmt_open,
 	.release = megasas_mgmt_release,
Index: linux-2.6/drivers/scsi/megaraid.c
===================================================================
--- linux-2.6.orig/drivers/scsi/megaraid.c
+++ linux-2.6/drivers/scsi/megaraid.c
@@ -92,7 +92,7 @@ static struct mega_hbas mega_hbas[MAX_CO
 /*
  * The File Operations structure for the serial/ioctl interface of the driver
  */
-static struct file_operations megadev_fops = {
+static const struct file_operations megadev_fops = {
 	.owner		= THIS_MODULE,
 	.ioctl		= megadev_ioctl,
 	.open		= megadev_open,
Index: linux-2.6/drivers/scsi/osst.c
===================================================================
--- linux-2.6.orig/drivers/scsi/osst.c
+++ linux-2.6/drivers/scsi/osst.c
@@ -5522,7 +5522,7 @@ __setup("osst=", osst_setup);
 
 #endif
 
-static struct file_operations osst_fops = {
+static const struct file_operations osst_fops = {
 	.owner =        THIS_MODULE,
 	.read =         osst_read,
 	.write =        osst_write,
Index: linux-2.6/drivers/scsi/scsi_proc.c
===================================================================
--- linux-2.6.orig/drivers/scsi/scsi_proc.c
+++ linux-2.6/drivers/scsi/scsi_proc.c
@@ -308,7 +308,7 @@ static int proc_scsi_open(struct inode *
 	return single_open(file, proc_scsi_show, NULL);
 }
 
-static struct file_operations proc_scsi_operations = {
+static const struct file_operations proc_scsi_operations = {
 	.open		= proc_scsi_open,
 	.read		= seq_read,
 	.write		= proc_scsi_write,
Index: linux-2.6/drivers/scsi/scsi_tgt_if.c
===================================================================
--- linux-2.6.orig/drivers/scsi/scsi_tgt_if.c
+++ linux-2.6/drivers/scsi/scsi_tgt_if.c
@@ -280,7 +280,7 @@ static int tgt_open(struct inode *inode,
 	return 0;
 }
 
-static struct file_operations tgt_fops = {
+static const struct file_operations tgt_fops = {
 	.owner		= THIS_MODULE,
 	.open		= tgt_open,
 	.poll		= tgt_poll,
Index: linux-2.6/drivers/scsi/st.c
===================================================================
--- linux-2.6.orig/drivers/scsi/st.c
+++ linux-2.6/drivers/scsi/st.c
@@ -3858,7 +3858,7 @@ __setup("st=", st_setup);
 
 #endif
 
-static struct file_operations st_fops =
+static const struct file_operations st_fops =
 {
 	.owner =	THIS_MODULE,
 	.read =		st_read,
Index: linux-2.6/drivers/telephony/ixj.c
===================================================================
--- linux-2.6.orig/drivers/telephony/ixj.c
+++ linux-2.6/drivers/telephony/ixj.c
@@ -6662,7 +6662,7 @@ static int ixj_fasync(int fd, struct fil
 	return fasync_helper(fd, file_p, mode, &j->async_queue);
 }
 
-static struct file_operations ixj_fops =
+static const struct file_operations ixj_fops =
 {
         .owner          = THIS_MODULE,
         .read           = ixj_enhanced_read,
Index: linux-2.6/drivers/telephony/phonedev.c
===================================================================
--- linux-2.6.orig/drivers/telephony/phonedev.c
+++ linux-2.6/drivers/telephony/phonedev.c
@@ -127,7 +127,7 @@ void phone_unregister_device(struct phon
 }
 
 
-static struct file_operations phone_fops =
+static const struct file_operations phone_fops =
 {
 	.owner		= THIS_MODULE,
 	.open		= phone_open,
Index: linux-2.6/drivers/usb/misc/adutux.c
===================================================================
--- linux-2.6.orig/drivers/usb/misc/adutux.c
+++ linux-2.6/drivers/usb/misc/adutux.c
@@ -644,7 +644,7 @@ exit:
 }
 
 /* file operations needed when we register this driver */
-static struct file_operations adu_fops = {
+static const struct file_operations adu_fops = {
 	.owner = THIS_MODULE,
 	.read  = adu_read,
 	.write = adu_write,
Index: linux-2.6/drivers/usb/misc/ftdi-elan.c
===================================================================
--- linux-2.6.orig/drivers/usb/misc/ftdi-elan.c
+++ linux-2.6/drivers/usb/misc/ftdi-elan.c
@@ -1209,7 +1209,7 @@ error_1:
 	return retval;
 }
 
-static struct file_operations ftdi_elan_fops = {
+static const struct file_operations ftdi_elan_fops = {
         .owner = THIS_MODULE,
         .llseek = no_llseek,
         .ioctl = ftdi_elan_ioctl,
Index: linux-2.6/drivers/video/mbx/mbxdebugfs.c
===================================================================
--- linux-2.6.orig/drivers/video/mbx/mbxdebugfs.c
+++ linux-2.6/drivers/video/mbx/mbxdebugfs.c
@@ -170,37 +170,37 @@ static ssize_t misc_read_file(struct fil
 }
 
 
-static struct file_operations sysconf_fops = {
+static const struct file_operations sysconf_fops = {
 	.read = sysconf_read_file,
 	.write = write_file_dummy,
 	.open = open_file_generic,
 };
 
-static struct file_operations clock_fops = {
+static const struct file_operations clock_fops = {
 	.read = clock_read_file,
 	.write = write_file_dummy,
 	.open = open_file_generic,
 };
 
-static struct file_operations display_fops = {
+static const struct file_operations display_fops = {
 	.read = display_read_file,
 	.write = write_file_dummy,
 	.open = open_file_generic,
 };
 
-static struct file_operations gsctl_fops = {
+static const struct file_operations gsctl_fops = {
 	.read = gsctl_read_file,
 	.write = write_file_dummy,
 	.open = open_file_generic,
 };
 
-static struct file_operations sdram_fops = {
+static const struct file_operations sdram_fops = {
 	.read = sdram_read_file,
 	.write = write_file_dummy,
 	.open = open_file_generic,
 };
 
-static struct file_operations misc_fops = {
+static const struct file_operations misc_fops = {
 	.read = misc_read_file,
 	.write = write_file_dummy,
 	.open = open_file_generic,
Index: linux-2.6/drivers/zorro/proc.c
===================================================================
--- linux-2.6.orig/drivers/zorro/proc.c
+++ linux-2.6/drivers/zorro/proc.c
@@ -75,7 +75,7 @@ proc_bus_zorro_read(struct file *file, c
 	return nbytes;
 }
 
-static struct file_operations proc_bus_zorro_operations = {
+static const struct file_operations proc_bus_zorro_operations = {
 	.llseek		= proc_bus_zorro_lseek,
 	.read		= proc_bus_zorro_read,
 };
Index: linux-2.6/fs/debugfs/file.c
===================================================================
--- linux-2.6.orig/fs/debugfs/file.c
+++ linux-2.6/fs/debugfs/file.c
@@ -254,7 +254,7 @@ static ssize_t read_file_blob(struct fil
 			blob->size);
 }
 
-static struct file_operations fops_blob = {
+static const struct file_operations fops_blob = {
 	.read =		read_file_blob,
 	.open =		default_open,
 };
Index: linux-2.6/fs/dlm/debug_fs.c
===================================================================
--- linux-2.6.orig/fs/dlm/debug_fs.c
+++ linux-2.6/fs/dlm/debug_fs.c
@@ -287,7 +287,7 @@ static int rsb_open(struct inode *inode,
 	return 0;
 }
 
-static struct file_operations rsb_fops = {
+static const struct file_operations rsb_fops = {
 	.owner   = THIS_MODULE,
 	.open    = rsb_open,
 	.read    = seq_read,
@@ -331,7 +331,7 @@ static ssize_t waiters_read(struct file 
 	return rv;
 }
 
-static struct file_operations waiters_fops = {
+static const struct file_operations waiters_fops = {
 	.owner   = THIS_MODULE,
 	.open    = waiters_open,
 	.read    = waiters_read
Index: linux-2.6/fs/dlm/user.c
===================================================================
--- linux-2.6.orig/fs/dlm/user.c
+++ linux-2.6/fs/dlm/user.c
@@ -25,7 +25,7 @@
 
 static const char *name_prefix="dlm";
 static struct miscdevice ctl_device;
-static struct file_operations device_fops;
+static const struct file_operations device_fops;
 
 #ifdef CONFIG_COMPAT
 
@@ -750,7 +750,7 @@ static int ctl_device_close(struct inode
 	return 0;
 }
 
-static struct file_operations device_fops = {
+static const struct file_operations device_fops = {
 	.open    = device_open,
 	.release = device_close,
 	.read    = device_read,
@@ -759,7 +759,7 @@ static struct file_operations device_fop
 	.owner   = THIS_MODULE,
 };
 
-static struct file_operations ctl_device_fops = {
+static const struct file_operations ctl_device_fops = {
 	.open    = ctl_device_open,
 	.release = ctl_device_close,
 	.write   = device_write,
Index: linux-2.6/fs/gfs2/locking/dlm/plock.c
===================================================================
--- linux-2.6.orig/fs/gfs2/locking/dlm/plock.c
+++ linux-2.6/fs/gfs2/locking/dlm/plock.c
@@ -264,7 +264,7 @@ static unsigned int dev_poll(struct file
 	return 0;
 }
 
-static struct file_operations dev_fops = {
+static const struct file_operations dev_fops = {
 	.read    = dev_read,
 	.write   = dev_write,
 	.poll    = dev_poll,
Index: linux-2.6/fs/nfs/client.c
===================================================================
--- linux-2.6.orig/fs/nfs/client.c
+++ linux-2.6/fs/nfs/client.c
@@ -1173,7 +1173,7 @@ static struct seq_operations nfs_server_
 	.show	= nfs_server_list_show,
 };
 
-static struct file_operations nfs_server_list_fops = {
+static const struct file_operations nfs_server_list_fops = {
 	.open		= nfs_server_list_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -1193,7 +1193,7 @@ static struct seq_operations nfs_volume_
 	.show	= nfs_volume_list_show,
 };
 
-static struct file_operations nfs_volume_list_fops = {
+static const struct file_operations nfs_volume_list_fops = {
 	.open		= nfs_volume_list_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
Index: linux-2.6/fs/ocfs2/dlm/dlmfs.c
===================================================================
--- linux-2.6.orig/fs/ocfs2/dlm/dlmfs.c
+++ linux-2.6/fs/ocfs2/dlm/dlmfs.c
@@ -62,7 +62,7 @@
 #include "cluster/masklog.h"
 
 static struct super_operations dlmfs_ops;
-static struct file_operations dlmfs_file_operations;
+static const struct file_operations dlmfs_file_operations;
 static struct inode_operations dlmfs_dir_inode_operations;
 static struct inode_operations dlmfs_root_inode_operations;
 static struct inode_operations dlmfs_file_inode_operations;
@@ -540,7 +540,7 @@ static int dlmfs_fill_super(struct super
 	return 0;
 }
 
-static struct file_operations dlmfs_file_operations = {
+static const struct file_operations dlmfs_file_operations = {
 	.open		= dlmfs_file_open,
 	.release	= dlmfs_file_release,
 	.read		= dlmfs_file_read,
Index: linux-2.6/fs/proc/base.c
===================================================================
--- linux-2.6.orig/fs/proc/base.c
+++ linux-2.6/fs/proc/base.c
@@ -94,7 +94,7 @@ struct pid_entry {
 	char *name;
 	mode_t mode;
 	struct inode_operations *iop;
-	struct file_operations *fop;
+	const struct file_operations *fop;
 	union proc_op op;
 };
 
@@ -422,7 +422,7 @@ static unsigned mounts_poll(struct file 
 	return res;
 }
 
-static struct file_operations proc_mounts_operations = {
+static const struct file_operations proc_mounts_operations = {
 	.open		= mounts_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -460,7 +460,7 @@ static int mountstats_open(struct inode 
 	return ret;
 }
 
-static struct file_operations proc_mountstats_operations = {
+static const struct file_operations proc_mountstats_operations = {
 	.open		= mountstats_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -499,7 +499,7 @@ out_no_task:
 	return length;
 }
 
-static struct file_operations proc_info_file_operations = {
+static const struct file_operations proc_info_file_operations = {
 	.read		= proc_info_read,
 };
 
@@ -644,7 +644,7 @@ static loff_t mem_lseek(struct file * fi
 	return file->f_pos;
 }
 
-static struct file_operations proc_mem_operations = {
+static const struct file_operations proc_mem_operations = {
 	.llseek		= mem_lseek,
 	.read		= mem_read,
 	.write		= mem_write,
@@ -708,7 +708,7 @@ static ssize_t oom_adjust_write(struct f
 	return end - buffer;
 }
 
-static struct file_operations proc_oom_adjust_operations = {
+static const struct file_operations proc_oom_adjust_operations = {
 	.read		= oom_adjust_read,
 	.write		= oom_adjust_write,
 };
@@ -775,7 +775,7 @@ out_free_page:
 	return length;
 }
 
-static struct file_operations proc_loginuid_operations = {
+static const struct file_operations proc_loginuid_operations = {
 	.read		= proc_loginuid_read,
 	.write		= proc_loginuid_write,
 };
@@ -847,7 +847,7 @@ out_no_task:
 	return result;
 }
 
-static struct file_operations proc_seccomp_operations = {
+static const struct file_operations proc_seccomp_operations = {
 	.read		= seccomp_read,
 	.write		= seccomp_write,
 };
@@ -906,7 +906,7 @@ static ssize_t proc_fault_inject_write(s
 	return end - buffer;
 }
 
-static struct file_operations proc_fault_inject_operations = {
+static const struct file_operations proc_fault_inject_operations = {
 	.read		= proc_fault_inject_read,
 	.write		= proc_fault_inject_write,
 };
@@ -1406,7 +1406,7 @@ out_no_task:
 	return retval;
 }
 
-static struct file_operations proc_fd_operations = {
+static const struct file_operations proc_fd_operations = {
 	.read		= generic_read_dir,
 	.readdir	= proc_readfd,
 };
@@ -1621,7 +1621,7 @@ out_no_task:
 	return length;
 }
 
-static struct file_operations proc_pid_attr_operations = {
+static const struct file_operations proc_pid_attr_operations = {
 	.read		= proc_pid_attr_read,
 	.write		= proc_pid_attr_write,
 };
@@ -1642,7 +1642,7 @@ static int proc_attr_dir_readdir(struct 
 				   attr_dir_stuff,ARRAY_SIZE(attr_dir_stuff));
 }
 
-static struct file_operations proc_attr_dir_operations = {
+static const struct file_operations proc_attr_dir_operations = {
 	.read		= generic_read_dir,
 	.readdir	= proc_attr_dir_readdir,
 };
@@ -1828,7 +1828,7 @@ static int proc_pid_io_accounting(struct
 /*
  * Thread groups
  */
-static struct file_operations proc_task_operations;
+static const struct file_operations proc_task_operations;
 static struct inode_operations proc_task_inode_operations;
 
 static struct pid_entry tgid_base_stuff[] = {
@@ -1888,7 +1888,7 @@ static int proc_tgid_base_readdir(struct
 				   tgid_base_stuff,ARRAY_SIZE(tgid_base_stuff));
 }
 
-static struct file_operations proc_tgid_base_operations = {
+static const struct file_operations proc_tgid_base_operations = {
 	.read		= generic_read_dir,
 	.readdir	= proc_tgid_base_readdir,
 };
@@ -2171,7 +2171,7 @@ static struct dentry *proc_tid_base_look
 				  tid_base_stuff, ARRAY_SIZE(tid_base_stuff));
 }
 
-static struct file_operations proc_tid_base_operations = {
+static const struct file_operations proc_tid_base_operations = {
 	.read		= generic_read_dir,
 	.readdir	= proc_tid_base_readdir,
 };
@@ -2398,7 +2398,7 @@ static struct inode_operations proc_task
 	.setattr	= proc_setattr,
 };
 
-static struct file_operations proc_task_operations = {
+static const struct file_operations proc_task_operations = {
 	.read		= generic_read_dir,
 	.readdir	= proc_task_readdir,
 };
Index: linux-2.6/fs/proc/generic.c
===================================================================
--- linux-2.6.orig/fs/proc/generic.c
+++ linux-2.6/fs/proc/generic.c
@@ -39,7 +39,7 @@ int proc_match(int len, const char *name
 	return !memcmp(name, de->name, len);
 }
 
-static struct file_operations proc_file_operations = {
+static const struct file_operations proc_file_operations = {
 	.llseek		= proc_file_lseek,
 	.read		= proc_file_read,
 	.write		= proc_file_write,
@@ -497,7 +497,7 @@ out:	unlock_kernel();
  * use the in-memory "struct proc_dir_entry" tree to parse
  * the /proc directory.
  */
-static struct file_operations proc_dir_operations = {
+static const struct file_operations proc_dir_operations = {
 	.read			= generic_read_dir,
 	.readdir		= proc_readdir,
 };
Index: linux-2.6/fs/proc/internal.h
===================================================================
--- linux-2.6.orig/fs/proc/internal.h
+++ linux-2.6/fs/proc/internal.h
@@ -38,13 +38,13 @@ extern int proc_tgid_stat(struct task_st
 extern int proc_pid_status(struct task_struct *, char *);
 extern int proc_pid_statm(struct task_struct *, char *);
 
-extern struct file_operations proc_maps_operations;
-extern struct file_operations proc_numa_maps_operations;
-extern struct file_operations proc_smaps_operations;
-
-extern struct file_operations proc_maps_operations;
-extern struct file_operations proc_numa_maps_operations;
-extern struct file_operations proc_smaps_operations;
+extern const struct file_operations proc_maps_operations;
+extern const struct file_operations proc_numa_maps_operations;
+extern const struct file_operations proc_smaps_operations;
+
+extern const struct file_operations proc_maps_operations;
+extern const struct file_operations proc_numa_maps_operations;
+extern const struct file_operations proc_smaps_operations;
 
 
 void free_proc_entry(struct proc_dir_entry *de);
Index: linux-2.6/fs/proc/nommu.c
===================================================================
--- linux-2.6.orig/fs/proc/nommu.c
+++ linux-2.6/fs/proc/nommu.c
@@ -128,7 +128,7 @@ static int proc_nommu_vma_list_open(stru
 	return seq_open(file, &proc_nommu_vma_list_seqop);
 }
 
-static struct file_operations proc_nommu_vma_list_operations = {
+static const struct file_operations proc_nommu_vma_list_operations = {
 	.open    = proc_nommu_vma_list_open,
 	.read    = seq_read,
 	.llseek  = seq_lseek,
Index: linux-2.6/fs/proc/proc_misc.c
===================================================================
--- linux-2.6.orig/fs/proc/proc_misc.c
+++ linux-2.6/fs/proc/proc_misc.c
@@ -228,7 +228,7 @@ static int fragmentation_open(struct ino
 	return seq_open(file, &fragmentation_op);
 }
 
-static struct file_operations fragmentation_file_operations = {
+static const struct file_operations fragmentation_file_operations = {
 	.open		= fragmentation_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -241,7 +241,7 @@ static int zoneinfo_open(struct inode *i
 	return seq_open(file, &zoneinfo_op);
 }
 
-static struct file_operations proc_zoneinfo_file_operations = {
+static const struct file_operations proc_zoneinfo_file_operations = {
 	.open		= zoneinfo_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -266,7 +266,7 @@ static int cpuinfo_open(struct inode *in
 	return seq_open(file, &cpuinfo_op);
 }
 
-static struct file_operations proc_cpuinfo_operations = {
+static const struct file_operations proc_cpuinfo_operations = {
 	.open		= cpuinfo_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -325,7 +325,7 @@ static int devinfo_open(struct inode *in
 	return seq_open(filp, &devinfo_ops);
 }
 
-static struct file_operations proc_devinfo_operations = {
+static const struct file_operations proc_devinfo_operations = {
 	.open		= devinfo_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -337,7 +337,7 @@ static int vmstat_open(struct inode *ino
 {
 	return seq_open(file, &vmstat_op);
 }
-static struct file_operations proc_vmstat_file_operations = {
+static const struct file_operations proc_vmstat_file_operations = {
 	.open		= vmstat_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -368,7 +368,7 @@ static int partitions_open(struct inode 
 {
 	return seq_open(file, &partitions_op);
 }
-static struct file_operations proc_partitions_operations = {
+static const struct file_operations proc_partitions_operations = {
 	.open		= partitions_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -380,7 +380,7 @@ static int diskstats_open(struct inode *
 {
 	return seq_open(file, &diskstats_op);
 }
-static struct file_operations proc_diskstats_operations = {
+static const struct file_operations proc_diskstats_operations = {
 	.open		= diskstats_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -394,7 +394,7 @@ static int modules_open(struct inode *in
 {
 	return seq_open(file, &modules_op);
 }
-static struct file_operations proc_modules_operations = {
+static const struct file_operations proc_modules_operations = {
 	.open		= modules_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -409,7 +409,7 @@ static int slabinfo_open(struct inode *i
 {
 	return seq_open(file, &slabinfo_op);
 }
-static struct file_operations proc_slabinfo_operations = {
+static const struct file_operations proc_slabinfo_operations = {
 	.open		= slabinfo_open,
 	.read		= seq_read,
 	.write		= slabinfo_write,
@@ -443,7 +443,7 @@ static int slabstats_release(struct inod
 	return seq_release(inode, file);
 }
 
-static struct file_operations proc_slabstats_operations = {
+static const struct file_operations proc_slabstats_operations = {
 	.open		= slabstats_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -556,7 +556,7 @@ static int stat_open(struct inode *inode
 		kfree(buf);
 	return res;
 }
-static struct file_operations proc_stat_operations = {
+static const struct file_operations proc_stat_operations = {
 	.open		= stat_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -598,7 +598,7 @@ static int interrupts_open(struct inode 
 	return seq_open(filp, &int_seq_ops);
 }
 
-static struct file_operations proc_interrupts_operations = {
+static const struct file_operations proc_interrupts_operations = {
 	.open		= interrupts_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -655,7 +655,7 @@ static ssize_t write_sysrq_trigger(struc
 	return count;
 }
 
-static struct file_operations proc_sysrq_trigger_operations = {
+static const struct file_operations proc_sysrq_trigger_operations = {
 	.write		= write_sysrq_trigger,
 };
 #endif
Index: linux-2.6/fs/proc/proc_tty.c
===================================================================
--- linux-2.6.orig/fs/proc/proc_tty.c
+++ linux-2.6/fs/proc/proc_tty.c
@@ -138,7 +138,7 @@ static int tty_drivers_open(struct inode
 	return seq_open(file, &tty_drivers_op);
 }
 
-static struct file_operations proc_tty_drivers_operations = {
+static const struct file_operations proc_tty_drivers_operations = {
 	.open		= tty_drivers_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
Index: linux-2.6/fs/proc/root.c
===================================================================
--- linux-2.6.orig/fs/proc/root.c
+++ linux-2.6/fs/proc/root.c
@@ -136,7 +136,7 @@ static int proc_root_readdir(struct file
  * <pid> directories. Thus we don't use the generic
  * directory handling functions for that..
  */
-static struct file_operations proc_root_operations = {
+static const struct file_operations proc_root_operations = {
 	.read		 = generic_read_dir,
 	.readdir	 = proc_root_readdir,
 };
Index: linux-2.6/fs/proc/task_mmu.c
===================================================================
--- linux-2.6.orig/fs/proc/task_mmu.c
+++ linux-2.6/fs/proc/task_mmu.c
@@ -434,7 +434,7 @@ static int maps_open(struct inode *inode
 	return do_maps_open(inode, file, &proc_pid_maps_op);
 }
 
-struct file_operations proc_maps_operations = {
+const struct file_operations proc_maps_operations = {
 	.open		= maps_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -456,7 +456,7 @@ static int numa_maps_open(struct inode *
 	return do_maps_open(inode, file, &proc_pid_numa_maps_op);
 }
 
-struct file_operations proc_numa_maps_operations = {
+const struct file_operations proc_numa_maps_operations = {
 	.open		= numa_maps_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -469,7 +469,7 @@ static int smaps_open(struct inode *inod
 	return do_maps_open(inode, file, &proc_pid_smaps_op);
 }
 
-struct file_operations proc_smaps_operations = {
+const struct file_operations proc_smaps_operations = {
 	.open		= smaps_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
Index: linux-2.6/fs/proc/task_nommu.c
===================================================================
--- linux-2.6.orig/fs/proc/task_nommu.c
+++ linux-2.6/fs/proc/task_nommu.c
@@ -220,7 +220,7 @@ static int maps_open(struct inode *inode
 	return ret;
 }
 
-struct file_operations proc_maps_operations = {
+const struct file_operations proc_maps_operations = {
 	.open		= maps_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,



^ permalink raw reply	[flat|nested] 17+ messages in thread

* [patch 07/12] mark struct file_operations const 7
  2007-01-14  0:51 Patch series to mark struct file_operations and struct inode_operations const Arjan van de Ven
                   ` (6 preceding siblings ...)
  2007-01-14  0:55 ` [patch 06/12] mark struct file_operations const 6 Arjan van de Ven
@ 2007-01-14  0:56 ` Arjan van de Ven
  2007-01-14  0:56 ` [patch 08/12] mark struct file_operations const 8 Arjan van de Ven
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Arjan van de Ven @ 2007-01-14  0:56 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm

From: Arjan van de Ven <arjan@linux.intel.com>
Subject: [patch 07/12] mark struct file_operations const

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>

Index: linux-2.6/ipc/mqueue.c
===================================================================
--- linux-2.6.orig/ipc/mqueue.c
+++ linux-2.6/ipc/mqueue.c
@@ -85,7 +85,7 @@ struct mqueue_inode_info {
 };
 
 static struct inode_operations mqueue_dir_inode_operations;
-static struct file_operations mqueue_file_operations;
+static const struct file_operations mqueue_file_operations;
 static struct super_operations mqueue_super_ops;
 static void remove_notification(struct mqueue_inode_info *info);
 
@@ -1166,7 +1166,7 @@ static struct inode_operations mqueue_di
 	.unlink = mqueue_unlink,
 };
 
-static struct file_operations mqueue_file_operations = {
+static const struct file_operations mqueue_file_operations = {
 	.flush = mqueue_flush_file,
 	.poll = mqueue_poll_file,
 	.read = mqueue_read_file,
Index: linux-2.6/ipc/shm.c
===================================================================
--- linux-2.6.orig/ipc/shm.c
+++ linux-2.6/ipc/shm.c
@@ -42,7 +42,7 @@
 
 #include "util.h"
 
-static struct file_operations shm_file_operations;
+static const struct file_operations shm_file_operations;
 static struct vm_operations_struct shm_vm_ops;
 
 static struct ipc_ids init_shm_ids;
@@ -249,7 +249,7 @@ static int shm_release(struct inode *ino
 	return 0;
 }
 
-static struct file_operations shm_file_operations = {
+static const struct file_operations shm_file_operations = {
 	.mmap		= shm_mmap,
 	.release	= shm_release,
 #ifndef CONFIG_MMU
Index: linux-2.6/ipc/util.c
===================================================================
--- linux-2.6.orig/ipc/util.c
+++ linux-2.6/ipc/util.c
@@ -205,7 +205,7 @@ void __ipc_init ipc_init_ids(struct ipc_
 }
 
 #ifdef CONFIG_PROC_FS
-static struct file_operations sysvipc_proc_fops;
+static const struct file_operations sysvipc_proc_fops;
 /**
  *	ipc_init_proc_interface	-  Create a proc interface for sysipc types
  *				   using a seq_file interface.
@@ -848,7 +848,7 @@ static int sysvipc_proc_open(struct inod
 	return ret;
 }
 
-static struct file_operations sysvipc_proc_fops = {
+static const struct file_operations sysvipc_proc_fops = {
 	.open    = sysvipc_proc_open,
 	.read    = seq_read,
 	.llseek  = seq_lseek,
Index: linux-2.6/kernel/cpuset.c
===================================================================
--- linux-2.6.orig/kernel/cpuset.c
+++ linux-2.6/kernel/cpuset.c
@@ -2656,7 +2656,7 @@ static int cpuset_open(struct inode *ino
 	return single_open(file, proc_cpuset_show, pid);
 }
 
-struct file_operations proc_cpuset_operations = {
+const struct file_operations proc_cpuset_operations = {
 	.open		= cpuset_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
Index: linux-2.6/net/802/tr.c
===================================================================
--- linux-2.6.orig/net/802/tr.c
+++ linux-2.6/net/802/tr.c
@@ -576,7 +576,7 @@ static int rif_seq_open(struct inode *in
 	return seq_open(file, &rif_seq_ops);
 }
 
-static struct file_operations rif_seq_fops = {
+static const struct file_operations rif_seq_fops = {
 	.owner	 = THIS_MODULE,
 	.open    = rif_seq_open,
 	.read    = seq_read,
Index: linux-2.6/net/8021q/vlanproc.c
===================================================================
--- linux-2.6.orig/net/8021q/vlanproc.c
+++ linux-2.6/net/8021q/vlanproc.c
@@ -81,7 +81,7 @@ static int vlan_seq_open(struct inode *i
 	return seq_open(file, &vlan_seq_ops);
 }
 
-static struct file_operations vlan_fops = {
+static const struct file_operations vlan_fops = {
 	.owner	 = THIS_MODULE,
 	.open    = vlan_seq_open,
 	.read    = seq_read,
@@ -98,7 +98,7 @@ static int vlandev_seq_open(struct inode
 	return single_open(file, vlandev_seq_show, PDE(inode)->data);
 }
 
-static struct file_operations vlandev_fops = {
+static const struct file_operations vlandev_fops = {
 	.owner = THIS_MODULE,
 	.open    = vlandev_seq_open,
 	.read    = seq_read,
Index: linux-2.6/net/appletalk/aarp.c
===================================================================
--- linux-2.6.orig/net/appletalk/aarp.c
+++ linux-2.6/net/appletalk/aarp.c
@@ -1048,7 +1048,7 @@ out_kfree:
 	goto out;
 }
 
-struct file_operations atalk_seq_arp_fops = {
+const struct file_operations atalk_seq_arp_fops = {
 	.owner		= THIS_MODULE,
 	.open           = aarp_seq_open,
 	.read           = seq_read,
Index: linux-2.6/net/appletalk/atalk_proc.c
===================================================================
--- linux-2.6.orig/net/appletalk/atalk_proc.c
+++ linux-2.6/net/appletalk/atalk_proc.c
@@ -240,7 +240,7 @@ static int atalk_seq_socket_open(struct 
 	return seq_open(file, &atalk_seq_socket_ops);
 }
 
-static struct file_operations atalk_seq_interface_fops = {
+static const struct file_operations atalk_seq_interface_fops = {
 	.owner		= THIS_MODULE,
 	.open		= atalk_seq_interface_open,
 	.read		= seq_read,
@@ -248,7 +248,7 @@ static struct file_operations atalk_seq_
 	.release	= seq_release,
 };
 
-static struct file_operations atalk_seq_route_fops = {
+static const struct file_operations atalk_seq_route_fops = {
 	.owner		= THIS_MODULE,
 	.open		= atalk_seq_route_open,
 	.read		= seq_read,
@@ -256,7 +256,7 @@ static struct file_operations atalk_seq_
 	.release	= seq_release,
 };
 
-static struct file_operations atalk_seq_socket_fops = {
+static const struct file_operations atalk_seq_socket_fops = {
 	.owner		= THIS_MODULE,
 	.open		= atalk_seq_socket_open,
 	.read		= seq_read,
Index: linux-2.6/net/atm/br2684.c
===================================================================
--- linux-2.6.orig/net/atm/br2684.c
+++ linux-2.6/net/atm/br2684.c
@@ -784,7 +784,7 @@ static int br2684_proc_open(struct inode
 	return seq_open(file, &br2684_seq_ops);
 }
 
-static struct file_operations br2684_proc_ops = {
+static const struct file_operations br2684_proc_ops = {
 	.owner   = THIS_MODULE,
 	.open    = br2684_proc_open,
 	.read    = seq_read,
Index: linux-2.6/net/atm/clip.c
===================================================================
--- linux-2.6.orig/net/atm/clip.c
+++ linux-2.6/net/atm/clip.c
@@ -971,7 +971,7 @@ out_kfree:
 	goto out;
 }
 
-static struct file_operations arp_seq_fops = {
+static const struct file_operations arp_seq_fops = {
 	.open		= arp_seq_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
Index: linux-2.6/net/atm/lec.c
===================================================================
--- linux-2.6.orig/net/atm/lec.c
+++ linux-2.6/net/atm/lec.c
@@ -1212,7 +1212,7 @@ static int lec_seq_release(struct inode 
 	return seq_release_private(inode, file);
 }
 
-static struct file_operations lec_seq_fops = {
+static const struct file_operations lec_seq_fops = {
 	.owner = THIS_MODULE,
 	.open = lec_seq_open,
 	.read = seq_read,
Index: linux-2.6/net/atm/mpoa_proc.c
===================================================================
--- linux-2.6.orig/net/atm/mpoa_proc.c
+++ linux-2.6/net/atm/mpoa_proc.c
@@ -39,7 +39,7 @@ static int parse_qos(const char *buff);
 /*
  *   Define allowed FILE OPERATIONS
  */
-static struct file_operations mpc_file_operations = {
+static const struct file_operations mpc_file_operations = {
 	.owner =	THIS_MODULE,
 	.open =		proc_mpc_open,
 	.read =		seq_read,
Index: linux-2.6/net/atm/proc.c
===================================================================
--- linux-2.6.orig/net/atm/proc.c
+++ linux-2.6/net/atm/proc.c
@@ -33,7 +33,7 @@
 static ssize_t proc_dev_atm_read(struct file *file,char __user *buf,size_t count,
     loff_t *pos);
 
-static struct file_operations proc_atm_dev_ops = {
+static const struct file_operations proc_atm_dev_ops = {
 	.owner =	THIS_MODULE,
 	.read =		proc_dev_atm_read,
 };
@@ -272,7 +272,7 @@ static int atm_dev_seq_open(struct inode
 	return seq_open(file, &atm_dev_seq_ops);
 }
  
-static struct file_operations devices_seq_fops = {
+static const struct file_operations devices_seq_fops = {
 	.open		= atm_dev_seq_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -307,7 +307,7 @@ static int pvc_seq_open(struct inode *in
 	return __vcc_seq_open(inode, file, PF_ATMPVC, &pvc_seq_ops);
 }
 
-static struct file_operations pvc_seq_fops = {
+static const struct file_operations pvc_seq_fops = {
 	.open		= pvc_seq_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -341,7 +341,7 @@ static int vcc_seq_open(struct inode *in
  	return __vcc_seq_open(inode, file, 0, &vcc_seq_ops);
 }
  
-static struct file_operations vcc_seq_fops = {
+static const struct file_operations vcc_seq_fops = {
 	.open		= vcc_seq_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -376,7 +376,7 @@ static int svc_seq_open(struct inode *in
 	return __vcc_seq_open(inode, file, PF_ATMSVC, &svc_seq_ops);
 }
 
-static struct file_operations svc_seq_fops = {
+static const struct file_operations svc_seq_fops = {
 	.open		= svc_seq_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -457,7 +457,7 @@ void atm_proc_dev_deregister(struct atm_
 
 static struct atm_proc_entry {
 	char *name;
-	struct file_operations *proc_fops;
+	const struct file_operations *proc_fops;
 	struct proc_dir_entry *dirent;
 } atm_proc_ents[] = {
 	{ .name = "devices",	.proc_fops = &devices_seq_fops },
Index: linux-2.6/net/ax25/af_ax25.c
===================================================================
--- linux-2.6.orig/net/ax25/af_ax25.c
+++ linux-2.6/net/ax25/af_ax25.c
@@ -1938,7 +1938,7 @@ static int ax25_info_open(struct inode *
 	return seq_open(file, &ax25_info_seqops);
 }
 
-static struct file_operations ax25_info_fops = {
+static const struct file_operations ax25_info_fops = {
 	.owner = THIS_MODULE,
 	.open = ax25_info_open,
 	.read = seq_read,
Index: linux-2.6/net/ax25/ax25_route.c
===================================================================
--- linux-2.6.orig/net/ax25/ax25_route.c
+++ linux-2.6/net/ax25/ax25_route.c
@@ -332,7 +332,7 @@ static int ax25_rt_info_open(struct inod
 	return seq_open(file, &ax25_rt_seqops);
 }
 
-struct file_operations ax25_route_fops = {
+const struct file_operations ax25_route_fops = {
 	.owner = THIS_MODULE,
 	.open = ax25_rt_info_open,
 	.read = seq_read,
Index: linux-2.6/net/ax25/ax25_uid.c
===================================================================
--- linux-2.6.orig/net/ax25/ax25_uid.c
+++ linux-2.6/net/ax25/ax25_uid.c
@@ -198,7 +198,7 @@ static int ax25_uid_info_open(struct ino
 	return seq_open(file, &ax25_uid_seqops);
 }
 
-struct file_operations ax25_uid_fops = {
+const struct file_operations ax25_uid_fops = {
 	.owner = THIS_MODULE,
 	.open = ax25_uid_info_open,
 	.read = seq_read,
Index: linux-2.6/net/core/dev.c
===================================================================
--- linux-2.6.orig/net/core/dev.c
+++ linux-2.6/net/core/dev.c
@@ -2200,7 +2200,7 @@ static int dev_seq_open(struct inode *in
 	return seq_open(file, &dev_seq_ops);
 }
 
-static struct file_operations dev_seq_fops = {
+static const struct file_operations dev_seq_fops = {
 	.owner	 = THIS_MODULE,
 	.open    = dev_seq_open,
 	.read    = seq_read,
@@ -2220,7 +2220,7 @@ static int softnet_seq_open(struct inode
 	return seq_open(file, &softnet_seq_ops);
 }
 
-static struct file_operations softnet_seq_fops = {
+static const struct file_operations softnet_seq_fops = {
 	.owner	 = THIS_MODULE,
 	.open    = softnet_seq_open,
 	.read    = seq_read,
Index: linux-2.6/net/core/dev_mcast.c
===================================================================
--- linux-2.6.orig/net/core/dev_mcast.c
+++ linux-2.6/net/core/dev_mcast.c
@@ -277,7 +277,7 @@ static int dev_mc_seq_open(struct inode 
 	return seq_open(file, &dev_mc_seq_ops);
 }
 
-static struct file_operations dev_mc_seq_fops = {
+static const struct file_operations dev_mc_seq_fops = {
 	.owner	 = THIS_MODULE,
 	.open    = dev_mc_seq_open,
 	.read    = seq_read,
Index: linux-2.6/net/core/neighbour.c
===================================================================
--- linux-2.6.orig/net/core/neighbour.c
+++ linux-2.6/net/core/neighbour.c
@@ -63,7 +63,7 @@ void neigh_changeaddr(struct neigh_table
 
 static struct neigh_table *neigh_tables;
 #ifdef CONFIG_PROC_FS
-static struct file_operations neigh_stat_seq_fops;
+static const struct file_operations neigh_stat_seq_fops;
 #endif
 
 /*
@@ -2399,7 +2399,7 @@ static int neigh_stat_seq_open(struct in
 	return ret;
 };
 
-static struct file_operations neigh_stat_seq_fops = {
+static const struct file_operations neigh_stat_seq_fops = {
 	.owner	 = THIS_MODULE,
 	.open 	 = neigh_stat_seq_open,
 	.read	 = seq_read,
Index: linux-2.6/net/core/pktgen.c
===================================================================
--- linux-2.6.orig/net/core/pktgen.c
+++ linux-2.6/net/core/pktgen.c
@@ -579,7 +579,7 @@ static int pgctrl_open(struct inode *ino
 	return single_open(file, pgctrl_show, PDE(inode)->data);
 }
 
-static struct file_operations pktgen_fops = {
+static const struct file_operations pktgen_fops = {
 	.owner   = THIS_MODULE,
 	.open    = pgctrl_open,
 	.read    = seq_read,
@@ -1672,7 +1672,7 @@ static int pktgen_if_open(struct inode *
 	return single_open(file, pktgen_if_show, PDE(inode)->data);
 }
 
-static struct file_operations pktgen_if_fops = {
+static const struct file_operations pktgen_if_fops = {
 	.owner   = THIS_MODULE,
 	.open    = pktgen_if_open,
 	.read    = seq_read,
@@ -1815,7 +1815,7 @@ static int pktgen_thread_open(struct ino
 	return single_open(file, pktgen_thread_show, PDE(inode)->data);
 }
 
-static struct file_operations pktgen_thread_fops = {
+static const struct file_operations pktgen_thread_fops = {
 	.owner   = THIS_MODULE,
 	.open    = pktgen_thread_open,
 	.read    = seq_read,
Index: linux-2.6/net/core/sock.c
===================================================================
--- linux-2.6.orig/net/core/sock.c
+++ linux-2.6/net/core/sock.c
@@ -1911,7 +1911,7 @@ static int proto_seq_open(struct inode *
 	return seq_open(file, &proto_seq_ops);
 }
 
-static struct file_operations proto_seq_fops = {
+static const struct file_operations proto_seq_fops = {
 	.owner		= THIS_MODULE,
 	.open		= proto_seq_open,
 	.read		= seq_read,
Index: linux-2.6/net/core/wireless.c
===================================================================
--- linux-2.6.orig/net/core/wireless.c
+++ linux-2.6/net/core/wireless.c
@@ -674,7 +674,7 @@ static int wireless_seq_open(struct inod
 	return seq_open(file, &wireless_seq_ops);
 }
 
-static struct file_operations wireless_seq_fops = {
+static const struct file_operations wireless_seq_fops = {
 	.owner	 = THIS_MODULE,
 	.open    = wireless_seq_open,
 	.read    = seq_read,
Index: linux-2.6/net/dccp/probe.c
===================================================================
--- linux-2.6.orig/net/dccp/probe.c
+++ linux-2.6/net/dccp/probe.c
@@ -149,7 +149,7 @@ out_free:
 	return error ? error : cnt;
 }
 
-static struct file_operations dccpprobe_fops = {
+static const struct file_operations dccpprobe_fops = {
 	.owner	 = THIS_MODULE,
 	.open	 = dccpprobe_open,
 	.read    = dccpprobe_read,
Index: linux-2.6/net/decnet/af_decnet.c
===================================================================
--- linux-2.6.orig/net/decnet/af_decnet.c
+++ linux-2.6/net/decnet/af_decnet.c
@@ -2331,7 +2331,7 @@ out_kfree:
 	goto out;
 }
 
-static struct file_operations dn_socket_seq_fops = {
+static const struct file_operations dn_socket_seq_fops = {
 	.owner		= THIS_MODULE,
 	.open		= dn_socket_seq_open,
 	.read		= seq_read,
Index: linux-2.6/net/decnet/dn_dev.c
===================================================================
--- linux-2.6.orig/net/decnet/dn_dev.c
+++ linux-2.6/net/decnet/dn_dev.c
@@ -1431,7 +1431,7 @@ static int dn_dev_seq_open(struct inode 
 	return seq_open(file, &dn_dev_seq_ops);
 }
 
-static struct file_operations dn_dev_seq_fops = {
+static const struct file_operations dn_dev_seq_fops = {
 	.owner	 = THIS_MODULE,
 	.open	 = dn_dev_seq_open,
 	.read	 = seq_read,
Index: linux-2.6/net/decnet/dn_neigh.c
===================================================================
--- linux-2.6.orig/net/decnet/dn_neigh.c
+++ linux-2.6/net/decnet/dn_neigh.c
@@ -598,7 +598,7 @@ out_kfree:
 	goto out;
 }
 
-static struct file_operations dn_neigh_seq_fops = {
+static const struct file_operations dn_neigh_seq_fops = {
 	.owner		= THIS_MODULE,
 	.open		= dn_neigh_seq_open,
 	.read		= seq_read,
Index: linux-2.6/net/decnet/dn_route.c
===================================================================
--- linux-2.6.orig/net/decnet/dn_route.c
+++ linux-2.6/net/decnet/dn_route.c
@@ -1751,7 +1751,7 @@ out_kfree:
 	goto out;
 }
 
-static struct file_operations dn_rt_cache_seq_fops = {
+static const struct file_operations dn_rt_cache_seq_fops = {
 	.owner	 = THIS_MODULE,
 	.open	 = dn_rt_cache_seq_open,
 	.read	 = seq_read,
Index: linux-2.6/net/ipv4/arp.c
===================================================================
--- linux-2.6.orig/net/ipv4/arp.c
+++ linux-2.6/net/ipv4/arp.c
@@ -1390,7 +1390,7 @@ out_kfree:
 	goto out;
 }
 
-static struct file_operations arp_seq_fops = {
+static const struct file_operations arp_seq_fops = {
 	.owner		= THIS_MODULE,
 	.open           = arp_seq_open,
 	.read           = seq_read,
Index: linux-2.6/net/ipv4/fib_hash.c
===================================================================
--- linux-2.6.orig/net/ipv4/fib_hash.c
+++ linux-2.6/net/ipv4/fib_hash.c
@@ -1057,7 +1057,7 @@ out_kfree:
 	goto out;
 }
 
-static struct file_operations fib_seq_fops = {
+static const struct file_operations fib_seq_fops = {
 	.owner		= THIS_MODULE,
 	.open           = fib_seq_open,
 	.read           = seq_read,
Index: linux-2.6/net/ipv4/fib_trie.c
===================================================================
--- linux-2.6.orig/net/ipv4/fib_trie.c
+++ linux-2.6/net/ipv4/fib_trie.c
@@ -2162,7 +2162,7 @@ static int fib_triestat_seq_open(struct 
 	return single_open(file, fib_triestat_seq_show, NULL);
 }
 
-static struct file_operations fib_triestat_fops = {
+static const struct file_operations fib_triestat_fops = {
 	.owner	= THIS_MODULE,
 	.open	= fib_triestat_seq_open,
 	.read	= seq_read,
@@ -2352,7 +2352,7 @@ out_kfree:
 	goto out;
 }
 
-static struct file_operations fib_trie_fops = {
+static const struct file_operations fib_trie_fops = {
 	.owner  = THIS_MODULE,
 	.open   = fib_trie_seq_open,
 	.read   = seq_read,
@@ -2473,7 +2473,7 @@ out_kfree:
 	goto out;
 }
 
-static struct file_operations fib_route_fops = {
+static const struct file_operations fib_route_fops = {
 	.owner  = THIS_MODULE,
 	.open   = fib_route_seq_open,
 	.read   = seq_read,
Index: linux-2.6/net/ipv4/igmp.c
===================================================================
--- linux-2.6.orig/net/ipv4/igmp.c
+++ linux-2.6/net/ipv4/igmp.c
@@ -2401,7 +2401,7 @@ out_kfree:
 	goto out;
 }
 
-static struct file_operations igmp_mc_seq_fops = {
+static const struct file_operations igmp_mc_seq_fops = {
 	.owner		=	THIS_MODULE,
 	.open		=	igmp_mc_seq_open,
 	.read		=	seq_read,
@@ -2575,7 +2575,7 @@ out_kfree:
 	goto out;
 }
 
-static struct file_operations igmp_mcf_seq_fops = {
+static const struct file_operations igmp_mcf_seq_fops = {
 	.owner		=	THIS_MODULE,
 	.open		=	igmp_mcf_seq_open,
 	.read		=	seq_read,
Index: linux-2.6/net/ipv4/ipconfig.c
===================================================================
--- linux-2.6.orig/net/ipv4/ipconfig.c
+++ linux-2.6/net/ipv4/ipconfig.c
@@ -1200,7 +1200,7 @@ static int pnp_seq_open(struct inode *in
 	return single_open(file, pnp_seq_show, NULL);
 }
 
-static struct file_operations pnp_seq_fops = {
+static const struct file_operations pnp_seq_fops = {
 	.owner		= THIS_MODULE,
 	.open		= pnp_seq_open,
 	.read		= seq_read,
Index: linux-2.6/net/ipv4/ipmr.c
===================================================================
--- linux-2.6.orig/net/ipv4/ipmr.c
+++ linux-2.6/net/ipv4/ipmr.c
@@ -1714,7 +1714,7 @@ out_kfree:
 
 }
 
-static struct file_operations ipmr_vif_fops = {
+static const struct file_operations ipmr_vif_fops = {
 	.owner	 = THIS_MODULE,
 	.open    = ipmr_vif_open,
 	.read    = seq_read,
@@ -1876,7 +1876,7 @@ out_kfree:
 
 }
 
-static struct file_operations ipmr_mfc_fops = {
+static const struct file_operations ipmr_mfc_fops = {
 	.owner	 = THIS_MODULE,
 	.open    = ipmr_mfc_open,
 	.read    = seq_read,
Index: linux-2.6/net/ipv4/ipvs/ip_vs_app.c
===================================================================
--- linux-2.6.orig/net/ipv4/ipvs/ip_vs_app.c
+++ linux-2.6/net/ipv4/ipvs/ip_vs_app.c
@@ -561,7 +561,7 @@ static int ip_vs_app_open(struct inode *
 	return seq_open(file, &ip_vs_app_seq_ops);
 }
 
-static struct file_operations ip_vs_app_fops = {
+static const struct file_operations ip_vs_app_fops = {
 	.owner	 = THIS_MODULE,
 	.open	 = ip_vs_app_open,
 	.read	 = seq_read,
Index: linux-2.6/net/ipv4/ipvs/ip_vs_conn.c
===================================================================
--- linux-2.6.orig/net/ipv4/ipvs/ip_vs_conn.c
+++ linux-2.6/net/ipv4/ipvs/ip_vs_conn.c
@@ -758,7 +758,7 @@ static int ip_vs_conn_open(struct inode 
 	return seq_open(file, &ip_vs_conn_seq_ops);
 }
 
-static struct file_operations ip_vs_conn_fops = {
+static const struct file_operations ip_vs_conn_fops = {
 	.owner	 = THIS_MODULE,
 	.open    = ip_vs_conn_open,
 	.read    = seq_read,
Index: linux-2.6/net/ipv4/ipvs/ip_vs_ctl.c
===================================================================
--- linux-2.6.orig/net/ipv4/ipvs/ip_vs_ctl.c
+++ linux-2.6/net/ipv4/ipvs/ip_vs_ctl.c
@@ -1812,7 +1812,7 @@ out_kfree:
 	goto out;
 }
 
-static struct file_operations ip_vs_info_fops = {
+static const struct file_operations ip_vs_info_fops = {
 	.owner	 = THIS_MODULE,
 	.open    = ip_vs_info_open,
 	.read    = seq_read,
@@ -1859,7 +1859,7 @@ static int ip_vs_stats_seq_open(struct i
 	return single_open(file, ip_vs_stats_show, NULL);
 }
 
-static struct file_operations ip_vs_stats_fops = {
+static const struct file_operations ip_vs_stats_fops = {
 	.owner = THIS_MODULE,
 	.open = ip_vs_stats_seq_open,
 	.read = seq_read,
Index: linux-2.6/net/ipv4/netfilter/ip_conntrack_standalone.c
===================================================================
--- linux-2.6.orig/net/ipv4/netfilter/ip_conntrack_standalone.c
+++ linux-2.6/net/ipv4/netfilter/ip_conntrack_standalone.c
@@ -222,7 +222,7 @@ out_free:
 	return ret;
 }
 
-static struct file_operations ct_file_ops = {
+static const struct file_operations ct_file_ops = {
 	.owner   = THIS_MODULE,
 	.open    = ct_open,
 	.read    = seq_read,
@@ -298,7 +298,7 @@ static int exp_open(struct inode *inode,
 	return seq_open(file, &exp_seq_ops);
 }
   
-static struct file_operations exp_file_ops = {
+static const struct file_operations exp_file_ops = {
 	.owner   = THIS_MODULE,
 	.open    = exp_open,
 	.read    = seq_read,
@@ -386,7 +386,7 @@ static int ct_cpu_seq_open(struct inode 
 	return seq_open(file, &ct_cpu_seq_ops);
 }
 
-static struct file_operations ct_cpu_seq_fops = {
+static const struct file_operations ct_cpu_seq_fops = {
 	.owner   = THIS_MODULE,
 	.open    = ct_cpu_seq_open,
 	.read    = seq_read,
Index: linux-2.6/net/ipv4/netfilter/ipt_CLUSTERIP.c
===================================================================
--- linux-2.6.orig/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ linux-2.6/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -69,7 +69,7 @@ static LIST_HEAD(clusterip_configs);
 static DEFINE_RWLOCK(clusterip_lock);
 
 #ifdef CONFIG_PROC_FS
-static struct file_operations clusterip_proc_fops;
+static const struct file_operations clusterip_proc_fops;
 static struct proc_dir_entry *clusterip_procdir;
 #endif
 
@@ -712,7 +712,7 @@ static ssize_t clusterip_proc_write(stru
 	return size;
 }
 
-static struct file_operations clusterip_proc_fops = {
+static const struct file_operations clusterip_proc_fops = {
 	.owner	 = THIS_MODULE,
 	.open	 = clusterip_proc_open,
 	.read	 = seq_read,
Index: linux-2.6/net/ipv4/netfilter/ipt_recent.c
===================================================================
--- linux-2.6.orig/net/ipv4/netfilter/ipt_recent.c
+++ linux-2.6/net/ipv4/netfilter/ipt_recent.c
@@ -78,7 +78,7 @@ static DEFINE_MUTEX(recent_mutex);
 
 #ifdef CONFIG_PROC_FS
 static struct proc_dir_entry	*proc_dir;
-static struct file_operations	recent_fops;
+static const struct file_operations	recent_fops;
 #endif
 
 static u_int32_t hash_rnd;
@@ -453,7 +453,7 @@ static ssize_t recent_proc_write(struct 
 	return size;
 }
 
-static struct file_operations recent_fops = {
+static const struct file_operations recent_fops = {
 	.open		= recent_seq_open,
 	.read		= seq_read,
 	.write		= recent_proc_write,
Index: linux-2.6/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
===================================================================
--- linux-2.6.orig/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
+++ linux-2.6/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
@@ -197,7 +197,7 @@ out_free:
 	return ret;
 }
 
-static struct file_operations ct_file_ops = {
+static const struct file_operations ct_file_ops = {
 	.owner   = THIS_MODULE,
 	.open    = ct_open,
 	.read    = seq_read,
@@ -278,7 +278,7 @@ static int exp_open(struct inode *inode,
 	return seq_open(file, &exp_seq_ops);
 }
 
-static struct file_operations ip_exp_file_ops = {
+static const struct file_operations ip_exp_file_ops = {
 	.owner   = THIS_MODULE,
 	.open    = exp_open,
 	.read    = seq_read,
@@ -366,7 +366,7 @@ static int ct_cpu_seq_open(struct inode 
 	return seq_open(file, &ct_cpu_seq_ops);
 }
 
-static struct file_operations ct_cpu_seq_fops = {
+static const struct file_operations ct_cpu_seq_fops = {
 	.owner   = THIS_MODULE,
 	.open    = ct_cpu_seq_open,
 	.read    = seq_read,
Index: linux-2.6/net/ipv4/proc.c
===================================================================
--- linux-2.6.orig/net/ipv4/proc.c
+++ linux-2.6/net/ipv4/proc.c
@@ -79,7 +79,7 @@ static int sockstat_seq_open(struct inod
 	return single_open(file, sockstat_seq_show, NULL);
 }
 
-static struct file_operations sockstat_seq_fops = {
+static const struct file_operations sockstat_seq_fops = {
 	.owner	 = THIS_MODULE,
 	.open	 = sockstat_seq_open,
 	.read	 = seq_read,
@@ -326,7 +326,7 @@ static int snmp_seq_open(struct inode *i
 	return single_open(file, snmp_seq_show, NULL);
 }
 
-static struct file_operations snmp_seq_fops = {
+static const struct file_operations snmp_seq_fops = {
 	.owner	 = THIS_MODULE,
 	.open	 = snmp_seq_open,
 	.read	 = seq_read,
@@ -360,7 +360,7 @@ static int netstat_seq_open(struct inode
 	return single_open(file, netstat_seq_show, NULL);
 }
 
-static struct file_operations netstat_seq_fops = {
+static const struct file_operations netstat_seq_fops = {
 	.owner	 = THIS_MODULE,
 	.open	 = netstat_seq_open,
 	.read	 = seq_read,
Index: linux-2.6/net/ipv4/raw.c
===================================================================
--- linux-2.6.orig/net/ipv4/raw.c
+++ linux-2.6/net/ipv4/raw.c
@@ -916,7 +916,7 @@ out_kfree:
 	goto out;
 }
 
-static struct file_operations raw_seq_fops = {
+static const struct file_operations raw_seq_fops = {
 	.owner	 = THIS_MODULE,
 	.open	 = raw_seq_open,
 	.read	 = seq_read,
Index: linux-2.6/net/ipv4/route.c
===================================================================
--- linux-2.6.orig/net/ipv4/route.c
+++ linux-2.6/net/ipv4/route.c
@@ -393,7 +393,7 @@ out_kfree:
 	goto out;
 }
 
-static struct file_operations rt_cache_seq_fops = {
+static const struct file_operations rt_cache_seq_fops = {
 	.owner	 = THIS_MODULE,
 	.open	 = rt_cache_seq_open,
 	.read	 = seq_read,
@@ -484,7 +484,7 @@ static int rt_cpu_seq_open(struct inode 
 	return seq_open(file, &rt_cpu_seq_ops);
 }
 
-static struct file_operations rt_cpu_seq_fops = {
+static const struct file_operations rt_cpu_seq_fops = {
 	.owner	 = THIS_MODULE,
 	.open	 = rt_cpu_seq_open,
 	.read	 = seq_read,
Index: linux-2.6/net/ipv4/tcp_probe.c
===================================================================
--- linux-2.6.orig/net/ipv4/tcp_probe.c
+++ linux-2.6/net/ipv4/tcp_probe.c
@@ -143,7 +143,7 @@ out_free:
 	return error ? error : cnt;
 }
 
-static struct file_operations tcpprobe_fops = {
+static const struct file_operations tcpprobe_fops = {
 	.owner	 = THIS_MODULE,
 	.open	 = tcpprobe_open,
 	.read    = tcpprobe_read,
Index: linux-2.6/net/ipv6/addrconf.c
===================================================================
--- linux-2.6.orig/net/ipv6/addrconf.c
+++ linux-2.6/net/ipv6/addrconf.c
@@ -2770,7 +2770,7 @@ out_kfree:
 	goto out;
 }
 
-static struct file_operations if6_fops = {
+static const struct file_operations if6_fops = {
 	.owner		= THIS_MODULE,
 	.open		= if6_seq_open,
 	.read		= seq_read,
Index: linux-2.6/net/ipv6/anycast.c
===================================================================
--- linux-2.6.orig/net/ipv6/anycast.c
+++ linux-2.6/net/ipv6/anycast.c
@@ -565,7 +565,7 @@ out_kfree:
 	goto out;
 }
 
-static struct file_operations ac6_seq_fops = {
+static const struct file_operations ac6_seq_fops = {
 	.owner		=	THIS_MODULE,
 	.open		=	ac6_seq_open,
 	.read		=	seq_read,
Index: linux-2.6/net/ipv6/ip6_flowlabel.c
===================================================================
--- linux-2.6.orig/net/ipv6/ip6_flowlabel.c
+++ linux-2.6/net/ipv6/ip6_flowlabel.c
@@ -677,7 +677,7 @@ out_kfree:
 	goto out;
 }
 
-static struct file_operations ip6fl_seq_fops = {
+static const struct file_operations ip6fl_seq_fops = {
 	.owner		=	THIS_MODULE,
 	.open		=	ip6fl_seq_open,
 	.read		=	seq_read,
Index: linux-2.6/net/ipv6/mcast.c
===================================================================
--- linux-2.6.orig/net/ipv6/mcast.c
+++ linux-2.6/net/ipv6/mcast.c
@@ -2455,7 +2455,7 @@ out_kfree:
 	goto out;
 }
 
-static struct file_operations igmp6_mc_seq_fops = {
+static const struct file_operations igmp6_mc_seq_fops = {
 	.owner		=	THIS_MODULE,
 	.open		=	igmp6_mc_seq_open,
 	.read		=	seq_read,
@@ -2629,7 +2629,7 @@ out_kfree:
 	goto out;
 }
 
-static struct file_operations igmp6_mcf_seq_fops = {
+static const struct file_operations igmp6_mcf_seq_fops = {
 	.owner		=	THIS_MODULE,
 	.open		=	igmp6_mcf_seq_open,
 	.read		=	seq_read,
Index: linux-2.6/net/ipv6/proc.c
===================================================================
--- linux-2.6.orig/net/ipv6/proc.c
+++ linux-2.6/net/ipv6/proc.c
@@ -187,7 +187,7 @@ static int sockstat6_seq_open(struct ino
 	return single_open(file, sockstat6_seq_show, NULL);
 }
 
-static struct file_operations sockstat6_seq_fops = {
+static const struct file_operations sockstat6_seq_fops = {
 	.owner	 = THIS_MODULE,
 	.open	 = sockstat6_seq_open,
 	.read	 = seq_read,
@@ -200,7 +200,7 @@ static int snmp6_seq_open(struct inode *
 	return single_open(file, snmp6_seq_show, PDE(inode)->data);
 }
 
-static struct file_operations snmp6_seq_fops = {
+static const struct file_operations snmp6_seq_fops = {
 	.owner	 = THIS_MODULE,
 	.open	 = snmp6_seq_open,
 	.read	 = seq_read,
Index: linux-2.6/net/ipv6/raw.c
===================================================================
--- linux-2.6.orig/net/ipv6/raw.c
+++ linux-2.6/net/ipv6/raw.c
@@ -1264,7 +1264,7 @@ out_kfree:
 	goto out;
 }
 
-static struct file_operations raw6_seq_fops = {
+static const struct file_operations raw6_seq_fops = {
 	.owner =	THIS_MODULE,
 	.open =		raw6_seq_open,
 	.read =		seq_read,
Index: linux-2.6/net/ipv6/route.c
===================================================================
--- linux-2.6.orig/net/ipv6/route.c
+++ linux-2.6/net/ipv6/route.c
@@ -2331,7 +2331,7 @@ static int rt6_stats_seq_open(struct ino
 	return single_open(file, rt6_stats_seq_show, NULL);
 }
 
-static struct file_operations rt6_stats_seq_fops = {
+static const struct file_operations rt6_stats_seq_fops = {
 	.owner	 = THIS_MODULE,
 	.open	 = rt6_stats_seq_open,
 	.read	 = seq_read,
Index: linux-2.6/net/ipx/ipx_proc.c
===================================================================
--- linux-2.6.orig/net/ipx/ipx_proc.c
+++ linux-2.6/net/ipx/ipx_proc.c
@@ -322,7 +322,7 @@ static int ipx_seq_socket_open(struct in
 	return seq_open(file, &ipx_seq_socket_ops);
 }
 
-static struct file_operations ipx_seq_interface_fops = {
+static const struct file_operations ipx_seq_interface_fops = {
 	.owner		= THIS_MODULE,
 	.open           = ipx_seq_interface_open,
 	.read           = seq_read,
@@ -330,7 +330,7 @@ static struct file_operations ipx_seq_in
 	.release        = seq_release,
 };
 
-static struct file_operations ipx_seq_route_fops = {
+static const struct file_operations ipx_seq_route_fops = {
 	.owner		= THIS_MODULE,
 	.open           = ipx_seq_route_open,
 	.read           = seq_read,
@@ -338,7 +338,7 @@ static struct file_operations ipx_seq_ro
 	.release        = seq_release,
 };
 
-static struct file_operations ipx_seq_socket_fops = {
+static const struct file_operations ipx_seq_socket_fops = {
 	.owner		= THIS_MODULE,
 	.open           = ipx_seq_socket_open,
 	.read           = seq_read,
Index: linux-2.6/net/irda/discovery.c
===================================================================
--- linux-2.6.orig/net/irda/discovery.c
+++ linux-2.6/net/irda/discovery.c
@@ -409,7 +409,7 @@ static int discovery_seq_open(struct ino
 	return seq_open(file, &discovery_seq_ops);
 }
 
-struct file_operations discovery_seq_fops = {
+const struct file_operations discovery_seq_fops = {
 	.owner		= THIS_MODULE,
 	.open           = discovery_seq_open,
 	.read           = seq_read,



^ permalink raw reply	[flat|nested] 17+ messages in thread

* [patch 08/12] mark struct file_operations const 8
  2007-01-14  0:51 Patch series to mark struct file_operations and struct inode_operations const Arjan van de Ven
                   ` (7 preceding siblings ...)
  2007-01-14  0:56 ` [patch 07/12] mark struct file_operations const 7 Arjan van de Ven
@ 2007-01-14  0:56 ` Arjan van de Ven
  2007-01-14  0:57 ` [patch 09/12] mark struct file_operations const 9 Arjan van de Ven
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Arjan van de Ven @ 2007-01-14  0:56 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm

From: Arjan van de Ven <arjan@linux.intel.com>
Subject: [patch 08/12] mark struct file_operations const

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>

Index: linux-2.6/net/irda/ircomm/ircomm_core.c
===================================================================
--- linux-2.6.orig/net/irda/ircomm/ircomm_core.c
+++ linux-2.6/net/irda/ircomm/ircomm_core.c
@@ -56,7 +56,7 @@ static void ircomm_control_indication(st
 extern struct proc_dir_entry *proc_irda;
 static int ircomm_seq_open(struct inode *, struct file *);
 
-static struct file_operations ircomm_proc_fops = {
+static const struct file_operations ircomm_proc_fops = {
 	.owner		= THIS_MODULE,
 	.open           = ircomm_seq_open,
 	.read           = seq_read,
Index: linux-2.6/net/irda/iriap.c
===================================================================
--- linux-2.6.orig/net/irda/iriap.c
+++ linux-2.6/net/irda/iriap.c
@@ -1080,7 +1080,7 @@ static int irias_seq_open(struct inode *
 	return seq_open(file, &irias_seq_ops);
 }
 
-struct file_operations irias_seq_fops = {
+const struct file_operations irias_seq_fops = {
 	.owner		= THIS_MODULE,
 	.open           = irias_seq_open,
 	.read           = seq_read,
Index: linux-2.6/net/irda/irlan/irlan_common.c
===================================================================
--- linux-2.6.orig/net/irda/irlan/irlan_common.c
+++ linux-2.6/net/irda/irlan/irlan_common.c
@@ -93,7 +93,7 @@ extern struct proc_dir_entry *proc_irda;
 
 static int irlan_seq_open(struct inode *inode, struct file *file);
 
-static struct file_operations irlan_fops = {
+static const struct file_operations irlan_fops = {
 	.owner	 = THIS_MODULE,
 	.open    = irlan_seq_open,
 	.read    = seq_read,
Index: linux-2.6/net/irda/irlap.c
===================================================================
--- linux-2.6.orig/net/irda/irlap.c
+++ linux-2.6/net/irda/irlap.c
@@ -1244,7 +1244,7 @@ out_kfree:
 	goto out;
 }
 
-struct file_operations irlap_seq_fops = {
+const struct file_operations irlap_seq_fops = {
 	.owner		= THIS_MODULE,
 	.open           = irlap_seq_open,
 	.read           = seq_read,
Index: linux-2.6/net/irda/irlmp.c
===================================================================
--- linux-2.6.orig/net/irda/irlmp.c
+++ linux-2.6/net/irda/irlmp.c
@@ -2026,7 +2026,7 @@ out_kfree:
 	goto out;
 }
 
-struct file_operations irlmp_seq_fops = {
+const struct file_operations irlmp_seq_fops = {
 	.owner		= THIS_MODULE,
 	.open           = irlmp_seq_open,
 	.read           = seq_read,
Index: linux-2.6/net/irda/irttp.c
===================================================================
--- linux-2.6.orig/net/irda/irttp.c
+++ linux-2.6/net/irda/irttp.c
@@ -1895,7 +1895,7 @@ out_kfree:
 	goto out;
 }
 
-struct file_operations irttp_seq_fops = {
+const struct file_operations irttp_seq_fops = {
 	.owner		= THIS_MODULE,
 	.open           = irttp_seq_open,
 	.read           = seq_read,
Index: linux-2.6/net/llc/llc_proc.c
===================================================================
--- linux-2.6.orig/net/llc/llc_proc.c
+++ linux-2.6/net/llc/llc_proc.c
@@ -208,7 +208,7 @@ static int llc_seq_core_open(struct inod
 	return seq_open(file, &llc_seq_core_ops);
 }
 
-static struct file_operations llc_seq_socket_fops = {
+static const struct file_operations llc_seq_socket_fops = {
 	.owner		= THIS_MODULE,
 	.open		= llc_seq_socket_open,
 	.read		= seq_read,
@@ -216,7 +216,7 @@ static struct file_operations llc_seq_so
 	.release	= seq_release,
 };
 
-static struct file_operations llc_seq_core_fops = {
+static const struct file_operations llc_seq_core_fops = {
 	.owner		= THIS_MODULE,
 	.open		= llc_seq_core_open,
 	.read		= seq_read,
Index: linux-2.6/net/netfilter/nf_conntrack_expect.c
===================================================================
--- linux-2.6.orig/net/netfilter/nf_conntrack_expect.c
+++ linux-2.6/net/netfilter/nf_conntrack_expect.c
@@ -435,7 +435,7 @@ static int exp_open(struct inode *inode,
 	return seq_open(file, &exp_seq_ops);
 }
 
-struct file_operations exp_file_ops = {
+const struct file_operations exp_file_ops = {
 	.owner   = THIS_MODULE,
 	.open    = exp_open,
 	.read    = seq_read,
Index: linux-2.6/net/netfilter/nf_conntrack_standalone.c
===================================================================
--- linux-2.6.orig/net/netfilter/nf_conntrack_standalone.c
+++ linux-2.6/net/netfilter/nf_conntrack_standalone.c
@@ -229,7 +229,7 @@ out_free:
 	return ret;
 }
 
-static struct file_operations ct_file_ops = {
+static const struct file_operations ct_file_ops = {
 	.owner   = THIS_MODULE,
 	.open    = ct_open,
 	.read    = seq_read,
@@ -317,7 +317,7 @@ static int ct_cpu_seq_open(struct inode 
 	return seq_open(file, &ct_cpu_seq_ops);
 }
 
-static struct file_operations ct_cpu_seq_fops = {
+static const struct file_operations ct_cpu_seq_fops = {
 	.owner	 = THIS_MODULE,
 	.open	 = ct_cpu_seq_open,
 	.read	 = seq_read,
Index: linux-2.6/net/netfilter/nf_log.c
===================================================================
--- linux-2.6.orig/net/netfilter/nf_log.c
+++ linux-2.6/net/netfilter/nf_log.c
@@ -151,7 +151,7 @@ static int nflog_open(struct inode *inod
 	return seq_open(file, &nflog_seq_ops);
 }
 
-static struct file_operations nflog_file_ops = {
+static const struct file_operations nflog_file_ops = {
 	.owner	 = THIS_MODULE,
 	.open	 = nflog_open,
 	.read	 = seq_read,
Index: linux-2.6/net/netfilter/nfnetlink_log.c
===================================================================
--- linux-2.6.orig/net/netfilter/nfnetlink_log.c
+++ linux-2.6/net/netfilter/nfnetlink_log.c
@@ -1025,7 +1025,7 @@ out_free:
 	return ret;
 }
 
-static struct file_operations nful_file_ops = {
+static const struct file_operations nful_file_ops = {
 	.owner	 = THIS_MODULE,
 	.open	 = nful_open,
 	.read	 = seq_read,
Index: linux-2.6/net/netfilter/nfnetlink_queue.c
===================================================================
--- linux-2.6.orig/net/netfilter/nfnetlink_queue.c
+++ linux-2.6/net/netfilter/nfnetlink_queue.c
@@ -1077,7 +1077,7 @@ out_free:
 	return ret;
 }
 
-static struct file_operations nfqnl_file_ops = {
+static const struct file_operations nfqnl_file_ops = {
 	.owner	 = THIS_MODULE,
 	.open	 = nfqnl_open,
 	.read	 = seq_read,
Index: linux-2.6/net/netfilter/nf_queue.c
===================================================================
--- linux-2.6.orig/net/netfilter/nf_queue.c
+++ linux-2.6/net/netfilter/nf_queue.c
@@ -331,7 +331,7 @@ static int nfqueue_open(struct inode *in
 	return seq_open(file, &nfqueue_seq_ops);
 }
 
-static struct file_operations nfqueue_file_ops = {
+static const struct file_operations nfqueue_file_ops = {
 	.owner	 = THIS_MODULE,
 	.open	 = nfqueue_open,
 	.read	 = seq_read,
Index: linux-2.6/net/netfilter/x_tables.c
===================================================================
--- linux-2.6.orig/net/netfilter/x_tables.c
+++ linux-2.6/net/netfilter/x_tables.c
@@ -772,7 +772,7 @@ static int xt_tgt_open(struct inode *ino
 	return ret;
 }
 
-static struct file_operations xt_file_ops = {
+static const struct file_operations xt_file_ops = {
 	.owner	 = THIS_MODULE,
 	.open	 = xt_tgt_open,
 	.read	 = seq_read,
Index: linux-2.6/net/netfilter/xt_hashlimit.c
===================================================================
--- linux-2.6.orig/net/netfilter/xt_hashlimit.c
+++ linux-2.6/net/netfilter/xt_hashlimit.c
@@ -37,7 +37,7 @@ MODULE_ALIAS("ip6t_hashlimit");
 /* need to declare this at the top */
 static struct proc_dir_entry *hashlimit_procdir4;
 static struct proc_dir_entry *hashlimit_procdir6;
-static struct file_operations dl_file_ops;
+static const struct file_operations dl_file_ops;
 
 /* hash table crap */
 struct dsthash_dst {
@@ -713,7 +713,7 @@ static int dl_proc_open(struct inode *in
 	return ret;
 }
 
-static struct file_operations dl_file_ops = {
+static const struct file_operations dl_file_ops = {
 	.owner   = THIS_MODULE,
 	.open    = dl_proc_open,
 	.read    = seq_read,
Index: linux-2.6/net/netlink/af_netlink.c
===================================================================
--- linux-2.6.orig/net/netlink/af_netlink.c
+++ linux-2.6/net/netlink/af_netlink.c
@@ -1713,7 +1713,7 @@ static int netlink_seq_open(struct inode
 	return 0;
 }
 
-static struct file_operations netlink_seq_fops = {
+static const struct file_operations netlink_seq_fops = {
 	.owner		= THIS_MODULE,
 	.open		= netlink_seq_open,
 	.read		= seq_read,
Index: linux-2.6/net/netrom/af_netrom.c
===================================================================
--- linux-2.6.orig/net/netrom/af_netrom.c
+++ linux-2.6/net/netrom/af_netrom.c
@@ -1335,7 +1335,7 @@ static int nr_info_open(struct inode *in
 	return seq_open(file, &nr_info_seqops);
 }
  
-static struct file_operations nr_info_fops = {
+static const struct file_operations nr_info_fops = {
 	.owner = THIS_MODULE,
 	.open = nr_info_open,
 	.read = seq_read,
Index: linux-2.6/net/netrom/nr_route.c
===================================================================
--- linux-2.6.orig/net/netrom/nr_route.c
+++ linux-2.6/net/netrom/nr_route.c
@@ -934,7 +934,7 @@ static int nr_node_info_open(struct inod
 	return seq_open(file, &nr_node_seqops);
 }
 
-struct file_operations nr_nodes_fops = {
+const struct file_operations nr_nodes_fops = {
 	.owner = THIS_MODULE,
 	.open = nr_node_info_open,
 	.read = seq_read,
@@ -1018,7 +1018,7 @@ static int nr_neigh_info_open(struct ino
 	return seq_open(file, &nr_neigh_seqops);
 }
 
-struct file_operations nr_neigh_fops = {
+const struct file_operations nr_neigh_fops = {
 	.owner = THIS_MODULE,
 	.open = nr_neigh_info_open,
 	.read = seq_read,
Index: linux-2.6/net/packet/af_packet.c
===================================================================
--- linux-2.6.orig/net/packet/af_packet.c
+++ linux-2.6/net/packet/af_packet.c
@@ -1899,7 +1899,7 @@ static int packet_seq_open(struct inode 
 	return seq_open(file, &packet_seq_ops);
 }
 
-static struct file_operations packet_seq_fops = {
+static const struct file_operations packet_seq_fops = {
 	.owner		= THIS_MODULE,
 	.open		= packet_seq_open,
 	.read		= seq_read,
Index: linux-2.6/net/rose/af_rose.c
===================================================================
--- linux-2.6.orig/net/rose/af_rose.c
+++ linux-2.6/net/rose/af_rose.c
@@ -1440,7 +1440,7 @@ static int rose_info_open(struct inode *
 	return seq_open(file, &rose_info_seqops);
 }
 
-static struct file_operations rose_info_fops = {
+static const struct file_operations rose_info_fops = {
 	.owner = THIS_MODULE,
 	.open = rose_info_open,
 	.read = seq_read,
Index: linux-2.6/net/rose/rose_route.c
===================================================================
--- linux-2.6.orig/net/rose/rose_route.c
+++ linux-2.6/net/rose/rose_route.c
@@ -1129,7 +1129,7 @@ static int rose_nodes_open(struct inode 
 	return seq_open(file, &rose_node_seqops);
 }
 
-struct file_operations rose_nodes_fops = {
+const struct file_operations rose_nodes_fops = {
 	.owner = THIS_MODULE,
 	.open = rose_nodes_open,
 	.read = seq_read,
@@ -1211,7 +1211,7 @@ static int rose_neigh_open(struct inode 
 	return seq_open(file, &rose_neigh_seqops);
 }
 
-struct file_operations rose_neigh_fops = {
+const struct file_operations rose_neigh_fops = {
 	.owner = THIS_MODULE,
 	.open = rose_neigh_open,
 	.read = seq_read,
@@ -1295,7 +1295,7 @@ static int rose_route_open(struct inode 
 	return seq_open(file, &rose_route_seqops);
 }
 
-struct file_operations rose_routes_fops = {
+const struct file_operations rose_routes_fops = {
 	.owner = THIS_MODULE,
 	.open = rose_route_open,
 	.read = seq_read,
Index: linux-2.6/net/rxrpc/proc.c
===================================================================
--- linux-2.6.orig/net/rxrpc/proc.c
+++ linux-2.6/net/rxrpc/proc.c
@@ -37,7 +37,7 @@ static struct seq_operations rxrpc_proc_
 	.show	= rxrpc_proc_transports_show,
 };
 
-static struct file_operations rxrpc_proc_transports_fops = {
+static const struct file_operations rxrpc_proc_transports_fops = {
 	.open		= rxrpc_proc_transports_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -57,7 +57,7 @@ static struct seq_operations rxrpc_proc_
 	.show	= rxrpc_proc_peers_show,
 };
 
-static struct file_operations rxrpc_proc_peers_fops = {
+static const struct file_operations rxrpc_proc_peers_fops = {
 	.open		= rxrpc_proc_peers_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -77,7 +77,7 @@ static struct seq_operations rxrpc_proc_
 	.show	= rxrpc_proc_conns_show,
 };
 
-static struct file_operations rxrpc_proc_conns_fops = {
+static const struct file_operations rxrpc_proc_conns_fops = {
 	.open		= rxrpc_proc_conns_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -97,7 +97,7 @@ static struct seq_operations rxrpc_proc_
 	.show	= rxrpc_proc_calls_show,
 };
 
-static struct file_operations rxrpc_proc_calls_fops = {
+static const struct file_operations rxrpc_proc_calls_fops = {
 	.open		= rxrpc_proc_calls_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
Index: linux-2.6/net/sched/sch_api.c
===================================================================
--- linux-2.6.orig/net/sched/sch_api.c
+++ linux-2.6/net/sched/sch_api.c
@@ -1194,7 +1194,7 @@ static int psched_open(struct inode *ino
 	return single_open(file, psched_show, PDE(inode)->data);
 }
 
-static struct file_operations psched_fops = {
+static const struct file_operations psched_fops = {
 	.owner = THIS_MODULE,
 	.open = psched_open,
 	.read  = seq_read,
Index: linux-2.6/net/sctp/proc.c
===================================================================
--- linux-2.6.orig/net/sctp/proc.c
+++ linux-2.6/net/sctp/proc.c
@@ -114,7 +114,7 @@ static int sctp_snmp_seq_open(struct ino
 	return single_open(file, sctp_snmp_seq_show, NULL);
 }
 
-static struct file_operations sctp_snmp_seq_fops = {
+static const struct file_operations sctp_snmp_seq_fops = {
 	.owner	 = THIS_MODULE,
 	.open	 = sctp_snmp_seq_open,
 	.read	 = seq_read,
@@ -264,7 +264,7 @@ static int sctp_eps_seq_open(struct inod
 	return seq_open(file, &sctp_eps_ops);
 }
 
-static struct file_operations sctp_eps_seq_fops = {
+static const struct file_operations sctp_eps_seq_fops = {
 	.open	 = sctp_eps_seq_open,
 	.read	 = seq_read,
 	.llseek	 = seq_lseek,
@@ -374,7 +374,7 @@ static int sctp_assocs_seq_open(struct i
 	return seq_open(file, &sctp_assoc_ops);
 }
 
-static struct file_operations sctp_assocs_seq_fops = {
+static const struct file_operations sctp_assocs_seq_fops = {
 	.open	 = sctp_assocs_seq_open,
 	.read	 = seq_read,
 	.llseek	 = seq_lseek,
Index: linux-2.6/net/socket.c
===================================================================
--- linux-2.6.orig/net/socket.c
+++ linux-2.6/net/socket.c
@@ -117,7 +117,7 @@ static ssize_t sock_sendpage(struct file
  *	in the operation structures but are done directly via the socketcall() multiplexor.
  */
 
-static struct file_operations socket_file_ops = {
+static const struct file_operations socket_file_ops = {
 	.owner =	THIS_MODULE,
 	.llseek =	no_llseek,
 	.aio_read =	sock_aio_read,
Index: linux-2.6/net/sunrpc/cache.c
===================================================================
--- linux-2.6.orig/net/sunrpc/cache.c
+++ linux-2.6/net/sunrpc/cache.c
@@ -282,9 +282,9 @@ static DEFINE_SPINLOCK(cache_list_lock);
 static struct cache_detail *current_detail;
 static int current_index;
 
-static struct file_operations cache_file_operations;
-static struct file_operations content_file_operations;
-static struct file_operations cache_flush_operations;
+static const struct file_operations cache_file_operations;
+static const struct file_operations content_file_operations;
+static const struct file_operations cache_flush_operations;
 
 static void do_cache_clean(struct work_struct *work);
 static DECLARE_DELAYED_WORK(cache_cleaner, do_cache_clean);
@@ -887,7 +887,7 @@ cache_release(struct inode *inode, struc
 
 
 
-static struct file_operations cache_file_operations = {
+static const struct file_operations cache_file_operations = {
 	.owner		= THIS_MODULE,
 	.llseek		= no_llseek,
 	.read		= cache_read,
@@ -1245,7 +1245,7 @@ static int content_release(struct inode 
 	return seq_release(inode, file);
 }
 
-static struct file_operations content_file_operations = {
+static const struct file_operations content_file_operations = {
 	.open		= content_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -1297,7 +1297,7 @@ static ssize_t write_flush(struct file *
 	return count;
 }
 
-static struct file_operations cache_flush_operations = {
+static const struct file_operations cache_flush_operations = {
 	.open		= nonseekable_open,
 	.read		= read_flush,
 	.write		= write_flush,
Index: linux-2.6/net/sunrpc/rpc_pipe.c
===================================================================
--- linux-2.6.orig/net/sunrpc/rpc_pipe.c
+++ linux-2.6/net/sunrpc/rpc_pipe.c
@@ -309,7 +309,7 @@ rpc_pipe_ioctl(struct inode *ino, struct
 	}
 }
 
-static struct file_operations rpc_pipe_fops = {
+static const struct file_operations rpc_pipe_fops = {
 	.owner		= THIS_MODULE,
 	.llseek		= no_llseek,
 	.read		= rpc_pipe_read,
@@ -366,7 +366,7 @@ rpc_info_release(struct inode *inode, st
 	return single_release(inode, file);
 }
 
-static struct file_operations rpc_info_operations = {
+static const struct file_operations rpc_info_operations = {
 	.owner		= THIS_MODULE,
 	.open		= rpc_info_open,
 	.read		= seq_read,
Index: linux-2.6/net/sunrpc/stats.c
===================================================================
--- linux-2.6.orig/net/sunrpc/stats.c
+++ linux-2.6/net/sunrpc/stats.c
@@ -66,7 +66,7 @@ static int rpc_proc_open(struct inode *i
 	return single_open(file, rpc_proc_show, PDE(inode)->data);
 }
 
-static struct file_operations rpc_proc_fops = {
+static const struct file_operations rpc_proc_fops = {
 	.owner = THIS_MODULE,
 	.open = rpc_proc_open,
 	.read  = seq_read,
Index: linux-2.6/net/unix/af_unix.c
===================================================================
--- linux-2.6.orig/net/unix/af_unix.c
+++ linux-2.6/net/unix/af_unix.c
@@ -2040,7 +2040,7 @@ out_kfree:
 	goto out;
 }
 
-static struct file_operations unix_seq_fops = {
+static const struct file_operations unix_seq_fops = {
 	.owner		= THIS_MODULE,
 	.open		= unix_seq_open,
 	.read		= seq_read,
Index: linux-2.6/net/wanrouter/wanproc.c
===================================================================
--- linux-2.6.orig/net/wanrouter/wanproc.c
+++ linux-2.6/net/wanrouter/wanproc.c
@@ -188,7 +188,7 @@ static int status_open(struct inode *ino
 	return seq_open(file, &status_op);
 }
 
-static struct file_operations config_fops = {
+static const struct file_operations config_fops = {
 	.owner	 = THIS_MODULE,
 	.open	 = config_open,
 	.read	 = seq_read,
@@ -196,7 +196,7 @@ static struct file_operations config_fop
 	.release = seq_release,
 };
 
-static struct file_operations status_fops = {
+static const struct file_operations status_fops = {
 	.owner	 = THIS_MODULE,
 	.open	 = status_open,
 	.read	 = seq_read,
@@ -271,7 +271,7 @@ static int wandev_open(struct inode *ino
 	return single_open(file, wandev_show, PDE(inode)->data);
 }
 
-static struct file_operations wandev_fops = {
+static const struct file_operations wandev_fops = {
 	.owner	 = THIS_MODULE,
 	.open	 = wandev_open,
 	.read	 = seq_read,
Index: linux-2.6/net/x25/x25_proc.c
===================================================================
--- linux-2.6.orig/net/x25/x25_proc.c
+++ linux-2.6/net/x25/x25_proc.c
@@ -189,7 +189,7 @@ static int x25_seq_route_open(struct ino
 	return seq_open(file, &x25_seq_route_ops);
 }
 
-static struct file_operations x25_seq_socket_fops = {
+static const struct file_operations x25_seq_socket_fops = {
 	.owner		= THIS_MODULE,
 	.open		= x25_seq_socket_open,
 	.read		= seq_read,
@@ -197,7 +197,7 @@ static struct file_operations x25_seq_so
 	.release	= seq_release,
 };
 
-static struct file_operations x25_seq_route_fops = {
+static const struct file_operations x25_seq_route_fops = {
 	.owner		= THIS_MODULE,
 	.open		= x25_seq_route_open,
 	.read		= seq_read,



^ permalink raw reply	[flat|nested] 17+ messages in thread

* [patch 09/12] mark struct file_operations const 9
  2007-01-14  0:51 Patch series to mark struct file_operations and struct inode_operations const Arjan van de Ven
                   ` (8 preceding siblings ...)
  2007-01-14  0:56 ` [patch 08/12] mark struct file_operations const 8 Arjan van de Ven
@ 2007-01-14  0:57 ` Arjan van de Ven
  2007-01-14  0:57 ` [patch 10/12] mark struct inode_operations const 1 Arjan van de Ven
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Arjan van de Ven @ 2007-01-14  0:57 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm

From: Arjan van de Ven <arjan@linux.intel.com>
Subject: [patch 09/12] mark struct file_operations const

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>

Index: linux-2.6/security/inode.c
===================================================================
--- linux-2.6.orig/security/inode.c
+++ linux-2.6/security/inode.c
@@ -50,7 +50,7 @@ static int default_open(struct inode *in
 	return 0;
 }
 
-static struct file_operations default_file_ops = {
+static const struct file_operations default_file_ops = {
 	.read =		default_read_file,
 	.write =	default_write_file,
 	.open =		default_open,
@@ -215,7 +215,7 @@ static int create_by_name(const char *na
  */
 struct dentry *securityfs_create_file(const char *name, mode_t mode,
 				   struct dentry *parent, void *data,
-				   struct file_operations *fops)
+				   const struct file_operations *fops)
 {
 	struct dentry *dentry = NULL;
 	int error;
Index: linux-2.6/security/keys/proc.c
===================================================================
--- linux-2.6.orig/security/keys/proc.c
+++ linux-2.6/security/keys/proc.c
@@ -33,7 +33,7 @@ static struct seq_operations proc_keys_o
 	.show	= proc_keys_show,
 };
 
-static struct file_operations proc_keys_fops = {
+static const struct file_operations proc_keys_fops = {
 	.open		= proc_keys_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -54,7 +54,7 @@ static struct seq_operations proc_key_us
 	.show	= proc_key_users_show,
 };
 
-static struct file_operations proc_key_users_fops = {
+static const struct file_operations proc_key_users_fops = {
 	.open		= proc_key_users_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
Index: linux-2.6/security/selinux/selinuxfs.c
===================================================================
--- linux-2.6.orig/security/selinux/selinuxfs.c
+++ linux-2.6/security/selinux/selinuxfs.c
@@ -161,7 +161,7 @@ out:
 #define sel_write_enforce NULL
 #endif
 
-static struct file_operations sel_enforce_ops = {
+static const struct file_operations sel_enforce_ops = {
 	.read		= sel_read_enforce,
 	.write		= sel_write_enforce,
 };
@@ -211,7 +211,7 @@ out:
 #define sel_write_disable NULL
 #endif
 
-static struct file_operations sel_disable_ops = {
+static const struct file_operations sel_disable_ops = {
 	.write		= sel_write_disable,
 };
 
@@ -225,7 +225,7 @@ static ssize_t sel_read_policyvers(struc
 	return simple_read_from_buffer(buf, count, ppos, tmpbuf, length);
 }
 
-static struct file_operations sel_policyvers_ops = {
+static const struct file_operations sel_policyvers_ops = {
 	.read		= sel_read_policyvers,
 };
 
@@ -242,7 +242,7 @@ static ssize_t sel_read_mls(struct file 
 	return simple_read_from_buffer(buf, count, ppos, tmpbuf, length);
 }
 
-static struct file_operations sel_mls_ops = {
+static const struct file_operations sel_mls_ops = {
 	.read		= sel_read_mls,
 };
 
@@ -294,7 +294,7 @@ out:
 	return length;
 }
 
-static struct file_operations sel_load_ops = {
+static const struct file_operations sel_load_ops = {
 	.write		= sel_write_load,
 };
 
@@ -374,7 +374,7 @@ out:
 	free_page((unsigned long) page);
 	return length;
 }
-static struct file_operations sel_checkreqprot_ops = {
+static const struct file_operations sel_checkreqprot_ops = {
 	.read		= sel_read_checkreqprot,
 	.write		= sel_write_checkreqprot,
 };
@@ -423,7 +423,7 @@ out:
 	free_page((unsigned long) page);
 	return length;
 }
-static struct file_operations sel_compat_net_ops = {
+static const struct file_operations sel_compat_net_ops = {
 	.read		= sel_read_compat_net,
 	.write		= sel_write_compat_net,
 };
@@ -467,7 +467,7 @@ static ssize_t selinux_transaction_write
 	return rv;
 }
 
-static struct file_operations transaction_ops = {
+static const struct file_operations transaction_ops = {
 	.write		= selinux_transaction_write,
 	.read		= simple_transaction_read,
 	.release	= simple_transaction_release,
@@ -875,7 +875,7 @@ out:
 	return length;
 }
 
-static struct file_operations sel_bool_ops = {
+static const struct file_operations sel_bool_ops = {
 	.read           = sel_read_bool,
 	.write          = sel_write_bool,
 };
@@ -932,7 +932,7 @@ out:
 	return length;
 }
 
-static struct file_operations sel_commit_bools_ops = {
+static const struct file_operations sel_commit_bools_ops = {
 	.write          = sel_commit_bools_write,
 };
 
@@ -1131,12 +1131,12 @@ out:
 	return ret;
 }
 
-static struct file_operations sel_avc_cache_threshold_ops = {
+static const struct file_operations sel_avc_cache_threshold_ops = {
 	.read		= sel_read_avc_cache_threshold,
 	.write		= sel_write_avc_cache_threshold,
 };
 
-static struct file_operations sel_avc_hash_stats_ops = {
+static const struct file_operations sel_avc_hash_stats_ops = {
 	.read		= sel_read_avc_hash_stats,
 };
 
@@ -1198,7 +1198,7 @@ static int sel_open_avc_cache_stats(stru
 	return seq_open(file, &sel_avc_cache_stats_seq_ops);
 }
 
-static struct file_operations sel_avc_cache_stats_ops = {
+static const struct file_operations sel_avc_cache_stats_ops = {
 	.open		= sel_open_avc_cache_stats,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
Index: linux-2.6/sound/core/control.c
===================================================================
--- linux-2.6.orig/sound/core/control.c
+++ linux-2.6/sound/core/control.c
@@ -1416,7 +1416,7 @@ static int snd_ctl_fasync(int fd, struct
  *  INIT PART
  */
 
-static struct file_operations snd_ctl_f_ops =
+static const struct file_operations snd_ctl_f_ops =
 {
 	.owner =	THIS_MODULE,
 	.read =		snd_ctl_read,
Index: linux-2.6/sound/core/hwdep.c
===================================================================
--- linux-2.6.orig/sound/core/hwdep.c
+++ linux-2.6/sound/core/hwdep.c
@@ -319,7 +319,7 @@ static int snd_hwdep_control_ioctl(struc
 
  */
 
-static struct file_operations snd_hwdep_f_ops =
+static const struct file_operations snd_hwdep_f_ops =
 {
 	.owner = 	THIS_MODULE,
 	.llseek =	snd_hwdep_llseek,
Index: linux-2.6/sound/core/info.c
===================================================================
--- linux-2.6.orig/sound/core/info.c
+++ linux-2.6/sound/core/info.c
@@ -507,7 +507,7 @@ static int snd_info_entry_mmap(struct fi
 	return -ENXIO;
 }
 
-static struct file_operations snd_info_entry_operations =
+static const struct file_operations snd_info_entry_operations =
 {
 	.owner =		THIS_MODULE,
 	.llseek =		snd_info_entry_llseek,
Index: linux-2.6/sound/core/init.c
===================================================================
--- linux-2.6.orig/sound/core/init.c
+++ linux-2.6/sound/core/init.c
@@ -36,7 +36,7 @@
 static DEFINE_SPINLOCK(shutdown_lock);
 static LIST_HEAD(shutdown_files);
 
-static struct file_operations snd_shutdown_f_ops;
+static const struct file_operations snd_shutdown_f_ops;
 
 static unsigned int snd_cards_lock;	/* locked for registering/using */
 struct snd_card *snd_cards[SNDRV_CARDS];
@@ -238,7 +238,7 @@ static int snd_disconnect_fasync(int fd,
 	return -ENODEV;
 }
 
-static struct file_operations snd_shutdown_f_ops =
+static const struct file_operations snd_shutdown_f_ops =
 {
 	.owner = 	THIS_MODULE,
 	.llseek =	snd_disconnect_llseek,
Index: linux-2.6/sound/core/oss/mixer_oss.c
===================================================================
--- linux-2.6.orig/sound/core/oss/mixer_oss.c
+++ linux-2.6/sound/core/oss/mixer_oss.c
@@ -390,7 +390,7 @@ int snd_mixer_oss_ioctl_card(struct snd_
  *  REGISTRATION PART
  */
 
-static struct file_operations snd_mixer_oss_f_ops =
+static const struct file_operations snd_mixer_oss_f_ops =
 {
 	.owner =	THIS_MODULE,
 	.open =		snd_mixer_oss_open,
Index: linux-2.6/sound/core/oss/pcm_oss.c
===================================================================
--- linux-2.6.orig/sound/core/oss/pcm_oss.c
+++ linux-2.6/sound/core/oss/pcm_oss.c
@@ -2889,7 +2889,7 @@ static void snd_pcm_oss_proc_done(struct
  *  ENTRY functions
  */
 
-static struct file_operations snd_pcm_oss_f_reg =
+static const struct file_operations snd_pcm_oss_f_reg =
 {
 	.owner =	THIS_MODULE,
 	.read =		snd_pcm_oss_read,
Index: linux-2.6/sound/core/pcm_native.c
===================================================================
--- linux-2.6.orig/sound/core/pcm_native.c
+++ linux-2.6/sound/core/pcm_native.c
@@ -3424,7 +3424,7 @@ out:
  *  Register section
  */
 
-struct file_operations snd_pcm_f_ops[2] = {
+const struct file_operations snd_pcm_f_ops[2] = {
 	{
 		.owner =		THIS_MODULE,
 		.write =		snd_pcm_write,
Index: linux-2.6/sound/core/rawmidi.c
===================================================================
--- linux-2.6.orig/sound/core/rawmidi.c
+++ linux-2.6/sound/core/rawmidi.c
@@ -1365,7 +1365,7 @@ static void snd_rawmidi_proc_info_read(s
  *  Register functions
  */
 
-static struct file_operations snd_rawmidi_f_ops =
+static const struct file_operations snd_rawmidi_f_ops =
 {
 	.owner =	THIS_MODULE,
 	.read =		snd_rawmidi_read,
Index: linux-2.6/sound/core/seq/oss/seq_oss.c
===================================================================
--- linux-2.6.orig/sound/core/seq/oss/seq_oss.c
+++ linux-2.6/sound/core/seq/oss/seq_oss.c
@@ -208,7 +208,7 @@ odev_poll(struct file *file, poll_table 
  * registration of sequencer minor device
  */
 
-static struct file_operations seq_oss_f_ops =
+static const struct file_operations seq_oss_f_ops =
 {
 	.owner =	THIS_MODULE,
 	.read =		odev_read,
Index: linux-2.6/sound/core/seq/seq_clientmgr.c
===================================================================
--- linux-2.6.orig/sound/core/seq/seq_clientmgr.c
+++ linux-2.6/sound/core/seq/seq_clientmgr.c
@@ -2542,7 +2542,7 @@ void snd_seq_info_clients_read(struct sn
  *  REGISTRATION PART
  */
 
-static struct file_operations snd_seq_f_ops =
+static const struct file_operations snd_seq_f_ops =
 {
 	.owner =	THIS_MODULE,
 	.read =		snd_seq_read,
Index: linux-2.6/sound/core/sound.c
===================================================================
--- linux-2.6.orig/sound/core/sound.c
+++ linux-2.6/sound/core/sound.c
@@ -168,7 +168,7 @@ static int snd_open(struct inode *inode,
 	return err;
 }
 
-static struct file_operations snd_fops =
+static const struct file_operations snd_fops =
 {
 	.owner =	THIS_MODULE,
 	.open =		snd_open
Index: linux-2.6/sound/core/timer.c
===================================================================
--- linux-2.6.orig/sound/core/timer.c
+++ linux-2.6/sound/core/timer.c
@@ -1931,7 +1931,7 @@ static unsigned int snd_timer_user_poll(
 #define snd_timer_user_ioctl_compat	NULL
 #endif
 
-static struct file_operations snd_timer_f_ops =
+static const struct file_operations snd_timer_f_ops =
 {
 	.owner =	THIS_MODULE,
 	.read =		snd_timer_user_read,
Index: linux-2.6/sound/oss/ad1889.c
===================================================================
--- linux-2.6.orig/sound/oss/ad1889.c
+++ linux-2.6/sound/oss/ad1889.c
@@ -778,7 +778,7 @@ static int ad1889_release(struct inode *
 	return 0;
 }
 
-static struct file_operations ad1889_fops = {
+static const struct file_operations ad1889_fops = {
 	.owner		= THIS_MODULE,
 	.llseek		= no_llseek,
 	.read		= ad1889_read,
@@ -812,7 +812,7 @@ static int ad1889_mixer_ioctl(struct ino
 	return codec->mixer_ioctl(codec, cmd, arg);
 }
 
-static struct file_operations ad1889_mixer_fops = {
+static const struct file_operations ad1889_mixer_fops = {
 	.owner		= THIS_MODULE,
 	.llseek		= no_llseek,
 	.ioctl		= ad1889_mixer_ioctl,
Index: linux-2.6/sound/oss/btaudio.c
===================================================================
--- linux-2.6.orig/sound/oss/btaudio.c
+++ linux-2.6/sound/oss/btaudio.c
@@ -429,7 +429,7 @@ static int btaudio_mixer_ioctl(struct in
 	return 0;
 }
 
-static struct file_operations btaudio_mixer_fops = {
+static const struct file_operations btaudio_mixer_fops = {
 	.owner		= THIS_MODULE,
 	.llseek		= no_llseek,
 	.open		= btaudio_mixer_open,
@@ -796,7 +796,7 @@ static unsigned int btaudio_dsp_poll(str
 	return mask;
 }
 
-static struct file_operations btaudio_digital_dsp_fops = {
+static const struct file_operations btaudio_digital_dsp_fops = {
 	.owner		= THIS_MODULE,
 	.llseek		= no_llseek,
 	.open		= btaudio_dsp_open_digital,
@@ -807,7 +807,7 @@ static struct file_operations btaudio_di
 	.poll		= btaudio_dsp_poll,
 };
 
-static struct file_operations btaudio_analog_dsp_fops = {
+static const struct file_operations btaudio_analog_dsp_fops = {
 	.owner		= THIS_MODULE,
 	.llseek		= no_llseek,
 	.open		= btaudio_dsp_open_analog,
Index: linux-2.6/sound/oss/dmasound/dmasound_core.c
===================================================================
--- linux-2.6.orig/sound/oss/dmasound/dmasound_core.c
+++ linux-2.6/sound/oss/dmasound/dmasound_core.c
@@ -371,7 +371,7 @@ static int mixer_ioctl(struct inode *ino
 	return -EINVAL;
 }
 
-static struct file_operations mixer_fops =
+static const struct file_operations mixer_fops =
 {
 	.owner		= THIS_MODULE,
 	.llseek		= no_llseek,
@@ -1337,7 +1337,7 @@ static int sq_ioctl(struct inode *inode,
 	return -EINVAL;
 }
 
-static struct file_operations sq_fops =
+static const struct file_operations sq_fops =
 {
 	.owner		= THIS_MODULE,
 	.llseek		= no_llseek,
@@ -1561,7 +1561,7 @@ static ssize_t state_read(struct file *f
 	return n;
 }
 
-static struct file_operations state_fops = {
+static const struct file_operations state_fops = {
 	.owner		= THIS_MODULE,
 	.llseek		= no_llseek,
 	.read		= state_read,
Index: linux-2.6/sound/oss/emu10k1/audio.c
===================================================================
--- linux-2.6.orig/sound/oss/emu10k1/audio.c
+++ linux-2.6/sound/oss/emu10k1/audio.c
@@ -1582,7 +1582,7 @@ static void emu10k1_waveout_bh(unsigned 
 	return;
 }
 
-struct file_operations emu10k1_audio_fops = {
+const struct file_operations emu10k1_audio_fops = {
 	.owner		= THIS_MODULE,
 	.llseek		= no_llseek,
 	.read		= emu10k1_audio_read,
Index: linux-2.6/sound/oss/emu10k1/midi.c
===================================================================
--- linux-2.6.orig/sound/oss/emu10k1/midi.c
+++ linux-2.6/sound/oss/emu10k1/midi.c
@@ -458,7 +458,7 @@ int emu10k1_midi_callback(unsigned long 
 }
 
 /* MIDI file operations */
-struct file_operations emu10k1_midi_fops = {
+const struct file_operations emu10k1_midi_fops = {
 	.owner		= THIS_MODULE,
 	.read		= emu10k1_midi_read,
 	.write		= emu10k1_midi_write,
Index: linux-2.6/sound/oss/emu10k1/mixer.c
===================================================================
--- linux-2.6.orig/sound/oss/emu10k1/mixer.c
+++ linux-2.6/sound/oss/emu10k1/mixer.c
@@ -681,7 +681,7 @@ static int emu10k1_mixer_release(struct 
 	return 0;
 }
 
-struct file_operations emu10k1_mixer_fops = {
+const struct file_operations emu10k1_mixer_fops = {
 	.owner		= THIS_MODULE,
 	.llseek		= no_llseek,
 	.ioctl		= emu10k1_mixer_ioctl,
Index: linux-2.6/sound/oss/hal2.c
===================================================================
--- linux-2.6.orig/sound/oss/hal2.c
+++ linux-2.6/sound/oss/hal2.c
@@ -1377,7 +1377,7 @@ static int hal2_release(struct inode *in
 	return 0;
 }
 
-static struct file_operations hal2_audio_fops = {
+static const struct file_operations hal2_audio_fops = {
 	.owner		= THIS_MODULE,
 	.llseek		= no_llseek,
 	.read		= hal2_read,
@@ -1388,7 +1388,7 @@ static struct file_operations hal2_audio
 	.release	= hal2_release,
 };
 
-static struct file_operations hal2_mixer_fops = {
+static const struct file_operations hal2_mixer_fops = {
 	.owner		= THIS_MODULE,
 	.llseek		= no_llseek,
 	.ioctl		= hal2_ioctl_mixdev,
Index: linux-2.6/sound/oss/msnd_pinnacle.c
===================================================================
--- linux-2.6.orig/sound/oss/msnd_pinnacle.c
+++ linux-2.6/sound/oss/msnd_pinnacle.c
@@ -1106,7 +1106,7 @@ static irqreturn_t intr(int irq, void *d
 	return IRQ_HANDLED;
 }
 
-static struct file_operations dev_fileops = {
+static const struct file_operations dev_fileops = {
 	.owner		= THIS_MODULE,
 	.read		= dev_read,
 	.write		= dev_write,
Index: linux-2.6/sound/oss/os.h
===================================================================
--- linux-2.6.orig/sound/oss/os.h
+++ linux-2.6/sound/oss/os.h
@@ -43,4 +43,4 @@ extern int sound_nblocks;
 #undef PSEUDO_DMA_AUTOINIT
 #define ALLOW_BUFFER_MAPPING
 
-extern struct file_operations oss_sound_fops;
+extern const struct file_operations oss_sound_fops;
Index: linux-2.6/sound/oss/sh_dac_audio.c
===================================================================
--- linux-2.6.orig/sound/oss/sh_dac_audio.c
+++ linux-2.6/sound/oss/sh_dac_audio.c
@@ -255,7 +255,7 @@ static int dac_audio_release(struct inod
 	return 0;
 }
 
-struct file_operations dac_audio_fops = {
+const struct file_operations dac_audio_fops = {
       .read =		dac_audio_read,
       .write =	dac_audio_write,
       .ioctl =	dac_audio_ioctl,
Index: linux-2.6/sound/oss/soundcard.c
===================================================================
--- linux-2.6.orig/sound/oss/soundcard.c
+++ linux-2.6/sound/oss/soundcard.c
@@ -482,7 +482,7 @@ static int sound_mmap(struct file *file,
 	return 0;
 }
 
-struct file_operations oss_sound_fops = {
+const struct file_operations oss_sound_fops = {
 	.owner		= THIS_MODULE,
 	.llseek		= no_llseek,
 	.read		= sound_read,
Index: linux-2.6/sound/oss/via82cxxx_audio.c
===================================================================
--- linux-2.6.orig/sound/oss/via82cxxx_audio.c
+++ linux-2.6/sound/oss/via82cxxx_audio.c
@@ -1619,7 +1619,7 @@ out:
 }
 
 
-static struct file_operations via_mixer_fops = {
+static const struct file_operations via_mixer_fops = {
 	.owner		= THIS_MODULE,
 	.open		= via_mixer_open,
 	.llseek		= no_llseek,
@@ -2042,7 +2042,7 @@ static int via_interrupt_init (struct vi
  *
  */
 
-static struct file_operations via_dsp_fops = {
+static const struct file_operations via_dsp_fops = {
 	.owner		= THIS_MODULE,
 	.open		= via_dsp_open,
 	.release	= via_dsp_release,
Index: linux-2.6/sound/oss/vwsnd.c
===================================================================
--- linux-2.6.orig/sound/oss/vwsnd.c
+++ linux-2.6/sound/oss/vwsnd.c
@@ -3035,7 +3035,7 @@ static int vwsnd_audio_release(struct in
 	return err;
 }
 
-static struct file_operations vwsnd_audio_fops = {
+static const struct file_operations vwsnd_audio_fops = {
 	.owner =	THIS_MODULE,
 	.llseek =	no_llseek,
 	.read =		vwsnd_audio_read,
@@ -3225,7 +3225,7 @@ static int vwsnd_mixer_ioctl(struct inod
 	return retval;
 }
 
-static struct file_operations vwsnd_mixer_fops = {
+static const struct file_operations vwsnd_mixer_fops = {
 	.owner =	THIS_MODULE,
 	.llseek =	no_llseek,
 	.ioctl =	vwsnd_mixer_ioctl,
Index: linux-2.6/sound/sound_core.c
===================================================================
--- linux-2.6.orig/sound/sound_core.c
+++ linux-2.6/sound/sound_core.c
@@ -436,7 +436,7 @@ EXPORT_SYMBOL(unregister_sound_dsp);
 
 static int soundcore_open(struct inode *, struct file *);
 
-static struct file_operations soundcore_fops=
+static const struct file_operations soundcore_fops=
 {
 	/* We must have an owner or the module locking fails */
 	.owner	= THIS_MODULE,
Index: linux-2.6/drivers/s390/char/tape_class.c
===================================================================
--- linux-2.6.orig/drivers/s390/char/tape_class.c
+++ linux-2.6/drivers/s390/char/tape_class.c
@@ -36,7 +36,7 @@ static struct class *tape_class;
 struct tape_class_device *register_tape_dev(
 	struct device *		device,
 	dev_t			dev,
-	struct file_operations *fops,
+	const struct file_operations *fops,
 	char *			device_name,
 	char *			mode_name)
 {
Index: linux-2.6/drivers/s390/char/tape_class.h
===================================================================
--- linux-2.6.orig/drivers/s390/char/tape_class.h
+++ linux-2.6/drivers/s390/char/tape_class.h
@@ -52,7 +52,7 @@ struct tape_class_device {
 struct tape_class_device *register_tape_dev(
 	struct device *		device,
 	dev_t			dev,
-	struct file_operations *fops,
+	const struct file_operations *fops,
 	char *			device_name,
 	char *			node_name
 );
Index: linux-2.6/arch/powerpc/platforms/cell/spufs/spufs.h
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/cell/spufs/spufs.h
+++ linux-2.6/arch/powerpc/platforms/cell/spufs/spufs.h
@@ -149,7 +149,7 @@ long spufs_run_spu(struct file *file,
 		   struct spu_context *ctx, u32 *npc, u32 *status);
 long spufs_create(struct nameidata *nd,
 			 unsigned int flags, mode_t mode);
-extern struct file_operations spufs_context_fops;
+extern const struct file_operations spufs_context_fops;
 
 /* gang management */
 struct spu_gang *alloc_spu_gang(void);



^ permalink raw reply	[flat|nested] 17+ messages in thread

* [patch 10/12] mark struct inode_operations const 1
  2007-01-14  0:51 Patch series to mark struct file_operations and struct inode_operations const Arjan van de Ven
                   ` (9 preceding siblings ...)
  2007-01-14  0:57 ` [patch 09/12] mark struct file_operations const 9 Arjan van de Ven
@ 2007-01-14  0:57 ` Arjan van de Ven
  2007-01-14  0:58 ` [patch 11/12] mark struct inode_operations const 2 Arjan van de Ven
  2007-01-14  0:58 ` [patch 12/12] mark struct inode_operations const 3 Arjan van de Ven
  12 siblings, 0 replies; 17+ messages in thread
From: Arjan van de Ven @ 2007-01-14  0:57 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm

From: Arjan van de Ven <arjan@linux.intel.com>
Subject: [patch 10/12] mark struct inode_operations const

Many struct inode_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>

Index: linux-2.6.20-rc4/arch/powerpc/platforms/cell/spufs/inode.c
===================================================================
--- linux-2.6.20-rc4.orig/arch/powerpc/platforms/cell/spufs/inode.c
+++ linux-2.6.20-rc4/arch/powerpc/platforms/cell/spufs/inode.c
@@ -220,7 +220,7 @@ static int spufs_dir_close(struct inode 
 	return dcache_dir_close(inode, file);
 }
 
-struct inode_operations spufs_dir_inode_operations = {
+const struct inode_operations spufs_dir_inode_operations = {
 	.lookup = simple_lookup,
 };
 
Index: linux-2.6.20-rc4/fs/9p/vfs_inode.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/9p/vfs_inode.c
+++ linux-2.6.20-rc4/fs/9p/vfs_inode.c
@@ -41,10 +41,10 @@
 #include "v9fs_vfs.h"
 #include "fid.h"
 
-static struct inode_operations v9fs_dir_inode_operations;
-static struct inode_operations v9fs_dir_inode_operations_ext;
-static struct inode_operations v9fs_file_inode_operations;
-static struct inode_operations v9fs_symlink_inode_operations;
+static const struct inode_operations v9fs_dir_inode_operations;
+static const struct inode_operations v9fs_dir_inode_operations_ext;
+static const struct inode_operations v9fs_file_inode_operations;
+static const struct inode_operations v9fs_symlink_inode_operations;
 
 /**
  * unixmode2p9mode - convert unix mode bits to plan 9
@@ -1274,7 +1274,7 @@ v9fs_vfs_mknod(struct inode *dir, struct
 	return retval;
 }
 
-static struct inode_operations v9fs_dir_inode_operations_ext = {
+static const struct inode_operations v9fs_dir_inode_operations_ext = {
 	.create = v9fs_vfs_create,
 	.lookup = v9fs_vfs_lookup,
 	.symlink = v9fs_vfs_symlink,
@@ -1289,7 +1289,7 @@ static struct inode_operations v9fs_dir_
 	.setattr = v9fs_vfs_setattr,
 };
 
-static struct inode_operations v9fs_dir_inode_operations = {
+static const struct inode_operations v9fs_dir_inode_operations = {
 	.create = v9fs_vfs_create,
 	.lookup = v9fs_vfs_lookup,
 	.unlink = v9fs_vfs_unlink,
@@ -1301,12 +1301,12 @@ static struct inode_operations v9fs_dir_
 	.setattr = v9fs_vfs_setattr,
 };
 
-static struct inode_operations v9fs_file_inode_operations = {
+static const struct inode_operations v9fs_file_inode_operations = {
 	.getattr = v9fs_vfs_getattr,
 	.setattr = v9fs_vfs_setattr,
 };
 
-static struct inode_operations v9fs_symlink_inode_operations = {
+static const struct inode_operations v9fs_symlink_inode_operations = {
 	.readlink = v9fs_vfs_readlink,
 	.follow_link = v9fs_vfs_follow_link,
 	.put_link = v9fs_vfs_put_link,
Index: linux-2.6.20-rc4/fs/adfs/adfs.h
===================================================================
--- linux-2.6.20-rc4.orig/fs/adfs/adfs.h
+++ linux-2.6.20-rc4/fs/adfs/adfs.h
@@ -84,7 +84,7 @@ void __adfs_error(struct super_block *sb
  */
 
 /* dir_*.c */
-extern struct inode_operations adfs_dir_inode_operations;
+extern const struct inode_operations adfs_dir_inode_operations;
 extern const struct file_operations adfs_dir_operations;
 extern struct dentry_operations adfs_dentry_operations;
 extern struct adfs_dir_ops adfs_f_dir_ops;
@@ -93,7 +93,7 @@ extern struct adfs_dir_ops adfs_fplus_di
 extern int adfs_dir_update(struct super_block *sb, struct object_info *obj);
 
 /* file.c */
-extern struct inode_operations adfs_file_inode_operations;
+extern const struct inode_operations adfs_file_inode_operations;
 extern const struct file_operations adfs_file_operations;
 
 static inline __u32 signed_asl(__u32 val, signed int shift)
Index: linux-2.6.20-rc4/fs/adfs/dir.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/adfs/dir.c
+++ linux-2.6.20-rc4/fs/adfs/dir.c
@@ -295,7 +295,7 @@ adfs_lookup(struct inode *dir, struct de
 /*
  * directories can handle most operations...
  */
-struct inode_operations adfs_dir_inode_operations = {
+const struct inode_operations adfs_dir_inode_operations = {
 	.lookup		= adfs_lookup,
 	.setattr	= adfs_notify_change,
 };
Index: linux-2.6.20-rc4/fs/adfs/file.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/adfs/file.c
+++ linux-2.6.20-rc4/fs/adfs/file.c
@@ -36,6 +36,6 @@ const struct file_operations adfs_file_o
 	.sendfile	= generic_file_sendfile,
 };
 
-struct inode_operations adfs_file_inode_operations = {
+const struct inode_operations adfs_file_inode_operations = {
 	.setattr	= adfs_notify_change,
 };
Index: linux-2.6.20-rc4/fs/affs/affs.h
===================================================================
--- linux-2.6.20-rc4.orig/fs/affs/affs.h
+++ linux-2.6.20-rc4/fs/affs/affs.h
@@ -188,9 +188,9 @@ extern void   affs_dir_truncate(struct i
 
 /* jump tables */
 
-extern struct inode_operations	 affs_file_inode_operations;
-extern struct inode_operations	 affs_dir_inode_operations;
-extern struct inode_operations   affs_symlink_inode_operations;
+extern const struct inode_operations	 affs_file_inode_operations;
+extern const struct inode_operations	 affs_dir_inode_operations;
+extern const struct inode_operations   affs_symlink_inode_operations;
 extern const struct file_operations	 affs_file_operations;
 extern const struct file_operations	 affs_file_operations_ofs;
 extern const struct file_operations	 affs_dir_operations;
Index: linux-2.6.20-rc4/fs/affs/dir.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/affs/dir.c
+++ linux-2.6.20-rc4/fs/affs/dir.c
@@ -26,7 +26,7 @@ const struct file_operations affs_dir_op
 /*
  * directories can handle most operations...
  */
-struct inode_operations affs_dir_inode_operations = {
+const struct inode_operations affs_dir_inode_operations = {
 	.create		= affs_create,
 	.lookup		= affs_lookup,
 	.link		= affs_link,
Index: linux-2.6.20-rc4/fs/affs/file.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/affs/file.c
+++ linux-2.6.20-rc4/fs/affs/file.c
@@ -38,7 +38,7 @@ const struct file_operations affs_file_o
 	.sendfile	= generic_file_sendfile,
 };
 
-struct inode_operations affs_file_inode_operations = {
+const struct inode_operations affs_file_inode_operations = {
 	.truncate	= affs_truncate,
 	.setattr	= affs_notify_change,
 };
Index: linux-2.6.20-rc4/fs/affs/inode.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/affs/inode.c
+++ linux-2.6.20-rc4/fs/affs/inode.c
@@ -12,7 +12,7 @@
 
 #include "affs.h"
 
-extern struct inode_operations affs_symlink_inode_operations;
+extern const struct inode_operations affs_symlink_inode_operations;
 extern struct timezone sys_tz;
 
 void
Index: linux-2.6.20-rc4/fs/affs/symlink.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/affs/symlink.c
+++ linux-2.6.20-rc4/fs/affs/symlink.c
@@ -70,7 +70,7 @@ const struct address_space_operations af
 	.readpage	= affs_symlink_readpage,
 };
 
-struct inode_operations affs_symlink_inode_operations = {
+const struct inode_operations affs_symlink_inode_operations = {
 	.readlink	= generic_readlink,
 	.follow_link	= page_follow_link_light,
 	.put_link	= page_put_link,
Index: linux-2.6.20-rc4/fs/afs/dir.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/afs/dir.c
+++ linux-2.6.20-rc4/fs/afs/dir.c
@@ -37,7 +37,7 @@ const struct file_operations afs_dir_fil
 	.readdir	= afs_dir_readdir,
 };
 
-struct inode_operations afs_dir_inode_operations = {
+const struct inode_operations afs_dir_inode_operations = {
 	.lookup		= afs_dir_lookup,
 	.getattr	= afs_inode_getattr,
 #if 0 /* TODO */
Index: linux-2.6.20-rc4/fs/afs/file.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/afs/file.c
+++ linux-2.6.20-rc4/fs/afs/file.c
@@ -30,7 +30,7 @@ static int afs_file_readpage(struct file
 static void afs_file_invalidatepage(struct page *page, unsigned long offset);
 static int afs_file_releasepage(struct page *page, gfp_t gfp_flags);
 
-struct inode_operations afs_file_inode_operations = {
+const struct inode_operations afs_file_inode_operations = {
 	.getattr	= afs_inode_getattr,
 };
 
Index: linux-2.6.20-rc4/fs/afs/internal.h
===================================================================
--- linux-2.6.20-rc4.orig/fs/afs/internal.h
+++ linux-2.6.20-rc4/fs/afs/internal.h
@@ -63,14 +63,14 @@ extern struct cachefs_index_def afs_cach
 /*
  * dir.c
  */
-extern struct inode_operations afs_dir_inode_operations;
+extern const struct inode_operations afs_dir_inode_operations;
 extern const struct file_operations afs_dir_file_operations;
 
 /*
  * file.c
  */
 extern const struct address_space_operations afs_fs_aops;
-extern struct inode_operations afs_file_inode_operations;
+extern const struct inode_operations afs_file_inode_operations;
 
 #ifdef AFS_CACHING_SUPPORT
 extern int afs_cache_get_page_cookie(struct page *page,
@@ -104,7 +104,7 @@ extern struct cachefs_netfs afs_cache_ne
 /*
  * mntpt.c
  */
-extern struct inode_operations afs_mntpt_inode_operations;
+extern const struct inode_operations afs_mntpt_inode_operations;
 extern const struct file_operations afs_mntpt_file_operations;
 extern struct afs_timer afs_mntpt_expiry_timer;
 extern struct afs_timer_ops afs_mntpt_expiry_timer_ops;
Index: linux-2.6.20-rc4/fs/afs/mntpt.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/afs/mntpt.c
+++ linux-2.6.20-rc4/fs/afs/mntpt.c
@@ -36,7 +36,7 @@ const struct file_operations afs_mntpt_f
 	.open		= afs_mntpt_open,
 };
 
-struct inode_operations afs_mntpt_inode_operations = {
+const struct inode_operations afs_mntpt_inode_operations = {
 	.lookup		= afs_mntpt_lookup,
 	.follow_link	= afs_mntpt_follow_link,
 	.readlink	= page_readlink,
Index: linux-2.6.20-rc4/fs/autofs/autofs_i.h
===================================================================
--- linux-2.6.20-rc4.orig/fs/autofs/autofs_i.h
+++ linux-2.6.20-rc4/fs/autofs/autofs_i.h
@@ -142,8 +142,8 @@ struct autofs_dir_ent *autofs_expire(str
 
 /* Operations structures */
 
-extern struct inode_operations autofs_root_inode_operations;
-extern struct inode_operations autofs_symlink_inode_operations;
+extern const struct inode_operations autofs_root_inode_operations;
+extern const struct inode_operations autofs_symlink_inode_operations;
 extern const struct file_operations autofs_root_operations;
 
 /* Initializing function */
Index: linux-2.6.20-rc4/fs/autofs/root.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/autofs/root.c
+++ linux-2.6.20-rc4/fs/autofs/root.c
@@ -32,7 +32,7 @@ const struct file_operations autofs_root
 	.ioctl		= autofs_root_ioctl,
 };
 
-struct inode_operations autofs_root_inode_operations = {
+const struct inode_operations autofs_root_inode_operations = {
         .lookup		= autofs_root_lookup,
         .unlink		= autofs_root_unlink,
         .symlink	= autofs_root_symlink,
Index: linux-2.6.20-rc4/fs/autofs/symlink.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/autofs/symlink.c
+++ linux-2.6.20-rc4/fs/autofs/symlink.c
@@ -20,7 +20,7 @@ static void *autofs_follow_link(struct d
 	return NULL;
 }
 
-struct inode_operations autofs_symlink_inode_operations = {
+const struct inode_operations autofs_symlink_inode_operations = {
 	.readlink	= generic_readlink,
 	.follow_link	= autofs_follow_link
 };
Index: linux-2.6.20-rc4/fs/autofs4/autofs_i.h
===================================================================
--- linux-2.6.20-rc4.orig/fs/autofs4/autofs_i.h
+++ linux-2.6.20-rc4/fs/autofs4/autofs_i.h
@@ -168,11 +168,11 @@ int autofs4_expire_multi(struct super_bl
 
 /* Operations structures */
 
-extern struct inode_operations autofs4_symlink_inode_operations;
-extern struct inode_operations autofs4_dir_inode_operations;
-extern struct inode_operations autofs4_root_inode_operations;
-extern struct inode_operations autofs4_indirect_root_inode_operations;
-extern struct inode_operations autofs4_direct_root_inode_operations;
+extern const struct inode_operations autofs4_symlink_inode_operations;
+extern const struct inode_operations autofs4_dir_inode_operations;
+extern const struct inode_operations autofs4_root_inode_operations;
+extern const struct inode_operations autofs4_indirect_root_inode_operations;
+extern const struct inode_operations autofs4_direct_root_inode_operations;
 extern const struct file_operations autofs4_dir_operations;
 extern const struct file_operations autofs4_root_operations;
 
Index: linux-2.6.20-rc4/fs/autofs4/root.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/autofs4/root.c
+++ linux-2.6.20-rc4/fs/autofs4/root.c
@@ -47,7 +47,7 @@ const struct file_operations autofs4_dir
 	.readdir	= autofs4_dir_readdir,
 };
 
-struct inode_operations autofs4_indirect_root_inode_operations = {
+const struct inode_operations autofs4_indirect_root_inode_operations = {
 	.lookup		= autofs4_lookup,
 	.unlink		= autofs4_dir_unlink,
 	.symlink	= autofs4_dir_symlink,
@@ -55,7 +55,7 @@ struct inode_operations autofs4_indirect
 	.rmdir		= autofs4_dir_rmdir,
 };
 
-struct inode_operations autofs4_direct_root_inode_operations = {
+const struct inode_operations autofs4_direct_root_inode_operations = {
 	.lookup		= autofs4_lookup,
 	.unlink		= autofs4_dir_unlink,
 	.mkdir		= autofs4_dir_mkdir,
@@ -63,7 +63,7 @@ struct inode_operations autofs4_direct_r
 	.follow_link	= autofs4_follow_link,
 };
 
-struct inode_operations autofs4_dir_inode_operations = {
+const struct inode_operations autofs4_dir_inode_operations = {
 	.lookup		= autofs4_lookup,
 	.unlink		= autofs4_dir_unlink,
 	.symlink	= autofs4_dir_symlink,
Index: linux-2.6.20-rc4/fs/autofs4/symlink.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/autofs4/symlink.c
+++ linux-2.6.20-rc4/fs/autofs4/symlink.c
@@ -19,7 +19,7 @@ static void *autofs4_follow_link(struct 
 	return NULL;
 }
 
-struct inode_operations autofs4_symlink_inode_operations = {
+const struct inode_operations autofs4_symlink_inode_operations = {
 	.readlink	= generic_readlink,
 	.follow_link	= autofs4_follow_link
 };
Index: linux-2.6.20-rc4/fs/bad_inode.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/bad_inode.c
+++ linux-2.6.20-rc4/fs/bad_inode.c
@@ -291,7 +291,7 @@ static int bad_inode_removexattr(struct 
 	return -EIO;
 }
 
-static struct inode_operations bad_inode_ops =
+static const struct inode_operations bad_inode_ops =
 {
 	.create		= bad_inode_create,
 	.lookup		= bad_inode_lookup,
Index: linux-2.6.20-rc4/fs/befs/linuxvfs.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/befs/linuxvfs.c
+++ linux-2.6.20-rc4/fs/befs/linuxvfs.c
@@ -68,7 +68,7 @@ static const struct file_operations befs
 	.readdir	= befs_readdir,
 };
 
-static struct inode_operations befs_dir_inode_operations = {
+static const struct inode_operations befs_dir_inode_operations = {
 	.lookup		= befs_lookup,
 };
 
@@ -78,7 +78,7 @@ static const struct address_space_operat
 	.bmap		= befs_bmap,
 };
 
-static struct inode_operations befs_symlink_inode_operations = {
+static const struct inode_operations befs_symlink_inode_operations = {
 	.readlink	= generic_readlink,
 	.follow_link	= befs_follow_link,
 	.put_link	= befs_put_link,
Index: linux-2.6.20-rc4/fs/bfs/bfs.h
===================================================================
--- linux-2.6.20-rc4.orig/fs/bfs/bfs.h
+++ linux-2.6.20-rc4/fs/bfs/bfs.h
@@ -48,12 +48,12 @@ static inline struct bfs_inode_info *BFS
 
 
 /* file.c */
-extern struct inode_operations bfs_file_inops;
+extern const struct inode_operations bfs_file_inops;
 extern const struct file_operations bfs_file_operations;
 extern const struct address_space_operations bfs_aops;
 
 /* dir.c */
-extern struct inode_operations bfs_dir_inops;
+extern const struct inode_operations bfs_dir_inops;
 extern const struct file_operations bfs_dir_operations;
 
 #endif /* _FS_BFS_BFS_H */
Index: linux-2.6.20-rc4/fs/bfs/dir.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/bfs/dir.c
+++ linux-2.6.20-rc4/fs/bfs/dir.c
@@ -260,7 +260,7 @@ end_rename:
 	return error;
 }
 
-struct inode_operations bfs_dir_inops = {
+const struct inode_operations bfs_dir_inops = {
 	.create			= bfs_create,
 	.lookup			= bfs_lookup,
 	.link			= bfs_link,
Index: linux-2.6.20-rc4/fs/bfs/file.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/bfs/file.c
+++ linux-2.6.20-rc4/fs/bfs/file.c
@@ -164,4 +164,4 @@ const struct address_space_operations bf
 	.bmap		= bfs_bmap,
 };
 
-struct inode_operations bfs_file_inops;
+const struct inode_operations bfs_file_inops;
Index: linux-2.6.20-rc4/fs/cifs/cifsfs.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/cifs/cifsfs.c
+++ linux-2.6.20-rc4/fs/cifs/cifsfs.c
@@ -525,7 +525,7 @@ static struct file_system_type cifs_fs_t
 	.kill_sb = kill_anon_super,
 	/*  .fs_flags */
 };
-struct inode_operations cifs_dir_inode_ops = {
+const struct inode_operations cifs_dir_inode_ops = {
 	.create = cifs_create,
 	.lookup = cifs_lookup,
 	.getattr = cifs_getattr,
@@ -547,7 +547,7 @@ struct inode_operations cifs_dir_inode_o
 #endif
 };
 
-struct inode_operations cifs_file_inode_ops = {
+const struct inode_operations cifs_file_inode_ops = {
 /*	revalidate:cifs_revalidate, */
 	.setattr = cifs_setattr,
 	.getattr = cifs_getattr, /* do we need this anymore? */
@@ -561,7 +561,7 @@ struct inode_operations cifs_file_inode_
 #endif 
 };
 
-struct inode_operations cifs_symlink_inode_ops = {
+const struct inode_operations cifs_symlink_inode_ops = {
 	.readlink = generic_readlink, 
 	.follow_link = cifs_follow_link,
 	.put_link = cifs_put_link,
Index: linux-2.6.20-rc4/fs/cifs/cifsfs.h
===================================================================
--- linux-2.6.20-rc4.orig/fs/cifs/cifsfs.h
+++ linux-2.6.20-rc4/fs/cifs/cifsfs.h
@@ -42,7 +42,7 @@ extern void cifs_delete_inode(struct ino
 /* extern void cifs_write_inode(struct inode *); *//* BB not needed yet */
 
 /* Functions related to inodes */
-extern struct inode_operations cifs_dir_inode_ops;
+extern const struct inode_operations cifs_dir_inode_ops;
 extern int cifs_create(struct inode *, struct dentry *, int, 
 		       struct nameidata *);
 extern struct dentry * cifs_lookup(struct inode *, struct dentry *,
@@ -58,8 +58,8 @@ extern int cifs_revalidate(struct dentry
 extern int cifs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
 extern int cifs_setattr(struct dentry *, struct iattr *);
 
-extern struct inode_operations cifs_file_inode_ops;
-extern struct inode_operations cifs_symlink_inode_ops;
+extern const struct inode_operations cifs_file_inode_ops;
+extern const struct inode_operations cifs_symlink_inode_ops;
 
 /* Functions related to files and directories */
 extern const struct file_operations cifs_file_ops;
Index: linux-2.6.20-rc4/fs/coda/cnode.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/coda/cnode.c
+++ linux-2.6.20-rc4/fs/coda/cnode.c
@@ -16,7 +16,7 @@ static inline int coda_fideq(struct Coda
 	return memcmp(fid1, fid2, sizeof(*fid1)) == 0;
 }
 
-static struct inode_operations coda_symlink_inode_operations = {
+static const struct inode_operations coda_symlink_inode_operations = {
 	.readlink	= generic_readlink,
 	.follow_link	= page_follow_link_light,
 	.put_link	= page_put_link,
Index: linux-2.6.20-rc4/fs/coda/dir.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/coda/dir.c
+++ linux-2.6.20-rc4/fs/coda/dir.c
@@ -66,7 +66,7 @@ static struct dentry_operations coda_den
 	.d_delete	= coda_dentry_delete,
 };
 
-struct inode_operations coda_dir_inode_operations =
+const struct inode_operations coda_dir_inode_operations =
 {
 	.create		= coda_create,
 	.lookup		= coda_lookup,
Index: linux-2.6.20-rc4/fs/coda/inode.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/coda/inode.c
+++ linux-2.6.20-rc4/fs/coda/inode.c
@@ -271,7 +271,7 @@ int coda_setattr(struct dentry *de, stru
 	return error;
 }
 
-struct inode_operations coda_file_inode_operations = {
+const struct inode_operations coda_file_inode_operations = {
 	.permission	= coda_permission,
 	.getattr	= coda_getattr,
 	.setattr	= coda_setattr,
Index: linux-2.6.20-rc4/fs/coda/pioctl.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/coda/pioctl.c
+++ linux-2.6.20-rc4/fs/coda/pioctl.c
@@ -30,7 +30,7 @@ static int coda_pioctl(struct inode * in
                        unsigned int cmd, unsigned long user_data);
 
 /* exported from this file */
-struct inode_operations coda_ioctl_inode_operations =
+const struct inode_operations coda_ioctl_inode_operations =
 {
 	.permission	= coda_ioctl_permission,
 	.setattr	= coda_setattr,
Index: linux-2.6.20-rc4/fs/configfs/configfs_internal.h
===================================================================
--- linux-2.6.20-rc4.orig/fs/configfs/configfs_internal.h
+++ linux-2.6.20-rc4/fs/configfs/configfs_internal.h
@@ -75,8 +75,8 @@ extern struct super_block * configfs_sb;
 extern const struct file_operations configfs_dir_operations;
 extern const struct file_operations configfs_file_operations;
 extern const struct file_operations bin_fops;
-extern struct inode_operations configfs_dir_inode_operations;
-extern struct inode_operations configfs_symlink_inode_operations;
+extern const struct inode_operations configfs_dir_inode_operations;
+extern const struct inode_operations configfs_symlink_inode_operations;
 
 extern int configfs_symlink(struct inode *dir, struct dentry *dentry,
 			    const char *symname);
Index: linux-2.6.20-rc4/fs/configfs/dir.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/configfs/dir.c
+++ linux-2.6.20-rc4/fs/configfs/dir.c
@@ -931,7 +931,7 @@ static int configfs_rmdir(struct inode *
 	return 0;
 }
 
-struct inode_operations configfs_dir_inode_operations = {
+const struct inode_operations configfs_dir_inode_operations = {
 	.mkdir		= configfs_mkdir,
 	.rmdir		= configfs_rmdir,
 	.symlink	= configfs_symlink,
Index: linux-2.6.20-rc4/fs/configfs/inode.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/configfs/inode.c
+++ linux-2.6.20-rc4/fs/configfs/inode.c
@@ -49,7 +49,7 @@ static struct backing_dev_info configfs_
 	.capabilities	= BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_WRITEBACK,
 };
 
-static struct inode_operations configfs_inode_operations ={
+static const struct inode_operations configfs_inode_operations ={
 	.setattr	= configfs_setattr,
 };
 
Index: linux-2.6.20-rc4/fs/configfs/symlink.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/configfs/symlink.c
+++ linux-2.6.20-rc4/fs/configfs/symlink.c
@@ -272,7 +272,7 @@ static void configfs_put_link(struct den
 	}
 }
 
-struct inode_operations configfs_symlink_inode_operations = {
+const struct inode_operations configfs_symlink_inode_operations = {
 	.follow_link = configfs_follow_link,
 	.readlink = generic_readlink,
 	.put_link = configfs_put_link,
Index: linux-2.6.20-rc4/fs/cramfs/inode.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/cramfs/inode.c
+++ linux-2.6.20-rc4/fs/cramfs/inode.c
@@ -28,7 +28,7 @@
 #include <asm/uaccess.h>
 
 static struct super_operations cramfs_ops;
-static struct inode_operations cramfs_dir_inode_operations;
+static const struct inode_operations cramfs_dir_inode_operations;
 static const struct file_operations cramfs_directory_operations;
 static const struct address_space_operations cramfs_aops;
 
@@ -518,7 +518,7 @@ static const struct file_operations cram
 	.readdir	= cramfs_readdir,
 };
 
-static struct inode_operations cramfs_dir_inode_operations = {
+static const struct inode_operations cramfs_dir_inode_operations = {
 	.lookup		= cramfs_lookup,
 };
 
Index: linux-2.6.20-rc4/fs/ecryptfs/ecryptfs_kernel.h
===================================================================
--- linux-2.6.20-rc4.orig/fs/ecryptfs/ecryptfs_kernel.h
+++ linux-2.6.20-rc4/fs/ecryptfs/ecryptfs_kernel.h
@@ -385,9 +385,9 @@ void __ecryptfs_printk(const char *fmt, 
 
 extern const struct file_operations ecryptfs_main_fops;
 extern const struct file_operations ecryptfs_dir_fops;
-extern struct inode_operations ecryptfs_main_iops;
-extern struct inode_operations ecryptfs_dir_iops;
-extern struct inode_operations ecryptfs_symlink_iops;
+extern const struct inode_operations ecryptfs_main_iops;
+extern const struct inode_operations ecryptfs_dir_iops;
+extern const struct inode_operations ecryptfs_symlink_iops;
 extern struct super_operations ecryptfs_sops;
 extern struct dentry_operations ecryptfs_dops;
 extern struct address_space_operations ecryptfs_aops;
Index: linux-2.6.20-rc4/fs/ecryptfs/inode.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/ecryptfs/inode.c
+++ linux-2.6.20-rc4/fs/ecryptfs/inode.c
@@ -972,7 +972,7 @@ int ecryptfs_inode_set(struct inode *ino
 	return 0;
 }
 
-struct inode_operations ecryptfs_symlink_iops = {
+const struct inode_operations ecryptfs_symlink_iops = {
 	.readlink = ecryptfs_readlink,
 	.follow_link = ecryptfs_follow_link,
 	.put_link = ecryptfs_put_link,
@@ -984,7 +984,7 @@ struct inode_operations ecryptfs_symlink
 	.removexattr = ecryptfs_removexattr
 };
 
-struct inode_operations ecryptfs_dir_iops = {
+const struct inode_operations ecryptfs_dir_iops = {
 	.create = ecryptfs_create,
 	.lookup = ecryptfs_lookup,
 	.link = ecryptfs_link,
@@ -1002,7 +1002,7 @@ struct inode_operations ecryptfs_dir_iop
 	.removexattr = ecryptfs_removexattr
 };
 
-struct inode_operations ecryptfs_main_iops = {
+const struct inode_operations ecryptfs_main_iops = {
 	.permission = ecryptfs_permission,
 	.setattr = ecryptfs_setattr,
 	.setxattr = ecryptfs_setxattr,
Index: linux-2.6.20-rc4/fs/efs/dir.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/efs/dir.c
+++ linux-2.6.20-rc4/fs/efs/dir.c
@@ -15,7 +15,7 @@ const struct file_operations efs_dir_ope
 	.readdir	= efs_readdir,
 };
 
-struct inode_operations efs_dir_inode_operations = {
+const struct inode_operations efs_dir_inode_operations = {
 	.lookup		= efs_lookup,
 };
 
Index: linux-2.6.20-rc4/fs/ext2/ext2.h
===================================================================
--- linux-2.6.20-rc4.orig/fs/ext2/ext2.h
+++ linux-2.6.20-rc4/fs/ext2/ext2.h
@@ -158,7 +158,7 @@ extern void ext2_write_super (struct sup
 extern const struct file_operations ext2_dir_operations;
 
 /* file.c */
-extern struct inode_operations ext2_file_inode_operations;
+extern const struct inode_operations ext2_file_inode_operations;
 extern const struct file_operations ext2_file_operations;
 extern const struct file_operations ext2_xip_file_operations;
 
@@ -168,9 +168,9 @@ extern const struct address_space_operat
 extern const struct address_space_operations ext2_nobh_aops;
 
 /* namei.c */
-extern struct inode_operations ext2_dir_inode_operations;
-extern struct inode_operations ext2_special_inode_operations;
+extern const struct inode_operations ext2_dir_inode_operations;
+extern const struct inode_operations ext2_special_inode_operations;
 
 /* symlink.c */
-extern struct inode_operations ext2_fast_symlink_inode_operations;
-extern struct inode_operations ext2_symlink_inode_operations;
+extern const struct inode_operations ext2_fast_symlink_inode_operations;
+extern const struct inode_operations ext2_symlink_inode_operations;
Index: linux-2.6.20-rc4/fs/ext2/file.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/ext2/file.c
+++ linux-2.6.20-rc4/fs/ext2/file.c
@@ -75,7 +75,7 @@ const struct file_operations ext2_xip_fi
 };
 #endif
 
-struct inode_operations ext2_file_inode_operations = {
+const struct inode_operations ext2_file_inode_operations = {
 	.truncate	= ext2_truncate,
 #ifdef CONFIG_EXT2_FS_XATTR
 	.setxattr	= generic_setxattr,
Index: linux-2.6.20-rc4/fs/ext2/namei.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/ext2/namei.c
+++ linux-2.6.20-rc4/fs/ext2/namei.c
@@ -373,7 +373,7 @@ out:
 	return err;
 }
 
-struct inode_operations ext2_dir_inode_operations = {
+const struct inode_operations ext2_dir_inode_operations = {
 	.create		= ext2_create,
 	.lookup		= ext2_lookup,
 	.link		= ext2_link,
@@ -393,7 +393,7 @@ struct inode_operations ext2_dir_inode_o
 	.permission	= ext2_permission,
 };
 
-struct inode_operations ext2_special_inode_operations = {
+const struct inode_operations ext2_special_inode_operations = {
 #ifdef CONFIG_EXT2_FS_XATTR
 	.setxattr	= generic_setxattr,
 	.getxattr	= generic_getxattr,
Index: linux-2.6.20-rc4/fs/ext2/symlink.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/ext2/symlink.c
+++ linux-2.6.20-rc4/fs/ext2/symlink.c
@@ -28,7 +28,7 @@ static void *ext2_follow_link(struct den
 	return NULL;
 }
 
-struct inode_operations ext2_symlink_inode_operations = {
+const struct inode_operations ext2_symlink_inode_operations = {
 	.readlink	= generic_readlink,
 	.follow_link	= page_follow_link_light,
 	.put_link	= page_put_link,
@@ -40,7 +40,7 @@ struct inode_operations ext2_symlink_ino
 #endif
 };
  
-struct inode_operations ext2_fast_symlink_inode_operations = {
+const struct inode_operations ext2_fast_symlink_inode_operations = {
 	.readlink	= generic_readlink,
 	.follow_link	= ext2_follow_link,
 #ifdef CONFIG_EXT2_FS_XATTR
Index: linux-2.6.20-rc4/fs/ext3/file.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/ext3/file.c
+++ linux-2.6.20-rc4/fs/ext3/file.c
@@ -125,7 +125,7 @@ const struct file_operations ext3_file_o
 	.splice_write	= generic_file_splice_write,
 };
 
-struct inode_operations ext3_file_inode_operations = {
+const struct inode_operations ext3_file_inode_operations = {
 	.truncate	= ext3_truncate,
 	.setattr	= ext3_setattr,
 #ifdef CONFIG_EXT3_FS_XATTR
Index: linux-2.6.20-rc4/fs/ext3/namei.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/ext3/namei.c
+++ linux-2.6.20-rc4/fs/ext3/namei.c
@@ -2374,7 +2374,7 @@ end_rename:
 /*
  * directories can handle most operations...
  */
-struct inode_operations ext3_dir_inode_operations = {
+const struct inode_operations ext3_dir_inode_operations = {
 	.create		= ext3_create,
 	.lookup		= ext3_lookup,
 	.link		= ext3_link,
@@ -2394,7 +2394,7 @@ struct inode_operations ext3_dir_inode_o
 	.permission	= ext3_permission,
 };
 
-struct inode_operations ext3_special_inode_operations = {
+const struct inode_operations ext3_special_inode_operations = {
 	.setattr	= ext3_setattr,
 #ifdef CONFIG_EXT3_FS_XATTR
 	.setxattr	= generic_setxattr,
Index: linux-2.6.20-rc4/fs/ext3/symlink.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/ext3/symlink.c
+++ linux-2.6.20-rc4/fs/ext3/symlink.c
@@ -30,7 +30,7 @@ static void * ext3_follow_link(struct de
 	return NULL;
 }
 
-struct inode_operations ext3_symlink_inode_operations = {
+const struct inode_operations ext3_symlink_inode_operations = {
 	.readlink	= generic_readlink,
 	.follow_link	= page_follow_link_light,
 	.put_link	= page_put_link,
@@ -42,7 +42,7 @@ struct inode_operations ext3_symlink_ino
 #endif
 };
 
-struct inode_operations ext3_fast_symlink_inode_operations = {
+const struct inode_operations ext3_fast_symlink_inode_operations = {
 	.readlink	= generic_readlink,
 	.follow_link	= ext3_follow_link,
 #ifdef CONFIG_EXT3_FS_XATTR
Index: linux-2.6.20-rc4/fs/ext4/file.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/ext4/file.c
+++ linux-2.6.20-rc4/fs/ext4/file.c
@@ -125,7 +125,7 @@ const struct file_operations ext4_file_o
 	.splice_write	= generic_file_splice_write,
 };
 
-struct inode_operations ext4_file_inode_operations = {
+const struct inode_operations ext4_file_inode_operations = {
 	.truncate	= ext4_truncate,
 	.setattr	= ext4_setattr,
 #ifdef CONFIG_EXT4DEV_FS_XATTR
Index: linux-2.6.20-rc4/fs/ext4/namei.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/ext4/namei.c
+++ linux-2.6.20-rc4/fs/ext4/namei.c
@@ -2372,7 +2372,7 @@ end_rename:
 /*
  * directories can handle most operations...
  */
-struct inode_operations ext4_dir_inode_operations = {
+const struct inode_operations ext4_dir_inode_operations = {
 	.create		= ext4_create,
 	.lookup		= ext4_lookup,
 	.link		= ext4_link,
@@ -2392,7 +2392,7 @@ struct inode_operations ext4_dir_inode_o
 	.permission	= ext4_permission,
 };
 
-struct inode_operations ext4_special_inode_operations = {
+const struct inode_operations ext4_special_inode_operations = {
 	.setattr	= ext4_setattr,
 #ifdef CONFIG_EXT4DEV_FS_XATTR
 	.setxattr	= generic_setxattr,
Index: linux-2.6.20-rc4/fs/ext4/symlink.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/ext4/symlink.c
+++ linux-2.6.20-rc4/fs/ext4/symlink.c
@@ -30,7 +30,7 @@ static void * ext4_follow_link(struct de
 	return NULL;
 }
 
-struct inode_operations ext4_symlink_inode_operations = {
+const struct inode_operations ext4_symlink_inode_operations = {
 	.readlink	= generic_readlink,
 	.follow_link	= page_follow_link_light,
 	.put_link	= page_put_link,
@@ -42,7 +42,7 @@ struct inode_operations ext4_symlink_ino
 #endif
 };
 
-struct inode_operations ext4_fast_symlink_inode_operations = {
+const struct inode_operations ext4_fast_symlink_inode_operations = {
 	.readlink	= generic_readlink,
 	.follow_link	= ext4_follow_link,
 #ifdef CONFIG_EXT4DEV_FS_XATTR
Index: linux-2.6.20-rc4/fs/fat/file.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/fat/file.c
+++ linux-2.6.20-rc4/fs/fat/file.c
@@ -312,7 +312,7 @@ int fat_getattr(struct vfsmount *mnt, st
 }
 EXPORT_SYMBOL_GPL(fat_getattr);
 
-struct inode_operations fat_file_inode_operations = {
+const struct inode_operations fat_file_inode_operations = {
 	.truncate	= fat_truncate,
 	.setattr	= fat_notify_change,
 	.getattr	= fat_getattr,
Index: linux-2.6.20-rc4/fs/fat/inode.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/fat/inode.c
+++ linux-2.6.20-rc4/fs/fat/inode.c
@@ -1151,7 +1151,7 @@ static int fat_read_root(struct inode *i
  * Read the super block of an MS-DOS FS.
  */
 int fat_fill_super(struct super_block *sb, void *data, int silent,
-		   struct inode_operations *fs_dir_inode_ops, int isvfat)
+		   const struct inode_operations *fs_dir_inode_ops, int isvfat)
 {
 	struct inode *root_inode = NULL;
 	struct buffer_head *bh;
Index: linux-2.6.20-rc4/fs/freevxfs/vxfs_extern.h
===================================================================
--- linux-2.6.20-rc4.orig/fs/freevxfs/vxfs_extern.h
+++ linux-2.6.20-rc4/fs/freevxfs/vxfs_extern.h
@@ -62,7 +62,7 @@ extern void			vxfs_read_inode(struct ino
 extern void			vxfs_clear_inode(struct inode *);
 
 /* vxfs_lookup.c */
-extern struct inode_operations	vxfs_dir_inode_ops;
+extern const struct inode_operations	vxfs_dir_inode_ops;
 extern const struct file_operations	vxfs_dir_operations;
 
 /* vxfs_olt.c */
Index: linux-2.6.20-rc4/fs/freevxfs/vxfs_immed.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/freevxfs/vxfs_immed.c
+++ linux-2.6.20-rc4/fs/freevxfs/vxfs_immed.c
@@ -48,7 +48,7 @@ static int	vxfs_immed_readpage(struct fi
  * Unliked all other operations we do not go through the pagecache,
  * but do all work directly on the inode.
  */
-struct inode_operations vxfs_immed_symlink_iops = {
+const struct inode_operations vxfs_immed_symlink_iops = {
 	.readlink =		generic_readlink,
 	.follow_link =		vxfs_immed_follow_link,
 };
Index: linux-2.6.20-rc4/fs/freevxfs/vxfs_inode.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/freevxfs/vxfs_inode.c
+++ linux-2.6.20-rc4/fs/freevxfs/vxfs_inode.c
@@ -44,7 +44,7 @@
 extern const struct address_space_operations vxfs_aops;
 extern const struct address_space_operations vxfs_immed_aops;
 
-extern struct inode_operations vxfs_immed_symlink_iops;
+extern const struct inode_operations vxfs_immed_symlink_iops;
 
 struct kmem_cache		*vxfs_inode_cachep;
 
Index: linux-2.6.20-rc4/fs/freevxfs/vxfs_lookup.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/freevxfs/vxfs_lookup.c
+++ linux-2.6.20-rc4/fs/freevxfs/vxfs_lookup.c
@@ -52,7 +52,7 @@
 static struct dentry *	vxfs_lookup(struct inode *, struct dentry *, struct nameidata *);
 static int		vxfs_readdir(struct file *, void *, filldir_t);
 
-struct inode_operations vxfs_dir_inode_ops = {
+const struct inode_operations vxfs_dir_inode_ops = {
 	.lookup =		vxfs_lookup,
 };
 
Index: linux-2.6.20-rc4/fs/fuse/control.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/fuse/control.c
+++ linux-2.6.20-rc4/fs/fuse/control.c
@@ -73,7 +73,7 @@ static struct dentry *fuse_ctl_add_dentr
 					  struct fuse_conn *fc,
 					  const char *name,
 					  int mode, int nlink,
-					  struct inode_operations *iop,
+					  const struct inode_operations *iop,
 					  const struct file_operations *fop)
 {
 	struct dentry *dentry;
Index: linux-2.6.20-rc4/fs/fuse/dir.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/fuse/dir.c
+++ linux-2.6.20-rc4/fs/fuse/dir.c
@@ -1242,7 +1242,7 @@ static int fuse_removexattr(struct dentr
 	return err;
 }
 
-static struct inode_operations fuse_dir_inode_operations = {
+static const struct inode_operations fuse_dir_inode_operations = {
 	.lookup		= fuse_lookup,
 	.mkdir		= fuse_mkdir,
 	.symlink	= fuse_symlink,
@@ -1270,7 +1270,7 @@ static const struct file_operations fuse
 	.fsync		= fuse_dir_fsync,
 };
 
-static struct inode_operations fuse_common_inode_operations = {
+static const struct inode_operations fuse_common_inode_operations = {
 	.setattr	= fuse_setattr,
 	.permission	= fuse_permission,
 	.getattr	= fuse_getattr,
@@ -1280,7 +1280,7 @@ static struct inode_operations fuse_comm
 	.removexattr	= fuse_removexattr,
 };
 
-static struct inode_operations fuse_symlink_inode_operations = {
+static const struct inode_operations fuse_symlink_inode_operations = {
 	.setattr	= fuse_setattr,
 	.follow_link	= fuse_follow_link,
 	.put_link	= fuse_put_link,



^ permalink raw reply	[flat|nested] 17+ messages in thread

* [patch 11/12] mark struct inode_operations const 2
  2007-01-14  0:51 Patch series to mark struct file_operations and struct inode_operations const Arjan van de Ven
                   ` (10 preceding siblings ...)
  2007-01-14  0:57 ` [patch 10/12] mark struct inode_operations const 1 Arjan van de Ven
@ 2007-01-14  0:58 ` Arjan van de Ven
  2007-01-14  0:58 ` [patch 12/12] mark struct inode_operations const 3 Arjan van de Ven
  12 siblings, 0 replies; 17+ messages in thread
From: Arjan van de Ven @ 2007-01-14  0:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm

From: Arjan van de Ven <arjan@linux.intel.com>
Subject: [patch 11/12] mark struct inode_operations const

Many struct inode_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>

Index: linux-2.6.20-rc4/fs/gfs2/ops_inode.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/gfs2/ops_inode.c
+++ linux-2.6.20-rc4/fs/gfs2/ops_inode.c
@@ -1084,7 +1084,7 @@ static int gfs2_removexattr(struct dentr
 	return gfs2_ea_remove(GFS2_I(dentry->d_inode), &er);
 }
 
-struct inode_operations gfs2_file_iops = {
+const struct inode_operations gfs2_file_iops = {
 	.permission = gfs2_permission,
 	.setattr = gfs2_setattr,
 	.getattr = gfs2_getattr,
@@ -1094,7 +1094,7 @@ struct inode_operations gfs2_file_iops =
 	.removexattr = gfs2_removexattr,
 };
 
-struct inode_operations gfs2_dev_iops = {
+const struct inode_operations gfs2_dev_iops = {
 	.permission = gfs2_permission,
 	.setattr = gfs2_setattr,
 	.getattr = gfs2_getattr,
@@ -1104,7 +1104,7 @@ struct inode_operations gfs2_dev_iops = 
 	.removexattr = gfs2_removexattr,
 };
 
-struct inode_operations gfs2_dir_iops = {
+const struct inode_operations gfs2_dir_iops = {
 	.create = gfs2_create,
 	.lookup = gfs2_lookup,
 	.link = gfs2_link,
@@ -1123,7 +1123,7 @@ struct inode_operations gfs2_dir_iops = 
 	.removexattr = gfs2_removexattr,
 };
 
-struct inode_operations gfs2_symlink_iops = {
+const struct inode_operations gfs2_symlink_iops = {
 	.readlink = gfs2_readlink,
 	.follow_link = gfs2_follow_link,
 	.permission = gfs2_permission,
Index: linux-2.6.20-rc4/fs/gfs2/ops_inode.h
===================================================================
--- linux-2.6.20-rc4.orig/fs/gfs2/ops_inode.h
+++ linux-2.6.20-rc4/fs/gfs2/ops_inode.h
@@ -12,9 +12,9 @@
 
 #include <linux/fs.h>
 
-extern struct inode_operations gfs2_file_iops;
-extern struct inode_operations gfs2_dir_iops;
-extern struct inode_operations gfs2_symlink_iops;
-extern struct inode_operations gfs2_dev_iops;
+extern const struct inode_operations gfs2_file_iops;
+extern const struct inode_operations gfs2_dir_iops;
+extern const struct inode_operations gfs2_symlink_iops;
+extern const struct inode_operations gfs2_dev_iops;
 
 #endif /* __OPS_INODE_DOT_H__ */
Index: linux-2.6.20-rc4/fs/hfs/dir.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/hfs/dir.c
+++ linux-2.6.20-rc4/fs/hfs/dir.c
@@ -320,7 +320,7 @@ const struct file_operations hfs_dir_ope
 	.release	= hfs_dir_release,
 };
 
-struct inode_operations hfs_dir_inode_operations = {
+const struct inode_operations hfs_dir_inode_operations = {
 	.create		= hfs_create,
 	.lookup		= hfs_lookup,
 	.unlink		= hfs_unlink,
Index: linux-2.6.20-rc4/fs/hfs/hfs_fs.h
===================================================================
--- linux-2.6.20-rc4.orig/fs/hfs/hfs_fs.h
+++ linux-2.6.20-rc4/fs/hfs/hfs_fs.h
@@ -170,7 +170,7 @@ extern void hfs_cat_build_key(struct sup
 
 /* dir.c */
 extern const struct file_operations hfs_dir_operations;
-extern struct inode_operations hfs_dir_inode_operations;
+extern const struct inode_operations hfs_dir_inode_operations;
 
 /* extent.c */
 extern int hfs_ext_keycmp(const btree_key *, const btree_key *);
Index: linux-2.6.20-rc4/fs/hfs/inode.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/hfs/inode.c
+++ linux-2.6.20-rc4/fs/hfs/inode.c
@@ -18,7 +18,7 @@
 #include "btree.h"
 
 static const struct file_operations hfs_file_operations;
-static struct inode_operations hfs_file_inode_operations;
+static const struct inode_operations hfs_file_inode_operations;
 
 /*================ Variable-like macros ================*/
 
@@ -612,7 +612,7 @@ static const struct file_operations hfs_
 	.release	= hfs_file_release,
 };
 
-static struct inode_operations hfs_file_inode_operations = {
+static const struct inode_operations hfs_file_inode_operations = {
 	.lookup		= hfs_file_lookup,
 	.truncate	= hfs_file_truncate,
 	.setattr	= hfs_inode_setattr,
Index: linux-2.6.20-rc4/fs/hfsplus/dir.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/hfsplus/dir.c
+++ linux-2.6.20-rc4/fs/hfsplus/dir.c
@@ -471,7 +471,7 @@ static int hfsplus_rename(struct inode *
 	return res;
 }
 
-struct inode_operations hfsplus_dir_inode_operations = {
+const struct inode_operations hfsplus_dir_inode_operations = {
 	.lookup		= hfsplus_lookup,
 	.create		= hfsplus_create,
 	.link		= hfsplus_link,
Index: linux-2.6.20-rc4/fs/hfsplus/inode.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/hfsplus/inode.c
+++ linux-2.6.20-rc4/fs/hfsplus/inode.c
@@ -268,10 +268,10 @@ static int hfsplus_file_release(struct i
 	return 0;
 }
 
-extern struct inode_operations hfsplus_dir_inode_operations;
+extern const struct inode_operations hfsplus_dir_inode_operations;
 extern struct file_operations hfsplus_dir_operations;
 
-static struct inode_operations hfsplus_file_inode_operations = {
+static const struct inode_operations hfsplus_file_inode_operations = {
 	.lookup		= hfsplus_file_lookup,
 	.truncate	= hfsplus_file_truncate,
 	.permission	= hfsplus_permission,
Index: linux-2.6.20-rc4/fs/hostfs/hostfs_kern.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/hostfs/hostfs_kern.c
+++ linux-2.6.20-rc4/fs/hostfs/hostfs_kern.c
@@ -52,8 +52,8 @@ static int append = 0;
 
 #define HOSTFS_SUPER_MAGIC 0x00c0ffee
 
-static struct inode_operations hostfs_iops;
-static struct inode_operations hostfs_dir_iops;
+static const struct inode_operations hostfs_iops;
+static const struct inode_operations hostfs_dir_iops;
 static const struct address_space_operations hostfs_link_aops;
 
 #ifndef MODULE
@@ -880,7 +880,7 @@ int hostfs_getattr(struct vfsmount *mnt,
 	return(0);
 }
 
-static struct inode_operations hostfs_iops = {
+static const struct inode_operations hostfs_iops = {
 	.create		= hostfs_create,
 	.link		= hostfs_link,
 	.unlink		= hostfs_unlink,
@@ -894,7 +894,7 @@ static struct inode_operations hostfs_io
 	.getattr	= hostfs_getattr,
 };
 
-static struct inode_operations hostfs_dir_iops = {
+static const struct inode_operations hostfs_dir_iops = {
 	.create		= hostfs_create,
 	.lookup		= hostfs_lookup,
 	.link		= hostfs_link,
Index: linux-2.6.20-rc4/fs/hpfs/file.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/hpfs/file.c
+++ linux-2.6.20-rc4/fs/hpfs/file.c
@@ -132,7 +132,7 @@ const struct file_operations hpfs_file_o
 	.sendfile	= generic_file_sendfile,
 };
 
-struct inode_operations hpfs_file_iops =
+const struct inode_operations hpfs_file_iops =
 {
 	.truncate	= hpfs_truncate,
 	.setattr	= hpfs_notify_change,
Index: linux-2.6.20-rc4/fs/hpfs/hpfs_fn.h
===================================================================
--- linux-2.6.20-rc4.orig/fs/hpfs/hpfs_fn.h
+++ linux-2.6.20-rc4/fs/hpfs/hpfs_fn.h
@@ -266,7 +266,7 @@ void hpfs_set_ea(struct inode *, struct 
 
 int hpfs_file_fsync(struct file *, struct dentry *, int);
 extern const struct file_operations hpfs_file_ops;
-extern struct inode_operations hpfs_file_iops;
+extern const struct inode_operations hpfs_file_iops;
 extern const struct address_space_operations hpfs_aops;
 
 /* inode.c */
@@ -302,7 +302,7 @@ void hpfs_decide_conv(struct inode *, un
 
 /* namei.c */
 
-extern struct inode_operations hpfs_dir_iops;
+extern const struct inode_operations hpfs_dir_iops;
 extern const struct address_space_operations hpfs_symlink_aops;
 
 static inline struct hpfs_inode_info *hpfs_i(struct inode *inode)
Index: linux-2.6.20-rc4/fs/hpfs/namei.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/hpfs/namei.c
+++ linux-2.6.20-rc4/fs/hpfs/namei.c
@@ -659,7 +659,7 @@ end1:
 	return err;
 }
 
-struct inode_operations hpfs_dir_iops =
+const struct inode_operations hpfs_dir_iops =
 {
 	.create		= hpfs_create,
 	.lookup		= hpfs_lookup,
Index: linux-2.6.20-rc4/fs/hppfs/hppfs_kern.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/hppfs/hppfs_kern.c
+++ linux-2.6.20-rc4/fs/hppfs/hppfs_kern.c
@@ -212,7 +212,7 @@ static struct dentry *hppfs_lookup(struc
 	return(ERR_PTR(err));
 }
 
-static struct inode_operations hppfs_file_iops = {
+static const struct inode_operations hppfs_file_iops = {
 };
 
 static ssize_t read_proc(struct file *file, char __user *buf, ssize_t count,
@@ -693,11 +693,11 @@ static void* hppfs_follow_link(struct de
 	return ret;
 }
 
-static struct inode_operations hppfs_dir_iops = {
+static const struct inode_operations hppfs_dir_iops = {
 	.lookup		= hppfs_lookup,
 };
 
-static struct inode_operations hppfs_link_iops = {
+static const struct inode_operations hppfs_link_iops = {
 	.readlink	= hppfs_readlink,
 	.follow_link	= hppfs_follow_link,
 };
Index: linux-2.6.20-rc4/fs/hugetlbfs/inode.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/hugetlbfs/inode.c
+++ linux-2.6.20-rc4/fs/hugetlbfs/inode.c
@@ -36,8 +36,8 @@
 static struct super_operations hugetlbfs_ops;
 static const struct address_space_operations hugetlbfs_aops;
 const struct file_operations hugetlbfs_file_operations;
-static struct inode_operations hugetlbfs_dir_inode_operations;
-static struct inode_operations hugetlbfs_inode_operations;
+static const struct inode_operations hugetlbfs_dir_inode_operations;
+static const struct inode_operations hugetlbfs_inode_operations;
 
 static struct backing_dev_info hugetlbfs_backing_dev_info = {
 	.ra_pages	= 0,	/* No readahead */
@@ -560,7 +560,7 @@ const struct file_operations hugetlbfs_f
 	.get_unmapped_area	= hugetlb_get_unmapped_area,
 };
 
-static struct inode_operations hugetlbfs_dir_inode_operations = {
+static const struct inode_operations hugetlbfs_dir_inode_operations = {
 	.create		= hugetlbfs_create,
 	.lookup		= simple_lookup,
 	.link		= simple_link,
@@ -573,7 +573,7 @@ static struct inode_operations hugetlbfs
 	.setattr	= hugetlbfs_setattr,
 };
 
-static struct inode_operations hugetlbfs_inode_operations = {
+static const struct inode_operations hugetlbfs_inode_operations = {
 	.setattr	= hugetlbfs_setattr,
 };
 
Index: linux-2.6.20-rc4/fs/isofs/dir.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/isofs/dir.c
+++ linux-2.6.20-rc4/fs/isofs/dir.c
@@ -24,7 +24,7 @@ const struct file_operations isofs_dir_o
 /*
  * directories can handle most operations...
  */
-struct inode_operations isofs_dir_inode_operations =
+const struct inode_operations isofs_dir_inode_operations =
 {
 	.lookup		= isofs_lookup,
 };
Index: linux-2.6.20-rc4/fs/isofs/isofs.h
===================================================================
--- linux-2.6.20-rc4.orig/fs/isofs/isofs.h
+++ linux-2.6.20-rc4/fs/isofs/isofs.h
@@ -174,7 +174,7 @@ isofs_normalize_block_and_offset(struct 
 	}
 }
 
-extern struct inode_operations isofs_dir_inode_operations;
+extern const struct inode_operations isofs_dir_inode_operations;
 extern const struct file_operations isofs_dir_operations;
 extern const struct address_space_operations isofs_symlink_aops;
 extern struct export_operations isofs_export_ops;
Index: linux-2.6.20-rc4/fs/jffs/inode-v23.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/jffs/inode-v23.c
+++ linux-2.6.20-rc4/fs/jffs/inode-v23.c
@@ -56,9 +56,9 @@ static int jffs_remove(struct inode *dir
 
 static struct super_operations jffs_ops;
 static const struct file_operations jffs_file_operations;
-static struct inode_operations jffs_file_inode_operations;
+static const struct inode_operations jffs_file_inode_operations;
 static const struct file_operations jffs_dir_operations;
-static struct inode_operations jffs_dir_inode_operations;
+static const struct inode_operations jffs_dir_inode_operations;
 static const struct address_space_operations jffs_address_operations;
 
 struct kmem_cache     *node_cache = NULL;
@@ -1642,7 +1642,7 @@ static const struct file_operations jffs
 };
 
 
-static struct inode_operations jffs_file_inode_operations =
+static const struct inode_operations jffs_file_inode_operations =
 {
 	.lookup		= jffs_lookup,          /* lookup */
 	.setattr	= jffs_setattr,
@@ -1655,7 +1655,7 @@ static const struct file_operations jffs
 };
 
 
-static struct inode_operations jffs_dir_inode_operations =
+static const struct inode_operations jffs_dir_inode_operations =
 {
 	.create		= jffs_create,
 	.lookup		= jffs_lookup,
Index: linux-2.6.20-rc4/fs/jffs2/dir.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/jffs2/dir.c
+++ linux-2.6.20-rc4/fs/jffs2/dir.c
@@ -46,7 +46,7 @@ const struct file_operations jffs2_dir_o
 };
 
 
-struct inode_operations jffs2_dir_inode_operations =
+const struct inode_operations jffs2_dir_inode_operations =
 {
 	.create =	jffs2_create,
 	.lookup =	jffs2_lookup,
Index: linux-2.6.20-rc4/fs/jffs2/file.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/jffs2/file.c
+++ linux-2.6.20-rc4/fs/jffs2/file.c
@@ -54,7 +54,7 @@ const struct file_operations jffs2_file_
 
 /* jffs2_file_inode_operations */
 
-struct inode_operations jffs2_file_inode_operations =
+const struct inode_operations jffs2_file_inode_operations =
 {
 	.permission =	jffs2_permission,
 	.setattr =	jffs2_setattr,
Index: linux-2.6.20-rc4/fs/jffs2/os-linux.h
===================================================================
--- linux-2.6.20-rc4.orig/fs/jffs2/os-linux.h
+++ linux-2.6.20-rc4/fs/jffs2/os-linux.h
@@ -153,11 +153,11 @@ void jffs2_garbage_collect_trigger(struc
 
 /* dir.c */
 extern const struct file_operations jffs2_dir_operations;
-extern struct inode_operations jffs2_dir_inode_operations;
+extern const struct inode_operations jffs2_dir_inode_operations;
 
 /* file.c */
 extern const struct file_operations jffs2_file_operations;
-extern struct inode_operations jffs2_file_inode_operations;
+extern const struct inode_operations jffs2_file_inode_operations;
 extern const struct address_space_operations jffs2_file_address_operations;
 int jffs2_fsync(struct file *, struct dentry *, int);
 int jffs2_do_readpage_unlock (struct inode *inode, struct page *pg);
@@ -166,7 +166,7 @@ int jffs2_do_readpage_unlock (struct ino
 int jffs2_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
 
 /* symlink.c */
-extern struct inode_operations jffs2_symlink_inode_operations;
+extern const struct inode_operations jffs2_symlink_inode_operations;
 
 /* fs.c */
 int jffs2_setattr (struct dentry *, struct iattr *);
Index: linux-2.6.20-rc4/fs/jffs2/symlink.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/jffs2/symlink.c
+++ linux-2.6.20-rc4/fs/jffs2/symlink.c
@@ -20,7 +20,7 @@
 
 static void *jffs2_follow_link(struct dentry *dentry, struct nameidata *nd);
 
-struct inode_operations jffs2_symlink_inode_operations =
+const struct inode_operations jffs2_symlink_inode_operations =
 {
 	.readlink =	generic_readlink,
 	.follow_link =	jffs2_follow_link,
Index: linux-2.6.20-rc4/fs/jfs/file.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/jfs/file.c
+++ linux-2.6.20-rc4/fs/jfs/file.c
@@ -88,7 +88,7 @@ static int jfs_release(struct inode *ino
 	return 0;
 }
 
-struct inode_operations jfs_file_inode_operations = {
+const struct inode_operations jfs_file_inode_operations = {
 	.truncate	= jfs_truncate,
 	.setxattr	= jfs_setxattr,
 	.getxattr	= jfs_getxattr,
Index: linux-2.6.20-rc4/fs/jfs/jfs_inode.h
===================================================================
--- linux-2.6.20-rc4.orig/fs/jfs/jfs_inode.h
+++ linux-2.6.20-rc4/fs/jfs/jfs_inode.h
@@ -35,10 +35,10 @@ extern void jfs_set_inode_flags(struct i
 extern int jfs_get_block(struct inode *, sector_t, struct buffer_head *, int);
 
 extern const struct address_space_operations jfs_aops;
-extern struct inode_operations jfs_dir_inode_operations;
+extern const struct inode_operations jfs_dir_inode_operations;
 extern const struct file_operations jfs_dir_operations;
-extern struct inode_operations jfs_file_inode_operations;
+extern const struct inode_operations jfs_file_inode_operations;
 extern const struct file_operations jfs_file_operations;
-extern struct inode_operations jfs_symlink_inode_operations;
+extern const struct inode_operations jfs_symlink_inode_operations;
 extern struct dentry_operations jfs_ci_dentry_operations;
 #endif				/* _H_JFS_INODE */
Index: linux-2.6.20-rc4/fs/jfs/namei.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/jfs/namei.c
+++ linux-2.6.20-rc4/fs/jfs/namei.c
@@ -1495,7 +1495,7 @@ struct dentry *jfs_get_parent(struct den
 	return parent;
 }
 
-struct inode_operations jfs_dir_inode_operations = {
+const struct inode_operations jfs_dir_inode_operations = {
 	.create		= jfs_create,
 	.lookup		= jfs_lookup,
 	.link		= jfs_link,
Index: linux-2.6.20-rc4/fs/jfs/symlink.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/jfs/symlink.c
+++ linux-2.6.20-rc4/fs/jfs/symlink.c
@@ -29,7 +29,7 @@ static void *jfs_follow_link(struct dent
 	return NULL;
 }
 
-struct inode_operations jfs_symlink_inode_operations = {
+const struct inode_operations jfs_symlink_inode_operations = {
 	.readlink	= generic_readlink,
 	.follow_link	= jfs_follow_link,
 	.setxattr	= jfs_setxattr,
Index: linux-2.6.20-rc4/fs/libfs.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/libfs.c
+++ linux-2.6.20-rc4/fs/libfs.c
@@ -186,7 +186,7 @@ const struct file_operations simple_dir_
 	.fsync		= simple_sync_file,
 };
 
-struct inode_operations simple_dir_inode_operations = {
+const struct inode_operations simple_dir_inode_operations = {
 	.lookup		= simple_lookup,
 };
 
Index: linux-2.6.20-rc4/fs/minix/file.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/minix/file.c
+++ linux-2.6.20-rc4/fs/minix/file.c
@@ -26,7 +26,7 @@ const struct file_operations minix_file_
 	.sendfile	= generic_file_sendfile,
 };
 
-struct inode_operations minix_file_inode_operations = {
+const struct inode_operations minix_file_inode_operations = {
 	.truncate	= minix_truncate,
 	.getattr	= minix_getattr,
 };
Index: linux-2.6.20-rc4/fs/minix/inode.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/minix/inode.c
+++ linux-2.6.20-rc4/fs/minix/inode.c
@@ -344,7 +344,7 @@ static const struct address_space_operat
 	.bmap = minix_bmap
 };
 
-static struct inode_operations minix_symlink_inode_operations = {
+static const struct inode_operations minix_symlink_inode_operations = {
 	.readlink	= generic_readlink,
 	.follow_link	= page_follow_link_light,
 	.put_link	= page_put_link,
Index: linux-2.6.20-rc4/fs/minix/minix.h
===================================================================
--- linux-2.6.20-rc4.orig/fs/minix/minix.h
+++ linux-2.6.20-rc4/fs/minix/minix.h
@@ -79,8 +79,8 @@ extern ino_t minix_inode_by_name(struct 
 
 extern int minix_sync_file(struct file *, struct dentry *, int);
 
-extern struct inode_operations minix_file_inode_operations;
-extern struct inode_operations minix_dir_inode_operations;
+extern const struct inode_operations minix_file_inode_operations;
+extern const struct inode_operations minix_dir_inode_operations;
 extern const struct file_operations minix_file_operations;
 extern const struct file_operations minix_dir_operations;
 extern struct dentry_operations minix_dentry_operations;
Index: linux-2.6.20-rc4/fs/minix/namei.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/minix/namei.c
+++ linux-2.6.20-rc4/fs/minix/namei.c
@@ -291,7 +291,7 @@ out:
 /*
  * directories can handle most operations...
  */
-struct inode_operations minix_dir_inode_operations = {
+const struct inode_operations minix_dir_inode_operations = {
 	.create		= minix_create,
 	.lookup		= minix_lookup,
 	.link		= minix_link,
Index: linux-2.6.20-rc4/fs/msdos/namei.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/msdos/namei.c
+++ linux-2.6.20-rc4/fs/msdos/namei.c
@@ -646,7 +646,7 @@ out:
 	return err;
 }
 
-static struct inode_operations msdos_dir_inode_operations = {
+static const struct inode_operations msdos_dir_inode_operations = {
 	.create		= msdos_create,
 	.lookup		= msdos_lookup,
 	.unlink		= msdos_unlink,
Index: linux-2.6.20-rc4/fs/namei.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/namei.c
+++ linux-2.6.20-rc4/fs/namei.c
@@ -2744,7 +2744,7 @@ int page_symlink(struct inode *inode, co
 			mapping_gfp_mask(inode->i_mapping));
 }
 
-struct inode_operations page_symlink_inode_operations = {
+const struct inode_operations page_symlink_inode_operations = {
 	.readlink	= generic_readlink,
 	.follow_link	= page_follow_link_light,
 	.put_link	= page_put_link,
Index: linux-2.6.20-rc4/fs/ncpfs/dir.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/ncpfs/dir.c
+++ linux-2.6.20-rc4/fs/ncpfs/dir.c
@@ -58,7 +58,7 @@ const struct file_operations ncp_dir_ope
 #endif
 };
 
-struct inode_operations ncp_dir_inode_operations =
+const struct inode_operations ncp_dir_inode_operations =
 {
 	.create		= ncp_create,
 	.lookup		= ncp_lookup,
Index: linux-2.6.20-rc4/fs/ncpfs/file.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/ncpfs/file.c
+++ linux-2.6.20-rc4/fs/ncpfs/file.c
@@ -297,7 +297,7 @@ const struct file_operations ncp_file_op
 	.fsync		= ncp_fsync,
 };
 
-struct inode_operations ncp_file_inode_operations =
+const struct inode_operations ncp_file_inode_operations =
 {
 	.setattr	= ncp_notify_change,
 };
Index: linux-2.6.20-rc4/fs/ncpfs/inode.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/ncpfs/inode.c
+++ linux-2.6.20-rc4/fs/ncpfs/inode.c
@@ -229,7 +229,7 @@ static void ncp_set_attr(struct inode *i
 }
 
 #if defined(CONFIG_NCPFS_EXTRAS) || defined(CONFIG_NCPFS_NFS_NS)
-static struct inode_operations ncp_symlink_inode_operations = {
+static const struct inode_operations ncp_symlink_inode_operations = {
 	.readlink	= generic_readlink,
 	.follow_link	= page_follow_link_light,
 	.put_link	= page_put_link,
Index: linux-2.6.20-rc4/fs/nfs/dir.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/nfs/dir.c
+++ linux-2.6.20-rc4/fs/nfs/dir.c
@@ -65,7 +65,7 @@ const struct file_operations nfs_dir_ope
 	.fsync		= nfs_fsync_dir,
 };
 
-struct inode_operations nfs_dir_inode_operations = {
+const struct inode_operations nfs_dir_inode_operations = {
 	.create		= nfs_create,
 	.lookup		= nfs_lookup,
 	.link		= nfs_link,
@@ -81,7 +81,7 @@ struct inode_operations nfs_dir_inode_op
 };
 
 #ifdef CONFIG_NFS_V3
-struct inode_operations nfs3_dir_inode_operations = {
+const struct inode_operations nfs3_dir_inode_operations = {
 	.create		= nfs_create,
 	.lookup		= nfs_lookup,
 	.link		= nfs_link,
@@ -104,7 +104,7 @@ struct inode_operations nfs3_dir_inode_o
 #ifdef CONFIG_NFS_V4
 
 static struct dentry *nfs_atomic_lookup(struct inode *, struct dentry *, struct nameidata *);
-struct inode_operations nfs4_dir_inode_operations = {
+const struct inode_operations nfs4_dir_inode_operations = {
 	.create		= nfs_create,
 	.lookup		= nfs_atomic_lookup,
 	.link		= nfs_link,
Index: linux-2.6.20-rc4/fs/nfs/file.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/nfs/file.c
+++ linux-2.6.20-rc4/fs/nfs/file.c
@@ -68,14 +68,14 @@ const struct file_operations nfs_file_op
 	.check_flags	= nfs_check_flags,
 };
 
-struct inode_operations nfs_file_inode_operations = {
+const struct inode_operations nfs_file_inode_operations = {
 	.permission	= nfs_permission,
 	.getattr	= nfs_getattr,
 	.setattr	= nfs_setattr,
 };
 
 #ifdef CONFIG_NFS_V3
-struct inode_operations nfs3_file_inode_operations = {
+const struct inode_operations nfs3_file_inode_operations = {
 	.permission	= nfs_permission,
 	.getattr	= nfs_getattr,
 	.setattr	= nfs_setattr,
Index: linux-2.6.20-rc4/fs/nfs/namespace.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/nfs/namespace.c
+++ linux-2.6.20-rc4/fs/nfs/namespace.c
@@ -155,12 +155,12 @@ out_follow:
 	goto out;
 }
 
-struct inode_operations nfs_mountpoint_inode_operations = {
+const struct inode_operations nfs_mountpoint_inode_operations = {
 	.follow_link	= nfs_follow_mountpoint,
 	.getattr	= nfs_getattr,
 };
 
-struct inode_operations nfs_referral_inode_operations = {
+const struct inode_operations nfs_referral_inode_operations = {
 	.follow_link	= nfs_follow_mountpoint,
 };
 
Index: linux-2.6.20-rc4/fs/nfs/nfs4_fs.h
===================================================================
--- linux-2.6.20-rc4.orig/fs/nfs/nfs4_fs.h
+++ linux-2.6.20-rc4/fs/nfs/nfs4_fs.h
@@ -151,7 +151,7 @@ struct nfs4_state_recovery_ops {
 };
 
 extern struct dentry_operations nfs4_dentry_operations;
-extern struct inode_operations nfs4_dir_inode_operations;
+extern const struct inode_operations nfs4_dir_inode_operations;
 
 /* inode.c */
 extern ssize_t nfs4_getxattr(struct dentry *, const char *, void *, size_t);
Index: linux-2.6.20-rc4/fs/nfs/nfs4proc.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/nfs/nfs4proc.c
+++ linux-2.6.20-rc4/fs/nfs/nfs4proc.c
@@ -3625,7 +3625,7 @@ struct nfs4_state_recovery_ops nfs4_netw
 	.recover_lock	= nfs4_lock_expired,
 };
 
-static struct inode_operations nfs4_file_inode_operations = {
+static const struct inode_operations nfs4_file_inode_operations = {
 	.permission	= nfs_permission,
 	.getattr	= nfs_getattr,
 	.setattr	= nfs_setattr,
Index: linux-2.6.20-rc4/fs/nfs/symlink.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/nfs/symlink.c
+++ linux-2.6.20-rc4/fs/nfs/symlink.c
@@ -76,7 +76,7 @@ read_failed:
 /*
  * symlinks can't do much...
  */
-struct inode_operations nfs_symlink_inode_operations = {
+const struct inode_operations nfs_symlink_inode_operations = {
 	.readlink	= generic_readlink,
 	.follow_link	= nfs_follow_link,
 	.put_link	= page_put_link,
Index: linux-2.6.20-rc4/fs/ntfs/file.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/ntfs/file.c
+++ linux-2.6.20-rc4/fs/ntfs/file.c
@@ -2328,7 +2328,7 @@ const struct file_operations ntfs_file_o
 						    the data source. */
 };
 
-struct inode_operations ntfs_file_inode_ops = {
+const struct inode_operations ntfs_file_inode_ops = {
 #ifdef NTFS_RW
 	.truncate	= ntfs_truncate_vfs,
 	.setattr	= ntfs_setattr,
@@ -2337,4 +2337,4 @@ struct inode_operations ntfs_file_inode_
 
 const struct file_operations ntfs_empty_file_ops = {};
 
-struct inode_operations ntfs_empty_inode_ops = {};
+const struct inode_operations ntfs_empty_inode_ops = {};
Index: linux-2.6.20-rc4/fs/ntfs/namei.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/ntfs/namei.c
+++ linux-2.6.20-rc4/fs/ntfs/namei.c
@@ -359,7 +359,7 @@ err_out:
 /**
  * Inode operations for directories.
  */
-struct inode_operations ntfs_dir_inode_ops = {
+const struct inode_operations ntfs_dir_inode_ops = {
 	.lookup	= ntfs_lookup,	/* VFS: Lookup directory. */
 };
 
Index: linux-2.6.20-rc4/fs/ntfs/ntfs.h
===================================================================
--- linux-2.6.20-rc4.orig/fs/ntfs/ntfs.h
+++ linux-2.6.20-rc4/fs/ntfs/ntfs.h
@@ -61,13 +61,13 @@ extern const struct address_space_operat
 extern const struct address_space_operations ntfs_mst_aops;
 
 extern const struct  file_operations ntfs_file_ops;
-extern struct inode_operations ntfs_file_inode_ops;
+extern const struct inode_operations ntfs_file_inode_ops;
 
 extern const struct  file_operations ntfs_dir_ops;
-extern struct inode_operations ntfs_dir_inode_ops;
+extern const struct inode_operations ntfs_dir_inode_ops;
 
 extern const struct  file_operations ntfs_empty_file_ops;
-extern struct inode_operations ntfs_empty_inode_ops;
+extern const struct inode_operations ntfs_empty_inode_ops;
 
 extern struct export_operations ntfs_export_ops;
 
Index: linux-2.6.20-rc4/fs/ocfs2/dlm/dlmfs.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/ocfs2/dlm/dlmfs.c
+++ linux-2.6.20-rc4/fs/ocfs2/dlm/dlmfs.c
@@ -63,9 +63,9 @@
 
 static struct super_operations dlmfs_ops;
 static const struct file_operations dlmfs_file_operations;
-static struct inode_operations dlmfs_dir_inode_operations;
-static struct inode_operations dlmfs_root_inode_operations;
-static struct inode_operations dlmfs_file_inode_operations;
+static const struct inode_operations dlmfs_dir_inode_operations;
+static const struct inode_operations dlmfs_root_inode_operations;
+static const struct inode_operations dlmfs_file_inode_operations;
 static struct kmem_cache *dlmfs_inode_cache;
 
 struct workqueue_struct *user_dlm_worker;
@@ -547,14 +547,14 @@ static const struct file_operations dlmf
 	.write		= dlmfs_file_write,
 };
 
-static struct inode_operations dlmfs_dir_inode_operations = {
+static const struct inode_operations dlmfs_dir_inode_operations = {
 	.create		= dlmfs_create,
 	.lookup		= simple_lookup,
 	.unlink		= dlmfs_unlink,
 };
 
 /* this way we can restrict mkdir to only the toplevel of the fs. */
-static struct inode_operations dlmfs_root_inode_operations = {
+static const struct inode_operations dlmfs_root_inode_operations = {
 	.lookup		= simple_lookup,
 	.mkdir		= dlmfs_mkdir,
 	.rmdir		= simple_rmdir,
@@ -568,7 +568,7 @@ static struct super_operations dlmfs_ops
 	.drop_inode	= generic_delete_inode,
 };
 
-static struct inode_operations dlmfs_file_inode_operations = {
+static const struct inode_operations dlmfs_file_inode_operations = {
 	.getattr	= simple_getattr,
 };
 
Index: linux-2.6.20-rc4/fs/ocfs2/file.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/ocfs2/file.c
+++ linux-2.6.20-rc4/fs/ocfs2/file.c
@@ -1365,13 +1365,13 @@ bail:
 	return ret;
 }
 
-struct inode_operations ocfs2_file_iops = {
+const struct inode_operations ocfs2_file_iops = {
 	.setattr	= ocfs2_setattr,
 	.getattr	= ocfs2_getattr,
 	.permission	= ocfs2_permission,
 };
 
-struct inode_operations ocfs2_special_file_iops = {
+const struct inode_operations ocfs2_special_file_iops = {
 	.setattr	= ocfs2_setattr,
 	.getattr	= ocfs2_getattr,
 	.permission	= ocfs2_permission,
Index: linux-2.6.20-rc4/fs/ocfs2/file.h
===================================================================
--- linux-2.6.20-rc4.orig/fs/ocfs2/file.h
+++ linux-2.6.20-rc4/fs/ocfs2/file.h
@@ -28,8 +28,8 @@
 
 extern const struct file_operations ocfs2_fops;
 extern const struct file_operations ocfs2_dops;
-extern struct inode_operations ocfs2_file_iops;
-extern struct inode_operations ocfs2_special_file_iops;
+extern const struct inode_operations ocfs2_file_iops;
+extern const struct inode_operations ocfs2_special_file_iops;
 struct ocfs2_alloc_context;
 
 enum ocfs2_alloc_restarted {
Index: linux-2.6.20-rc4/fs/ocfs2/namei.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/ocfs2/namei.c
+++ linux-2.6.20-rc4/fs/ocfs2/namei.c
@@ -2301,7 +2301,7 @@ leave:
 	return status;
 }
 
-struct inode_operations ocfs2_dir_iops = {
+const struct inode_operations ocfs2_dir_iops = {
 	.create		= ocfs2_create,
 	.lookup		= ocfs2_lookup,
 	.link		= ocfs2_link,
Index: linux-2.6.20-rc4/fs/ocfs2/namei.h
===================================================================
--- linux-2.6.20-rc4.orig/fs/ocfs2/namei.h
+++ linux-2.6.20-rc4/fs/ocfs2/namei.h
@@ -26,7 +26,7 @@
 #ifndef OCFS2_NAMEI_H
 #define OCFS2_NAMEI_H
 
-extern struct inode_operations ocfs2_dir_iops;
+extern const struct inode_operations ocfs2_dir_iops;
 
 struct dentry *ocfs2_get_parent(struct dentry *child);
 
Index: linux-2.6.20-rc4/fs/ocfs2/symlink.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/ocfs2/symlink.c
+++ linux-2.6.20-rc4/fs/ocfs2/symlink.c
@@ -171,12 +171,12 @@ bail:
 	return ERR_PTR(status);
 }
 
-struct inode_operations ocfs2_symlink_inode_operations = {
+const struct inode_operations ocfs2_symlink_inode_operations = {
 	.readlink	= page_readlink,
 	.follow_link	= ocfs2_follow_link,
 	.getattr	= ocfs2_getattr,
 };
-struct inode_operations ocfs2_fast_symlink_inode_operations = {
+const struct inode_operations ocfs2_fast_symlink_inode_operations = {
 	.readlink	= ocfs2_readlink,
 	.follow_link	= ocfs2_follow_link,
 	.getattr	= ocfs2_getattr,
Index: linux-2.6.20-rc4/fs/ocfs2/symlink.h
===================================================================
--- linux-2.6.20-rc4.orig/fs/ocfs2/symlink.h
+++ linux-2.6.20-rc4/fs/ocfs2/symlink.h
@@ -26,8 +26,8 @@
 #ifndef OCFS2_SYMLINK_H
 #define OCFS2_SYMLINK_H
 
-extern struct inode_operations ocfs2_symlink_inode_operations;
-extern struct inode_operations ocfs2_fast_symlink_inode_operations;
+extern const struct inode_operations ocfs2_symlink_inode_operations;
+extern const struct inode_operations ocfs2_fast_symlink_inode_operations;
 
 /*
  * Test whether an inode is a fast symlink.
Index: linux-2.6.20-rc4/fs/openpromfs/inode.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/openpromfs/inode.c
+++ linux-2.6.20-rc4/fs/openpromfs/inode.c
@@ -169,7 +169,7 @@ static const struct file_operations open
 
 static struct dentry *openpromfs_lookup(struct inode *, struct dentry *, struct nameidata *);
 
-static struct inode_operations openprom_inode_operations = {
+static const struct inode_operations openprom_inode_operations = {
 	.lookup		= openpromfs_lookup,
 };
 
Index: linux-2.6.20-rc4/ipc/mqueue.c
===================================================================
--- linux-2.6.20-rc4.orig/ipc/mqueue.c
+++ linux-2.6.20-rc4/ipc/mqueue.c
@@ -84,7 +84,7 @@ struct mqueue_inode_info {
 	unsigned long qsize; /* size of queue in memory (sum of all msgs) */
 };
 
-static struct inode_operations mqueue_dir_inode_operations;
+static const struct inode_operations mqueue_dir_inode_operations;
 static const struct file_operations mqueue_file_operations;
 static struct super_operations mqueue_super_ops;
 static void remove_notification(struct mqueue_inode_info *info);
@@ -1160,7 +1160,7 @@ out:
 	return ret;
 }
 
-static struct inode_operations mqueue_dir_inode_operations = {
+static const struct inode_operations mqueue_dir_inode_operations = {
 	.lookup = simple_lookup,
 	.create = mqueue_create,
 	.unlink = mqueue_unlink,
Index: linux-2.6.20-rc4/kernel/cpuset.c
===================================================================
--- linux-2.6.20-rc4.orig/kernel/cpuset.c
+++ linux-2.6.20-rc4/kernel/cpuset.c
@@ -1540,7 +1540,7 @@ static const struct file_operations cpus
 	.release = cpuset_file_release,
 };
 
-static struct inode_operations cpuset_dir_inode_operations = {
+static const struct inode_operations cpuset_dir_inode_operations = {
 	.lookup = simple_lookup,
 	.mkdir = cpuset_mkdir,
 	.rmdir = cpuset_rmdir,
Index: linux-2.6.20-rc4/mm/shmem.c
===================================================================
--- linux-2.6.20-rc4.orig/mm/shmem.c
+++ linux-2.6.20-rc4/mm/shmem.c
@@ -178,9 +178,9 @@ static inline void shmem_unacct_blocks(u
 static struct super_operations shmem_ops;
 static const struct address_space_operations shmem_aops;
 static const struct file_operations shmem_file_operations;
-static struct inode_operations shmem_inode_operations;
-static struct inode_operations shmem_dir_inode_operations;
-static struct inode_operations shmem_special_inode_operations;
+static const struct inode_operations shmem_inode_operations;
+static const struct inode_operations shmem_dir_inode_operations;
+static const struct inode_operations shmem_special_inode_operations;
 static struct vm_operations_struct shmem_vm_ops;
 
 static struct backing_dev_info shmem_backing_dev_info  __read_mostly = {
@@ -1410,8 +1410,8 @@ shmem_get_inode(struct super_block *sb, 
 }
 
 #ifdef CONFIG_TMPFS
-static struct inode_operations shmem_symlink_inode_operations;
-static struct inode_operations shmem_symlink_inline_operations;
+static const struct inode_operations shmem_symlink_inode_operations;
+static const struct inode_operations shmem_symlink_inline_operations;
 
 /*
  * Normally tmpfs makes no use of shmem_prepare_write, but it
@@ -1904,12 +1904,12 @@ static void shmem_put_link(struct dentry
 	}
 }
 
-static struct inode_operations shmem_symlink_inline_operations = {
+static const struct inode_operations shmem_symlink_inline_operations = {
 	.readlink	= generic_readlink,
 	.follow_link	= shmem_follow_link_inline,
 };
 
-static struct inode_operations shmem_symlink_inode_operations = {
+static const struct inode_operations shmem_symlink_inode_operations = {
 	.truncate	= shmem_truncate,
 	.readlink	= generic_readlink,
 	.follow_link	= shmem_follow_link,
@@ -2335,7 +2335,7 @@ static const struct file_operations shme
 #endif
 };
 
-static struct inode_operations shmem_inode_operations = {
+static const struct inode_operations shmem_inode_operations = {
 	.truncate	= shmem_truncate,
 	.setattr	= shmem_notify_change,
 	.truncate_range	= shmem_truncate_range,
@@ -2349,7 +2349,7 @@ static struct inode_operations shmem_ino
 
 };
 
-static struct inode_operations shmem_dir_inode_operations = {
+static const struct inode_operations shmem_dir_inode_operations = {
 #ifdef CONFIG_TMPFS
 	.create		= shmem_create,
 	.lookup		= simple_lookup,
@@ -2371,7 +2371,7 @@ static struct inode_operations shmem_dir
 #endif
 };
 
-static struct inode_operations shmem_special_inode_operations = {
+static const struct inode_operations shmem_special_inode_operations = {
 #ifdef CONFIG_TMPFS_POSIX_ACL
 	.setattr	= shmem_notify_change,
 	.setxattr	= generic_setxattr,



^ permalink raw reply	[flat|nested] 17+ messages in thread

* [patch 12/12] mark struct inode_operations const 3
  2007-01-14  0:51 Patch series to mark struct file_operations and struct inode_operations const Arjan van de Ven
                   ` (11 preceding siblings ...)
  2007-01-14  0:58 ` [patch 11/12] mark struct inode_operations const 2 Arjan van de Ven
@ 2007-01-14  0:58 ` Arjan van de Ven
  12 siblings, 0 replies; 17+ messages in thread
From: Arjan van de Ven @ 2007-01-14  0:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm

From: Arjan van de Ven <arjan@linux.intel.com>
Subject: [patch 12/12] mark struct inode_operations const

Many struct inode_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>

Index: linux-2.6.20-rc4/fs/proc/base.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/proc/base.c
+++ linux-2.6.20-rc4/fs/proc/base.c
@@ -93,7 +93,7 @@ struct pid_entry {
 	int len;
 	char *name;
 	mode_t mode;
-	struct inode_operations *iop;
+	const struct inode_operations *iop;
 	const struct file_operations *fop;
 	union proc_op op;
 };
@@ -352,7 +352,7 @@ static int proc_setattr(struct dentry *d
 	return error;
 }
 
-static struct inode_operations proc_def_inode_operations = {
+static const struct inode_operations proc_def_inode_operations = {
 	.setattr	= proc_setattr,
 };
 
@@ -978,7 +978,7 @@ out:
 	return error;
 }
 
-static struct inode_operations proc_pid_link_inode_operations = {
+static const struct inode_operations proc_pid_link_inode_operations = {
 	.readlink	= proc_pid_readlink,
 	.follow_link	= proc_pid_follow_link,
 	.setattr	= proc_setattr,
@@ -1414,7 +1414,7 @@ static const struct file_operations proc
 /*
  * proc directories can do almost nothing..
  */
-static struct inode_operations proc_fd_inode_operations = {
+static const struct inode_operations proc_fd_inode_operations = {
 	.lookup		= proc_lookupfd,
 	.setattr	= proc_setattr,
 };
@@ -1654,7 +1654,7 @@ static struct dentry *proc_attr_dir_look
 				  attr_dir_stuff, ARRAY_SIZE(attr_dir_stuff));
 }
 
-static struct inode_operations proc_attr_dir_inode_operations = {
+static const struct inode_operations proc_attr_dir_inode_operations = {
 	.lookup		= proc_attr_dir_lookup,
 	.getattr	= pid_getattr,
 	.setattr	= proc_setattr,
@@ -1680,7 +1680,7 @@ static void *proc_self_follow_link(struc
 	return ERR_PTR(vfs_follow_link(nd,tmp));
 }
 
-static struct inode_operations proc_self_inode_operations = {
+static const struct inode_operations proc_self_inode_operations = {
 	.readlink	= proc_self_readlink,
 	.follow_link	= proc_self_follow_link,
 };
@@ -1829,7 +1829,7 @@ static int proc_pid_io_accounting(struct
  * Thread groups
  */
 static const struct file_operations proc_task_operations;
-static struct inode_operations proc_task_inode_operations;
+static const struct inode_operations proc_task_inode_operations;
 
 static struct pid_entry tgid_base_stuff[] = {
 	DIR("task",       S_IRUGO|S_IXUGO, task),
@@ -1898,7 +1898,7 @@ static struct dentry *proc_tgid_base_loo
 				  tgid_base_stuff, ARRAY_SIZE(tgid_base_stuff));
 }
 
-static struct inode_operations proc_tgid_base_inode_operations = {
+static const struct inode_operations proc_tgid_base_inode_operations = {
 	.lookup		= proc_tgid_base_lookup,
 	.getattr	= pid_getattr,
 	.setattr	= proc_setattr,
@@ -2176,7 +2176,7 @@ static const struct file_operations proc
 	.readdir	= proc_tid_base_readdir,
 };
 
-static struct inode_operations proc_tid_base_inode_operations = {
+static const struct inode_operations proc_tid_base_inode_operations = {
 	.lookup		= proc_tid_base_lookup,
 	.getattr	= pid_getattr,
 	.setattr	= proc_setattr,
@@ -2392,7 +2392,7 @@ static int proc_task_getattr(struct vfsm
 	return 0;
 }
 
-static struct inode_operations proc_task_inode_operations = {
+static const struct inode_operations proc_task_inode_operations = {
 	.lookup		= proc_task_lookup,
 	.getattr	= proc_task_getattr,
 	.setattr	= proc_setattr,
Index: linux-2.6.20-rc4/fs/proc/generic.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/proc/generic.c
+++ linux-2.6.20-rc4/fs/proc/generic.c
@@ -265,7 +265,7 @@ static int proc_getattr(struct vfsmount 
 	return 0;
 }
 
-static struct inode_operations proc_file_inode_operations = {
+static const struct inode_operations proc_file_inode_operations = {
 	.setattr	= proc_notify_change,
 };
 
@@ -357,7 +357,7 @@ static void *proc_follow_link(struct den
 	return NULL;
 }
 
-static struct inode_operations proc_link_inode_operations = {
+static const struct inode_operations proc_link_inode_operations = {
 	.readlink	= generic_readlink,
 	.follow_link	= proc_follow_link,
 };
@@ -505,7 +505,7 @@ static const struct file_operations proc
 /*
  * proc directories can do almost nothing..
  */
-static struct inode_operations proc_dir_inode_operations = {
+static const struct inode_operations proc_dir_inode_operations = {
 	.lookup		= proc_lookup,
 	.getattr	= proc_getattr,
 	.setattr	= proc_notify_change,
Index: linux-2.6.20-rc4/fs/proc/root.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/proc/root.c
+++ linux-2.6.20-rc4/fs/proc/root.c
@@ -144,7 +144,7 @@ static const struct file_operations proc
 /*
  * proc root can do almost nothing..
  */
-static struct inode_operations proc_root_inode_operations = {
+static const struct inode_operations proc_root_inode_operations = {
 	.lookup		= proc_root_lookup,
 	.getattr	= proc_root_getattr,
 };
Index: linux-2.6.20-rc4/fs/qnx4/dir.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/qnx4/dir.c
+++ linux-2.6.20-rc4/fs/qnx4/dir.c
@@ -87,7 +87,7 @@ const struct file_operations qnx4_dir_op
 	.fsync		= file_fsync,
 };
 
-struct inode_operations qnx4_dir_inode_operations =
+const struct inode_operations qnx4_dir_inode_operations =
 {
 	.lookup		= qnx4_lookup,
 #ifdef CONFIG_QNX4FS_RW
Index: linux-2.6.20-rc4/fs/qnx4/file.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/qnx4/file.c
+++ linux-2.6.20-rc4/fs/qnx4/file.c
@@ -33,7 +33,7 @@ const struct file_operations qnx4_file_o
 #endif
 };
 
-struct inode_operations qnx4_file_inode_operations =
+const struct inode_operations qnx4_file_inode_operations =
 {
 #ifdef CONFIG_QNX4FS_RW
 	.truncate	= qnx4_truncate,
Index: linux-2.6.20-rc4/fs/ramfs/file-mmu.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/ramfs/file-mmu.c
+++ linux-2.6.20-rc4/fs/ramfs/file-mmu.c
@@ -45,6 +45,6 @@ const struct file_operations ramfs_file_
 	.llseek		= generic_file_llseek,
 };
 
-struct inode_operations ramfs_file_inode_operations = {
+const struct inode_operations ramfs_file_inode_operations = {
 	.getattr	= simple_getattr,
 };
Index: linux-2.6.20-rc4/fs/ramfs/file-nommu.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/ramfs/file-nommu.c
+++ linux-2.6.20-rc4/fs/ramfs/file-nommu.c
@@ -47,7 +47,7 @@ const struct file_operations ramfs_file_
 	.llseek			= generic_file_llseek,
 };
 
-struct inode_operations ramfs_file_inode_operations = {
+const struct inode_operations ramfs_file_inode_operations = {
 	.setattr		= ramfs_nommu_setattr,
 	.getattr		= simple_getattr,
 };
Index: linux-2.6.20-rc4/fs/ramfs/inode.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/ramfs/inode.c
+++ linux-2.6.20-rc4/fs/ramfs/inode.c
@@ -41,7 +41,7 @@
 #define RAMFS_MAGIC	0x858458f6
 
 static struct super_operations ramfs_ops;
-static struct inode_operations ramfs_dir_inode_operations;
+static const struct inode_operations ramfs_dir_inode_operations;
 
 static struct backing_dev_info ramfs_backing_dev_info = {
 	.ra_pages	= 0,	/* No readahead */
@@ -143,7 +143,7 @@ static int ramfs_symlink(struct inode * 
 	return error;
 }
 
-static struct inode_operations ramfs_dir_inode_operations = {
+static const struct inode_operations ramfs_dir_inode_operations = {
 	.create		= ramfs_create,
 	.lookup		= simple_lookup,
 	.link		= simple_link,
Index: linux-2.6.20-rc4/fs/ramfs/internal.h
===================================================================
--- linux-2.6.20-rc4.orig/fs/ramfs/internal.h
+++ linux-2.6.20-rc4/fs/ramfs/internal.h
@@ -12,4 +12,4 @@
 
 extern const struct address_space_operations ramfs_aops;
 extern const struct file_operations ramfs_file_operations;
-extern struct inode_operations ramfs_file_inode_operations;
+extern const struct inode_operations ramfs_file_inode_operations;
Index: linux-2.6.20-rc4/fs/reiserfs/file.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/reiserfs/file.c
+++ linux-2.6.20-rc4/fs/reiserfs/file.c
@@ -1538,7 +1538,7 @@ const struct file_operations reiserfs_fi
 	.splice_write = generic_file_splice_write,
 };
 
-struct inode_operations reiserfs_file_inode_operations = {
+const struct inode_operations reiserfs_file_inode_operations = {
 	.truncate = reiserfs_vfs_truncate_file,
 	.setattr = reiserfs_setattr,
 	.setxattr = reiserfs_setxattr,
Index: linux-2.6.20-rc4/fs/reiserfs/namei.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/reiserfs/namei.c
+++ linux-2.6.20-rc4/fs/reiserfs/namei.c
@@ -1525,7 +1525,7 @@ static int reiserfs_rename(struct inode 
 /*
  * directories can handle most operations...
  */
-struct inode_operations reiserfs_dir_inode_operations = {
+const struct inode_operations reiserfs_dir_inode_operations = {
 	//&reiserfs_dir_operations,   /* default_file_ops */
 	.create = reiserfs_create,
 	.lookup = reiserfs_lookup,
@@ -1548,7 +1548,7 @@ struct inode_operations reiserfs_dir_ino
  * symlink operations.. same as page_symlink_inode_operations, with xattr
  * stuff added
  */
-struct inode_operations reiserfs_symlink_inode_operations = {
+const struct inode_operations reiserfs_symlink_inode_operations = {
 	.readlink = generic_readlink,
 	.follow_link = page_follow_link_light,
 	.put_link = page_put_link,
@@ -1564,7 +1564,7 @@ struct inode_operations reiserfs_symlink
 /*
  * special file operations.. just xattr/acl stuff
  */
-struct inode_operations reiserfs_special_inode_operations = {
+const struct inode_operations reiserfs_special_inode_operations = {
 	.setattr = reiserfs_setattr,
 	.setxattr = reiserfs_setxattr,
 	.getxattr = reiserfs_getxattr,
Index: linux-2.6.20-rc4/fs/romfs/inode.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/romfs/inode.c
+++ linux-2.6.20-rc4/fs/romfs/inode.c
@@ -468,7 +468,7 @@ static const struct file_operations romf
 	.readdir	= romfs_readdir,
 };
 
-static struct inode_operations romfs_dir_inode_operations = {
+static const struct inode_operations romfs_dir_inode_operations = {
 	.lookup		= romfs_lookup,
 };
 
Index: linux-2.6.20-rc4/fs/smbfs/dir.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/smbfs/dir.c
+++ linux-2.6.20-rc4/fs/smbfs/dir.c
@@ -42,7 +42,7 @@ const struct file_operations smb_dir_ope
 	.open		= smb_dir_open,
 };
 
-struct inode_operations smb_dir_inode_operations =
+const struct inode_operations smb_dir_inode_operations =
 {
 	.create		= smb_create,
 	.lookup		= smb_lookup,
@@ -54,7 +54,7 @@ struct inode_operations smb_dir_inode_op
 	.setattr	= smb_notify_change,
 };
 
-struct inode_operations smb_dir_inode_operations_unix =
+const struct inode_operations smb_dir_inode_operations_unix =
 {
 	.create		= smb_create,
 	.lookup		= smb_lookup,
Index: linux-2.6.20-rc4/fs/smbfs/file.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/smbfs/file.c
+++ linux-2.6.20-rc4/fs/smbfs/file.c
@@ -418,7 +418,7 @@ const struct file_operations smb_file_op
 	.sendfile	= smb_file_sendfile,
 };
 
-struct inode_operations smb_file_inode_operations =
+const struct inode_operations smb_file_inode_operations =
 {
 	.permission	= smb_file_permission,
 	.getattr	= smb_getattr,
Index: linux-2.6.20-rc4/fs/smbfs/proto.h
===================================================================
--- linux-2.6.20-rc4.orig/fs/smbfs/proto.h
+++ linux-2.6.20-rc4/fs/smbfs/proto.h
@@ -36,8 +36,8 @@ extern int smb_proc_link(struct smb_sb_i
 extern void smb_install_null_ops(struct smb_ops *ops);
 /* dir.c */
 extern const struct file_operations smb_dir_operations;
-extern struct inode_operations smb_dir_inode_operations;
-extern struct inode_operations smb_dir_inode_operations_unix;
+extern const struct inode_operations smb_dir_inode_operations;
+extern const struct inode_operations smb_dir_inode_operations_unix;
 extern void smb_new_dentry(struct dentry *dentry);
 extern void smb_renew_times(struct dentry *dentry);
 /* cache.c */
@@ -65,7 +65,7 @@ extern int smb_notify_change(struct dent
 /* file.c */
 extern const struct address_space_operations smb_file_aops;
 extern const struct file_operations smb_file_operations;
-extern struct inode_operations smb_file_inode_operations;
+extern const struct inode_operations smb_file_inode_operations;
 /* ioctl.c */
 extern int smb_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);
 /* smbiod.c */
@@ -84,4 +84,4 @@ extern int smb_request_send_server(struc
 extern int smb_request_recv(struct smb_sb_info *server);
 /* symlink.c */
 extern int smb_symlink(struct inode *inode, struct dentry *dentry, const char *oldname);
-extern struct inode_operations smb_link_inode_operations;
+extern const struct inode_operations smb_link_inode_operations;
Index: linux-2.6.20-rc4/fs/smbfs/symlink.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/smbfs/symlink.c
+++ linux-2.6.20-rc4/fs/smbfs/symlink.c
@@ -62,7 +62,7 @@ static void smb_put_link(struct dentry *
 		__putname(s);
 }
 
-struct inode_operations smb_link_inode_operations =
+const struct inode_operations smb_link_inode_operations =
 {
 	.readlink	= generic_readlink,
 	.follow_link	= smb_follow_link,
Index: linux-2.6.20-rc4/fs/sysfs/dir.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/sysfs/dir.c
+++ linux-2.6.20-rc4/fs/sysfs/dir.c
@@ -267,7 +267,7 @@ static struct dentry * sysfs_lookup(stru
 	return ERR_PTR(err);
 }
 
-struct inode_operations sysfs_dir_inode_operations = {
+const struct inode_operations sysfs_dir_inode_operations = {
 	.lookup		= sysfs_lookup,
 	.setattr	= sysfs_setattr,
 };
Index: linux-2.6.20-rc4/fs/sysfs/inode.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/sysfs/inode.c
+++ linux-2.6.20-rc4/fs/sysfs/inode.c
@@ -28,7 +28,7 @@ static struct backing_dev_info sysfs_bac
 	.capabilities	= BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_WRITEBACK,
 };
 
-static struct inode_operations sysfs_inode_operations ={
+static const struct inode_operations sysfs_inode_operations ={
 	.setattr	= sysfs_setattr,
 };
 
Index: linux-2.6.20-rc4/fs/sysfs/symlink.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/sysfs/symlink.c
+++ linux-2.6.20-rc4/fs/sysfs/symlink.c
@@ -180,7 +180,7 @@ static void sysfs_put_link(struct dentry
 		free_page((unsigned long)page);
 }
 
-struct inode_operations sysfs_symlink_inode_operations = {
+const struct inode_operations sysfs_symlink_inode_operations = {
 	.readlink = generic_readlink,
 	.follow_link = sysfs_follow_link,
 	.put_link = sysfs_put_link,
Index: linux-2.6.20-rc4/fs/sysfs/sysfs.h
===================================================================
--- linux-2.6.20-rc4.orig/fs/sysfs/sysfs.h
+++ linux-2.6.20-rc4/fs/sysfs/sysfs.h
@@ -25,8 +25,8 @@ extern struct super_block * sysfs_sb;
 extern const struct file_operations sysfs_dir_operations;
 extern const struct file_operations sysfs_file_operations;
 extern const struct file_operations bin_fops;
-extern struct inode_operations sysfs_dir_inode_operations;
-extern struct inode_operations sysfs_symlink_inode_operations;
+extern const struct inode_operations sysfs_dir_inode_operations;
+extern const struct inode_operations sysfs_symlink_inode_operations;
 
 struct sysfs_symlink {
 	char * link_name;
Index: linux-2.6.20-rc4/fs/sysv/file.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/sysv/file.c
+++ linux-2.6.20-rc4/fs/sysv/file.c
@@ -30,7 +30,7 @@ const struct file_operations sysv_file_o
 	.sendfile	= generic_file_sendfile,
 };
 
-struct inode_operations sysv_file_inode_operations = {
+const struct inode_operations sysv_file_inode_operations = {
 	.truncate	= sysv_truncate,
 	.getattr	= sysv_getattr,
 };
Index: linux-2.6.20-rc4/fs/sysv/inode.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/sysv/inode.c
+++ linux-2.6.20-rc4/fs/sysv/inode.c
@@ -142,7 +142,7 @@ static inline void write3byte(struct sys
 	}
 }
 
-static struct inode_operations sysv_symlink_inode_operations = {
+static const struct inode_operations sysv_symlink_inode_operations = {
 	.readlink	= generic_readlink,
 	.follow_link	= page_follow_link_light,
 	.put_link	= page_put_link,
Index: linux-2.6.20-rc4/fs/sysv/namei.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/sysv/namei.c
+++ linux-2.6.20-rc4/fs/sysv/namei.c
@@ -292,7 +292,7 @@ out:
 /*
  * directories can handle most operations...
  */
-struct inode_operations sysv_dir_inode_operations = {
+const struct inode_operations sysv_dir_inode_operations = {
 	.create		= sysv_create,
 	.lookup		= sysv_lookup,
 	.link		= sysv_link,
Index: linux-2.6.20-rc4/fs/sysv/symlink.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/sysv/symlink.c
+++ linux-2.6.20-rc4/fs/sysv/symlink.c
@@ -14,7 +14,7 @@ static void *sysv_follow_link(struct den
 	return NULL;
 }
 
-struct inode_operations sysv_fast_symlink_inode_operations = {
+const struct inode_operations sysv_fast_symlink_inode_operations = {
 	.readlink	= generic_readlink,
 	.follow_link	= sysv_follow_link,
 };
Index: linux-2.6.20-rc4/fs/sysv/sysv.h
===================================================================
--- linux-2.6.20-rc4.orig/fs/sysv/sysv.h
+++ linux-2.6.20-rc4/fs/sysv/sysv.h
@@ -159,9 +159,9 @@ extern struct sysv_dir_entry *sysv_dotdo
 extern ino_t sysv_inode_by_name(struct dentry *);
 
 
-extern struct inode_operations sysv_file_inode_operations;
-extern struct inode_operations sysv_dir_inode_operations;
-extern struct inode_operations sysv_fast_symlink_inode_operations;
+extern const struct inode_operations sysv_file_inode_operations;
+extern const struct inode_operations sysv_dir_inode_operations;
+extern const struct inode_operations sysv_fast_symlink_inode_operations;
 extern const struct file_operations sysv_file_operations;
 extern const struct file_operations sysv_dir_operations;
 extern const struct address_space_operations sysv_aops;
Index: linux-2.6.20-rc4/fs/udf/file.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/udf/file.c
+++ linux-2.6.20-rc4/fs/udf/file.c
@@ -263,6 +263,6 @@ const struct file_operations udf_file_op
 	.sendfile		= generic_file_sendfile,
 };
 
-struct inode_operations udf_file_inode_operations = {
+const struct inode_operations udf_file_inode_operations = {
 	.truncate		= udf_truncate,
 };
Index: linux-2.6.20-rc4/fs/udf/namei.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/udf/namei.c
+++ linux-2.6.20-rc4/fs/udf/namei.c
@@ -1308,7 +1308,7 @@ end_rename:
 	return retval;
 }
 
-struct inode_operations udf_dir_inode_operations = {
+const struct inode_operations udf_dir_inode_operations = {
 	.lookup				= udf_lookup,
 	.create				= udf_create,
 	.link				= udf_link,
Index: linux-2.6.20-rc4/fs/udf/udfdecl.h
===================================================================
--- linux-2.6.20-rc4.orig/fs/udf/udfdecl.h
+++ linux-2.6.20-rc4/fs/udf/udfdecl.h
@@ -42,9 +42,9 @@ struct task_struct;
 struct buffer_head;
 struct super_block;
 
-extern struct inode_operations udf_dir_inode_operations;
+extern const struct inode_operations udf_dir_inode_operations;
 extern const struct file_operations udf_dir_operations;
-extern struct inode_operations udf_file_inode_operations;
+extern const struct inode_operations udf_file_inode_operations;
 extern const struct file_operations udf_file_operations;
 extern const struct address_space_operations udf_aops;
 extern const struct address_space_operations udf_adinicb_aops;
Index: linux-2.6.20-rc4/fs/ufs/namei.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/ufs/namei.c
+++ linux-2.6.20-rc4/fs/ufs/namei.c
@@ -355,7 +355,7 @@ out:
 	return err;
 }
 
-struct inode_operations ufs_dir_inode_operations = {
+const struct inode_operations ufs_dir_inode_operations = {
 	.create		= ufs_create,
 	.lookup		= ufs_lookup,
 	.link		= ufs_link,
Index: linux-2.6.20-rc4/fs/ufs/symlink.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/ufs/symlink.c
+++ linux-2.6.20-rc4/fs/ufs/symlink.c
@@ -36,7 +36,7 @@ static void *ufs_follow_link(struct dent
 	return NULL;
 }
 
-struct inode_operations ufs_fast_symlink_inode_operations = {
+const struct inode_operations ufs_fast_symlink_inode_operations = {
 	.readlink	= generic_readlink,
 	.follow_link	= ufs_follow_link,
 };
Index: linux-2.6.20-rc4/fs/ufs/truncate.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/ufs/truncate.c
+++ linux-2.6.20-rc4/fs/ufs/truncate.c
@@ -502,6 +502,6 @@ static int ufs_setattr(struct dentry *de
 	return inode_setattr(inode, attr);
 }
 
-struct inode_operations ufs_file_inode_operations = {
+const struct inode_operations ufs_file_inode_operations = {
 	.setattr = ufs_setattr,
 };
Index: linux-2.6.20-rc4/fs/vfat/namei.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/vfat/namei.c
+++ linux-2.6.20-rc4/fs/vfat/namei.c
@@ -996,7 +996,7 @@ error_inode:
 	goto out;
 }
 
-static struct inode_operations vfat_dir_inode_operations = {
+static const struct inode_operations vfat_dir_inode_operations = {
 	.create		= vfat_create,
 	.lookup		= vfat_lookup,
 	.unlink		= vfat_unlink,
Index: linux-2.6.20-rc4/fs/xfs/linux-2.6/xfs_iops.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/xfs/linux-2.6/xfs_iops.c
+++ linux-2.6.20-rc4/fs/xfs/linux-2.6/xfs_iops.c
@@ -815,7 +815,7 @@ xfs_vn_removexattr(
 }
 
 
-struct inode_operations xfs_inode_operations = {
+const struct inode_operations xfs_inode_operations = {
 	.permission		= xfs_vn_permission,
 	.truncate		= xfs_vn_truncate,
 	.getattr		= xfs_vn_getattr,
@@ -826,7 +826,7 @@ struct inode_operations xfs_inode_operat
 	.removexattr		= xfs_vn_removexattr,
 };
 
-struct inode_operations xfs_dir_inode_operations = {
+const struct inode_operations xfs_dir_inode_operations = {
 	.create			= xfs_vn_create,
 	.lookup			= xfs_vn_lookup,
 	.link			= xfs_vn_link,
@@ -845,7 +845,7 @@ struct inode_operations xfs_dir_inode_op
 	.removexattr		= xfs_vn_removexattr,
 };
 
-struct inode_operations xfs_symlink_inode_operations = {
+const struct inode_operations xfs_symlink_inode_operations = {
 	.readlink		= generic_readlink,
 	.follow_link		= xfs_vn_follow_link,
 	.put_link		= xfs_vn_put_link,
Index: linux-2.6.20-rc4/fs/xfs/linux-2.6/xfs_iops.h
===================================================================
--- linux-2.6.20-rc4.orig/fs/xfs/linux-2.6/xfs_iops.h
+++ linux-2.6.20-rc4/fs/xfs/linux-2.6/xfs_iops.h
@@ -18,9 +18,9 @@
 #ifndef __XFS_IOPS_H__
 #define __XFS_IOPS_H__
 
-extern struct inode_operations xfs_inode_operations;
-extern struct inode_operations xfs_dir_inode_operations;
-extern struct inode_operations xfs_symlink_inode_operations;
+extern const struct inode_operations xfs_inode_operations;
+extern const struct inode_operations xfs_dir_inode_operations;
+extern const struct inode_operations xfs_symlink_inode_operations;
 
 extern const struct file_operations xfs_file_operations;
 extern const struct file_operations xfs_dir_file_operations;
Index: linux-2.6.20-rc4/include/linux/coda_linux.h
===================================================================
--- linux-2.6.20-rc4.orig/include/linux/coda_linux.h
+++ linux-2.6.20-rc4/include/linux/coda_linux.h
@@ -23,9 +23,9 @@
 #include <linux/coda_fs_i.h>
 
 /* operations */
-extern struct inode_operations coda_dir_inode_operations;
-extern struct inode_operations coda_file_inode_operations;
-extern struct inode_operations coda_ioctl_inode_operations;
+extern const struct inode_operations coda_dir_inode_operations;
+extern const struct inode_operations coda_file_inode_operations;
+extern const struct inode_operations coda_ioctl_inode_operations;
 
 extern const struct address_space_operations coda_file_aops;
 extern const struct address_space_operations coda_symlink_aops;
Index: linux-2.6.20-rc4/include/linux/efs_fs.h
===================================================================
--- linux-2.6.20-rc4.orig/include/linux/efs_fs.h
+++ linux-2.6.20-rc4/include/linux/efs_fs.h
@@ -36,7 +36,7 @@ static inline struct efs_sb_info *SUPER_
 
 struct statfs;
 
-extern struct inode_operations efs_dir_inode_operations;
+extern const struct inode_operations efs_dir_inode_operations;
 extern const struct file_operations efs_dir_operations;
 extern const struct address_space_operations efs_symlink_aops;
 
Index: linux-2.6.20-rc4/include/linux/ext3_fs.h
===================================================================
--- linux-2.6.20-rc4.orig/include/linux/ext3_fs.h
+++ linux-2.6.20-rc4/include/linux/ext3_fs.h
@@ -868,16 +868,16 @@ do {								\
 extern const struct file_operations ext3_dir_operations;
 
 /* file.c */
-extern struct inode_operations ext3_file_inode_operations;
+extern const struct inode_operations ext3_file_inode_operations;
 extern const struct file_operations ext3_file_operations;
 
 /* namei.c */
-extern struct inode_operations ext3_dir_inode_operations;
-extern struct inode_operations ext3_special_inode_operations;
+extern const struct inode_operations ext3_dir_inode_operations;
+extern const struct inode_operations ext3_special_inode_operations;
 
 /* symlink.c */
-extern struct inode_operations ext3_symlink_inode_operations;
-extern struct inode_operations ext3_fast_symlink_inode_operations;
+extern const struct inode_operations ext3_symlink_inode_operations;
+extern const struct inode_operations ext3_fast_symlink_inode_operations;
 
 
 #endif	/* __KERNEL__ */
Index: linux-2.6.20-rc4/include/linux/ext4_fs.h
===================================================================
--- linux-2.6.20-rc4.orig/include/linux/ext4_fs.h
+++ linux-2.6.20-rc4/include/linux/ext4_fs.h
@@ -955,16 +955,16 @@ do {								\
 extern const struct file_operations ext4_dir_operations;
 
 /* file.c */
-extern struct inode_operations ext4_file_inode_operations;
+extern const struct inode_operations ext4_file_inode_operations;
 extern const struct file_operations ext4_file_operations;
 
 /* namei.c */
-extern struct inode_operations ext4_dir_inode_operations;
-extern struct inode_operations ext4_special_inode_operations;
+extern const struct inode_operations ext4_dir_inode_operations;
+extern const struct inode_operations ext4_special_inode_operations;
 
 /* symlink.c */
-extern struct inode_operations ext4_symlink_inode_operations;
-extern struct inode_operations ext4_fast_symlink_inode_operations;
+extern const struct inode_operations ext4_symlink_inode_operations;
+extern const struct inode_operations ext4_fast_symlink_inode_operations;
 
 /* extents.c */
 extern int ext4_ext_tree_init(handle_t *handle, struct inode *);
Index: linux-2.6.20-rc4/include/linux/fs.h
===================================================================
--- linux-2.6.20-rc4.orig/include/linux/fs.h
+++ linux-2.6.20-rc4/include/linux/fs.h
@@ -549,7 +549,7 @@ struct inode {
 	spinlock_t		i_lock;	/* i_blocks, i_bytes, maybe i_size */
 	struct mutex		i_mutex;
 	struct rw_semaphore	i_alloc_sem;
-	struct inode_operations	*i_op;
+	const struct inode_operations	*i_op;
 	const struct file_operations	*i_fop;	/* former ->i_op->default_file_ops */
 	struct super_block	*i_sb;
 	struct file_lock	*i_flock;
@@ -1821,7 +1821,7 @@ extern void page_put_link(struct dentry 
 extern int __page_symlink(struct inode *inode, const char *symname, int len,
 		gfp_t gfp_mask);
 extern int page_symlink(struct inode *inode, const char *symname, int len);
-extern struct inode_operations page_symlink_inode_operations;
+extern const struct inode_operations page_symlink_inode_operations;
 extern int generic_readlink(struct dentry *, char __user *, int);
 extern void generic_fillattr(struct inode *, struct kstat *);
 extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
@@ -1866,7 +1866,7 @@ extern int simple_commit_write(struct fi
 extern struct dentry *simple_lookup(struct inode *, struct dentry *, struct nameidata *);
 extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *);
 extern const struct file_operations simple_dir_operations;
-extern struct inode_operations simple_dir_inode_operations;
+extern const struct inode_operations simple_dir_inode_operations;
 struct tree_descr { char *name; const struct file_operations *ops; int mode; };
 struct dentry *d_alloc_name(struct dentry *, const char *);
 extern int simple_fill_super(struct super_block *, int, struct tree_descr *);
Index: linux-2.6.20-rc4/include/linux/msdos_fs.h
===================================================================
--- linux-2.6.20-rc4.orig/include/linux/msdos_fs.h
+++ linux-2.6.20-rc4/include/linux/msdos_fs.h
@@ -234,7 +234,7 @@ struct msdos_sb_info {
 	struct fat_mount_options options;
 	struct nls_table *nls_disk;  /* Codepage used on disk */
 	struct nls_table *nls_io;    /* Charset used for input and display */
-	void *dir_ops;		     /* Opaque; default directory operations */
+	const void *dir_ops;		     /* Opaque; default directory operations */
 	int dir_per_block;	     /* dir entries per block */
 	int dir_per_block_bits;	     /* log2(dir_per_block) */
 
@@ -399,7 +399,7 @@ extern int fat_count_free_clusters(struc
 extern int fat_generic_ioctl(struct inode *inode, struct file *filp,
 			     unsigned int cmd, unsigned long arg);
 extern const struct file_operations fat_file_operations;
-extern struct inode_operations fat_file_inode_operations;
+extern const struct inode_operations fat_file_inode_operations;
 extern int fat_notify_change(struct dentry * dentry, struct iattr * attr);
 extern void fat_truncate(struct inode *inode);
 extern int fat_getattr(struct vfsmount *mnt, struct dentry *dentry,
@@ -413,7 +413,7 @@ extern struct inode *fat_build_inode(str
 			struct msdos_dir_entry *de, loff_t i_pos);
 extern int fat_sync_inode(struct inode *inode);
 extern int fat_fill_super(struct super_block *sb, void *data, int silent,
-			struct inode_operations *fs_dir_inode_ops, int isvfat);
+			const struct inode_operations *fs_dir_inode_ops, int isvfat);
 
 extern int fat_flush_inodes(struct super_block *sb, struct inode *i1,
 		            struct inode *i2);
Index: linux-2.6.20-rc4/include/linux/ncp_fs.h
===================================================================
--- linux-2.6.20-rc4.orig/include/linux/ncp_fs.h
+++ linux-2.6.20-rc4/include/linux/ncp_fs.h
@@ -204,7 +204,7 @@ void ncp_update_inode(struct inode *, st
 void ncp_update_inode2(struct inode *, struct ncp_entry_info *);
 
 /* linux/fs/ncpfs/dir.c */
-extern struct inode_operations ncp_dir_inode_operations;
+extern const struct inode_operations ncp_dir_inode_operations;
 extern const struct file_operations ncp_dir_operations;
 int ncp_conn_logged_in(struct super_block *);
 int ncp_date_dos2unix(__le16 time, __le16 date);
@@ -226,7 +226,7 @@ void ncp_lock_server(struct ncp_server *
 void ncp_unlock_server(struct ncp_server *server);
 
 /* linux/fs/ncpfs/file.c */
-extern struct inode_operations ncp_file_inode_operations;
+extern const struct inode_operations ncp_file_inode_operations;
 extern const struct file_operations ncp_file_operations;
 int ncp_make_open(struct inode *, int);
 
Index: linux-2.6.20-rc4/include/linux/nfs_fs.h
===================================================================
--- linux-2.6.20-rc4.orig/include/linux/nfs_fs.h
+++ linux-2.6.20-rc4/include/linux/nfs_fs.h
@@ -330,9 +330,9 @@ static inline void nfs_fattr_init(struct
 /*
  * linux/fs/nfs/file.c
  */
-extern struct inode_operations nfs_file_inode_operations;
+extern const struct inode_operations nfs_file_inode_operations;
 #ifdef CONFIG_NFS_V3
-extern struct inode_operations nfs3_file_inode_operations;
+extern const struct inode_operations nfs3_file_inode_operations;
 #endif /* CONFIG_NFS_V3 */
 extern const struct file_operations nfs_file_operations;
 extern const struct address_space_operations nfs_file_aops;
@@ -379,9 +379,9 @@ extern ssize_t nfs_file_direct_write(str
 /*
  * linux/fs/nfs/dir.c
  */
-extern struct inode_operations nfs_dir_inode_operations;
+extern const struct inode_operations nfs_dir_inode_operations;
 #ifdef CONFIG_NFS_V3
-extern struct inode_operations nfs3_dir_inode_operations;
+extern const struct inode_operations nfs3_dir_inode_operations;
 #endif /* CONFIG_NFS_V3 */
 extern const struct file_operations nfs_dir_operations;
 extern struct dentry_operations nfs_dentry_operations;
@@ -391,7 +391,7 @@ extern int nfs_instantiate(struct dentry
 /*
  * linux/fs/nfs/symlink.c
  */
-extern struct inode_operations nfs_symlink_inode_operations;
+extern const struct inode_operations nfs_symlink_inode_operations;
 
 /*
  * linux/fs/nfs/sysctl.c
@@ -408,8 +408,8 @@ extern void nfs_unregister_sysctl(void);
  * linux/fs/nfs/namespace.c
  */
 extern struct list_head nfs_automount_list;
-extern struct inode_operations nfs_mountpoint_inode_operations;
-extern struct inode_operations nfs_referral_inode_operations;
+extern const struct inode_operations nfs_mountpoint_inode_operations;
+extern const struct inode_operations nfs_referral_inode_operations;
 extern int nfs_mountpoint_expiry_timeout;
 extern void nfs_release_automount_timer(void);
 
Index: linux-2.6.20-rc4/include/linux/nfs_xdr.h
===================================================================
--- linux-2.6.20-rc4.orig/include/linux/nfs_xdr.h
+++ linux-2.6.20-rc4/include/linux/nfs_xdr.h
@@ -767,8 +767,8 @@ struct nfs_access_entry;
 struct nfs_rpc_ops {
 	int	version;		/* Protocol version */
 	struct dentry_operations *dentry_ops;
-	struct inode_operations *dir_inode_ops;
-	struct inode_operations *file_inode_ops;
+	const struct inode_operations *dir_inode_ops;
+	const struct inode_operations *file_inode_ops;
 
 	int	(*getroot) (struct nfs_server *, struct nfs_fh *,
 			    struct nfs_fsinfo *);
Index: linux-2.6.20-rc4/include/linux/phonedev.h
===================================================================
--- linux-2.6.20-rc4.orig/include/linux/phonedev.h
+++ linux-2.6.20-rc4/include/linux/phonedev.h
@@ -9,7 +9,7 @@
 
 struct phone_device {
 	struct phone_device *next;
-	struct file_operations *f_op;
+	const struct file_operations *f_op;
 	int (*open) (struct phone_device *, struct file *);
 	int board;		/* Device private index */
 	int minor;
Index: linux-2.6.20-rc4/include/linux/proc_fs.h
===================================================================
--- linux-2.6.20-rc4.orig/include/linux/proc_fs.h
+++ linux-2.6.20-rc4/include/linux/proc_fs.h
@@ -55,7 +55,7 @@ struct proc_dir_entry {
 	uid_t uid;
 	gid_t gid;
 	loff_t size;
-	struct inode_operations * proc_iops;
+	const struct inode_operations * proc_iops;
 	const struct file_operations * proc_fops;
 	get_info_t *get_info;
 	struct module *owner;
Index: linux-2.6.20-rc4/include/linux/qnx4_fs.h
===================================================================
--- linux-2.6.20-rc4.orig/include/linux/qnx4_fs.h
+++ linux-2.6.20-rc4/include/linux/qnx4_fs.h
@@ -116,8 +116,8 @@ extern unsigned long qnx4_block_map(stru
 
 extern struct buffer_head *qnx4_bread(struct inode *, int, int);
 
-extern struct inode_operations qnx4_file_inode_operations;
-extern struct inode_operations qnx4_dir_inode_operations;
+extern const struct inode_operations qnx4_file_inode_operations;
+extern const struct inode_operations qnx4_dir_inode_operations;
 extern const struct file_operations qnx4_file_operations;
 extern const struct file_operations qnx4_dir_operations;
 extern int qnx4_is_free(struct super_block *sb, long block);
Index: linux-2.6.20-rc4/include/linux/reiserfs_fs.h
===================================================================
--- linux-2.6.20-rc4.orig/include/linux/reiserfs_fs.h
+++ linux-2.6.20-rc4/include/linux/reiserfs_fs.h
@@ -1949,9 +1949,9 @@ int reiserfs_global_version_in_proc(char
 #endif
 
 /* dir.c */
-extern struct inode_operations reiserfs_dir_inode_operations;
-extern struct inode_operations reiserfs_symlink_inode_operations;
-extern struct inode_operations reiserfs_special_inode_operations;
+extern const struct inode_operations reiserfs_dir_inode_operations;
+extern const struct inode_operations reiserfs_symlink_inode_operations;
+extern const struct inode_operations reiserfs_special_inode_operations;
 extern const struct file_operations reiserfs_dir_operations;
 
 /* tail_conversion.c */
@@ -1963,7 +1963,7 @@ int indirect2direct(struct reiserfs_tran
 void reiserfs_unmap_buffer(struct buffer_head *);
 
 /* file.c */
-extern struct inode_operations reiserfs_file_inode_operations;
+extern const struct inode_operations reiserfs_file_inode_operations;
 extern const struct file_operations reiserfs_file_operations;
 extern const struct address_space_operations reiserfs_address_space_operations;
 
Index: linux-2.6.20-rc4/include/linux/ufs_fs.h
===================================================================
--- linux-2.6.20-rc4.orig/include/linux/ufs_fs.h
+++ linux-2.6.20-rc4/include/linux/ufs_fs.h
@@ -959,7 +959,7 @@ extern struct ufs_cg_private_info * ufs_
 extern void ufs_put_cylinder (struct super_block *, unsigned);
 
 /* dir.c */
-extern struct inode_operations ufs_dir_inode_operations;
+extern const struct inode_operations ufs_dir_inode_operations;
 extern int ufs_add_link (struct dentry *, struct inode *);
 extern ino_t ufs_inode_by_name(struct inode *, struct dentry *);
 extern int ufs_make_empty(struct inode *, struct inode *);
@@ -971,7 +971,7 @@ extern void ufs_set_link(struct inode *d
 			 struct page *page, struct inode *inode);
 
 /* file.c */
-extern struct inode_operations ufs_file_inode_operations;
+extern const struct inode_operations ufs_file_inode_operations;
 extern const struct file_operations ufs_file_operations;
 
 extern const struct address_space_operations ufs_aops;
@@ -998,7 +998,7 @@ extern void ufs_error (struct super_bloc
 extern void ufs_panic (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
 
 /* symlink.c */
-extern struct inode_operations ufs_fast_symlink_inode_operations;
+extern const struct inode_operations ufs_fast_symlink_inode_operations;
 
 /* truncate.c */
 extern int ufs_truncate (struct inode *, loff_t);



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [patch 00/12] Fix ppc64's writing to struct file_operations
  2007-01-14  0:51 ` [patch 00/12] Fix ppc64's writing to struct file_operations Arjan van de Ven
@ 2007-01-14 14:54   ` Alan
  2007-01-14 23:55     ` Stephen Rothwell
  0 siblings, 1 reply; 17+ messages in thread
From: Alan @ 2007-01-14 14:54 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: linux-kernel, akpm

>  	.read		= seq_read,
> +	.write		= lparcfg_write,
>  	.open		= lparcfg_open,
>  	.release	= single_release,
>  };
> @@ -581,10 +582,8 @@ int __init lparcfg_init(void)
>  
>  	/* Allow writing if we have FW_FEATURE_SPLPAR */
>  	if (firmware_has_feature(FW_FEATURE_SPLPAR) &&
> -			!firmware_has_feature(FW_FEATURE_ISERIES)) {
> -		lparcfg_fops.write = lparcfg_write;
> +			!firmware_has_feature(FW_FEATURE_ISERIES))
>  		mode |= S_IWUSR;
> -	}


This doesn't appea to do the same thing at all. You need to select
between two sets of const inode ops instead, otherwise you turn write on
arbitarily.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [patch 00/12] Fix ppc64's writing to struct file_operations
  2007-01-14 14:54   ` Alan
@ 2007-01-14 23:55     ` Stephen Rothwell
  2007-01-15  0:15       ` Arjan van de Ven
  0 siblings, 1 reply; 17+ messages in thread
From: Stephen Rothwell @ 2007-01-14 23:55 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: linux-kernel, akpm, Alan

On Sun, 14 Jan 2007 14:54:11 +0000 Alan <alan@lxorguk.ukuu.org.uk> wrote:
>
> This doesn't appea to do the same thing at all. You need to select
> between two sets of const inode ops instead, otherwise you turn write on
> arbitarily.

Or something like below ... (compile tested on pseries, iseries and combined).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index 41c05dc..0de5a08 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -439,6 +439,10 @@ static ssize_t lparcfg_write(struct file *file, const char __user * buf,
 
 	ssize_t retval = -ENOMEM;
 
+	if (!firmware_has_feature(FW_FEATURE_SPLPAR) ||
+			firmware_has_feature(FW_FEATURE_ISERIES))
+		return -EINVAL;
+
 	kbuf = kmalloc(count, GFP_KERNEL);
 	if (!kbuf)
 		goto out;
@@ -517,7 +521,7 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v)
 static ssize_t lparcfg_write(struct file *file, const char __user * buf,
 			     size_t count, loff_t * off)
 {
-	return count;
+	return -EINVAL;
 }
 
 #endif				/* CONFIG_PPC_PSERIES */
@@ -570,6 +574,7 @@ static int lparcfg_open(struct inode *inode, struct file *file)
 struct file_operations lparcfg_fops = {
 	.owner		= THIS_MODULE,
 	.read		= seq_read,
+	.write		= lparcfg_write,
 	.open		= lparcfg_open,
 	.release	= single_release,
 };
@@ -581,10 +586,8 @@ int __init lparcfg_init(void)
 
 	/* Allow writing if we have FW_FEATURE_SPLPAR */
 	if (firmware_has_feature(FW_FEATURE_SPLPAR) &&
-			!firmware_has_feature(FW_FEATURE_ISERIES)) {
-		lparcfg_fops.write = lparcfg_write;
+			!firmware_has_feature(FW_FEATURE_ISERIES))
 		mode |= S_IWUSR;
-	}
 
 	ent = create_proc_entry("ppc64/lparcfg", mode, NULL);
 	if (ent) {

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [patch 00/12] Fix ppc64's writing to struct file_operations
  2007-01-14 23:55     ` Stephen Rothwell
@ 2007-01-15  0:15       ` Arjan van de Ven
  0 siblings, 0 replies; 17+ messages in thread
From: Arjan van de Ven @ 2007-01-15  0:15 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: linux-kernel, akpm, Alan

On Mon, 2007-01-15 at 10:55 +1100, Stephen Rothwell wrote:
> On Sun, 14 Jan 2007 14:54:11 +0000 Alan <alan@lxorguk.ukuu.org.uk> wrote:
> >
> > This doesn't appea to do the same thing at all. You need to select
> > between two sets of const inode ops instead, otherwise you turn write on
> > arbitarily.
> 
> Or something like below ... (compile tested on pseries, iseries and combined).

ok I was about to do this instead... but you beat me to it.. thanks!

Acked-by: Arjan van de Ven <arjan@linux.intel.com>



-- 
if you want to mail me at work (you don't), use arjan (at) linux.intel.com
Test the interaction between Linux and your BIOS via http://www.linuxfirmwarekit.org


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2007-01-15  0:15 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-14  0:51 Patch series to mark struct file_operations and struct inode_operations const Arjan van de Ven
2007-01-14  0:51 ` [patch 00/12] Fix ppc64's writing to struct file_operations Arjan van de Ven
2007-01-14 14:54   ` Alan
2007-01-14 23:55     ` Stephen Rothwell
2007-01-15  0:15       ` Arjan van de Ven
2007-01-14  0:52 ` [patch 01/12] mark struct file_operations const 1 Arjan van de Ven
2007-01-14  0:53 ` [patch 02/12] mark struct file_operations const 2 Arjan van de Ven
2007-01-14  0:53 ` [patch 03/12] mark struct file_operations const 3 Arjan van de Ven
2007-01-14  0:54 ` [patch 04/12] mark struct file_operations const 4 Arjan van de Ven
2007-01-14  0:54 ` [patch 05/12] mark struct file_operations const 5 Arjan van de Ven
2007-01-14  0:55 ` [patch 06/12] mark struct file_operations const 6 Arjan van de Ven
2007-01-14  0:56 ` [patch 07/12] mark struct file_operations const 7 Arjan van de Ven
2007-01-14  0:56 ` [patch 08/12] mark struct file_operations const 8 Arjan van de Ven
2007-01-14  0:57 ` [patch 09/12] mark struct file_operations const 9 Arjan van de Ven
2007-01-14  0:57 ` [patch 10/12] mark struct inode_operations const 1 Arjan van de Ven
2007-01-14  0:58 ` [patch 11/12] mark struct inode_operations const 2 Arjan van de Ven
2007-01-14  0:58 ` [patch 12/12] mark struct inode_operations const 3 Arjan van de Ven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).