[Ocfs-tools-commits] smushran commits r99 - in trunk/ocfs2/debugfs.ocfs2: . include

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Thu Jun 24 21:33:11 CDT 2004


Author: smushran
Date: 2004-06-24 20:33:09 -0500 (Thu, 24 Jun 2004)
New Revision: 99

Modified:
   trunk/ocfs2/debugfs.ocfs2/dump.c
   trunk/ocfs2/debugfs.ocfs2/include/main.h
Log:
%*s removed from dump_dir_entry
node_map output is more readable

Modified: trunk/ocfs2/debugfs.ocfs2/dump.c
===================================================================
--- trunk/ocfs2/debugfs.ocfs2/dump.c	2004-06-25 00:27:19 UTC (rev 98)
+++ trunk/ocfs2/debugfs.ocfs2/dump.c	2004-06-25 01:33:09 UTC (rev 99)
@@ -29,6 +29,8 @@
 #include <readfs.h>
 #include <utils.h>
 
+extern char *superblk;
+
 /*
  * dump_super_block()
  *
@@ -77,10 +79,14 @@
 	struct passwd *pw;
 	struct group *gr;
 	char *str;
-	ocfs2_disk_lock *dl;
+	ocfs2_disk_lock *dl = &(in->i_disk_lock);
+	ocfs2_super_block *sb = &(((ocfs2_dinode *)superblk)->id2.i_super);
 	int i;
+	int j;
+	int k;
 	__u16 mode;
 	GString *flags = NULL;
+	__u32 node_map;
 
 /*
 Inode: 32001   Type: directory    Mode:  0755   Flags: 0x0   Generation: 721849
@@ -161,14 +167,20 @@
 
 	printf("Links: %u   Clusters: %u\n", in->i_links_count, in->i_clusters);
 
-	dl = &(in->i_disk_lock);
 	printf("Lock Master: %u   Level: 0x%0x   Seqnum: %llu\n",
 	       dl->dl_master, dl->dl_level, dl->dl_seq_num);
-	printf("Lock Node Map:");
-	for (i = 0; i < 8; ++i)
-		printf(" 0x%08x", dl->dl_node_map[i]);
-	printf("\n");
 
+	printf("Lock Node Map: ");
+	for (i = 0, j = 0; i < 8 && j < sb->s_max_nodes; ++i) {
+		if (i)
+			printf("               ");
+		node_map = dl->dl_node_map[i];
+		for (k = 0; k < 32 && j < sb->s_max_nodes; k++, j++)
+			printf ("%d%c", ((node_map & (1 << k)) ? 1 : 0),
+				(((k + 1) % 8) ? '\0' : ' '));
+		printf ("\n");
+	}
+
 	str = ctime((time_t*)&in->i_ctime);
 	printf("ctime: 0x%llx -- %s", in->i_ctime, str);
 	str = ctime((time_t*)&in->i_atime);
@@ -180,7 +192,7 @@
 
 	printf("Last Extblk: %llu\n", in->i_last_eb_blk);
 	printf("Sub Alloc Node: %u   Sub Alloc Blknum: %llu\n",
-	       in->i_suballoc_node, in->i_suballoc_blkno); /* ?? */
+	       in->i_suballoc_node, in->i_suballoc_blkno);
 
 	if (flags)
 		g_string_free (flags, 1);
@@ -247,9 +259,9 @@
 		rec = (struct ocfs2_dir_entry *)p;
 		if (!rec->inode)
 			break;
-		printf("%-15llu  %-6u  %-7u  %-4u  %*s\n", rec->inode,
-		       rec->rec_len, rec->name_len, rec->file_type,
-		       rec->name_len, rec->name);
+		null_term (rec->name, rec->name_len);
+		printf("%-15llu  %-6u  %-7u  %-4u  %s\n", rec->inode,
+		       rec->rec_len, rec->name_len, rec->file_type, rec->name);
 		p += rec->rec_len;
 	}
 

Modified: trunk/ocfs2/debugfs.ocfs2/include/main.h
===================================================================
--- trunk/ocfs2/debugfs.ocfs2/include/main.h	2004-06-25 00:27:19 UTC (rev 98)
+++ trunk/ocfs2/debugfs.ocfs2/include/main.h	2004-06-25 01:33:09 UTC (rev 99)
@@ -52,6 +52,11 @@
 
 #define safefree(_p)	do {if (_p) { free(_p); (_p) = NULL; } } while (0)
 
+static inline void null_term(char *_s, __u32 _l)
+{
+	*(_s + _l) = '\0';
+}
+
 #define DBGFS_FATAL(fmt, arg...)	({ fprintf(stderr, "ERROR at %s, %d: " fmt ".  EXITING!!!\n", \
 						   __FILE__, __LINE__, ##arg);  \
 					   exit(1); \



More information about the Ocfs-tools-commits mailing list