aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorCornelia Huck <cornelia.huck@de.ibm.com>2006-11-20 11:07:51 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-12-01 17:52:01 -0500
commit8a82472f86bf693b8e91ed56c9ca4f62fbbdcfa3 (patch)
tree79d148ee548f4b57e6f5a4a69cf6cdb81e7a1bf2 /include
parentaf9e0765362151b27372c14d9d6dc417184182d3 (diff)
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>
Diffstat (limited to 'include')
-rw-r--r--include/linux/device.h1
-rw-r--r--include/linux/kobject.h8
-rw-r--r--include/linux/sysfs.h8
3 files changed, 17 insertions, 0 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index 0a0370c74181..583a341e016c 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -424,6 +424,7 @@ extern int device_for_each_child(struct device *, void *,
424extern struct device *device_find_child(struct device *, void *data, 424extern struct device *device_find_child(struct device *, void *data,
425 int (*match)(struct device *, void *)); 425 int (*match)(struct device *, void *));
426extern int device_rename(struct device *dev, char *new_name); 426extern int device_rename(struct device *dev, char *new_name);
427extern int device_move(struct device *dev, struct device *new_parent);
427 428
428/* 429/*
429 * Manual binding of a device to driver. See drivers/base/bus.c 430 * Manual binding of a device to driver. See drivers/base/bus.c
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index bcd9cd173c2c..d1c8d28fa92e 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -47,6 +47,7 @@ enum kobject_action {
47 KOBJ_UMOUNT = (__force kobject_action_t) 0x05, /* umount event for block devices (broken) */ 47 KOBJ_UMOUNT = (__force kobject_action_t) 0x05, /* umount event for block devices (broken) */
48 KOBJ_OFFLINE = (__force kobject_action_t) 0x06, /* device offline */ 48 KOBJ_OFFLINE = (__force kobject_action_t) 0x06, /* device offline */
49 KOBJ_ONLINE = (__force kobject_action_t) 0x07, /* device online */ 49 KOBJ_ONLINE = (__force kobject_action_t) 0x07, /* device online */
50 KOBJ_MOVE = (__force kobject_action_t) 0x08, /* device move */
50}; 51};
51 52
52struct kobject { 53struct kobject {
@@ -76,6 +77,7 @@ extern int __must_check kobject_add(struct kobject *);
76extern void kobject_del(struct kobject *); 77extern void kobject_del(struct kobject *);
77 78
78extern int __must_check kobject_rename(struct kobject *, const char *new_name); 79extern int __must_check kobject_rename(struct kobject *, const char *new_name);
80extern int __must_check kobject_move(struct kobject *, struct kobject *);
79 81
80extern int __must_check kobject_register(struct kobject *); 82extern int __must_check kobject_register(struct kobject *);
81extern void kobject_unregister(struct kobject *); 83extern void kobject_unregister(struct kobject *);
@@ -264,6 +266,8 @@ extern int __must_check subsys_create_file(struct subsystem * ,
264 266
265#if defined(CONFIG_HOTPLUG) 267#if defined(CONFIG_HOTPLUG)
266void kobject_uevent(struct kobject *kobj, enum kobject_action action); 268void kobject_uevent(struct kobject *kobj, enum kobject_action action);
269void kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
270 char *envp[]);
267 271
268int add_uevent_var(char **envp, int num_envp, int *cur_index, 272int add_uevent_var(char **envp, int num_envp, int *cur_index,
269 char *buffer, int buffer_size, int *cur_len, 273 char *buffer, int buffer_size, int *cur_len,
@@ -271,6 +275,10 @@ int add_uevent_var(char **envp, int num_envp, int *cur_index,
271 __attribute__((format (printf, 7, 8))); 275 __attribute__((format (printf, 7, 8)));
272#else 276#else
273static inline void kobject_uevent(struct kobject *kobj, enum kobject_action action) { } 277static inline void kobject_uevent(struct kobject *kobj, enum kobject_action action) { }
278static inline void kobject_uevent_env(struct kobject *kobj,
279 enum kobject_action action,
280 char *envp[])
281{ }
274 282
275static inline int add_uevent_var(char **envp, int num_envp, int *cur_index, 283static inline int add_uevent_var(char **envp, int num_envp, int *cur_index,
276 char *buffer, int buffer_size, int *cur_len, 284 char *buffer, int buffer_size, int *cur_len,
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 6d5c43d31dec..2129d1b6c874 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -97,6 +97,9 @@ extern int __must_check
97sysfs_rename_dir(struct kobject *, const char *new_name); 97sysfs_rename_dir(struct kobject *, const char *new_name);
98 98
99extern int __must_check 99extern int __must_check
100sysfs_move_dir(struct kobject *, struct kobject *);
101
102extern int __must_check
100sysfs_create_file(struct kobject *, const struct attribute *); 103sysfs_create_file(struct kobject *, const struct attribute *);
101 104
102extern int __must_check 105extern int __must_check
@@ -142,6 +145,11 @@ static inline int sysfs_rename_dir(struct kobject * k, const char *new_name)
142 return 0; 145 return 0;
143} 146}
144 147
148static inline int sysfs_move_dir(struct kobject * k, struct kobject * new_parent)
149{
150 return 0;
151}
152
145static inline int sysfs_create_file(struct kobject * k, const struct attribute * a) 153static inline int sysfs_create_file(struct kobject * k, const struct attribute * a)
146{ 154{
147 return 0; 155 return 0;