diff options
author | Emese Revfy <re.emese@gmail.com> | 2009-12-31 08:52:51 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-07 20:04:49 -0500 |
commit | 9cd43611ccfb46632bfa7d19f688924ea93f1613 (patch) | |
tree | e11ecee403235ba9d8855892fa7ad55d9b63e221 /include | |
parent | 985fc176a6c03836454629be2f2a611ccc7c7002 (diff) |
kobject: Constify struct kset_uevent_ops
Constify struct kset_uevent_ops.
This is part of the ops structure constification
effort started by Arjan van de Ven et al.
Benefits of this constification:
* prevents modification of data that is shared
(referenced) by many other structure instances
at runtime
* detects/prevents accidental (but not intentional)
modification attempts on archs that enforce
read-only kernel data at runtime
* potentially better optimized code as the compiler
can assume that the const data cannot be changed
* the compiler/linker move const data into .rodata
and therefore exclude them from false sharing
Signed-off-by: Emese Revfy <re.emese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/kobject.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index 58ae8e00fcdd..57a1eaae9096 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h | |||
@@ -118,9 +118,9 @@ struct kobj_uevent_env { | |||
118 | }; | 118 | }; |
119 | 119 | ||
120 | struct kset_uevent_ops { | 120 | struct kset_uevent_ops { |
121 | int (*filter)(struct kset *kset, struct kobject *kobj); | 121 | int (* const filter)(struct kset *kset, struct kobject *kobj); |
122 | const char *(*name)(struct kset *kset, struct kobject *kobj); | 122 | const char *(* const name)(struct kset *kset, struct kobject *kobj); |
123 | int (*uevent)(struct kset *kset, struct kobject *kobj, | 123 | int (* const uevent)(struct kset *kset, struct kobject *kobj, |
124 | struct kobj_uevent_env *env); | 124 | struct kobj_uevent_env *env); |
125 | }; | 125 | }; |
126 | 126 | ||
@@ -155,14 +155,14 @@ struct kset { | |||
155 | struct list_head list; | 155 | struct list_head list; |
156 | spinlock_t list_lock; | 156 | spinlock_t list_lock; |
157 | struct kobject kobj; | 157 | struct kobject kobj; |
158 | struct kset_uevent_ops *uevent_ops; | 158 | const struct kset_uevent_ops *uevent_ops; |
159 | }; | 159 | }; |
160 | 160 | ||
161 | extern void kset_init(struct kset *kset); | 161 | extern void kset_init(struct kset *kset); |
162 | extern int __must_check kset_register(struct kset *kset); | 162 | extern int __must_check kset_register(struct kset *kset); |
163 | extern void kset_unregister(struct kset *kset); | 163 | extern void kset_unregister(struct kset *kset); |
164 | extern struct kset * __must_check kset_create_and_add(const char *name, | 164 | extern struct kset * __must_check kset_create_and_add(const char *name, |
165 | struct kset_uevent_ops *u, | 165 | const struct kset_uevent_ops *u, |
166 | struct kobject *parent_kobj); | 166 | struct kobject *parent_kobj); |
167 | 167 | ||
168 | static inline struct kset *to_kset(struct kobject *kobj) | 168 | static inline struct kset *to_kset(struct kobject *kobj) |