From: Sven Hoexter Date: Sun, 12 Aug 2012 17:17:10 +0000 (+0200) Subject: Imported Upstream version 0.9.8 X-Git-Tag: upstream/0.9.8^0 X-Git-Url: https://git.sven.stormbind.net/?a=commitdiff_plain;h=31c7740425f6fc11cc1f4c4316c659c566d94036;p=sven%2Ffuse-exfat.git Imported Upstream version 0.9.8 --- diff --git a/ChangeLog b/ChangeLog index d492c39..e42a095 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +0.9.8 (2012-08-09) + +* The mkfs utility can now create huge file systems (up to several exabytes). +* Fixed handling of characters beyond Basic Multilingual Plane. +* Echo messages to syslog only if stderr is not connected to a terminal. + 0.9.7 (2012-03-08) * Out-of-the-box FreeBSD support (via ublio library). diff --git a/SConstruct b/SConstruct index 14bd10e..3206c54 100644 --- a/SConstruct +++ b/SConstruct @@ -2,7 +2,7 @@ # SConstruct (10.09.09) # SConscript for all components. # -# Copyright (C) 2009, 2010 Andrew Nayenko +# Copyright (C) 2010-2012 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 @@ -36,16 +36,23 @@ if 'CCFLAGS' in os.environ: # Set default CCFLAGS for known compilers if not conf.env['CCFLAGS']: if conf.env['CC'] == 'gcc': - conf.env.Replace(CCFLAGS = '-Wall -O2 -ggdb') + conf.env.Replace(CCFLAGS = '-Wall -O2 -ggdb -std=c99') elif conf.env['CC'] == 'clang': - conf.env.Replace(CCFLAGS = '-Wall -O2 -g') -conf.env.Append(CPPDEFINES = {'FUSE_USE_VERSION': 26}) + conf.env.Replace(CCFLAGS = '-Wall -O2 -g -std=c99') +if 'CPPFLAGS' in os.environ: + conf.env.Replace(CPPFLAGS = os.environ['CPPFLAGS']) conf.env.Append(CPPDEFINES = {'_FILE_OFFSET_BITS' : 64}) conf.env.Append(CPPPATH = ['libexfat']) if 'LDFLAGS' in os.environ: conf.env.Append(LINKFLAGS = os.environ['LDFLAGS']) conf.env.Append(LIBPATH = ['libexfat']) +# GNU/Linux requires _BSD_SOURCE define for vsyslog(), _XOPEN_SOURCE >= 500 for +# pread(), pwrite(), snprintf(), strdup(), etc. Everything needed is enabled by +# _GNU_SOURCE. +if platform.system() == 'Linux': + conf.env.Append(CPPDEFINES = '_GNU_SOURCE'); + # __DARWIN_64_BIT_INO_T=0 define is needed because since Snow Leopard inode # numbers are 64-bit by default, but libfuse operates 32-bit ones. This define # forces 32-bit inode declaration in system headers, but it's also possible to diff --git a/fuse/main.c b/fuse/main.c index 9155912..643df3f 100644 --- a/fuse/main.c +++ b/fuse/main.c @@ -2,7 +2,7 @@ main.c (01.09.09) FUSE-based exFAT implementation. Requires FUSE 2.6 or later. - Copyright (C) 2009, 2010 Andrew Nayenko + Copyright (C) 2010-2012 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 @@ -18,6 +18,7 @@ along with this program. If not, see . */ +#define FUSE_USE_VERSION 26 #include #include #include @@ -401,7 +402,7 @@ int main(int argc, char* argv[]) else if (strcmp(*pp, "-v") == 0) { free(mount_options); - puts("Copyright (C) 2009 Andrew Nayenko"); + puts("Copyright (C) 2010-2012 Andrew Nayenko"); return 0; } else if (spec == NULL) diff --git a/libexfat/byteorder.h b/libexfat/byteorder.h index 6b38646..abcf811 100644 --- a/libexfat/byteorder.h +++ b/libexfat/byteorder.h @@ -2,7 +2,7 @@ byteorder.h (12.01.10) Endianness stuff. exFAT uses little-endian byte order. - Copyright (C) 2009, 2010 Andrew Nayenko + Copyright (C) 2010-2012 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/libexfat/cluster.c b/libexfat/cluster.c index 1257c7a..0418932 100644 --- a/libexfat/cluster.c +++ b/libexfat/cluster.c @@ -2,7 +2,7 @@ cluster.c (03.09.09) exFAT file system implementation library. - Copyright (C) 2009, 2010 Andrew Nayenko + Copyright (C) 2010-2012 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/libexfat/exfat.h b/libexfat/exfat.h index bca0d24..392c95d 100644 --- a/libexfat/exfat.h +++ b/libexfat/exfat.h @@ -3,7 +3,7 @@ Definitions of structures and constants used in exFAT file system implementation. - Copyright (C) 2009, 2010 Andrew Nayenko + Copyright (C) 2010-2012 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 @@ -38,10 +38,12 @@ #define IS_CONTIGUOUS(node) (((node).flags & EXFAT_ATTRIB_CONTIGUOUS) != 0) #define SECTOR_SIZE(sb) (1 << (sb).sector_bits) #define CLUSTER_SIZE(sb) (SECTOR_SIZE(sb) << (sb).spc_bits) -#define CLUSTER_INVALID(c) ((c) == EXFAT_CLUSTER_BAD || (c) == EXFAT_CLUSTER_END) +#define CLUSTER_INVALID(c) ((c) > EXFAT_LAST_DATA_CLUSTER) #define MIN(a, b) ((a) < (b) ? (a) : (b)) +#define MAX(a, b) ((a) > (b) ? (a) : (b)) #define DIV_ROUND_UP(x, d) (((x) + (d) - 1) / (d)) +#define ROUND_UP(x, d) (DIV_ROUND_UP(x, d) * (d)) #define BMAP_GET(bitmap, index) \ (((uint8_t*) bitmap)[(index) / 8] & (1u << ((index) % 8))) diff --git a/libexfat/exfatfs.h b/libexfat/exfatfs.h index 61e39a1..5a8e39f 100644 --- a/libexfat/exfatfs.h +++ b/libexfat/exfatfs.h @@ -2,7 +2,7 @@ exfatfs.h (29.08.09) Definitions of structures and constants used in exFAT file system. - Copyright (C) 2009, 2010 Andrew Nayenko + Copyright (C) 2010-2012 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 @@ -26,6 +26,7 @@ typedef uint32_t cluster_t; /* cluster number */ #define EXFAT_FIRST_DATA_CLUSTER 2 +#define EXFAT_LAST_DATA_CLUSTER 0xfffffff6 #define EXFAT_CLUSTER_FREE 0 /* free cluster */ #define EXFAT_CLUSTER_BAD 0xfffffff7 /* cluster contains bad sector */ diff --git a/libexfat/io.c b/libexfat/io.c index c9c1e2b..f0beddc 100644 --- a/libexfat/io.c +++ b/libexfat/io.c @@ -2,7 +2,7 @@ io.c (02.09.09) exFAT file system implementation library. - Copyright (C) 2009, 2010 Andrew Nayenko + Copyright (C) 2010-2012 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 @@ -18,7 +18,6 @@ along with this program. If not, see . */ -#define _XOPEN_SOURCE 500 /* for pread() and pwrite() in Linux */ #include "exfat.h" #include #include @@ -32,7 +31,7 @@ #include #endif -#if _FILE_OFFSET_BITS != 64 +#if !defined(_FILE_OFFSET_BITS) || (_FILE_OFFSET_BITS != 64) #error You should define _FILE_OFFSET_BITS=64 #endif diff --git a/libexfat/log.c b/libexfat/log.c index 7a2b35d..8b589b4 100644 --- a/libexfat/log.c +++ b/libexfat/log.c @@ -2,7 +2,7 @@ log.c (02.09.09) exFAT file system implementation library. - Copyright (C) 2009, 2010 Andrew Nayenko + Copyright (C) 2010-2012 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 "exfat.h" #include #include +#include int exfat_errors; @@ -40,7 +41,8 @@ void exfat_bug(const char* format, ...) va_end(ap); fputs(".\n", stderr); - vsyslog(LOG_CRIT, format, aq); + if (!isatty(STDERR_FILENO)) + vsyslog(LOG_CRIT, format, aq); va_end(aq); abort(); @@ -63,7 +65,8 @@ void exfat_error(const char* format, ...) va_end(ap); fputs(".\n", stderr); - vsyslog(LOG_ERR, format, aq); + if (!isatty(STDERR_FILENO)) + vsyslog(LOG_ERR, format, aq); va_end(aq); } @@ -84,7 +87,8 @@ void exfat_warn(const char* format, ...) va_end(ap); fputs(".\n", stderr); - vsyslog(LOG_WARNING, format, aq); + if (!isatty(STDERR_FILENO)) + vsyslog(LOG_WARNING, format, aq); va_end(aq); } diff --git a/libexfat/lookup.c b/libexfat/lookup.c index 619dcea..d650976 100644 --- a/libexfat/lookup.c +++ b/libexfat/lookup.c @@ -2,7 +2,7 @@ lookup.c (02.09.09) exFAT file system implementation library. - Copyright (C) 2009, 2010 Andrew Nayenko + Copyright (C) 2010-2012 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/libexfat/mount.c b/libexfat/mount.c index 521b539..a62466b 100644 --- a/libexfat/mount.c +++ b/libexfat/mount.c @@ -2,7 +2,7 @@ mount.c (22.10.09) exFAT file system implementation library. - Copyright (C) 2009, 2010 Andrew Nayenko + Copyright (C) 2010-2012 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/libexfat/node.c b/libexfat/node.c index 2ae724d..4cbb3e2 100644 --- a/libexfat/node.c +++ b/libexfat/node.c @@ -2,7 +2,7 @@ node.c (09.10.09) exFAT file system implementation library. - Copyright (C) 2009, 2010 Andrew Nayenko + Copyright (C) 2010-2012 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/libexfat/time.c b/libexfat/time.c index 2e22a99..890930e 100644 --- a/libexfat/time.c +++ b/libexfat/time.c @@ -2,7 +2,7 @@ time.c (03.02.12) exFAT file system implementation library. - Copyright (C) 2009, 2010 Andrew Nayenko + Copyright (C) 2010-2012 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/libexfat/utf.c b/libexfat/utf.c index 3f0dc19..983c793 100644 --- a/libexfat/utf.c +++ b/libexfat/utf.c @@ -2,7 +2,7 @@ utf.c (13.09.09) exFAT file system implementation library. - Copyright (C) 2009, 2010 Andrew Nayenko + Copyright (C) 2010-2012 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 @@ -89,6 +89,7 @@ static const le16_t* utf16_to_wchar(const le16_t* input, wchar_t* wc, return NULL; *wc = ((wchar_t) (le16_to_cpu(input[0]) & 0x3ff) << 10); *wc |= (le16_to_cpu(input[1]) & 0x3ff); + *wc += 0x10000; return input + 2; } else @@ -186,6 +187,7 @@ static le16_t* wchar_to_utf16(le16_t* output, wchar_t wc, size_t outsize) } if (outsize < 2) return NULL; + wc -= 0x10000; output[0] = cpu_to_le16(0xd800 | ((wc >> 10) & 0x3ff)); output[1] = cpu_to_le16(0xdc00 | (wc & 0x3ff)); return output + 2; diff --git a/libexfat/utils.c b/libexfat/utils.c index c165cf9..7c47f4d 100644 --- a/libexfat/utils.c +++ b/libexfat/utils.c @@ -2,7 +2,7 @@ utils.c (04.09.09) exFAT file system implementation library. - Copyright (C) 2009, 2010 Andrew Nayenko + Copyright (C) 2010-2012 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 @@ -133,11 +133,13 @@ le16_t exfat_calc_name_hash(const struct exfat* ef, const le16_t* name) void exfat_humanize_bytes(uint64_t value, struct exfat_human_bytes* hb) { size_t i; - const char* units[] = {"bytes", "KB", "MB", "GB", "TB", "PB"}; + /* 16 EB (minus 1 byte) is the largest size that can be represented by + uint64_t */ + const char* units[] = {"bytes", "KB", "MB", "GB", "TB", "PB", "EB"}; uint64_t divisor = 1; uint64_t temp = 0; - for (i = 0; i < sizeof(units) / sizeof(units[0]) - 1; i++, divisor *= 1024) + for (i = 0; ; i++, divisor *= 1024) { temp = (value + divisor / 2) / divisor; diff --git a/libexfat/version.h b/libexfat/version.h index aa636f8..f35cb4f 100644 --- a/libexfat/version.h +++ b/libexfat/version.h @@ -2,7 +2,7 @@ version.h (12.06.10) Version constants. - Copyright (C) 2009, 2010 Andrew Nayenko + Copyright (C) 2010-2012 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 @@ -23,6 +23,6 @@ #define EXFAT_VERSION_MAJOR 0 #define EXFAT_VERSION_MINOR 9 -#define EXFAT_VERSION_PATCH 7 +#define EXFAT_VERSION_PATCH 8 #endif /* ifndef VERSION_H_INCLUDED */