libmultipath: Print out uevent sequence number
authorHannes Reinecke <hare@suse.de>
Tue, 8 Jan 2013 13:54:07 +0000 (14:54 +0100)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Tue, 8 Jan 2013 22:59:46 +0000 (23:59 +0100)
For debugging we should be printing out the sequence number.

Signed-off-by: Hannes Reinecke <hare@suse.de>
libmultipath/uevent.c
libmultipath/uevent.h

index 5b0b258..bc74d38 100644 (file)
@@ -361,11 +361,20 @@ int failback_listen(void)
                        key = &buffer[bufpos];
                        keylen = strlen(key);
                        uev->envp[i] = key;
+                       /* Filter out sequence number */
+                       if (strncmp(key, "SEQNUM=", 7) == 0) {
+                               char *eptr;
+
+                               uev->seqnum = strtoul(key + 7, &eptr, 10);
+                               if (eptr == key + 7)
+                                       uev->seqnum = -1;
+                       }
                        bufpos += keylen + 1;
                }
                uev->envp[i] = NULL;
 
-               condlog(3, "uevent '%s' from '%s'", uev->action, uev->devpath);
+               condlog(3, "uevent %ld '%s' from '%s'", uev->seqnum,
+                       uev->action, uev->devpath);
                uev->kernel = strrchr(uev->devpath, '/');
                if (uev->kernel)
                        uev->kernel++;
index 64f00b7..762595a 100644 (file)
@@ -20,6 +20,7 @@ struct uevent {
        char *devpath;
        char *action;
        char *kernel;
+       unsigned long seqnum;
        char *envp[HOTPLUG_NUM_ENVP];
 };