summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2007-07-08 22:29:26 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-18 15:49:49 -0700
commit60a96a59569bab85571d0089682109bd3324e896 (patch)
treeb70d0174ddae44224ae5c8cea90231e659beff30 /lib
parenta6bb340da32f0abf76656be1619fb85150eef61b (diff)
downloadtalos-op-linux-60a96a59569bab85571d0089682109bd3324e896.tar.gz
talos-op-linux-60a96a59569bab85571d0089682109bd3324e896.zip
Driver core: accept all valid action-strings in uevent-trigger
This allows the uevent file to handle any type of uevent action to be triggered by userspace instead of just the "add" uevent. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/kobject_uevent.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index bd5ecbbafab1..6a80c784a8fb 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -33,25 +33,15 @@ static DEFINE_SPINLOCK(sequence_lock);
static struct sock *uevent_sock;
#endif
-static char *action_to_string(enum kobject_action action)
-{
- switch (action) {
- case KOBJ_ADD:
- return "add";
- case KOBJ_REMOVE:
- return "remove";
- case KOBJ_CHANGE:
- return "change";
- case KOBJ_OFFLINE:
- return "offline";
- case KOBJ_ONLINE:
- return "online";
- case KOBJ_MOVE:
- return "move";
- default:
- return NULL;
- }
-}
+/* the strings here must match the enum in include/linux/kobject.h */
+const char *kobject_actions[] = {
+ "add",
+ "remove",
+ "change",
+ "move",
+ "online",
+ "offline",
+};
/**
* kobject_uevent_env - send an uevent with environmental data
@@ -83,7 +73,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
pr_debug("%s\n", __FUNCTION__);
- action_string = action_to_string(action);
+ action_string = kobject_actions[action];
if (!action_string) {
pr_debug("kobject attempted to send uevent without action_string!\n");
return -EINVAL;
OpenPOWER on IntegriCloud