[Ocfs-tools-commits] smushran commits r165 - trunk/ocfs2/debugfs.ocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Mon Jul 19 20:13:39 CDT 2004


Author: smushran
Date: 2004-07-19 19:13:37 -0500 (Mon, 19 Jul 2004)
New Revision: 165

Modified:
   trunk/ocfs2/debugfs.ocfs2/commands.c
   trunk/ocfs2/debugfs.ocfs2/main.c
Log:
--no-raw option added

Modified: trunk/ocfs2/debugfs.ocfs2/commands.c
===================================================================
--- trunk/ocfs2/debugfs.ocfs2/commands.c	2004-07-19 23:33:03 UTC (rev 164)
+++ trunk/ocfs2/debugfs.ocfs2/commands.c	2004-07-20 00:13:37 UTC (rev 165)
@@ -70,6 +70,7 @@
 static void do_journal (char **args);
 
 extern gboolean allow_write;
+extern gboolean no_raw_bind;
 
 dbgfs_gbls gbls = {
 	.device = NULL,
@@ -187,18 +188,20 @@
 		goto bail;
 	}
 
-	if (bind_raw (dev, &gbls.raw_minor, raw_dev, sizeof(raw_dev)))
-		goto bail;
+	if (!no_raw_bind) {
+		if (bind_raw (dev, &gbls.raw_minor, raw_dev, sizeof(raw_dev)))
+			goto bail;
+		printf ("Bound %s to %s\n", dev, raw_dev);
+		dev = raw_dev;
+	}
 
-	printf ("Bound %s to %s\n", dev, raw_dev);
-
-	gbls.dev_fd = open (raw_dev, allow_write ? O_RDONLY : O_RDWR);
+	gbls.dev_fd = open (dev, allow_write ? O_RDONLY : O_RDWR);
 	if (gbls.dev_fd == -1) {
 		printf ("could not open device %s\n", dev);
 		goto bail;
 	}
 
-	gbls.device = g_strdup (raw_dev);
+	gbls.device = g_strdup (dev);
 
 	if (read_super_block (gbls.dev_fd, (char **)&gbls.superblk) != -1)
 		gbls.curdir = g_strdup ("/");

Modified: trunk/ocfs2/debugfs.ocfs2/main.c
===================================================================
--- trunk/ocfs2/debugfs.ocfs2/main.c	2004-07-19 23:33:03 UTC (rev 164)
+++ trunk/ocfs2/debugfs.ocfs2/main.c	2004-07-20 00:13:37 UTC (rev 165)
@@ -38,6 +38,7 @@
 static char *get_line      (void);
 
 gboolean allow_write = FALSE;
+gboolean no_raw_bind = FALSE;
 
 /*
  * usage()
@@ -48,8 +49,9 @@
 	g_print ("Usage: %s [OPTION]... [DEVICE]\n", progname);
 	g_print ("Options:\n");
 	g_print ("  -V, --version  g_print version information and exit\n");
-	g_print ("      --help     display this help and exit\n");
+	g_print ("  -?, --help     display this help and exit\n");
 	g_print ("  -w, --write    turn on write support\n");
+	g_print ("  -N, --no-raw   do not bind device to raw\n");
 	exit (0);
 }					/* usage */
 
@@ -112,7 +114,11 @@
 			   (strcmp (arg, "-V") == 0)) {
 			print_version ();
 			exit (0);
-		} else if (strcmp (arg, "--help") == 0) {
+		} else if ((strcmp (arg, "--no-raw") == 0) ||
+			   (strcmp (arg, "-N") == 0)) {
+			no_raw_bind = TRUE;
+		} else if ((strcmp (arg, "--help") == 0) ||
+			   (strcmp (arg, "-?") == 0)) {
 			usage (argv[0]);
 			exit (0);
 		} else if (!seen_device) {



More information about the Ocfs-tools-commits mailing list