Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src newfs_v7fs(8)'s -v and -P options are obsolete. changed to n...



details:   https://anonhg.NetBSD.org/src/rev/ec962bfa7da3
branches:  trunk
changeset: 768177:ec962bfa7da3
user:      uch <uch%NetBSD.org@localhost>
date:      Wed Aug 10 11:31:49 2011 +0000

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

diffstat:

 sbin/newfs_v7fs/main.c               |  25 +++++++++++++------------
 sbin/newfs_v7fs/newfs_v7fs.8         |  23 +++++++++++++++++------
 sbin/newfs_v7fs/newfs_v7fs.c         |  20 ++++++++++----------
 sbin/newfs_v7fs/newfs_v7fs.h         |   4 ++--
 usr.sbin/makefs/v7fs.c               |   8 ++++----
 usr.sbin/makefs/v7fs/v7fs_estimate.c |   7 +++----
 usr.sbin/makefs/v7fs/v7fs_populate.c |   7 +++----
 usr.sbin/makefs/v7fs_makefs.h        |   3 ++-
 8 files changed, 54 insertions(+), 43 deletions(-)

diffs (truncated from 344 to 300 lines):

diff -r a6ade51aa69d -r ec962bfa7da3 sbin/newfs_v7fs/main.c
--- a/sbin/newfs_v7fs/main.c    Wed Aug 10 10:34:48 2011 +0000
+++ b/sbin/newfs_v7fs/main.c    Wed Aug 10 11:31:49 2011 +0000
@@ -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. */
diff -r a6ade51aa69d -r ec962bfa7da3 sbin/newfs_v7fs/newfs_v7fs.8
--- a/sbin/newfs_v7fs/newfs_v7fs.8      Wed Aug 10 10:34:48 2011 +0000
+++ b/sbin/newfs_v7fs/newfs_v7fs.8      Wed Aug 10 11:31:49 2011 +0000
@@ -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
diff -r a6ade51aa69d -r ec962bfa7da3 sbin/newfs_v7fs/newfs_v7fs.c
--- a/sbin/newfs_v7fs/newfs_v7fs.c      Wed Aug 10 10:34:48 2011 +0000
+++ b/sbin/newfs_v7fs/newfs_v7fs.c      Wed Aug 10 11:31:49 2011 +0000
@@ -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);
diff -r a6ade51aa69d -r ec962bfa7da3 sbin/newfs_v7fs/newfs_v7fs.h
--- a/sbin/newfs_v7fs/newfs_v7fs.h      Wed Aug 10 10:34:48 2011 +0000
+++ b/sbin/newfs_v7fs/newfs_v7fs.h      Wed Aug 10 11:31:49 2011 +0000
@@ -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_ */
diff -r a6ade51aa69d -r ec962bfa7da3 usr.sbin/makefs/v7fs.c
--- a/usr.sbin/makefs/v7fs.c    Wed Aug 10 10:34:48 2011 +0000
+++ b/usr.sbin/makefs/v7fs.c    Wed Aug 10 11:31:49 2011 +0000
@@ -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);
diff -r a6ade51aa69d -r ec962bfa7da3 usr.sbin/makefs/v7fs/v7fs_estimate.c
--- a/usr.sbin/makefs/v7fs/v7fs_estimate.c      Wed Aug 10 10:34:48 2011 +0000
+++ b/usr.sbin/makefs/v7fs/v7fs_estimate.c      Wed Aug 10 11:31:49 2011 +0000
@@ -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)



Home | Main Index | Thread Index | Old Index