[patch] export, rename fill_kobj_path and get_kobj_path_length

From: Robert Love
Date: Fri Aug 06 2004 - 15:32:16 EST


Greg,

Per our discussion, the following patch exports fill_kobj_path and
get_kobj_path_length and adds them to kobject.h.

I also renamed them to kobject_get_path_len and kobject_fill_path,
respectively, to match the name space.

I need these for a kobject-based kevent. Others may find them
fascinating as well.

Robert Love


Export some internal kobject helpers.
Signed-Off-By: Robert Love <rml@xxxxxxxxxx>

include/linux/kobject.h | 3 +++
lib/kobject.c | 12 +++++++-----
2 files changed, 10 insertions(+), 5 deletions(-)

diff -urN linux-2.6.8-rc3-mm1/include/linux/kobject.h linux-rml/include/linux/kobject.h
--- linux-2.6.8-rc3-mm1/include/linux/kobject.h 2004-08-06 14:03:04.882742673 -0400
+++ linux-rml/include/linux/kobject.h 2004-08-06 15:50:32.518075100 -0400
@@ -58,6 +58,9 @@

extern void kobject_hotplug(const char *action, struct kobject *);

+extern int kobject_get_path_len(struct kset *, struct kobject *);
+extern void kobject_fill_path(struct kset *, struct kobject *, char *, int);
+
struct kobj_type {
void (*release)(struct kobject *);
struct sysfs_ops * sysfs_ops;
diff -urN linux-2.6.8-rc3-mm1/lib/kobject.c linux-rml/lib/kobject.c
--- linux-2.6.8-rc3-mm1/lib/kobject.c 2004-08-06 14:03:06.229569894 -0400
+++ linux-rml/lib/kobject.c 2004-08-06 16:11:14.450737875 -0400
@@ -66,7 +66,7 @@


#ifdef CONFIG_HOTPLUG
-static int get_kobj_path_length(struct kset *kset, struct kobject *kobj)
+int kobject_get_path_len(struct kset *kset, struct kobject *kobj)
{
int length = 1;
struct kobject * parent = kobj;
@@ -82,7 +82,8 @@
return length;
}

-static void fill_kobj_path(struct kset *kset, struct kobject *kobj, char *path, int length)
+void kobject_fill_path(struct kset *kset, struct kobject *kobj, char *path,
+ int length)
{
struct kobject * parent;

@@ -163,12 +164,12 @@
envp [i++] = scratch;
scratch += sprintf(scratch, "SEQNUM=%ld", seq) + 1;

- kobj_path_length = get_kobj_path_length (kset, kobj);
+ kobj_path_length = kobject_get_path_len (kset, kobj);
kobj_path = kmalloc (kobj_path_length, GFP_KERNEL);
if (!kobj_path)
goto exit;
memset (kobj_path, 0x00, kobj_path_length);
- fill_kobj_path (kset, kobj, kobj_path, kobj_path_length);
+ kobject_fill_path (kset, kobj, kobj_path, kobj_path_length);

envp [i++] = scratch;
scratch += sprintf (scratch, "DEVPATH=%s", kobj_path) + 1;
@@ -626,7 +627,8 @@
}
}

-
+EXPORT_SYMBOL(kobject_get_path_len);
+EXPORT_SYMBOL(kobject_fill_path);
EXPORT_SYMBOL(kobject_init);
EXPORT_SYMBOL(kobject_register);
EXPORT_SYMBOL(kobject_unregister);


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/