[Ocfs-tools-commits] smushran commits r31 - trunk/debugocfs

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Wed May 12 15:01:31 CDT 2004


Author: smushran
Date: 2004-05-12 14:01:28 -0500 (Wed, 12 May 2004)
New Revision: 31

Modified:
   trunk/debugocfs/
   trunk/debugocfs/debugocfs.h
   trunk/debugocfs/main.c
   trunk/debugocfs/print.c
Log:
added -N: do not bind device with raw


Property changes on: trunk/debugocfs
___________________________________________________________________
Name: svn:ignore
   - debugocfs
test
cscope.files
ocfsextfinder
debugocfs.8
stamp-md5
*.a

   + debugocfs
test
cscope*
ocfsextfinder
debugocfs.8
stamp-md5
*.a


Modified: trunk/debugocfs/debugocfs.h
===================================================================
--- trunk/debugocfs/debugocfs.h	2004-05-05 22:20:51 UTC (rev 30)
+++ trunk/debugocfs/debugocfs.h	2004-05-12 19:01:28 UTC (rev 31)
@@ -58,6 +58,7 @@
     int showDirentAll;
     int showFileent;
     int showFileext;
+    bool no_rawbind;
     int twoFourbyte;
     int showSystemFiles;
     int suckFile;

Modified: trunk/debugocfs/main.c
===================================================================
--- trunk/debugocfs/main.c	2004-05-05 22:20:51 UTC (rev 30)
+++ trunk/debugocfs/main.c	2004-05-12 19:01:28 UTC (rev 31)
@@ -70,6 +70,7 @@
     printf("       -L: vol metadata log system file\n");
     printf("       -M: vol metadata system file\n");
     printf("       -n: perform action as node number given\n");
+    printf("       -N: do not bind device with raw\n");
     printf("/dev/name: readable device\n");
     printf("    range: node numbers to inspect (0-31), commas and dashes ok\n");
     printf("            ex. 0-3,5,14-17\n");
@@ -77,7 +78,7 @@
 
 void translate_usage(void)
 {
-    printf("Usage: debugocfs -X { -h highoff -l lowoff | -o off } -t type\n");
+    printf("Usage: debugocfs -X { -h highoff -l lowoff | -o off } [-N] -t type\n");
     printf("\n");
     printf("       highoff/lowoff: 32-bit high and low offsets to data\n");
     printf("                  off: 64-bit offset to data\n");
@@ -101,23 +102,26 @@
     __u64 off = 0;
     int size = 0;
     char *type = NULL;
-    char *dot;
+    char *p;
     debugocfs_print_func func;
     int flags;
+    bool no_rawbind = false;
 
     while (1)
     {
-	c = getopt(argc, argv, "2o:h:l:s:t:");
+	c = getopt(argc, argv, "N2o:h:l:s:t:");
 	if (c == -1)
 	    break;
 	switch (c)
 	{
 	    case 'o':
-		if ((dot = strchr(optarg, '.')) != NULL)
-		{
-		    *dot = '\0';
-		    off = atoll(optarg);
-		    *dot = '.';
+		p = strchr(optarg, '.');
+		if (!p)
+			off = atoll(optarg);
+		else {
+			*p = '\0';
+			off  = ((__u64) strtoul(optarg, NULL, 0)) << 32;
+			off |= strtoul(++p, NULL, 0);
 		}
 		break;
 	    case 'h':
@@ -131,6 +135,9 @@
 	    case 't':
 		type = (char *) strdup(optarg);
 		break;
+	    case 'N':
+		no_rawbind = true;
+		break;
 	    case '2':		/* display 8-byte nums as 2 4-byte nums */
 		args.twoFourbyte = true;
 		break;
@@ -199,8 +206,11 @@
 	exit(1);
     }
 
-    if (bind_raw(argv[optind], &rawminor, rawdev, sizeof(rawdev)) == -1)
-	    goto bail;
+    if (!no_rawbind) {
+	    if (bind_raw(argv[optind], &rawminor, rawdev, sizeof(rawdev)) == -1)
+		    goto bail;
+    } else
+	    strncpy(rawdev, argv[optind], sizeof(rawdev));
 
     flags = O_RDONLY | O_LARGEFILE;
     fd = open(rawdev, flags);
@@ -303,7 +313,7 @@
     while (1)
     {
 	int off = 0;
-	int c = getopt(argc, argv, "hgl2v:p:d:D:f:F:a:A:b:B:b:r:c:L:M:s:n:X");
+	int c = getopt(argc, argv, "Nhgl2v:p:d:D:f:F:a:A:b:B:b:r:c:L:M:s:n:X");
 
 	if (c == -1)
 	    break;
@@ -392,6 +402,9 @@
 	    case 'n':		/* node number */
 		args.nodenum = atoi(optarg);
 		break;
+	    case 'N':
+		args.no_rawbind = true;
+		break;
 	    case 'X':		/* translate */
 		do_translate(argc, argv);
 		exit(0);
@@ -420,8 +433,11 @@
 	exit(1);
     }
 
-    if (bind_raw(argv[optind], &rawminor, rawdev, sizeof(rawdev)) == -1)
-	    goto bail;
+    if (!args.no_rawbind) {
+	    if (bind_raw(argv[optind], &rawminor, rawdev, sizeof(rawdev)) == -1)
+		    goto bail;
+    } else
+	    strncpy(rawdev, argv[optind], sizeof(rawdev));
 
     flags = O_RDONLY | O_LARGEFILE;
     fd = open(rawdev, flags);

Modified: trunk/debugocfs/print.c
===================================================================
--- trunk/debugocfs/print.c	2004-05-05 22:20:51 UTC (rev 30)
+++ trunk/debugocfs/print.c	2004-05-12 19:01:28 UTC (rev 31)
@@ -91,6 +91,8 @@
     printf("\tuid = %u\n", v->uid);
     printf("\tgid = %u\n", v->gid);
     printf("\texcl_mount = %d\n", v->excl_mount);
+    printf("\tdisk_hb = %d\n", v->disk_hb);
+    printf("\thb_timeo = %d\n", v->hb_timeo);
 }
 
 __u64 global_bm_bitnum_to_offset(int bitnum, void *data)



More information about the Ocfs-tools-commits mailing list