aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPatrick Mochel <mochel@osdl.org>2003-06-15 19:02:19 -0700
committerPatrick Mochel <mochel@osdl.org>2003-06-15 19:02:19 -0700
commit4d7fcae96cab59f57b4a8460fa784d85acc67f72 (patch)
tree6f69837df52d2129a5b59d7a7fda611eefa2d8f8 /lib
parenteaaaa30438086b33825ea63748d98a3714201b90 (diff)
downloadhistory-4d7fcae96cab59f57b4a8460fa784d85acc67f72.tar.gz
[kobject] Add sequence number to kobject hotplug.
Diffstat (limited to 'lib')
-rw-r--r--lib/kobject.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/kobject.c b/lib/kobject.c
index e2378597b989ca..fb49131f5ff98e 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -100,6 +100,9 @@ static void fill_kobj_path(struct kset *kset, struct kobject *kobj, char *path,
#define BUFFER_SIZE 1024 /* should be enough memory for the env */
#define NUM_ENVP 32 /* number of env pointers */
+static unsigned long sequence_num;
+static spinlock_t sequence_lock = SPIN_LOCK_UNLOCKED;
+
static void kset_hotplug(const char *action, struct kset *kset,
struct kobject *kobj)
{
@@ -112,6 +115,7 @@ static void kset_hotplug(const char *action, struct kset *kset,
int kobj_path_length;
char *kobj_path = NULL;
char *name = NULL;
+ unsigned long seq;
/* If the kset has a filter operation, call it. If it returns
failure, no hotplug event is required. */
@@ -152,6 +156,13 @@ static void kset_hotplug(const char *action, struct kset *kset,
envp [i++] = scratch;
scratch += sprintf(scratch, "ACTION=%s", action) + 1;
+ spin_lock(&sequence_lock);
+ seq = sequence_num++;
+ spin_unlock(&sequence_lock);
+
+ envp [i++] = scratch;
+ scratch += sprintf(scratch, "SEQNUM=%ld", seq) + 1;
+
kobj_path_length = get_kobj_path_length (kset, kobj);
kobj_path = kmalloc (kobj_path_length, GFP_KERNEL);
if (!kobj_path)