newfs_v7fs(8)'s -v and -P options are obsolete. changed to newfs(8) compatible -V option.
This commit is contained in:
parent
6fa6a60bcb
commit
7d18226237
@ -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 @@ __RCSID("$NetBSD: main.c,v 1.9 2011/08/09 11:18:28 uch Exp $");
|
||||
#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 @@ make_freeblocklist(struct v7fs_self *fs, v7fs_daddr_t listblk, uint8_t *buf)
|
||||
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 @@ make_filesystem(struct v7fs_self *fs, v7fs_daddr_t volume_size,
|
||||
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 @@ make_filesystem(struct v7fs_self *fs, v7fs_daddr_t volume_size,
|
||||
#ifndef HAVE_NBTOOL_CONFIG_H
|
||||
progress_done();
|
||||
#endif
|
||||
VPRINTF("\n");
|
||||
VPRINTF(4, "\n");
|
||||
|
||||
/* Construct superblock */
|
||||
sb = &fs->superblock;
|
||||
@ -227,14 +228,14 @@ make_filesystem(struct v7fs_self *fs, v7fs_daddr_t volume_size,
|
||||
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 @@ make_filesystem(struct v7fs_self *fs, v7fs_daddr_t volume_size,
|
||||
}
|
||||
|
||||
/* 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 @@ make_filesystem(struct v7fs_self *fs, v7fs_daddr_t volume_size,
|
||||
progress_done();
|
||||
#endif
|
||||
|
||||
VPRINTF("done.\n");
|
||||
VPRINTF(4, "done.\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -283,7 +284,7 @@ v7fs_newfs(const struct v7fs_mount_device *mount, int32_t maxfile)
|
||||
|
||||
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. */
|
||||
|
@ -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 @@ option).
|
||||
.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
|
||||
|
@ -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 @@ __RCSID("$NetBSD: newfs_v7fs.c,v 1.1 2011/06/27 11:52:58 uch Exp $");
|
||||
|
||||
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 @@ main(int argc, char **argv)
|
||||
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 @@ main(int argc, char **argv)
|
||||
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 @@ main(int argc, char **argv)
|
||||
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);
|
||||
|
@ -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 @@ struct progress_arg {
|
||||
__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_ */
|
||||
|
@ -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 @@ static v7fs_opt_t v7fs_opts;
|
||||
#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 @@ v7fs_makefs(const char *image, const char *dir, fsnode *root, fsinfo_t *fsopts)
|
||||
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);
|
||||
|
@ -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 @@ struct v7fs_geometry {
|
||||
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)
|
||||
|
@ -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 @@ __RCSID("$NetBSD: v7fs_populate.c,v 1.2 2011/07/18 17:15:07 tron Exp $");
|
||||
#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)
|
||||
|
@ -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 @@ int v7fs_populate(const char *, fsnode *, fsinfo_t *,
|
||||
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_*/
|
||||
|
Loading…
Reference in New Issue
Block a user