[PATCH] mark struct file_operations const 9
authorArjan van de Ven <arjan@linux.intel.com>
Mon, 12 Feb 2007 08:55:37 +0000 (00:55 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Mon, 12 Feb 2007 17:48:46 +0000 (09:48 -0800)
Many struct file_operations in the kernel can be "const".  Marking them const
moves these to the .rodata section, which avoids false sharing with potential
dirty data.  In addition it'll catch accidental writes at compile time to
these shared resources.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
32 files changed:
arch/powerpc/platforms/cell/spufs/spufs.h
drivers/s390/char/tape_class.c
drivers/s390/char/tape_class.h
security/inode.c
security/keys/proc.c
security/selinux/selinuxfs.c
sound/core/control.c
sound/core/hwdep.c
sound/core/info.c
sound/core/init.c
sound/core/oss/mixer_oss.c
sound/core/oss/pcm_oss.c
sound/core/pcm_native.c
sound/core/rawmidi.c
sound/core/seq/oss/seq_oss.c
sound/core/seq/seq_clientmgr.c
sound/core/sound.c
sound/core/timer.c
sound/oss/ad1889.c
sound/oss/btaudio.c
sound/oss/dmasound/dmasound_core.c
sound/oss/emu10k1/audio.c
sound/oss/emu10k1/midi.c
sound/oss/emu10k1/mixer.c
sound/oss/hal2.c
sound/oss/msnd_pinnacle.c
sound/oss/os.h
sound/oss/sh_dac_audio.c
sound/oss/soundcard.c
sound/oss/via82cxxx_audio.c
sound/oss/vwsnd.c
sound/sound_core.c

index 70fb13395c04b47325e6940df9c089c921ac3a8a..56864469215e5b6b75fd46ae07ca62f483821d10 100644 (file)
@@ -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);
index 56b87618b100c1d33b8829d3f9bd184f7c80f7b6..2e0d29730b67590639f8e0dba84b48ae90ebd5b5 100644 (file)
@@ -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 3d0ca054cdee75fb2b51dfcad55f92889216874b..a8bd9b47fad62ac022aa9a88517b5b65f917a8ca 100644 (file)
@@ -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 9b16e14f3a80e8faa6ad2bc5efe53d100e3d29a0..d7ecf89fbc743435dc8e82cb424c1b9803984700 100644 (file)
@@ -50,7 +50,7 @@ static int default_open(struct inode *inode, struct file *file)
        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 *name, mode_t mode,
  */
 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 686a9ee0c5dee8b43fbcf72e407dc386e52e7086..3e0d0a6e224f5e36204c05526175d9382f6af6c6 100644 (file)
@@ -33,7 +33,7 @@ static struct seq_operations proc_keys_ops = {
        .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_users_ops = {
        .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 c8bf6e172f6e02ed8246f26d642d8841181b8151..93b3177c7585aca735deea6397cbddee86a192cd 100644 (file)
@@ -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(struct file *filp, char __user *buf,
        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 *filp, char __user *buf,
        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(struct file *file, const char __user *b
        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(struct inode *inode, struct file *file)
        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 42bcf2794b285dd14bc89d8b9cb8cc11686d2037..86de7258b76d04a0695251e94ecfcbc2e63c10a4 100644 (file)
@@ -1398,7 +1398,7 @@ static int snd_ctl_fasync(int fd, struct file * file, int on)
  *  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 39c03f3dfbfa07d2a0dfed12ac5bf12480cfb8ac..96ffdf18c3fef89e7aa6e39d303a6a678df932ba 100644 (file)
@@ -317,7 +317,7 @@ static int snd_hwdep_control_ioctl(struct snd_card *card,
 
  */
 
-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 54591e2eb6eea23d8febdf0d42d94421d5db3a3f..bf6dbf99528be5a0895de0d3616f02e15d1c350a 100644 (file)
@@ -507,7 +507,7 @@ static int snd_info_entry_mmap(struct file *file, struct vm_area_struct *vma)
        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 db61037337427b9adc881868fa104c9ec015bc06..4a431e3ea3a2c7f8bb69bbd2d347cd419883d283 100644 (file)
@@ -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];
@@ -244,7 +244,7 @@ static int snd_disconnect_fasync(int fd, struct file *file, int on)
        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 3391f2a9b4d167150114deec246ce3cc7082978e..74a2923eb40155708d5f97543e3fc3e3f0e65926 100644 (file)
@@ -390,7 +390,7 @@ int snd_mixer_oss_ioctl_card(struct snd_card *card, unsigned int cmd, unsigned l
  *  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 786a82e68890c86247052513f6c72b2d9e3523d3..c4744bb07f4119c2ee930953fd9049b7daa9e210 100644 (file)
@@ -2889,7 +2889,7 @@ static void snd_pcm_oss_proc_done(struct snd_pcm *pcm)
  *  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 b52e89393fa399062c93b46b81f3fa84be36d591..3e276fcf3336eec5f0234de0750f83d54404b0a4 100644 (file)
@@ -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 7e6ceec738d53cafc868865d5470a70d13f91b43..d14dcbb6dbca70a6789b0b56144cd1d99f85f361 100644 (file)
@@ -1359,7 +1359,7 @@ static void snd_rawmidi_proc_info_read(struct snd_info_entry *entry,
  *  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 92858cf8b6eb09e4b71b951698375e20a6a9efb2..2eb987308b539af5f321c9ea0c7264ca24a56a33 100644 (file)
@@ -208,7 +208,7 @@ odev_poll(struct file *file, poll_table * wait)
  * 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 bb9dd9fa8e51a0b122f2e3ef1010937c4d986112..694efe832b6787f9aa683635c42a00346d626aab 100644 (file)
@@ -2538,7 +2538,7 @@ void snd_seq_info_clients_read(struct snd_info_entry *entry,
  *  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 4084de06412707e28011788d56c02aa60514fe10..70600df94d62e3ef6d3d38566e9699a92bcfa7f4 100644 (file)
@@ -168,7 +168,7 @@ static int snd_open(struct inode *inode, struct file *file)
        return err;
 }
 
-static struct file_operations snd_fops =
+static const struct file_operations snd_fops =
 {
        .owner =        THIS_MODULE,
        .open =         snd_open
index 3e06383510692ba3ef5416eb367b0a7c9f5c2b4c..160e40ede72316a68bc13e47ee4d9bd25bf2be94 100644 (file)
@@ -1901,7 +1901,7 @@ static unsigned int snd_timer_user_poll(struct file *file, poll_table * wait)
 #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 09263d72a519983a10e96347d9ee4f8cd3f1ed9d..f0724327493c0c47e66a822e009ee0602c064a9b 100644 (file)
@@ -778,7 +778,7 @@ static int ad1889_release(struct inode *inode, struct file *file)
        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 inode *inode, struct file *file,
        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 ad7210a00dc01ead45e119d7fed3f2c613124ed6..f845528e1facc8713e025a4b600f37343c4f6fc1 100644 (file)
@@ -429,7 +429,7 @@ static int btaudio_mixer_ioctl(struct inode *inode, struct file *file,
        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(struct file *file, struct poll_table_struct
        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_digital_dsp_fops = {
        .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 80b836e80d993745b11b16dcd5c1f86da4c07795..a0ec886f2aa367e0f573a3bc8e4f6d981260158f 100644 (file)
@@ -371,7 +371,7 @@ static int mixer_ioctl(struct inode *inode, struct file *file, u_int cmd,
        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, struct file *file, u_int cmd,
        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 *file, char __user *buf, size_t count,
        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 efcf589d7083401450d2c743d36b65e5cedbf6ee..e75ea21eb8117fd67558b4d64328f18c806035be 100644 (file)
@@ -1582,7 +1582,7 @@ static void emu10k1_waveout_bh(unsigned long refdata)
        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 cca3dad2bdf4bf2550f48668286687cb1dc33ed1..df1e990449a0370b0f5b7090205c8162990e19d7 100644 (file)
@@ -458,7 +458,7 @@ int emu10k1_midi_callback(unsigned long msg, unsigned long refdata, unsigned lon
 }
 
 /* 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 6419796c2ed7b665e442547dfea1447e6f7590a4..bc3805fb0701eae0ce5dab83ba12c3c69b2f64c4 100644 (file)
@@ -681,7 +681,7 @@ static int emu10k1_mixer_release(struct inode *inode, struct file *file)
        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 d18286ccc14d244ee18d55b9ac9d04c48b0c2c50..80a42773c6485c98cbc80706a97741861ef713ef 100644 (file)
@@ -1377,7 +1377,7 @@ static int hal2_release(struct inode *inode, struct file *file)
        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_fops = {
        .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 24110d63b136803e1d9ac9a2942b213e068a066e..f1f49ebf752ea0a6ee109fbf9622b1a0265c92f0 100644 (file)
@@ -1106,7 +1106,7 @@ static irqreturn_t intr(int irq, void *dev_id)
        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 0490562c7f7f03d8bed5f945ee4f30943721f64b..a1a962d7f67d3a07e77cf1d0a36b791116ca83cf 100644 (file)
@@ -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 51f554154c48dfa0a7c56d082231268fc9a55c5a..7ea9accc2ba4461dd5a543cec153b4c8ca729dde 100644 (file)
@@ -255,7 +255,7 @@ static int dac_audio_release(struct inode *inode, struct file *file)
        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 b92c8cd1aeafea220e707d4c4b17272b94ef8d3c..dcd8d6d2f56f39b6b821f12e503bce389996ccf4 100644 (file)
@@ -483,7 +483,7 @@ static int sound_mmap(struct file *file, struct vm_area_struct *vma)
        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 c96cc8c68b3bec1135aefc7fd7e6c370c540121d..7ab3a732e184443ecc299147240f1470df2e9e84 100644 (file)
@@ -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 via_info *card)
  *
  */
 
-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 6dfb9f4b03ec9c0fae1df528ec9245f226ab50ed..d25249a932bfa48abe544bfa7dac49ba0a3e17e7 100644 (file)
@@ -3035,7 +3035,7 @@ static int vwsnd_audio_release(struct inode *inode, struct file *file)
        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 inode *ioctl,
        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 8f1ced4ab34cb2fbf0dd3143fa882ce916dafac6..46daca1755028d9ac73a4270deda963a11ef6cc9 100644 (file)
@@ -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,