From 2e33c5ee0b1a1ece068489e8fd99f3e4eb3501b5 Mon Sep 17 00:00:00 2001 From: bigbiff bigbiff Date: Thu, 4 Sep 2014 20:58:41 -0400 Subject: update exfat from current head Change-Id: I7d93474296612fda1dde23f6e8690668d6880e27 --- exfat/mkfs/cbm.c | 12 +++++++----- exfat/mkfs/cbm.h | 2 +- exfat/mkfs/fat.c | 2 +- exfat/mkfs/fat.h | 2 +- exfat/mkfs/main.c | 6 +++--- exfat/mkfs/mkexfat.c | 2 +- exfat/mkfs/mkexfat.h | 2 +- exfat/mkfs/mkexfatfs.8 | 9 ++++++--- exfat/mkfs/rootdir.c | 2 +- exfat/mkfs/rootdir.h | 2 +- exfat/mkfs/uct.c | 2 +- exfat/mkfs/uct.h | 2 +- exfat/mkfs/uctc.c | 2 +- exfat/mkfs/uctc.h | 2 +- exfat/mkfs/vbr.c | 2 +- exfat/mkfs/vbr.h | 2 +- 16 files changed, 29 insertions(+), 24 deletions(-) (limited to 'exfat/mkfs') diff --git a/exfat/mkfs/cbm.c b/exfat/mkfs/cbm.c index 0110b4065..189ae32fd 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 +#include #include "cbm.h" #include "fat.h" #include "uct.h" @@ -45,22 +46,23 @@ static int cbm_write(struct exfat_dev* dev) 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 b9d285013..f959124de 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 9ed90223e..25d37a2e8 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 1327f0acc..bd30fe300 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 3c3c3829f..87f25db42 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 @@ int main(int argc, char* argv[]) 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 c5c86d9b8..df6391aab 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 d0685afa7..a9e49488f 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 5f6ba3db7..8f5e53bfc 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 @@ Zero is returned on successful creation. Any other code means an error. 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 49d364324..f453131f6 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 2d1d3453c..ddf5f418f 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 5f173233c..912940350 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 ef3339218..6f276de47 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 1ee8efe3f..b5aa17d0f 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 3e7dee0ef..c492ec24c 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 bbf1304d9..b3889e554 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 fec88bc1e..075938f47 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 -- cgit v1.2.3