Module Name: src Committed By: christos Date: Sat Feb 2 20:42:02 UTC 2013
Modified Files: src/usr.sbin/makefs: makefs.8 makefs.c makefs.h src/usr.sbin/makefs/ffs: buf.c Log Message: add and document offset. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/usr.sbin/makefs/makefs.8 cvs rdiff -u -r1.47 -r1.48 src/usr.sbin/makefs/makefs.c cvs rdiff -u -r1.32 -r1.33 src/usr.sbin/makefs/makefs.h cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/makefs/ffs/buf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.sbin/makefs/makefs.8 diff -u src/usr.sbin/makefs/makefs.8:1.43 src/usr.sbin/makefs/makefs.8:1.44 --- src/usr.sbin/makefs/makefs.8:1.43 Mon Jan 28 20:52:04 2013 +++ src/usr.sbin/makefs/makefs.8 Sat Feb 2 15:42:02 2013 @@ -1,4 +1,4 @@ -.\" $NetBSD: makefs.8,v 1.43 2013/01/29 01:52:04 christos Exp $ +.\" $NetBSD: makefs.8,v 1.44 2013/02/02 20:42:02 christos Exp $ .\" .\" Copyright (c) 2001-2003 Wasabi Systems, Inc. .\" All rights reserved. @@ -33,7 +33,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd January 27, 2013 +.Dd February 2, 2013 .Dt MAKEFS 8 .Os .Sh NAME @@ -50,6 +50,7 @@ .Op Fl M Ar minimum-size .Op Fl m Ar maximum-size .Op Fl N Ar userdb-dir +.Op Fl O Ar offset .Op Fl o Ar fs-options .Op Fl S Ar sector-size .Op Fl s Ar image-size @@ -176,6 +177,13 @@ rather than using the results from the s and .Xr getgrnam 3 (and related) library calls. +.It Fl O Ar offset +Instead of creating the filesystem at the beginning of the file, start +at offset. +Valid only for +.Sy ffs +and +.Sy msdos . .It Fl o Ar fs-options Set file system specific options. .Ar fs-options Index: src/usr.sbin/makefs/makefs.c diff -u src/usr.sbin/makefs/makefs.c:1.47 src/usr.sbin/makefs/makefs.c:1.48 --- src/usr.sbin/makefs/makefs.c:1.47 Fri Feb 1 09:02:17 2013 +++ src/usr.sbin/makefs/makefs.c Sat Feb 2 15:42:02 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: makefs.c,v 1.47 2013/02/01 14:02:17 christos Exp $ */ +/* $NetBSD: makefs.c,v 1.48 2013/02/02 20:42:02 christos Exp $ */ /* * Copyright (c) 2001-2003 Wasabi Systems, Inc. @@ -41,7 +41,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(__lint) -__RCSID("$NetBSD: makefs.c,v 1.47 2013/02/01 14:02:17 christos Exp $"); +__RCSID("$NetBSD: makefs.c,v 1.48 2013/02/02 20:42:02 christos Exp $"); #endif /* !__lint */ #include <assert.h> @@ -121,7 +121,7 @@ main(int argc, char *argv[]) start_time.tv_sec = start.tv_sec; start_time.tv_nsec = start.tv_usec * 1000; - while ((ch = getopt(argc, argv, "B:b:d:f:F:M:m:N:o:s:S:t:xZ")) != -1) { + while ((ch = getopt(argc, argv, "B:b:d:f:F:M:m:N:O:o:s:S:t:xZ")) != -1) { switch (ch) { case 'B': @@ -195,6 +195,11 @@ main(int argc, char *argv[]) fsoptions.maxsize = strsuftoll("maximum size", optarg, 1LL, LLONG_MAX); break; + + case 'O': + fsoptions.offset = + strsuftoll("offset", optarg, 0LL, LLONG_MAX); + break; case 'o': { @@ -407,8 +412,8 @@ usage(fstype_t *fstype, fsinfo_t *fsopti prog = getprogname(); fprintf(stderr, "Usage: %s [-xZ] [-B endian] [-b free-blocks] [-d debug-mask]\n" -"\t[-F mtree-specfile] [-f free-files] [-M minimum-size]\n" -"\t[-m maximum-size] [-N userdb-dir] [-o fs-options] [-S sector-size]\n" +"\t[-F mtree-specfile] [-f free-files] [-M minimum-size] [-m maximum-size]\n" +"\t[-N userdb-dir] [-O offset] [-o fs-options] [-S sector-size]\n" "\t[-s image-size] [-t fs-type] image-file directory [extra-directory ...]\n", prog); Index: src/usr.sbin/makefs/makefs.h diff -u src/usr.sbin/makefs/makefs.h:1.32 src/usr.sbin/makefs/makefs.h:1.33 --- src/usr.sbin/makefs/makefs.h:1.32 Wed Jan 30 14:19:19 2013 +++ src/usr.sbin/makefs/makefs.h Sat Feb 2 15:42:02 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: makefs.h,v 1.32 2013/01/30 19:19:19 christos Exp $ */ +/* $NetBSD: makefs.h,v 1.33 2013/02/02 20:42:02 christos Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -157,8 +157,9 @@ typedef struct makefs_fsinfo { off_t minsize; /* minimum size image should be */ off_t maxsize; /* maximum size image can be */ off_t freefiles; /* free file entries to leave */ - int freefilepc; /* free file % */ off_t freeblocks; /* free blocks to leave */ + off_t offset; /* offset from start of file */ + int freefilepc; /* free file % */ int freeblockpc; /* free block % */ int needswap; /* non-zero if byte swapping needed */ int sectorsize; /* sector size */ Index: src/usr.sbin/makefs/ffs/buf.c diff -u src/usr.sbin/makefs/ffs/buf.c:1.19 src/usr.sbin/makefs/ffs/buf.c:1.20 --- src/usr.sbin/makefs/ffs/buf.c:1.19 Wed Jan 30 14:19:19 2013 +++ src/usr.sbin/makefs/ffs/buf.c Sat Feb 2 15:42:02 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: buf.c,v 1.19 2013/01/30 19:19:19 christos Exp $ */ +/* $NetBSD: buf.c,v 1.20 2013/02/02 20:42:02 christos Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -41,7 +41,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(__lint) -__RCSID("$NetBSD: buf.c,v 1.19 2013/01/30 19:19:19 christos Exp $"); +__RCSID("$NetBSD: buf.c,v 1.20 2013/02/02 20:42:02 christos Exp $"); #endif /* !__lint */ #include <sys/param.h> @@ -72,7 +72,7 @@ bread(struct vnode *vp, daddr_t blkno, i if (debug & DEBUG_BUF_BREAD) printf("bread: blkno %lld size %d\n", (long long)blkno, size); *bpp = getblk(vp, blkno, size, 0, 0); - offset = (*bpp)->b_blkno * fs->sectorsize; + offset = (*bpp)->b_blkno * fs->sectorsize + fs->offset; if (debug & DEBUG_BUF_BREAD) printf("bread: blkno %lld offset %lld bcount %ld\n", (long long)(*bpp)->b_blkno, (long long) offset, @@ -133,7 +133,7 @@ bwrite(struct buf *bp) fsinfo_t *fs = bp->b_fs; assert (bp != NULL); - offset = bp->b_blkno * fs->sectorsize; + offset = bp->b_blkno * fs->sectorsize + fs->offset; bytes = bp->b_bcount; if (debug & DEBUG_BUF_BWRITE) printf("bwrite: blkno %lld offset %lld bcount %d\n",