* If you add an action here, you must also add the proper string to the
* lib/kobject_uevent.c file.
*/
-
+typedef int __bitwise kobject_action_t;
enum kobject_action {
- KOBJ_ADD = 0x00, /* add event, for hotplug */
- KOBJ_REMOVE = 0x01, /* remove event, for hotplug */
- KOBJ_CHANGE = 0x02, /* a sysfs attribute file has changed */
- KOBJ_MOUNT = 0x03, /* mount event for block devices */
- KOBJ_UMOUNT = 0x04, /* umount event for block devices */
- KOBJ_MAX_ACTION, /* must be last action listed */
+ KOBJ_ADD = (__force kobject_action_t) 0x01, /* add event, for hotplug */
+ KOBJ_REMOVE = (__force kobject_action_t) 0x02, /* remove event, for hotplug */
+ KOBJ_CHANGE = (__force kobject_action_t) 0x03, /* a sysfs attribute file has changed */
+ KOBJ_MOUNT = (__force kobject_action_t) 0x04, /* mount event for block devices */
+ KOBJ_UMOUNT = (__force kobject_action_t) 0x05, /* umount event for block devices */
};
#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