[PATCH 23/27] DDF: guid_str: convenience function to print GUID for debugging

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For debugging DDF structure changes, it is important to be able
to identify VCs by their GUIDs.

Signed-off-by: Martin Wilck <mwilck@xxxxxxxx>
---
 super-ddf.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/super-ddf.c b/super-ddf.c
index cd6f298..bfb7f22 100644
--- a/super-ddf.c
+++ b/super-ddf.c
@@ -1293,6 +1293,17 @@ static void print_guid(char *guid, int tstamp)
 	printf(")");
 }
 
+static const char *guid_str(const char *guid)
+{
+	static char buf[DDF_GUID_LEN*2+1];
+	int i;
+	char *p = buf;
+	for (i = 0; i < DDF_GUID_LEN; i++)
+		p += sprintf(p, "%02x", (unsigned char)guid[i]);
+	*p = '\0';
+	return (const char *) buf;
+}
+
 static void examine_vd(int n, struct ddf_super *sb, char *guid)
 {
 	int crl = sb->conf_rec_len;
@@ -2789,6 +2800,9 @@ static int __write_ddf_structure(struct dl *d, struct ddf_super *ddf, __u8 type,
 					&dummy);
 		}
 		if (c) {
+			dprintf("writing conf record %i on disk %08x for %s/%u\n",
+				i, d->disk.refnum, guid_str(vdc->guid),
+				vdc->sec_elmnt_seq);
 			vdc->seqnum = header->seq;
 			vdc->crc = calc_crc(vdc, conf_size);
 			if (write(fd, vdc, conf_size) < 0)
-- 
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux