[Ocfs2-tools-commits] smushran commits r243 - trunk/mounted.ocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Fri Sep 17 13:02:58 CDT 2004


Author: smushran
Date: 2004-09-17 13:02:55 -0500 (Fri, 17 Sep 2004)
New Revision: 243

Modified:
   trunk/mounted.ocfs2/mounted.c
Log:
dumps guid in quick detect

Modified: trunk/mounted.ocfs2/mounted.c
===================================================================
--- trunk/mounted.ocfs2/mounted.c	2004-09-16 23:45:22 UTC (rev 242)
+++ trunk/mounted.ocfs2/mounted.c	2004-09-17 18:02:55 UTC (rev 243)
@@ -179,11 +179,15 @@
 	errcode_t ret = 0;
 	ocfs2_filesys *fs = NULL;
 	uint8_t *vol_label = NULL;
+	uint8_t *vol_uuid = NULL;
 	ocfs1_vol_label *v1_lbl = NULL;
 	struct list_head dev_list;
 	struct list_head *pos;
 	ocfs2_devices *dev;
 	char buf[512];
+	char uuid[40];
+	char *p;
+	int i;
 
 	INIT_LIST_HEAD(&dev_list);
 
@@ -201,23 +205,32 @@
 		}
 	}
 
-	printf("%-30s  %-6s  %-s\n", "Device", "Type", "Label");
+	printf("%-20s  %-6s  %-32s  %-s\n", "Device", "Type", "GUID", "Label");
 
 	list_for_each(pos, &(dev_list)) {
 		dev = list_entry(pos, ocfs2_devices, list);
 		ret = ocfs2_open(dev->name, OCFS2_FLAG_RO, 0, 0, &fs);
 		if (ret == 0 || ret == OCFS2_ET_OCFS_REV) {
-			if (!ret)
+			if (!ret) {
 				vol_label = OCFS2_RAW_SB(fs->fs_super)->s_label;
-			else {
+				vol_uuid = OCFS2_RAW_SB(fs->fs_super)->s_uuid;
+			} else {
 				if (!ocfs2_get_ocfs1_label(dev->name, buf, sizeof(buf))) {
 					v1_lbl = (ocfs1_vol_label *)buf;
 					vol_label = v1_lbl->label;
-				} else
+					vol_uuid = v1_lbl->vol_id;
+				} else {
 					vol_label = NULL;
+					vol_uuid = NULL;
+				}
 			}
-			printf("%-30s  %-6s  %-s\n", dev->name,
-			       (!ret ? "ocfs2" : "ocfs"),
+	
+			memset(uuid, 0, sizeof(uuid));		
+			for (i = 0, p = uuid; i < 16 && vol_uuid; i++, p += 2)
+				sprintf(p, "%02X", vol_uuid[i]);
+
+			printf("%-20s  %-6s  %-32s  %-s\n", dev->name,
+			       (!ret ? "ocfs2" : "ocfs"), uuid,
 			       (vol_label ? (char *)vol_label : " "));
 		}
 		if (!ret)



More information about the Ocfs2-tools-commits mailing list