mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
driver core: Introduce device_move(): move a device to a new parent.
Provide a function device_move() to move a device to a new parent device. Add auxilliary functions kobject_move() and sysfs_move_dir(). kobject_move() generates a new uevent of type KOBJ_MOVE, containing the previous path (DEVPATH_OLD) in addition to the usual values. For this, a new interface kobject_uevent_env() is created that allows to add further environmental data to the uevent at the kobject layer. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Acked-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
af9e076536
commit
8a82472f86
7 changed files with 228 additions and 4 deletions
|
@ -47,6 +47,7 @@ enum kobject_action {
|
|||
KOBJ_UMOUNT = (__force kobject_action_t) 0x05, /* umount event for block devices (broken) */
|
||||
KOBJ_OFFLINE = (__force kobject_action_t) 0x06, /* device offline */
|
||||
KOBJ_ONLINE = (__force kobject_action_t) 0x07, /* device online */
|
||||
KOBJ_MOVE = (__force kobject_action_t) 0x08, /* device move */
|
||||
};
|
||||
|
||||
struct kobject {
|
||||
|
@ -76,6 +77,7 @@ extern int __must_check kobject_add(struct kobject *);
|
|||
extern void kobject_del(struct kobject *);
|
||||
|
||||
extern int __must_check kobject_rename(struct kobject *, const char *new_name);
|
||||
extern int __must_check kobject_move(struct kobject *, struct kobject *);
|
||||
|
||||
extern int __must_check kobject_register(struct kobject *);
|
||||
extern void kobject_unregister(struct kobject *);
|
||||
|
@ -264,6 +266,8 @@ extern int __must_check subsys_create_file(struct subsystem * ,
|
|||
|
||||
#if defined(CONFIG_HOTPLUG)
|
||||
void kobject_uevent(struct kobject *kobj, enum kobject_action action);
|
||||
void kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
|
||||
char *envp[]);
|
||||
|
||||
int add_uevent_var(char **envp, int num_envp, int *cur_index,
|
||||
char *buffer, int buffer_size, int *cur_len,
|
||||
|
@ -271,6 +275,10 @@ int add_uevent_var(char **envp, int num_envp, int *cur_index,
|
|||
__attribute__((format (printf, 7, 8)));
|
||||
#else
|
||||
static inline void kobject_uevent(struct kobject *kobj, enum kobject_action action) { }
|
||||
static inline void kobject_uevent_env(struct kobject *kobj,
|
||||
enum kobject_action action,
|
||||
char *envp[])
|
||||
{ }
|
||||
|
||||
static inline int add_uevent_var(char **envp, int num_envp, int *cur_index,
|
||||
char *buffer, int buffer_size, int *cur_len,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue