diff options
author | Greg Kroah-Hartman <greg@kroah.com> | 2004-10-15 02:07:38 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <greg@kroah.com> | 2004-10-15 02:07:38 -0700 |
commit | 23aebb6f8755121394ef088d84a7fa483b444aa9 (patch) | |
tree | 6ce45ed7f7377475a41b544376ba0e39ff53abea /lib | |
parent | 086bdc0608c56c6b1afb76d641111e1df6e99024 (diff) | |
download | history-23aebb6f8755121394ef088d84a7fa483b444aa9.tar.gz |
kevent: add __bitwise kobject_action to help the compiler check for misusages
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/kobject_uevent.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index 67c1d11bf78898..a5ea7709667018 100644 --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c @@ -23,24 +23,22 @@ #include <linux/kobject.h> #include <net/sock.h> -/* - * These must match up with the values for enum kobject_action - * as found in include/linux/kobject_uevent.h - */ -static char *actions[] = { - "add", /* 0x00 */ - "remove", /* 0x01 */ - "change", /* 0x02 */ - "mount", /* 0x03 */ - "umount", /* 0x04 */ -}; - static char *action_to_string(enum kobject_action action) { - if (action >= KOBJ_MAX_ACTION) + switch (action) { + case KOBJ_ADD: + return "add"; + case KOBJ_REMOVE: + return "remove"; + case KOBJ_CHANGE: + return "change"; + case KOBJ_MOUNT: + return "mount"; + case KOBJ_UMOUNT: + return "umount"; + default: return NULL; - else - return actions[action]; + } } #ifdef CONFIG_KOBJECT_UEVENT |