From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Driver Core patches for 2.6.9
Date: Tue, 19 Oct 2004 09:37:12 -0700 [thread overview]
Message-ID: <10982038323021@kroah.com> (raw)
In-Reply-To: <10982038294134@kroah.com>
ChangeSet 1.1996, 2004/10/15 16:07:38-07:00, greg@kroah.com
kevent: add __bitwise kobject_action to help the compiler check for misusages
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
include/linux/kobject_uevent.h | 13 ++++++-------
lib/kobject_uevent.c | 28 +++++++++++++---------------
2 files changed, 19 insertions(+), 22 deletions(-)
diff -Nru a/include/linux/kobject_uevent.h b/include/linux/kobject_uevent.h
--- a/include/linux/kobject_uevent.h 2004-10-19 09:20:20 -07:00
+++ b/include/linux/kobject_uevent.h 2004-10-19 09:20:20 -07:00
@@ -15,14 +15,13 @@
* 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 */
};
diff -Nru a/lib/kobject_uevent.c b/lib/kobject_uevent.c
--- a/lib/kobject_uevent.c 2004-10-19 09:20:20 -07:00
+++ b/lib/kobject_uevent.c 2004-10-19 09:20:20 -07:00
@@ -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
next prev parent reply other threads:[~2004-10-22 7:47 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-19 16:34 [BK PATCH] Driver Core patches for 2.6.9 Greg KH
2004-10-19 16:35 ` [PATCH] " Greg KH
2004-10-19 16:35 ` Greg KH
2004-10-19 16:36 ` Greg KH
2004-10-19 16:36 ` Greg KH
2004-10-19 16:36 ` Greg KH
2004-10-19 16:36 ` Greg KH
2004-10-19 16:36 ` Greg KH
2004-10-19 16:36 ` Greg KH
2004-10-19 16:36 ` Greg KH
2004-10-19 16:36 ` Greg KH
2004-10-19 16:36 ` Greg KH
2004-10-19 16:36 ` Greg KH
2004-10-19 16:36 ` Greg KH
2004-10-19 16:36 ` Greg KH
2004-10-19 16:36 ` Greg KH
2004-10-19 16:36 ` Greg KH
2004-10-19 16:36 ` Greg KH
2004-10-19 16:36 ` Greg KH
2004-10-19 16:36 ` Greg KH
2004-10-19 16:36 ` Greg KH
2004-10-19 16:36 ` Greg KH
2004-10-19 16:36 ` Greg KH
2004-10-19 16:36 ` Greg KH
2004-10-19 16:36 ` Greg KH
2004-10-19 16:36 ` Greg KH
2004-10-19 16:36 ` Greg KH
2004-10-19 16:36 ` Greg KH
2004-10-19 16:36 ` Greg KH
2004-10-19 16:37 ` Greg KH
2004-10-19 16:37 ` Greg KH
2004-10-19 16:37 ` Greg KH
2004-10-19 16:37 ` Greg KH
2004-10-19 16:37 ` Greg KH
2004-10-19 16:37 ` Greg KH [this message]
2004-10-23 20:20 ` Kronos
2004-10-23 20:34 ` Greg KH
2004-10-23 21:46 ` Kronos
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=10982038323021@kroah.com \
--to=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.