Commit e956d3ab authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

[PATCH] kobject: add kobject_rename()

Based on a patch written by Dan Aloni <da-x@gmx.net>
parent f91c01ac
......@@ -39,6 +39,8 @@ extern void kobject_cleanup(struct kobject *);
extern int kobject_add(struct kobject *);
extern void kobject_del(struct kobject *);
extern void kobject_rename(struct kobject *, char *new_name);
extern int kobject_register(struct kobject *);
extern void kobject_unregister(struct kobject *);
......
......@@ -313,6 +313,21 @@ int kobject_register(struct kobject * kobj)
return error;
}
/**
* kobject_rename - change the name of an object
* @kobj: object in question.
* @new_name: object's new name
*/
void kobject_rename(struct kobject * kobj, char *new_name)
{
kobj = kobject_get(kobj);
if (!kobj)
return;
sysfs_rename_dir(kobj, new_name);
kobject_put(kobj);
}
/**
* kobject_del - unlink kobject from hierarchy.
* @kobj: object.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment