Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/makefs add and document offset.



details:   https://anonhg.NetBSD.org/src/rev/20171b56b6bf
branches:  trunk
changeset: 784582:20171b56b6bf
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Feb 02 20:42:02 2013 +0000

description:
add and document offset.

diffstat:

 usr.sbin/makefs/ffs/buf.c |   8 ++++----
 usr.sbin/makefs/makefs.8  |  12 ++++++++++--
 usr.sbin/makefs/makefs.c  |  15 ++++++++++-----
 usr.sbin/makefs/makefs.h  |   5 +++--
 4 files changed, 27 insertions(+), 13 deletions(-)

diffs (146 lines):

diff -r b54c48626e08 -r 20171b56b6bf usr.sbin/makefs/ffs/buf.c
--- a/usr.sbin/makefs/ffs/buf.c Sat Feb 02 20:06:48 2013 +0000
+++ b/usr.sbin/makefs/ffs/buf.c Sat Feb 02 20:42:02 2013 +0000
@@ -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 @@
        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 @@
        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",
diff -r b54c48626e08 -r 20171b56b6bf usr.sbin/makefs/makefs.8
--- a/usr.sbin/makefs/makefs.8  Sat Feb 02 20:06:48 2013 +0000
+++ b/usr.sbin/makefs/makefs.8  Sat Feb 02 20:42:02 2013 +0000
@@ -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 @@
 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
diff -r b54c48626e08 -r 20171b56b6bf usr.sbin/makefs/makefs.c
--- a/usr.sbin/makefs/makefs.c  Sat Feb 02 20:06:48 2013 +0000
+++ b/usr.sbin/makefs/makefs.c  Sat Feb 02 20:42:02 2013 +0000
@@ -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 @@
        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 @@
                        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 @@
        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);
 
diff -r b54c48626e08 -r 20171b56b6bf usr.sbin/makefs/makefs.h
--- a/usr.sbin/makefs/makefs.h  Sat Feb 02 20:06:48 2013 +0000
+++ b/usr.sbin/makefs/makefs.h  Sat Feb 02 20:42:02 2013 +0000
@@ -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 @@
        off_t   minsize;        /* minimum size image should be */
        off_t   maxsize;        /* maximum size image can be */
        off_t   freefiles;      /* free file entries to leave */
+       off_t   freeblocks;     /* free blocks to leave */
+       off_t   offset;         /* offset from start of file */
        int     freefilepc;     /* free file % */
-       off_t   freeblocks;     /* free blocks to leave */
        int     freeblockpc;    /* free block % */
        int     needswap;       /* non-zero if byte swapping needed */
        int     sectorsize;     /* sector size */



Home | Main Index | Thread Index | Old Index