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);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to