[Ocfs2-tools-commits] manish commits r566 - trunk/ocfs2tool

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Thu Jan 20 20:58:22 CST 2005


Author: manish
Date: 2005-01-20 20:58:19 -0600 (Thu, 20 Jan 2005)
New Revision: 566

Modified:
   trunk/ocfs2tool/ocfs2module.c
Log:
Pretty print UUID


Modified: trunk/ocfs2tool/ocfs2module.c
===================================================================
--- trunk/ocfs2tool/ocfs2module.c	2005-01-21 01:46:17 UTC (rev 565)
+++ trunk/ocfs2tool/ocfs2module.c	2005-01-21 02:58:19 UTC (rev 566)
@@ -141,6 +141,10 @@
   GString       *uuid;
   gint           i;
 
+  static gchar *fmt[] = { "%02x", "%02x", "%02x", "%02x",
+			  "-%02x", "%02x", "-%02x", "%02x", "-%02x", "%02x",
+			  "-%02x", "%02x", "%02x", "%02x", "%02x", "%02x" };
+
   if (!PyArg_ParseTuple (args, "s:get_super", &device))
     return NULL;
 
@@ -178,7 +182,7 @@
   uuid = g_string_sized_new (32);
 
   for (i = 0; i < 16; i++)
-    g_string_append_printf (uuid, "%02X",
+    g_string_append_printf (uuid, fmt[i],
 			    OCFS2_RAW_SB (fs->fs_super)->s_uuid[i]);
 
   PyStructSequence_SET_ITEM (v, index++, PyString_FromString (uuid->str));
@@ -197,8 +201,8 @@
 }
 
 static PyMethodDef ocfs2_methods[] = {
-  {"partition_list", partition_list, METH_VARARGS | METH_KEYWORDS},
-  {"get_super", get_super, METH_VARARGS},
+  {"partition_list", (PyCFunction)partition_list, METH_VARARGS | METH_KEYWORDS},
+  {"get_super", (PyCFunction)get_super, METH_VARARGS},
   {NULL,       NULL}    /* sentinel */
 };
 



More information about the Ocfs2-tools-commits mailing list