update exfat from current head

Change-Id: I7d93474296612fda1dde23f6e8690668d6880e27
diff --git a/exfat/mkfs/cbm.c b/exfat/mkfs/cbm.c
index 0110b40..189ae32 100644
--- a/exfat/mkfs/cbm.c
+++ b/exfat/mkfs/cbm.c
@@ -3,7 +3,7 @@
 	Clusters Bitmap creation code.
 
 	Free exFAT implementation.
-	Copyright (C) 2011-2013  Andrew Nayenko
+	Copyright (C) 2011-2014  Andrew Nayenko
 
 	This program is free software; you can redistribute it and/or modify
 	it under the terms of the GNU General Public License as published by
@@ -21,6 +21,7 @@
 */
 
 #include <limits.h>
+#include <string.h>
 #include "cbm.h"
 #include "fat.h"
 #include "uct.h"
@@ -45,22 +46,23 @@
 			DIV_ROUND_UP(uct.get_size(), get_cluster_size()) +
 			DIV_ROUND_UP(rootdir.get_size(), get_cluster_size());
 	size_t bitmap_size = DIV_ROUND_UP(allocated_clusters, CHAR_BIT);
-	uint8_t* bitmap = malloc(bitmap_size);
+	bitmap_t* bitmap = malloc(BMAP_SIZE(bitmap_size));
 	size_t i;
 
 	if (bitmap == NULL)
 	{
-		exfat_error("failed to allocate bitmap of %zu bytes", bitmap_size);
+		exfat_error("failed to allocate bitmap of %zu bytes",
+				BMAP_SIZE(bitmap_size));
 		return 1;
 	}
+	memset(bitmap, 0, BMAP_SIZE(bitmap_size));
 
 	for (i = 0; i < bitmap_size * CHAR_BIT; i++)
 		if (i < allocated_clusters)
 			BMAP_SET(bitmap, i);
-		else
-			BMAP_CLR(bitmap, i);
 	if (exfat_write(dev, bitmap, bitmap_size) < 0)
 	{
+		free(bitmap);
 		exfat_error("failed to write bitmap of %zu bytes", bitmap_size);
 		return 1;
 	}
diff --git a/exfat/mkfs/cbm.h b/exfat/mkfs/cbm.h
index b9d2850..f959124 100644
--- a/exfat/mkfs/cbm.h
+++ b/exfat/mkfs/cbm.h
@@ -3,7 +3,7 @@
 	Clusters Bitmap creation code.
 
 	Free exFAT implementation.
-	Copyright (C) 2011-2013  Andrew Nayenko
+	Copyright (C) 2011-2014  Andrew Nayenko
 
 	This program is free software; you can redistribute it and/or modify
 	it under the terms of the GNU General Public License as published by
diff --git a/exfat/mkfs/fat.c b/exfat/mkfs/fat.c
index 9ed9022..25d37a2 100644
--- a/exfat/mkfs/fat.c
+++ b/exfat/mkfs/fat.c
@@ -3,7 +3,7 @@
 	File Allocation Table creation code.
 
 	Free exFAT implementation.
-	Copyright (C) 2011-2013  Andrew Nayenko
+	Copyright (C) 2011-2014  Andrew Nayenko
 
 	This program is free software; you can redistribute it and/or modify
 	it under the terms of the GNU General Public License as published by
diff --git a/exfat/mkfs/fat.h b/exfat/mkfs/fat.h
index 1327f0a..bd30fe3 100644
--- a/exfat/mkfs/fat.h
+++ b/exfat/mkfs/fat.h
@@ -3,7 +3,7 @@
 	File Allocation Table creation code.
 
 	Free exFAT implementation.
-	Copyright (C) 2011-2013  Andrew Nayenko
+	Copyright (C) 2011-2014  Andrew Nayenko
 
 	This program is free software; you can redistribute it and/or modify
 	it under the terms of the GNU General Public License as published by
diff --git a/exfat/mkfs/main.c b/exfat/mkfs/main.c
index 3c3c382..87f25db 100644
--- a/exfat/mkfs/main.c
+++ b/exfat/mkfs/main.c
@@ -3,7 +3,7 @@
 	Creates exFAT file system.
 
 	Free exFAT implementation.
-	Copyright (C) 2011-2013  Andrew Nayenko
+	Copyright (C) 2011-2014  Andrew Nayenko
 
 	This program is free software; you can redistribute it and/or modify
 	it under the terms of the GNU General Public License as published by
@@ -224,12 +224,12 @@
 			spc_bits = logarithm2(atoi(optarg));
 			if (spc_bits < 0)
 			{
-				exfat_error("invalid option value: `%s'", optarg);
+				exfat_error("invalid option value: '%s'", optarg);
 				return 1;
 			}
 			break;
 		case 'V':
-			puts("Copyright (C) 2011-2013  Andrew Nayenko");
+			puts("Copyright (C) 2011-2014  Andrew Nayenko");
 			return 0;
 		default:
 			usage(argv[0]);
diff --git a/exfat/mkfs/mkexfat.c b/exfat/mkfs/mkexfat.c
index c5c86d9..df6391a 100644
--- a/exfat/mkfs/mkexfat.c
+++ b/exfat/mkfs/mkexfat.c
@@ -3,7 +3,7 @@
 	FS creation engine.
 
 	Free exFAT implementation.
-	Copyright (C) 2011-2013  Andrew Nayenko
+	Copyright (C) 2011-2014  Andrew Nayenko
 
 	This program is free software; you can redistribute it and/or modify
 	it under the terms of the GNU General Public License as published by
diff --git a/exfat/mkfs/mkexfat.h b/exfat/mkfs/mkexfat.h
index d0685af..a9e4948 100644
--- a/exfat/mkfs/mkexfat.h
+++ b/exfat/mkfs/mkexfat.h
@@ -3,7 +3,7 @@
 	FS creation engine.
 
 	Free exFAT implementation.
-	Copyright (C) 2011-2013  Andrew Nayenko
+	Copyright (C) 2011-2014  Andrew Nayenko
 
 	This program is free software; you can redistribute it and/or modify
 	it under the terms of the GNU General Public License as published by
diff --git a/exfat/mkfs/mkexfatfs.8 b/exfat/mkfs/mkexfatfs.8
index 5f6ba3d..8f5e53b 100644
--- a/exfat/mkfs/mkexfatfs.8
+++ b/exfat/mkfs/mkexfatfs.8
@@ -1,4 +1,4 @@
-.\" Copyright (C) 2011  Andrew Nayenko
+.\" Copyright (C) 2011-2014  Andrew Nayenko
 .\"
 .TH MKEXFATFS 8 "January 2011"
 .SH NAME
@@ -31,7 +31,10 @@
 .B mkexfatfs
 creates an exFAT file system on a block device.
 .I device
-is a special file corresponding to the device.
+is a special file corresponding to the partition on the device. Note that if
+this is an MBR partition then the file system type should be set to 0x07
+(NTFS/exFAT) otherwise other operating systems may refuse to mount the
+file system.
 
 .SH OPTIONS
 Command line options available:
@@ -65,4 +68,4 @@
 Andrew Nayenko
 
 .SH SEE ALSO
-.BR mkfs (8)
+.BR mkfs (8), fdisk (8)
diff --git a/exfat/mkfs/rootdir.c b/exfat/mkfs/rootdir.c
index 49d3643..f453131 100644
--- a/exfat/mkfs/rootdir.c
+++ b/exfat/mkfs/rootdir.c
@@ -3,7 +3,7 @@
 	Root directory creation code.
 
 	Free exFAT implementation.
-	Copyright (C) 2011-2013  Andrew Nayenko
+	Copyright (C) 2011-2014  Andrew Nayenko
 
 	This program is free software; you can redistribute it and/or modify
 	it under the terms of the GNU General Public License as published by
diff --git a/exfat/mkfs/rootdir.h b/exfat/mkfs/rootdir.h
index 2d1d345..ddf5f41 100644
--- a/exfat/mkfs/rootdir.h
+++ b/exfat/mkfs/rootdir.h
@@ -3,7 +3,7 @@
 	Root directory creation code.
 
 	Free exFAT implementation.
-	Copyright (C) 2011-2013  Andrew Nayenko
+	Copyright (C) 2011-2014  Andrew Nayenko
 
 	This program is free software; you can redistribute it and/or modify
 	it under the terms of the GNU General Public License as published by
diff --git a/exfat/mkfs/uct.c b/exfat/mkfs/uct.c
index 5f17323..9129403 100644
--- a/exfat/mkfs/uct.c
+++ b/exfat/mkfs/uct.c
@@ -3,7 +3,7 @@
 	Upper Case Table creation code.
 
 	Free exFAT implementation.
-	Copyright (C) 2011-2013  Andrew Nayenko
+	Copyright (C) 2011-2014  Andrew Nayenko
 
 	This program is free software; you can redistribute it and/or modify
 	it under the terms of the GNU General Public License as published by
diff --git a/exfat/mkfs/uct.h b/exfat/mkfs/uct.h
index ef33392..6f276de 100644
--- a/exfat/mkfs/uct.h
+++ b/exfat/mkfs/uct.h
@@ -3,7 +3,7 @@
 	Upper Case Table creation code.
 
 	Free exFAT implementation.
-	Copyright (C) 2011-2013  Andrew Nayenko
+	Copyright (C) 2011-2014  Andrew Nayenko
 
 	This program is free software; you can redistribute it and/or modify
 	it under the terms of the GNU General Public License as published by
diff --git a/exfat/mkfs/uctc.c b/exfat/mkfs/uctc.c
index 1ee8efe..b5aa17d 100644
--- a/exfat/mkfs/uctc.c
+++ b/exfat/mkfs/uctc.c
@@ -3,7 +3,7 @@
 	Upper Case Table contents.
 
 	Free exFAT implementation.
-	Copyright (C) 2011-2013  Andrew Nayenko
+	Copyright (C) 2011-2014  Andrew Nayenko
 
 	This program is free software; you can redistribute it and/or modify
 	it under the terms of the GNU General Public License as published by
diff --git a/exfat/mkfs/uctc.h b/exfat/mkfs/uctc.h
index 3e7dee0..c492ec2 100644
--- a/exfat/mkfs/uctc.h
+++ b/exfat/mkfs/uctc.h
@@ -3,7 +3,7 @@
 	Upper Case Table declaration.
 
 	Free exFAT implementation.
-	Copyright (C) 2011-2013  Andrew Nayenko
+	Copyright (C) 2011-2014  Andrew Nayenko
 
 	This program is free software; you can redistribute it and/or modify
 	it under the terms of the GNU General Public License as published by
diff --git a/exfat/mkfs/vbr.c b/exfat/mkfs/vbr.c
index bbf1304..b3889e5 100644
--- a/exfat/mkfs/vbr.c
+++ b/exfat/mkfs/vbr.c
@@ -3,7 +3,7 @@
 	Volume Boot Record creation code.
 
 	Free exFAT implementation.
-	Copyright (C) 2011-2013  Andrew Nayenko
+	Copyright (C) 2011-2014  Andrew Nayenko
 
 	This program is free software; you can redistribute it and/or modify
 	it under the terms of the GNU General Public License as published by
diff --git a/exfat/mkfs/vbr.h b/exfat/mkfs/vbr.h
index fec88bc..075938f 100644
--- a/exfat/mkfs/vbr.h
+++ b/exfat/mkfs/vbr.h
@@ -3,7 +3,7 @@
 	Volume Boot Record creation code.
 
 	Free exFAT implementation.
-	Copyright (C) 2011-2013  Andrew Nayenko
+	Copyright (C) 2011-2014  Andrew Nayenko
 
 	This program is free software; you can redistribute it and/or modify
 	it under the terms of the GNU General Public License as published by