From: Dmitry Torokhov <dtor_core@ameritech.net>
To: linux-kernel@vger.kernel.org
Cc: Greg KH <gregkh@suse.de>
Subject: [PATCH 3/5] Make kobject's name be const char *
Date: Tue, 26 Apr 2005 02:32:00 -0500 [thread overview]
Message-ID: <200504260232.01017.dtor_core@ameritech.net> (raw)
In-Reply-To: <200504260229.03866.dtor_core@ameritech.net>
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>
---
include/linux/kobject.h | 6 +++---
lib/kobject.c | 2 +-
lib/kobject_uevent.c | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
Index: dtor/include/linux/kobject.h
===================================================================
--- dtor.orig/include/linux/kobject.h
+++ dtor/include/linux/kobject.h
@@ -33,7 +33,7 @@
extern u64 hotplug_seqnum;
struct kobject {
- char * k_name;
+ const char * k_name;
char name[KOBJ_NAME_LEN];
struct kref kref;
struct list_head entry;
@@ -46,7 +46,7 @@ struct kobject {
extern int kobject_set_name(struct kobject *, const char *, ...)
__attribute__((format(printf,2,3)));
-static inline char * kobject_name(struct kobject * kobj)
+static inline const char * kobject_name(const struct kobject * kobj)
{
return kobj->k_name;
}
@@ -57,7 +57,7 @@ extern void kobject_cleanup(struct kobje
extern int kobject_add(struct kobject *);
extern void kobject_del(struct kobject *);
-extern int kobject_rename(struct kobject *, char *new_name);
+extern int kobject_rename(struct kobject *, const char *new_name);
extern int kobject_register(struct kobject *);
extern void kobject_unregister(struct kobject *);
Index: dtor/lib/kobject.c
===================================================================
--- dtor.orig/lib/kobject.c
+++ dtor/lib/kobject.c
@@ -280,7 +280,7 @@ EXPORT_SYMBOL(kobject_set_name);
* @new_name: object's new name
*/
-int kobject_rename(struct kobject * kobj, char *new_name)
+int kobject_rename(struct kobject * kobj, const char *new_name)
{
int error = 0;
Index: dtor/lib/kobject_uevent.c
===================================================================
--- dtor.orig/lib/kobject_uevent.c
+++ dtor/lib/kobject_uevent.c
@@ -197,7 +197,7 @@ void kobject_hotplug(struct kobject *kob
int i = 0;
int retval;
char *kobj_path = NULL;
- char *name = NULL;
+ const char *name = NULL;
char *action_string;
u64 seq;
struct kobject *top_kobj = kobj;
@@ -249,7 +249,7 @@ void kobject_hotplug(struct kobject *kob
name = kobject_name(&kset->kobj);
argv [0] = hotplug_path;
- argv [1] = name;
+ argv [1] = (char *)name; /* won't be changed but 'const' has to go */
argv [2] = NULL;
/* minimal command environment */
next prev parent reply other threads:[~2005-04-26 7:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-26 7:29 [PATCH 0/5] Misc driver core changes (constness) Dmitry Torokhov
2005-04-26 7:29 ` [PATCH 1/5] kobject_hotplug() should use kobject_name() Dmitry Torokhov
2005-04-26 7:31 ` [PATCH 2/5] sysfs_{create|remove}_link should take const char * Dmitry Torokhov
2005-04-26 7:32 ` Dmitry Torokhov [this message]
2005-04-26 7:32 ` [PATCH 4/5] kset_hotplug_ops->name shoudl return " Dmitry Torokhov
2005-04-26 7:34 ` [PATCH 5/5] make driver's name be " Dmitry Torokhov
2005-04-28 7:00 ` [PATCH 0/5] Misc driver core changes (constness) Greg KH
2005-04-29 5:58 ` [PATCH 6/5] Make attributes names const char * Dmitry Torokhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200504260232.01017.dtor_core@ameritech.net \
--to=dtor_core@ameritech.net \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.