Module Name:    src
Committed By:   uch
Date:           Wed Aug 10 11:31:49 UTC 2011

Modified Files:
        src/sbin/newfs_v7fs: main.c newfs_v7fs.8 newfs_v7fs.c newfs_v7fs.h
        src/usr.sbin/makefs: v7fs.c v7fs_makefs.h
        src/usr.sbin/makefs/v7fs: v7fs_estimate.c v7fs_populate.c

Log Message:
newfs_v7fs(8)'s -v and -P options are obsolete. changed to newfs(8) compatible 
-V option.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sbin/newfs_v7fs/main.c
cvs rdiff -u -r1.2 -r1.3 src/sbin/newfs_v7fs/newfs_v7fs.8
cvs rdiff -u -r1.1 -r1.2 src/sbin/newfs_v7fs/newfs_v7fs.c \
    src/sbin/newfs_v7fs/newfs_v7fs.h
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/makefs/v7fs.c
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/makefs/v7fs_makefs.h
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/makefs/v7fs/v7fs_estimate.c
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/makefs/v7fs/v7fs_populate.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/newfs_v7fs/main.c
diff -u src/sbin/newfs_v7fs/main.c:1.9 src/sbin/newfs_v7fs/main.c:1.10
--- src/sbin/newfs_v7fs/main.c:1.9	Tue Aug  9 11:18:28 2011
+++ src/sbin/newfs_v7fs/main.c	Wed Aug 10 11:31:49 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.9 2011/08/09 11:18:28 uch Exp $	*/
+/*	$NetBSD: main.c,v 1.10 2011/08/10 11:31:49 uch Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.9 2011/08/09 11:18:28 uch Exp $");
+__RCSID("$NetBSD: main.c,v 1.10 2011/08/10 11:31:49 uch Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -54,7 +54,8 @@
 #include "newfs_v7fs.h"
 #include "progress.h" /*../sbin/fsck */
 
-#define	VPRINTF(fmt, args...)	{ if (verbose) printf(fmt, ##args); }
+#define	VPRINTF(lv, fmt, args...)	{ if (v7fs_newfs_verbose >= lv)	\
+	printf(fmt, ##args); }
 
 static v7fs_daddr_t
 determine_ilist_size(v7fs_daddr_t volume_size, int32_t files)
@@ -170,14 +171,14 @@
 		progress(0);
 		if (j == (int32_t)fs->superblock.volume_size)
 		{
-			VPRINTF("\nlast freeblock #%d\n",
+			VPRINTF(4, "\nlast freeblock #%d\n",
 			    (*val32)(fb->freeblock[i + 1]));
 
 			memmove(fb->freeblock + 1, fb->freeblock + i + 1, k *
 			    sizeof(v7fs_daddr_t));
 			fb->freeblock[0] = 0; /* Terminate link; */
 			fb->nfreeblock = (*val16)(k + 1);
-			VPRINTF("last freeblock contains #%d\n",
+			VPRINTF(4, "last freeblock contains #%d\n",
 			    (*val16)(fb->nfreeblock));
 			fs->io.write(fs->io.cookie, buf, listblk);
 			return 0;
@@ -207,7 +208,7 @@
 	int32_t i, j;
 
 	/* Setup ilist. (ilist must be zero filled. becuase of they are free) */
-	VPRINTF("Zero clear ilist.\n");
+	VPRINTF(4, "Zero clear ilist.\n");
 	progress(&(struct progress_arg){ .label = "zero ilist", .tick =
 	    ilist_size / PROGRESS_BAR_GRANULE });
 	memset(buf, 0, sizeof buf);
@@ -218,7 +219,7 @@
 #ifndef HAVE_NBTOOL_CONFIG_H
 	progress_done();
 #endif
-	VPRINTF("\n");
+	VPRINTF(4, "\n");
 
 	/* Construct superblock */
 	sb = &fs->superblock;
@@ -227,14 +228,14 @@
 	sb->update_time = time(NULL);
 
 	/* fill free inode cache. */
-	VPRINTF("Setup inode cache.\n");
+	VPRINTF(4, "Setup inode cache.\n");
 	sb->nfreeinode = V7FS_MAX_FREEINODE;
 	for (i = V7FS_MAX_FREEINODE - 1, j = V7FS_ROOT_INODE; i >= 0; i--, j++)
 		sb->freeinode[i] = j;
 	sb->total_freeinode = ilist_size * V7FS_INODE_PER_BLOCK - 1;
 
 	/* fill free block cache. */
-	VPRINTF("Setup free block cache.\n");
+	VPRINTF(4, "Setup free block cache.\n");
 	sb->nfreeblock = V7FS_MAX_FREEBLOCK;
 	for (i = V7FS_MAX_FREEBLOCK - 1, j = sb->datablock_start_sector; i >= 0;
 	    i--, j++)
@@ -251,7 +252,7 @@
 	}
 
 	/* Construct freeblock list */
-	VPRINTF("Setup whole freeblock list.\n");
+	VPRINTF(4, "Setup whole freeblock list.\n");
 	progress(&(struct progress_arg){ .label = "freeblock list", .tick =
 	    (volume_size - sb->datablock_start_sector) / PROGRESS_BAR_GRANULE});
 	blk = sb->freeblock[0];
@@ -261,7 +262,7 @@
 	progress_done();
 #endif
 
-	VPRINTF("done.\n");
+	VPRINTF(4, "done.\n");
 
 	return 0;
 }
@@ -283,7 +284,7 @@
 
 	ilist_size = determine_ilist_size(volume_size, maxfile);
 
-	VPRINTF("volume size=%d, ilist size=%d, endian=%d, NAME_MAX=%d\n",
+	VPRINTF(1, "volume size=%d, ilist size=%d, endian=%d, NAME_MAX=%d\n",
 	    volume_size, ilist_size, mount->endian, V7FS_NAME_MAX);
 
 	/* Setup I/O ops. */

Index: src/sbin/newfs_v7fs/newfs_v7fs.8
diff -u src/sbin/newfs_v7fs/newfs_v7fs.8:1.2 src/sbin/newfs_v7fs/newfs_v7fs.8:1.3
--- src/sbin/newfs_v7fs/newfs_v7fs.8:1.2	Mon Jun 27 13:50:31 2011
+++ src/sbin/newfs_v7fs/newfs_v7fs.8	Wed Aug 10 11:31:49 2011
@@ -1,4 +1,4 @@
-.\"	$NetBSD: newfs_v7fs.8,v 1.2 2011/06/27 13:50:31 wiz Exp $
+.\"	$NetBSD: newfs_v7fs.8,v 1.3 2011/08/10 11:31:49 uch Exp $
 .\"
 .\" Copyright (c) 2011 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -64,10 +64,11 @@
 .Nd construct a new 7th Edition(V7) File System
 .Sh SYNOPSIS
 .Nm
-.Op Fl FPvZ
+.Op Fl FZ
 .Op Fl B Ar byte-order
 .Op Fl n Ar inodes
 .Op Fl s Ar sectors
+.Op Fl V Ar verbose
 .Ar special
 .Sh DESCRIPTION
 .Nm
@@ -102,12 +103,22 @@
 .It Fl n Ar inodes
 This specifies the number of inodes for the filesystem.
 If the number of inodes exceeds 65536, it is reduced to 65536.
-.It Fl P
-Display a progress meter for the file system construction.
 .It Fl s Ar sectors
 Create file system with specified number of disk sectors.
-.It Fl v
-Verbose mode.
+.It Fl V Ar verbose
+This controls the amount of information written to stdout:
+.Bl -tag -width 3n -offset indent -compact
+.It 0
+No output.
+.It 1
+Overall size, ilist size, endian and filename length.
+.It 2
+A progress bar.
+.It 3
+.It 4
+More verbose message.
+.El
+The default is 3.
 .It Fl Z
 Fill file with zeroes instead of creating a sparse file.
 .El

Index: src/sbin/newfs_v7fs/newfs_v7fs.c
diff -u src/sbin/newfs_v7fs/newfs_v7fs.c:1.1 src/sbin/newfs_v7fs/newfs_v7fs.c:1.2
--- src/sbin/newfs_v7fs/newfs_v7fs.c:1.1	Mon Jun 27 11:52:58 2011
+++ src/sbin/newfs_v7fs/newfs_v7fs.c	Wed Aug 10 11:31:49 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: newfs_v7fs.c,v 1.1 2011/06/27 11:52:58 uch Exp $ */
+/*	$NetBSD: newfs_v7fs.c,v 1.2 2011/08/10 11:31:49 uch Exp $ */
 
 /*-
  * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: newfs_v7fs.c,v 1.1 2011/06/27 11:52:58 uch Exp $");
+__RCSID("$NetBSD: newfs_v7fs.c,v 1.2 2011/08/10 11:31:49 uch Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -52,7 +52,7 @@
 
 static void usage(void) __dead;
 static bool progress_bar_enable = false;
-bool verbose = false;
+int v7fs_newfs_verbose = 3;	/* newfs compatible */
 
 int
 main(int argc, char **argv)
@@ -72,13 +72,10 @@
 		usage();
 
 	Fflag = Zflag = partsize = 0;
-	while ((ch = getopt(argc, argv, "Fs:Zs:n:B:vP")) != -1) {
+	while ((ch = getopt(argc, argv, "Fs:Zs:n:B:V:")) != -1) {
 		switch (ch) {
-		case 'P':
-			progress_bar_enable = true;
-			break;
-		case 'v':
-			verbose = true;
+		case 'V':
+			v7fs_newfs_verbose = atoi(optarg);
 			break;
 		case 'F':
 			Fflag = 1;
@@ -117,6 +114,9 @@
 		usage();
 	device = argv[0];
 
+	progress_bar_enable = v7fs_newfs_verbose > 1;
+
+
 	if (progress_bar_enable) {
 		progress_switch(progress_bar_enable);
 		progress_init();
@@ -140,7 +140,7 @@
 			goto err_exit;
 		}
 		p = &d.d_partitions[part];
-		if (verbose) {
+		if (v7fs_newfs_verbose) {
 			printf("partition=%d size=%d offset=%d fstype=%d"
 			    " secsize=%d\n", part, p->p_size, p->p_offset,
 			    p->p_fstype, d.d_secsize);
Index: src/sbin/newfs_v7fs/newfs_v7fs.h
diff -u src/sbin/newfs_v7fs/newfs_v7fs.h:1.1 src/sbin/newfs_v7fs/newfs_v7fs.h:1.2
--- src/sbin/newfs_v7fs/newfs_v7fs.h:1.1	Mon Jun 27 11:52:58 2011
+++ src/sbin/newfs_v7fs/newfs_v7fs.h	Wed Aug 10 11:31:49 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: newfs_v7fs.h,v 1.1 2011/06/27 11:52:58 uch Exp $	*/
+/*	$NetBSD: newfs_v7fs.h,v 1.2 2011/08/10 11:31:49 uch Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -43,6 +43,6 @@
 __BEGIN_DECLS
 void progress(const struct progress_arg *);
 int v7fs_newfs(const struct v7fs_mount_device *, int32_t);
-extern bool verbose;
+extern int v7fs_newfs_verbose;
 __END_DECLS
 #endif /* !_SBIN_NEWFS_V7FS_NEWFS_V7FS_H_ */

Index: src/usr.sbin/makefs/v7fs.c
diff -u src/usr.sbin/makefs/v7fs.c:1.2 src/usr.sbin/makefs/v7fs.c:1.3
--- src/usr.sbin/makefs/v7fs.c:1.2	Tue Jul 19 18:29:41 2011
+++ src/usr.sbin/makefs/v7fs.c	Wed Aug 10 11:31:49 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs.c,v 1.2 2011/07/19 18:29:41 joerg Exp $	*/
+/*	$NetBSD: v7fs.c,v 1.3 2011/08/10 11:31:49 uch Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: v7fs.c,v 1.2 2011/07/19 18:29:41 joerg Exp $");
+__RCSID("$NetBSD: v7fs.c,v 1.3 2011/08/10 11:31:49 uch Exp $");
 #endif	/* !__lint */
 
 #include <stdio.h>
@@ -56,7 +56,7 @@
 #include "progress.h"
 static bool progress_bar_enable;
 #endif
-bool verbose;
+int v7fs_newfs_verbose;
 
 void
 v7fs_prep_opts(fsinfo_t *fsopts)
@@ -92,7 +92,7 @@
 	struct v7fs_mount_device v7fs_mount;
 	int fd, endian, error = 1;
 
-	verbose = debug;
+	v7fs_newfs_verbose = debug;
 #ifndef HAVE_NBTOOL_CONFIG_H
 	if ((progress_bar_enable = v7fs_opts.progress)) {
 		progress_switch(progress_bar_enable);

Index: src/usr.sbin/makefs/v7fs_makefs.h
diff -u src/usr.sbin/makefs/v7fs_makefs.h:1.1 src/usr.sbin/makefs/v7fs_makefs.h:1.2
--- src/usr.sbin/makefs/v7fs_makefs.h:1.1	Mon Jul 18 08:58:38 2011
+++ src/usr.sbin/makefs/v7fs_makefs.h	Wed Aug 10 11:31:49 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_makefs.h,v 1.1 2011/07/18 08:58:38 uch Exp $	*/
+/*	$NetBSD: v7fs_makefs.h,v 1.2 2011/08/10 11:31:49 uch Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -44,5 +44,6 @@
     const struct v7fs_mount_device *);
 struct progress_arg;
 void progress(const struct progress_arg *);
+extern int v7fs_newfs_verbose;
 __END_DECLS
 #endif /*!_MAKEFS_V7FS_H_*/

Index: src/usr.sbin/makefs/v7fs/v7fs_estimate.c
diff -u src/usr.sbin/makefs/v7fs/v7fs_estimate.c:1.1 src/usr.sbin/makefs/v7fs/v7fs_estimate.c:1.2
--- src/usr.sbin/makefs/v7fs/v7fs_estimate.c:1.1	Mon Jul 18 08:58:39 2011
+++ src/usr.sbin/makefs/v7fs/v7fs_estimate.c	Wed Aug 10 11:31:49 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_estimate.c,v 1.1 2011/07/18 08:58:39 uch Exp $	*/
+/*	$NetBSD: v7fs_estimate.c,v 1.2 2011/08/10 11:31:49 uch Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: v7fs_estimate.c,v 1.1 2011/07/18 08:58:39 uch Exp $");
+__RCSID("$NetBSD: v7fs_estimate.c,v 1.2 2011/08/10 11:31:49 uch Exp $");
 #endif	/* !__lint */
 
 #include <stdio.h>
@@ -60,8 +60,7 @@
 	v7fs_daddr_t npuredatablk;
 };
 
-extern bool verbose;
-#define	VPRINTF(fmt, args...)	{ if (verbose) printf(fmt, ##args); }
+#define	VPRINTF(fmt, args...)	{ if (v7fs_newfs_verbose) printf(fmt, ##args); }
 
 static int
 v7fs_datablock_size(off_t sz, v7fs_daddr_t *nblk)

Index: src/usr.sbin/makefs/v7fs/v7fs_populate.c
diff -u src/usr.sbin/makefs/v7fs/v7fs_populate.c:1.2 src/usr.sbin/makefs/v7fs/v7fs_populate.c:1.3
--- src/usr.sbin/makefs/v7fs/v7fs_populate.c:1.2	Mon Jul 18 17:15:07 2011
+++ src/usr.sbin/makefs/v7fs/v7fs_populate.c	Wed Aug 10 11:31:49 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_populate.c,v 1.2 2011/07/18 17:15:07 tron Exp $	*/
+/*	$NetBSD: v7fs_populate.c,v 1.3 2011/08/10 11:31:49 uch Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: v7fs_populate.c,v 1.2 2011/07/18 17:15:07 tron Exp $");
+__RCSID("$NetBSD: v7fs_populate.c,v 1.3 2011/08/10 11:31:49 uch Exp $");
 #endif	/* !__lint */
 
 #include <stdio.h>
@@ -61,8 +61,7 @@
 #include "v7fs_makefs.h"
 #include "newfs_v7fs.h"
 
-extern bool verbose;
-#define	VPRINTF(fmt, args...)	{ if (verbose) printf(fmt, ##args); }
+#define	VPRINTF(fmt, args...)	{ if (v7fs_newfs_verbose) printf(fmt, ##args); }
 
 static void
 attr_setup(fsnode *node, struct v7fs_fileattr *attr)

Reply via email to