Module Name:    src
Committed By:   christos
Date:           Wed Jan 30 17:29:25 UTC 2013

Modified Files:
        src/usr.sbin/makefs: ffs.c msdos.c

Log Message:
gc global sectorsize.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/usr.sbin/makefs/ffs.c
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/makefs/msdos.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/ffs.c
diff -u src/usr.sbin/makefs/ffs.c:1.57 src/usr.sbin/makefs/ffs.c:1.58
--- src/usr.sbin/makefs/ffs.c:1.57	Tue Jan 29 10:52:25 2013
+++ src/usr.sbin/makefs/ffs.c	Wed Jan 30 12:29:25 2013
@@ -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 @@ static  void	*ffs_build_dinode2(struct u
 
 
 
-int	sectorsize;		/* XXX: for buf.c::getblk() */
-
-
 	/* publically visible functions */
 void
 ffs_prep_opts(fsinfo_t *fsopts)
@@ -421,8 +418,6 @@ ffs_validate(const char *dir, fsnode *ro
 		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.",

Index: src/usr.sbin/makefs/msdos.c
diff -u src/usr.sbin/makefs/msdos.c:1.11 src/usr.sbin/makefs/msdos.c:1.12
--- src/usr.sbin/makefs/msdos.c:1.11	Tue Jan 29 16:54:19 2013
+++ src/usr.sbin/makefs/msdos.c	Wed Jan 30 12:29:25 2013
@@ -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 @@ __RCSID("$NetBSD: msdos.c,v 1.11 2013/01
 #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 @@ msdos_makefs(const char *image, const ch
 	 * 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);

Reply via email to