diff options
author | Arjan van de Ven <arjan@linux.intel.com> | 2007-02-12 00:55:37 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-12 09:48:46 -0800 |
commit | 9c2e08c592cd357a8330c34def1e8ecfdcf53275 (patch) | |
tree | 62e7449e43bb502f2e9630ab41832ceccd9a0f65 /security | |
parent | da7071d7e32d15149cc513f096a3638097b66387 (diff) |
[PATCH] mark struct file_operations const 9
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>
Diffstat (limited to 'security')
-rw-r--r-- | security/inode.c | 4 | ||||
-rw-r--r-- | security/keys/proc.c | 4 | ||||
-rw-r--r-- | security/selinux/selinuxfs.c | 26 |
3 files changed, 17 insertions, 17 deletions
diff --git a/security/inode.c b/security/inode.c index 9b16e14f3a8..d7ecf89fbc7 100644 --- a/security/inode.c +++ b/security/inode.c @@ -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; diff --git a/security/keys/proc.c b/security/keys/proc.c index 686a9ee0c5d..3e0d0a6e224 100644 --- a/security/keys/proc.c +++ b/security/keys/proc.c @@ -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, diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index c8bf6e172f6..93b3177c758 100644 --- a/security/selinux/selinuxfs.c +++ b/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(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, |