[dm-devel] [PATCH 29/42] libmultipath: Print out uevent sequence number

Hannes Reinecke hare at suse.de
Tue Jan 8 13:54:07 UTC 2013


For debugging we should be printing out the sequence number.

Signed-off-by: Hannes Reinecke <hare at suse.de>
---
 libmultipath/uevent.c |   11 ++++++++++-
 libmultipath/uevent.h |    1 +
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/libmultipath/uevent.c b/libmultipath/uevent.c
index 5b0b258..bc74d38 100644
--- a/libmultipath/uevent.c
+++ b/libmultipath/uevent.c
@@ -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++;
diff --git a/libmultipath/uevent.h b/libmultipath/uevent.h
index 64f00b7..762595a 100644
--- a/libmultipath/uevent.h
+++ b/libmultipath/uevent.h
@@ -20,6 +20,7 @@ struct uevent {
 	char *devpath;
 	char *action;
 	char *kernel;
+	unsigned long seqnum;
 	char *envp[HOTPLUG_NUM_ENVP];
 };
 
-- 
1.7.4.2




More information about the dm-devel mailing list