Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Nov 2015 14:20:32 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r291382 - head/sbin/newfs_msdos
Message-ID:  <201511271420.tAREKWrY050499@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Fri Nov 27 14:20:32 2015
New Revision: 291382
URL: https://svnweb.freebsd.org/changeset/base/291382

Log:
  mkfs_msdos: sync with NetBSD
  
  Add a sanity test and clean up whitespace.
  
  Obtained from:	NetBSD

Modified:
  head/sbin/newfs_msdos/mkfs_msdos.c

Modified: head/sbin/newfs_msdos/mkfs_msdos.c
==============================================================================
--- head/sbin/newfs_msdos/mkfs_msdos.c	Fri Nov 27 03:48:02 2015	(r291381)
+++ head/sbin/newfs_msdos/mkfs_msdos.c	Fri Nov 27 14:20:32 2015	(r291382)
@@ -223,8 +223,8 @@ static void mklabel(u_int8_t *, const ch
 static int oklabel(const char *);
 static void setstr(u_int8_t *, const char *, size_t);
 
-int mkfs_msdos(const char *fname, const char *dtype,
-    const struct msdos_options *op)
+int
+mkfs_msdos(const char *fname, const char *dtype, const struct msdos_options *op)
 {
     char buf[MAXPATHLEN];
     struct sigaction si_sa;
@@ -245,6 +245,10 @@ int mkfs_msdos(const char *fname, const 
     int fd, fd1;
     struct msdos_options o = *op;
 
+    if (o.block_size && o.sectors_per_cluster) {
+	warnx("Cannot specify both block size and sectors per cluster");
+	return -1;
+    }
     if (o.OEM_string && strlen(o.OEM_string) > 8) {
 	warnx("%s: bad OEM string", o.OEM_string);
 	return -1;
@@ -304,7 +308,8 @@ int mkfs_msdos(const char *fname, const 
 	bpb.bpbHugeSectors = o.size;
     if (o.hidden_sectors_set)
 	bpb.bpbHiddenSecs = o.hidden_sectors;
-    if (!(o.floppy || (o.drive_heads && o.sectors_per_track && o.bytes_per_sector && o.size && o.hidden_sectors_set))) {
+    if (!(o.floppy || (o.drive_heads && o.sectors_per_track &&
+	o.bytes_per_sector && o.size && o.hidden_sectors_set))) {
 	off_t delta;
 	getdiskinfo(fd, fname, dtype, o.hidden_sectors_set, &bpb);
 	bpb.bpbHugeSectors -= (o.offset / bpb.bpbBytesPerSec);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511271420.tAREKWrY050499>