Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/makefs gc global sectorsize.



details:   https://anonhg.NetBSD.org/src/rev/97309847d6a5
branches:  trunk
changeset: 784522:97309847d6a5
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Jan 30 17:29:25 2013 +0000

description:
gc global sectorsize.

diffstat:

 usr.sbin/makefs/ffs.c   |   9 ++-------
 usr.sbin/makefs/msdos.c |  18 +++++++++++++-----
 2 files changed, 15 insertions(+), 12 deletions(-)

diffs (83 lines):

diff -r 1bc1e311e56d -r 97309847d6a5 usr.sbin/makefs/ffs.c
--- a/usr.sbin/makefs/ffs.c     Wed Jan 30 17:29:05 2013 +0000
+++ b/usr.sbin/makefs/ffs.c     Wed Jan 30 17:29:25 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs.c,v 1.57 2013/01/29 15:52:25 christos Exp $        */
+/*     $NetBSD: ffs.c,v 1.58 2013/01/30 17:29:25 christos Exp $        */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -71,7 +71,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: ffs.c,v 1.57 2013/01/29 15:52:25 christos Exp $");
+__RCSID("$NetBSD: ffs.c,v 1.58 2013/01/30 17:29:25 christos Exp $");
 #endif /* !__lint */
 
 #include <sys/param.h>
@@ -149,9 +149,6 @@
 
 
 
-int    sectorsize;             /* XXX: for buf.c::getblk() */
-
-
        /* publically visible functions */
 void
 ffs_prep_opts(fsinfo_t *fsopts)
@@ -421,8 +418,6 @@
                printf("ffs_validate: dir %s; %lld bytes, %lld inodes\n",
                    dir, (long long)fsopts->size, (long long)fsopts->inodes);
        }
-       sectorsize = fsopts->sectorsize;        /* XXX - see earlier */
-
                /* now check calculated sizes vs requested sizes */
        if (fsopts->maxsize > 0 && fsopts->size > fsopts->maxsize) {
                errx(1, "`%s' size of %lld is larger than the maxsize of %lld.",
diff -r 1bc1e311e56d -r 97309847d6a5 usr.sbin/makefs/msdos.c
--- a/usr.sbin/makefs/msdos.c   Wed Jan 30 17:29:05 2013 +0000
+++ b/usr.sbin/makefs/msdos.c   Wed Jan 30 17:29:25 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msdos.c,v 1.11 2013/01/29 21:54:19 christos Exp $      */
+/*     $NetBSD: msdos.c,v 1.12 2013/01/30 17:29:25 christos Exp $      */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: msdos.c,v 1.11 2013/01/29 21:54:19 christos Exp $");
+__RCSID("$NetBSD: msdos.c,v 1.12 2013/01/30 17:29:25 christos Exp $");
 #endif /* !__lint */
 
 #include <sys/param.h>
@@ -63,8 +63,6 @@
 #include "msdos.h"
 #include "mkfs_msdos.h"
 
-extern int sectorsize; /* XXX: horrid */
-
 static int msdos_populate_dir(const char *, struct denode *, fsnode *,
     fsnode *, fsinfo_t *);
 
@@ -151,7 +149,17 @@
         * Is minsize right here?
         */
        msdos_opt->create_size = MAX(msdos_opt->create_size, fsopts->minsize);
-       msdos_opt->bytes_per_sector = sectorsize = 512;
+       if (msdos_opt->bytes_per_sector == 0) {
+               if (fsopts->sectorsize == 0)
+                       fsopts->sectorsize = 512;
+               msdos_opt->bytes_per_sector = fsopts->sectorsize;
+       } else if (fsopts->sectorsize == 0) {
+               fsopts->sectorsize = msdos_opt->bytes_per_sector;
+       } else if (fsopts->sectorsize != msdos_opt->bytes_per_sector) {
+               err(1, "inconsistent sectorsize -S %u"
+                   "!= -o bytes_per_sector %u", 
+                   fsopts->sectorsize, msdos_opt->bytes_per_sector);
+       }
 
                /* create image */
        printf("Creating `%s'\n", image);



Home | Main Index | Thread Index | Old Index