From owner-svn-src-all@freebsd.org Fri Nov 27 14:20:33 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 81629A39C12; Fri, 27 Nov 2015 14:20:33 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 494141304; Fri, 27 Nov 2015 14:20:33 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAREKW2k050500; Fri, 27 Nov 2015 14:20:32 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAREKWrY050499; Fri, 27 Nov 2015 14:20:32 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201511271420.tAREKWrY050499@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 27 Nov 2015 14:20:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r291382 - head/sbin/newfs_msdos X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Nov 2015 14:20:33 -0000 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);