diff options
author | Dmitry Torokhov <dtor_core@ameritech.net> | 2005-04-26 03:32:00 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-06-20 18:15:00 -0400 |
commit | f3b4f3c6dec04c6c8261fe22645f07b39976595a (patch) | |
tree | 9c4ad15f5d5fc7d3a8006396b185bb615386a61c | |
parent | e3a15db2415579d5136b9ba9b52fe27c66da8780 (diff) |
[PATCH] Make kobject's name be const char *
kobject: make kobject's name const char * since users should not
attempt to change it (except by calling kobject_rename).
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | include/linux/kobject.h | 6 | ||||
-rw-r--r-- | lib/kobject.c | 2 | ||||
-rw-r--r-- | lib/kobject_uevent.c | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index 765d660d3bea..76dc67245c0c 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h | |||
@@ -33,7 +33,7 @@ | |||
33 | extern u64 hotplug_seqnum; | 33 | extern u64 hotplug_seqnum; |
34 | 34 | ||
35 | struct kobject { | 35 | struct kobject { |
36 | char * k_name; | 36 | const char * k_name; |
37 | char name[KOBJ_NAME_LEN]; | 37 | char name[KOBJ_NAME_LEN]; |
38 | struct kref kref; | 38 | struct kref kref; |
39 | struct list_head entry; | 39 | struct list_head entry; |
@@ -46,7 +46,7 @@ struct kobject { | |||
46 | extern int kobject_set_name(struct kobject *, const char *, ...) | 46 | extern int kobject_set_name(struct kobject *, const char *, ...) |
47 | __attribute__((format(printf,2,3))); | 47 | __attribute__((format(printf,2,3))); |
48 | 48 | ||
49 | static inline char * kobject_name(struct kobject * kobj) | 49 | static inline const char * kobject_name(const struct kobject * kobj) |
50 | { | 50 | { |
51 | return kobj->k_name; | 51 | return kobj->k_name; |
52 | } | 52 | } |
@@ -57,7 +57,7 @@ extern void kobject_cleanup(struct kobject *); | |||
57 | extern int kobject_add(struct kobject *); | 57 | extern int kobject_add(struct kobject *); |
58 | extern void kobject_del(struct kobject *); | 58 | extern void kobject_del(struct kobject *); |
59 | 59 | ||
60 | extern int kobject_rename(struct kobject *, char *new_name); | 60 | extern int kobject_rename(struct kobject *, const char *new_name); |
61 | 61 | ||
62 | extern int kobject_register(struct kobject *); | 62 | extern int kobject_register(struct kobject *); |
63 | extern void kobject_unregister(struct kobject *); | 63 | extern void kobject_unregister(struct kobject *); |
diff --git a/lib/kobject.c b/lib/kobject.c index 94048826624c..dd0917dd9fa9 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
@@ -279,7 +279,7 @@ EXPORT_SYMBOL(kobject_set_name); | |||
279 | * @new_name: object's new name | 279 | * @new_name: object's new name |
280 | */ | 280 | */ |
281 | 281 | ||
282 | int kobject_rename(struct kobject * kobj, char *new_name) | 282 | int kobject_rename(struct kobject * kobj, const char *new_name) |
283 | { | 283 | { |
284 | int error = 0; | 284 | int error = 0; |
285 | 285 | ||
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index 1ede5aa33376..8e49d21057e4 100644 --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c | |||
@@ -197,7 +197,7 @@ void kobject_hotplug(struct kobject *kobj, enum kobject_action action) | |||
197 | int i = 0; | 197 | int i = 0; |
198 | int retval; | 198 | int retval; |
199 | char *kobj_path = NULL; | 199 | char *kobj_path = NULL; |
200 | char *name = NULL; | 200 | const char *name = NULL; |
201 | char *action_string; | 201 | char *action_string; |
202 | u64 seq; | 202 | u64 seq; |
203 | struct kobject *top_kobj = kobj; | 203 | struct kobject *top_kobj = kobj; |
@@ -249,7 +249,7 @@ void kobject_hotplug(struct kobject *kobj, enum kobject_action action) | |||
249 | name = kobject_name(&kset->kobj); | 249 | name = kobject_name(&kset->kobj); |
250 | 250 | ||
251 | argv [0] = hotplug_path; | 251 | argv [0] = hotplug_path; |
252 | argv [1] = name; | 252 | argv [1] = (char *)name; /* won't be changed but 'const' has to go */ |
253 | argv [2] = NULL; | 253 | argv [2] = NULL; |
254 | 254 | ||
255 | /* minimal command environment */ | 255 | /* minimal command environment */ |