]> git.sven.stormbind.net Git - sven/fuse-exfat.git/commitdiff
New upstream version 1.4.0
authorSven Hoexter <sven@stormbind.net>
Fri, 3 Mar 2023 14:10:41 +0000 (15:10 +0100)
committerSven Hoexter <sven@stormbind.net>
Fri, 3 Mar 2023 14:10:41 +0000 (15:10 +0100)
54 files changed:
.cirrus.yml
.gitignore
Android.bp
ChangeLog
Makefile.am
attrib/Makefile.am [new file with mode: 0644]
attrib/exfatattrib.8 [new file with mode: 0644]
attrib/main.c [new file with mode: 0644]
configure.ac
dump/Makefile.am
dump/dumpexfat.8
dump/main.c
fsck/Makefile.am
fsck/exfatfsck.8
fsck/main.c
fuse/Makefile.am
fuse/main.c
fuse/mount.exfat-fuse.8
label/Makefile.am
label/exfatlabel.8
label/main.c
libexfat/Makefile.am
libexfat/byteorder.h
libexfat/cluster.c
libexfat/compiler.h
libexfat/exfat.h
libexfat/exfatfs.h
libexfat/io.c
libexfat/log.c
libexfat/lookup.c
libexfat/mount.c
libexfat/node.c
libexfat/platform.h
libexfat/repair.c
libexfat/time.c
libexfat/utf.c
libexfat/utils.c
mkfs/Makefile.am
mkfs/cbm.c
mkfs/cbm.h
mkfs/fat.c
mkfs/fat.h
mkfs/main.c
mkfs/mkexfat.c
mkfs/mkexfat.h
mkfs/mkexfatfs.8
mkfs/rootdir.c
mkfs/rootdir.h
mkfs/uct.c
mkfs/uct.h
mkfs/uctc.c
mkfs/uctc.h
mkfs/vbr.c
mkfs/vbr.h

index 2685902cf4efcee719f9996b6a66113cd36b0b18..1d280232c40eb7c21817004c79e83dc72c022029 100644 (file)
@@ -23,7 +23,7 @@
 ---
 task:
   matrix:
-    - name: debian
+    - name: debian-fuse2
       container:
         image: gcc:11-bullseye
       install_script: |
@@ -32,9 +32,18 @@ task:
       env:
         EXTRA_CFLAGS: -fanalyzer
 
+    - name: debian-fuse3
+      container:
+        image: gcc:11-bullseye
+      install_script: |
+        apt-get update
+        apt-get install -y libfuse3-dev
+      env:
+        EXTRA_CFLAGS: -fanalyzer
+
     - name: macos
       macos_instance:
-        image: big-sur-base
+        image: ghcr.io/cirruslabs/macos-ventura-base:latest
       install_script: |
         brew update --preinstall
         brew install automake macfuse
@@ -47,7 +56,9 @@ task:
 
   compile_script: |
     autoreconf --install
-    ./configure CFLAGS="-Wall -Wextra -Werror $EXTRA_CFLAGS"
+    ./configure CFLAGS="-Wall -Wextra -Werror \
+                        -fsanitize=address,undefined \
+                        $EXTRA_CFLAGS"
     make -k
 
   test_script: |
@@ -55,3 +66,5 @@ task:
     mkfs/mkexfatfs -i 12345678 foo.img
     fsck/exfatfsck foo.img
     echo 'f1b3a11f781533f5b69086596be38367d0ebfb77  foo.img' | shasum -c
+    label/exfatlabel foo.img ○○○○○○○○○○○○○○○
+    echo '4720462db953d5b2094c884f4b3098a138790533  foo.img' | shasum -c
index 99039834934f726dbc8e406f12883cc0ef59fbe0..c5338609a8fdfd22d0493a5ce30962e169a17291 100644 (file)
@@ -20,6 +20,7 @@ Makefile
 
 # make
 *.o
+/attrib/exfatattrib
 /dump/dumpexfat
 /fsck/exfatfsck
 /fuse/mount.exfat-fuse
index f26e30c0780394027a749076a83905a456064c35..97390041d3701a62d24a83f049d2f372a3b8aed3 100644 (file)
@@ -25,7 +25,7 @@ cc_defaults {
         "-Wno-error",
         "-D_FILE_OFFSET_BITS=64",
         "-DPACKAGE=\"exfat\"",
-        "-DVERSION=\"1.3.0\"",
+        "-DVERSION=\"1.4.0\"",
     ],
     shared_libs: ["liblog"],
 }
index 9e20bf53f0c66486a286d5527ad600f9fcca24cb..74139960cc444badaee9d2b0f4d3bd21f04f4540 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+1.4.0 (2023-03-02)
+
+* Added exfatattrib utility which prints or changes file attributes [Will
+Thompson].
+* Added FUSE 3 support. FUSE 2 continues to be supported.
+* Added support for timezone offsets [Nathan Hunsperger].
+* Fixed device opening error being reported as FS error.
+* Fixed possible data leakage when uninitialized clusters were allocated using
+NtSetInformationFile() call under Windows and FS was not unmounted correctly.
+* Improved compatibility with autoconf 2.70.
+* Fixed disk size reading on NetBSD [Dave Vasilevsky].
+* Fixed "automounted" option handling on FreeBSD [Iouri V. Ivliev].
+* Allowed to specify the "nonempty" mount option.
+* Fixed file data contiguity handling bug which could cause performance
+degradation [noctis].
+* Fixed possible crashes on invalid UTF-8 sequences.
+* Fixed a situation when FS could be erroneously marked as dirty (not cleanly
+unmounted).
+
 1.3.0 (2018-09-15)
 
 * exfatfsck can now repair some errors.
index 067f481c10853fbe12ca9231842ba4ee4d26f1ba..3d0b45900c286e8f1e6b80e222f4237d426fc2e7 100644 (file)
@@ -3,7 +3,7 @@
 #      Automake source.
 #
 #      Free exFAT implementation.
-#      Copyright (C) 2010-2018  Andrew Nayenko
+#      Copyright (C) 2010-2023  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
@@ -20,4 +20,4 @@
 #      51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 #
 
-SUBDIRS = libexfat dump fsck fuse label mkfs
+SUBDIRS = libexfat attrib dump fsck fuse label mkfs
diff --git a/attrib/Makefile.am b/attrib/Makefile.am
new file mode 100644 (file)
index 0000000..e1eaa85
--- /dev/null
@@ -0,0 +1,27 @@
+#
+#      Makefile.am (08.11.20)
+#      Automake source.
+#
+#      Free exFAT implementation.
+#      Copyright (C) 2020  Endless OS Foundation LLC
+#
+#      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
+#      the Free Software Foundation, either version 2 of the License, or
+#      (at your option) any later version.
+#
+#      This program is distributed in the hope that it will be useful,
+#      but WITHOUT ANY WARRANTY; without even the implied warranty of
+#      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#      GNU General Public License for more details.
+#
+#      You should have received a copy of the GNU General Public License along
+#      with this program; if not, write to the Free Software Foundation, Inc.,
+#      51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+sbin_PROGRAMS = exfatattrib
+dist_man8_MANS = exfatattrib.8
+exfatattrib_SOURCES = main.c
+exfatattrib_CPPFLAGS = -I$(top_srcdir)/libexfat
+exfatattrib_LDADD = ../libexfat/libexfat.a
diff --git a/attrib/exfatattrib.8 b/attrib/exfatattrib.8
new file mode 100644 (file)
index 0000000..7ec88a2
--- /dev/null
@@ -0,0 +1,90 @@
+.\" Copyright (C) 2020-2023 Endless OS Foundation
+.\"
+.TH EXFATATTRIB 8 "November 2020"
+.SH NAME
+.B exfatattrib
+\- Set or display exFAT file attributes
+.SH SYNOPSIS
+.B exfatattrib
+[
+.B \-r
+|
+.B \-R
+|
+.B \-i
+|
+.B \-I
+|
+.B \-s
+|
+.B \-S
+|
+.B \-a
+|
+.B \-A
+]
+.B \-d
+.I device
+.I file
+.SH DESCRIPTION
+.B exfatattrib
+sets or displays attributes of a file on an exFAT file system.
+
+.I device
+is the path to an unmounted disk partition or disk image file containing an
+exFAT file system.
+
+.I file
+is the path of a file within that file system.
+
+If run with no command line options, the current attributes of
+.I file
+are displayed; otherwise, the specified attributes are set or cleared. It is an
+error to set and clear the same flag.
+
+.SH COMMAND LINE OPTIONS
+Command line options available:
+
+.TP
+.BI \-d " device"
+The path to an unmounted disk partition or disk image file containing an exFAT
+file system. This option is required.
+.TP
+.BI -r
+Set read\-only flag
+.TP
+.BI \-R
+Clear read\-only flag
+.TP
+.BI \-i
+Set hidden flag (mnemonic: \fBi\fRnvisible)
+.TP
+.BI \-I
+Clear hidden flag
+.TP
+.BI \-s
+Set system flag
+.TP
+.BI \-S
+Clear system flag
+.TP
+.BI \-a
+Set archive flag
+.TP
+.BI \-A
+Clear archive flag
+.TP
+.BI \-h
+Display this help message
+.TP
+.BI \-V
+Print version and copyright.
+
+.SH EXIT CODES
+Zero is returned if errors were not found. Any other code means an error.
+
+.SH AUTHOR
+Will Thompson
+
+.SH SEE ALSO
+.BR chmod(1)
diff --git a/attrib/main.c b/attrib/main.c
new file mode 100644 (file)
index 0000000..53d0ba4
--- /dev/null
@@ -0,0 +1,198 @@
+/*
+       main.c (08.11.20)
+       Prints or changes exFAT file attributes
+
+       Free exFAT implementation.
+       Copyright (C) 2020-2023  Endless OS Foundation LLC
+
+       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
+       the Free Software Foundation, either version 2 of the License, or
+       (at your option) any later version.
+
+       This program is distributed in the hope that it will be useful,
+       but WITHOUT ANY WARRANTY; without even the implied warranty of
+       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       GNU General Public License for more details.
+
+       You should have received a copy of the GNU General Public License along
+       with this program; if not, write to the Free Software Foundation, Inc.,
+       51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
+#include <exfat.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+static void usage(const char* prog)
+{
+       fprintf(stderr,
+               "Display current attributes:\n"
+               "  %1$s -d <device> <file>\n"
+               "\n"
+               "Set attributes:\n"
+               "  %1$s [FLAGS] -d <device> <file>\n"
+               "\n"
+               "Flags:\n"
+               "  -r    Set read-only flag\n"
+               "  -R    Clear read-only flag\n"
+               "  -i    Set hidden flag\n"
+               "  -I    Clear hidden flag\n"
+               "  -s    Set system flag\n"
+               "  -S    Clear system flag\n"
+               "  -a    Set archive flag\n"
+               "  -A    Clear archive flag\n"
+               "\n"
+               "  -h    Display this help message\n"
+               "  -V    Display version information\n",
+               prog);
+       exit(1);
+}
+
+static void print_attribute(uint16_t attribs, uint16_t attrib,
+               const char* label)
+{
+       printf("%9s: %s\n", label, (attribs & attrib) ? "yes" : "no");
+}
+
+static int attribute(struct exfat* ef, struct exfat_node* node,
+               uint16_t add_flags, uint16_t clear_flags)
+{
+       if ((add_flags | clear_flags) != 0)
+       {
+               uint16_t attrib = node->attrib;
+
+               attrib |= add_flags;
+               attrib &= ~clear_flags;
+
+               if (node->attrib != attrib)
+               {
+                       int ret;
+
+                       node->attrib = attrib;
+                       node->is_dirty = true;
+
+                       ret = exfat_flush_node(ef, node);
+                       if (ret != 0)
+                       {
+                               char buffer[EXFAT_UTF8_NAME_BUFFER_MAX];
+
+                               exfat_get_name(node, buffer);
+                               exfat_error("failed to flush changes to '%s': %s", buffer,
+                                               strerror(-ret));
+                               return 1;
+                       }
+               }
+       }
+       else
+       {
+               print_attribute(node->attrib, EXFAT_ATTRIB_RO, "Read-only");
+               print_attribute(node->attrib, EXFAT_ATTRIB_HIDDEN, "Hidden");
+               print_attribute(node->attrib, EXFAT_ATTRIB_SYSTEM, "System");
+               print_attribute(node->attrib, EXFAT_ATTRIB_ARCH, "Archive");
+               /* read-only attributes */
+               print_attribute(node->attrib, EXFAT_ATTRIB_VOLUME, "Volume");
+               print_attribute(node->attrib, EXFAT_ATTRIB_DIR, "Directory");
+       }
+
+       return 0;
+}
+
+int main(int argc, char* argv[])
+{
+       int opt;
+       int ret;
+       const char* spec = NULL;
+       const char* options = "";
+       const char* file_path = NULL;
+       struct exfat ef;
+       struct exfat_node* node;
+       uint16_t add_flags = 0;
+       uint16_t clear_flags = 0;
+
+       while ((opt = getopt(argc, argv, "d:rRiIsSaAhV")) != -1)
+       {
+               switch (opt)
+               {
+               case 'V':
+                       printf("exfatattrib %s\n", VERSION);
+                       puts("Copyright (C) 2011-2023  Andrew Nayenko");
+                       puts("Copyright (C) 2020-2023  Endless OS Foundation LLC");
+                       return 0;
+               /*
+                       The path to the unmounted exFAT partition is a (mandatory) named
+                       option rather than a positional parameter. If the FUSE file system
+                       ever gains an ioctl to get and set attributes, this option could be
+                       made optional, and this tool taught to use the ioctl.
+               */
+               case 'd':
+                       spec = optarg;
+                       break;
+               case 'r':
+                       add_flags |= EXFAT_ATTRIB_RO;
+                       break;
+               case 'R':
+                       clear_flags |= EXFAT_ATTRIB_RO;
+                       break;
+               /* "-h[elp]" is taken; i is the second letter of "hidden" and
+                  its synonym "invisible" */
+               case 'i':
+                       add_flags |= EXFAT_ATTRIB_HIDDEN;
+                       break;
+               case 'I':
+                       clear_flags |= EXFAT_ATTRIB_HIDDEN;
+                       break;
+               case 's':
+                       add_flags |= EXFAT_ATTRIB_SYSTEM;
+                       break;
+               case 'S':
+                       clear_flags |= EXFAT_ATTRIB_SYSTEM;
+                       break;
+               case 'a':
+                       add_flags |= EXFAT_ATTRIB_ARCH;
+                       break;
+               case 'A':
+                       clear_flags |= EXFAT_ATTRIB_ARCH;
+                       break;
+               default:
+                       usage(argv[0]);
+               }
+       }
+
+       if ((add_flags & clear_flags) != 0)
+       {
+               exfat_error("can't set and clear the same flag");
+               return 1;
+       }
+
+       if (spec == NULL || argc - optind != 1)
+               usage(argv[0]);
+
+       file_path = argv[optind];
+
+       if ((add_flags | clear_flags) == 0)
+               options = "ro";
+
+       ret = exfat_mount(&ef, spec, options);
+       if (ret != 0)
+       {
+               exfat_error("failed to mount %s: %s", spec, strerror(-ret));
+               return 1;
+       }
+
+       ret = exfat_lookup(&ef, &node, file_path);
+       if (ret != 0)
+       {
+               exfat_error("failed to look up '%s': %s", file_path, strerror(-ret));
+               exfat_unmount(&ef);
+               return 1;
+       }
+
+       ret = attribute(&ef, node, add_flags, clear_flags);
+
+       exfat_put_node(&ef, node);
+       exfat_unmount(&ef);
+
+       return ret;
+}
index b675be5494c9dbcfc7a43dd5d6d7fea8ee5acb5e..45d01c3bfbb95fc8a82a0627f36909e62738f748 100644 (file)
@@ -3,7 +3,7 @@
 #      Autoconf source.
 #
 #      Free exFAT implementation.
-#      Copyright (C) 2010-2018  Andrew Nayenko
+#      Copyright (C) 2010-2023  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
 #
 
 AC_INIT([Free exFAT implementation],
-       [1.3.0],
+       [1.4.0],
        [relan@users.noreply.github.com],
        [exfat],
        [https://github.com/relan/exfat])
 AM_INIT_AUTOMAKE([1.11.2 -Wall -Werror foreign subdir-objects])
 AC_PROG_CC
-AC_PROG_CC_C99
 AC_PROG_RANLIB
 AM_PROG_AR
 AC_SYS_LARGEFILE
@@ -38,7 +37,10 @@ PKG_CHECK_MODULES([UBLIO], [libublio], [
   AC_DEFINE([USE_UBLIO], [1],
     [Define if block devices are not supported.])
 ], [:])
-PKG_CHECK_MODULES([FUSE], [fuse])
+PKG_CHECK_MODULES([FUSE3], [fuse3],
+  [AC_DEFINE([FUSE_USE_VERSION], [30], [Required FUSE API version.])],
+  [PKG_CHECK_MODULES([FUSE2], [fuse >= 2.6],
+    [AC_DEFINE([FUSE_USE_VERSION], [26], [Required FUSE API version.])])])
 case "$host_os" in
   *-gnu)
     AC_DEFINE([_XOPEN_SOURCE], [500], [Enable pread() and pwrite().])
@@ -48,6 +50,7 @@ esac
 AC_CONFIG_HEADERS([libexfat/config.h])
 AC_CONFIG_FILES([
        libexfat/Makefile
+       attrib/Makefile
        dump/Makefile
        fsck/Makefile
        fuse/Makefile
index d081f7b8d22f2438dbf48af7d1e0d993fba12b0e..1c28ea652cfdff178fcb51899e9f682abc205eeb 100644 (file)
@@ -3,7 +3,7 @@
 #      Automake source.
 #
 #      Free exFAT implementation.
-#      Copyright (C) 2011-2018  Andrew Nayenko
+#      Copyright (C) 2011-2023  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
index 06022a5ddb470a8f2b6092156989c7056ece26f1..beaecb716183dd10fb87460b34302abaf272ac2f 100644 (file)
@@ -1,4 +1,4 @@
-.\" Copyright (C) 2011-2018  Andrew Nayenko
+.\" Copyright (C) 2011-2023  Andrew Nayenko
 .\"
 .TH DUMPEXFAT 8 "July 2016"
 .SH NAME
index 4f562f321d3d64a691d3b29c3ad5be23a8c5815a..af6b12dcaf9c173f4b5b20691ddb7dd1b0b5f96d 100644 (file)
@@ -3,7 +3,7 @@
        Prints detailed information about exFAT volume.
 
        Free exFAT implementation.
-       Copyright (C) 2011-2018  Andrew Nayenko
+       Copyright (C) 2011-2023  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
@@ -226,7 +226,7 @@ int main(int argc, char* argv[])
                        break;
                case 'V':
                        printf("dumpexfat %s\n", VERSION);
-                       puts("Copyright (C) 2011-2018  Andrew Nayenko");
+                       puts("Copyright (C) 2011-2023  Andrew Nayenko");
                        return 0;
                default:
                        usage(argv[0]);
index 34d0f6c6ced84151d4ae6e596218e3ad0e3a8ee3..ec0d6014a7d32664fb045021e87cf11a75b816f1 100644 (file)
@@ -3,7 +3,7 @@
 #      Automake source.
 #
 #      Free exFAT implementation.
-#      Copyright (C) 2011-2018  Andrew Nayenko
+#      Copyright (C) 2011-2023  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
index a641b6ca91c6dd957fd52c0ef90a3b16719688a7..445f25b6ee279694756dcc7f0ff78d5beba4d4e9 100644 (file)
@@ -1,4 +1,4 @@
-.\" Copyright (C) 2011-2018  Andrew Nayenko
+.\" Copyright (C) 2011-2023  Andrew Nayenko
 .\"
 .TH EXFATFSCK 8 "September 2018"
 .SH NAME
index 6a42092ed2068a2bbfc2dd6b5a71b59d5789a177..399f4320957e6838d0d628d7b4561e4bc7cd73fb 100644 (file)
@@ -3,7 +3,7 @@
        exFAT file system checker.
 
        Free exFAT implementation.
-       Copyright (C) 2011-2018  Andrew Nayenko
+       Copyright (C) 2011-2023  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
@@ -25,6 +25,7 @@
 #include <string.h>
 #include <inttypes.h>
 #include <unistd.h>
+#include <errno.h>
 
 #define exfat_debug(format, ...) do {} while (0)
 
@@ -123,12 +124,17 @@ static void dirck(struct exfat* ef, const char* path)
        free(entry_path);
 }
 
-static void fsck(struct exfat* ef, const char* spec, const char* options)
+static bool fsck(struct exfat* ef, const char* spec, const char* options)
 {
-       if (exfat_mount(ef, spec, options) != 0)
+       int rc;
+
+       rc = exfat_mount(ef, spec, options);
+       if (rc == -ENODEV)
+               return false; /* failed to open the device, checking haven't started */
+       if (rc != 0)
        {
                fputs("File system checking stopped. ", stdout);
-               return;
+               return true;
        }
 
        exfat_print_info(ef->sb, exfat_count_free_clusters(ef));
@@ -139,6 +145,7 @@ static void fsck(struct exfat* ef, const char* spec, const char* options)
        printf("Totally %"PRIu64" directories and %"PRIu64" files.\n",
                        directories_count, files_count);
        fputs("File system checking finished. ", stdout);
+       return true;
 }
 
 static void usage(const char* prog)
@@ -175,7 +182,7 @@ int main(int argc, char* argv[])
                        options = "repair=0,ro";
                        break;
                case 'V':
-                       puts("Copyright (C) 2011-2018  Andrew Nayenko");
+                       puts("Copyright (C) 2011-2023  Andrew Nayenko");
                        return 0;
                default:
                        usage(argv[0]);
@@ -187,7 +194,8 @@ int main(int argc, char* argv[])
        spec = argv[optind];
 
        printf("Checking file system on %s.\n", spec);
-       fsck(&ef, spec, options);
+       if (!fsck(&ef, spec, options))
+               return 1;
        if (exfat_errors != 0)
        {
                printf("ERRORS FOUND: %d, FIXED: %d.\n",
index be27dc90d43ac1a7cdaca5cd3f244d2d5cee17f8..013d307f61d8e7cbe233e1d559d25e828dfeb099 100644 (file)
@@ -3,7 +3,7 @@
 #      Automake source.
 #
 #      Free exFAT implementation.
-#      Copyright (C) 2010-2018  Andrew Nayenko
+#      Copyright (C) 2010-2023  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
@@ -24,8 +24,8 @@ sbin_PROGRAMS = mount.exfat-fuse
 dist_man8_MANS = mount.exfat-fuse.8
 mount_exfat_fuse_SOURCES = main.c
 mount_exfat_fuse_CPPFLAGS = -I$(top_srcdir)/libexfat
-mount_exfat_fuse_CFLAGS = $(FUSE_CFLAGS)
-mount_exfat_fuse_LDADD = ../libexfat/libexfat.a $(FUSE_LIBS)
+mount_exfat_fuse_CFLAGS = $(FUSE2_CFLAGS) $(FUSE3_CFLAGS)
+mount_exfat_fuse_LDADD = ../libexfat/libexfat.a $(FUSE2_LIBS) $(FUSE3_LIBS)
 
 install-exec-hook:
        ln -sf $(sbin_PROGRAMS) $(DESTDIR)$(sbindir)/mount.exfat
index 3143693cb6048324ba4f196d1d269b445e9fd64b..f7aacb47ffc04bfbbf1c2e9922f36f3c84f72993 100644 (file)
@@ -3,7 +3,7 @@
        FUSE-based exFAT implementation. Requires FUSE 2.6 or later.
 
        Free exFAT implementation.
-       Copyright (C) 2010-2018  Andrew Nayenko
+       Copyright (C) 2010-2023  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,7 +21,6 @@
 */
 
 #include <exfat.h>
-#define FUSE_USE_VERSION 26
 #include <fuse.h>
 #include <errno.h>
 #include <fcntl.h>
@@ -55,7 +54,11 @@ static void set_node(struct fuse_file_info* fi, struct exfat_node* node)
        fi->keep_cache = 1;
 }
 
-static int fuse_exfat_getattr(const char* path, struct stat* stbuf)
+static int fuse_exfat_getattr(const char* path, struct stat* stbuf
+#if FUSE_USE_VERSION >= 30
+               , UNUSED struct fuse_file_info* fi
+#endif
+               )
 {
        struct exfat_node* node;
        int rc;
@@ -71,7 +74,11 @@ static int fuse_exfat_getattr(const char* path, struct stat* stbuf)
        return 0;
 }
 
-static int fuse_exfat_truncate(const char* path, off_t size)
+static int fuse_exfat_truncate(const char* path, off_t size
+#if FUSE_USE_VERSION >= 30
+               , UNUSED struct fuse_file_info* fi
+#endif
+               )
 {
        struct exfat_node* node;
        int rc;
@@ -96,7 +103,11 @@ static int fuse_exfat_truncate(const char* path, off_t size)
 
 static int fuse_exfat_readdir(const char* path, void* buffer,
                fuse_fill_dir_t filler, UNUSED off_t offset,
-               UNUSED struct fuse_file_info* fi)
+               UNUSED struct fuse_file_info* fi
+#if FUSE_USE_VERSION >= 30
+               , UNUSED enum fuse_readdir_flags flags
+#endif
+               )
 {
        struct exfat_node* parent;
        struct exfat_node* node;
@@ -117,8 +128,13 @@ static int fuse_exfat_readdir(const char* path, void* buffer,
                return -ENOTDIR;
        }
 
+#if FUSE_USE_VERSION < 30
        filler(buffer, ".", NULL, 0);
        filler(buffer, "..", NULL, 0);
+#else
+       filler(buffer, ".", NULL, 0, 0);
+       filler(buffer, "..", NULL, 0, 0);
+#endif
 
        rc = exfat_opendir(&ef, parent, &it);
        if (rc != 0)
@@ -134,7 +150,11 @@ static int fuse_exfat_readdir(const char* path, void* buffer,
                                name, node->is_contiguous ? "contiguous" : "fragmented",
                                node->size, node->start_cluster);
                exfat_stat(&ef, node, &stbuf);
+#if FUSE_USE_VERSION < 30
                filler(buffer, name, &stbuf, 0);
+#else
+               filler(buffer, name, &stbuf, 0, 0);
+#endif
                exfat_put_node(&ef, node);
        }
        exfat_closedir(&ef, &it);
@@ -147,11 +167,28 @@ static int fuse_exfat_open(const char* path, struct fuse_file_info* fi)
        struct exfat_node* node;
        int rc;
 
-       exfat_debug("[%s] %s", __func__, path);
+       exfat_debug("[%s] %s flags %#x%s%s%s%s%s", __func__, path, fi->flags,
+                       fi->flags & O_RDONLY ? " O_RDONLY" : "",
+                       fi->flags & O_WRONLY ? " O_WRONLY" : "",
+                       fi->flags & O_RDWR   ? " O_RDWR"   : "",
+                       fi->flags & O_APPEND ? " O_APPEND" : "",
+                       fi->flags & O_TRUNC  ? " O_TRUNC"  : "");
 
        rc = exfat_lookup(&ef, &node, path);
        if (rc != 0)
                return rc;
+       /* FUSE 2.x will call fuse_exfat_truncate() explicitly */
+#if FUSE_USE_VERSION >= 30
+       if (fi->flags & O_TRUNC)
+       {
+               rc = exfat_truncate(&ef, node, 0, true);
+               if (rc != 0)
+               {
+                       exfat_put_node(&ef, node);
+                       return rc;
+               }
+       }
+#endif
        set_node(fi, node);
        return 0;
 }
@@ -195,14 +232,14 @@ static int fuse_exfat_flush(UNUSED const char* path, struct fuse_file_info* fi)
           This handler may be called by FUSE on close() syscall. FUSE also deals
           with removals of open files, so we don't free clusters on close but
           only on rmdir and unlink. If the FUSE implementation does not call this
-          handler we will flush node on release. See fuse_exfat_relase() above.
+          handler we will flush node on release. See fuse_exfat_release() above.
        */
        exfat_debug("[%s] %s", __func__, path);
        return exfat_flush_node(&ef, get_node(fi));
 }
 
 static int fuse_exfat_fsync(UNUSED const char* path, UNUSED int datasync,
-               UNUSED struct fuse_file_info *fi)
+               UNUSED struct fuse_file_infofi)
 {
        int rc;
 
@@ -279,13 +316,21 @@ static int fuse_exfat_mkdir(const char* path, UNUSED mode_t mode)
        return exfat_mkdir(&ef, path);
 }
 
-static int fuse_exfat_rename(const char* old_path, const char* new_path)
+static int fuse_exfat_rename(const char* old_path, const char* new_path
+#if FUSE_USE_VERSION >= 30
+               , UNUSED unsigned int flags
+#endif
+               )
 {
        exfat_debug("[%s] %s => %s", __func__, old_path, new_path);
        return exfat_rename(&ef, old_path, new_path);
 }
 
-static int fuse_exfat_utimens(const char* path, const struct timespec tv[2])
+static int fuse_exfat_utimens(const char* path, const struct timespec tv[2]
+#if FUSE_USE_VERSION >= 30
+               , UNUSED struct fuse_file_info* fi
+#endif
+               )
 {
        struct exfat_node* node;
        int rc;
@@ -302,7 +347,11 @@ static int fuse_exfat_utimens(const char* path, const struct timespec tv[2])
        return rc;
 }
 
-static int fuse_exfat_chmod(UNUSED const char* path, mode_t mode)
+static int fuse_exfat_chmod(UNUSED const char* path, mode_t mode
+#if FUSE_USE_VERSION >= 30
+               , UNUSED struct fuse_file_info* fi
+#endif
+               )
 {
        const mode_t VALID_MODE_MASK = S_IFREG | S_IFDIR |
                        S_IRWXU | S_IRWXG | S_IRWXO;
@@ -313,7 +362,11 @@ static int fuse_exfat_chmod(UNUSED const char* path, mode_t mode)
        return 0;
 }
 
-static int fuse_exfat_chown(UNUSED const char* path, uid_t uid, gid_t gid)
+static int fuse_exfat_chown(UNUSED const char* path, uid_t uid, gid_t gid
+#if FUSE_USE_VERSION >= 30
+               , UNUSED struct fuse_file_info* fi
+#endif
+               )
 {
        exfat_debug("[%s] %s %u:%u", __func__, path, uid, gid);
        if (uid != ef.uid || gid != ef.gid)
@@ -345,7 +398,16 @@ static int fuse_exfat_statfs(UNUSED const char* path, struct statvfs* sfs)
        return 0;
 }
 
-static void* fuse_exfat_init(struct fuse_conn_info* fci)
+static void* fuse_exfat_init(
+#ifdef FUSE_CAP_BIG_WRITES
+               struct fuse_conn_info* fci
+#else
+               UNUSED struct fuse_conn_info* fci
+#endif
+#if FUSE_USE_VERSION >= 30
+               , UNUSED struct fuse_config* cfg
+#endif
+               )
 {
        exfat_debug("[%s]", __func__);
 #ifdef FUSE_CAP_BIG_WRITES
@@ -550,10 +612,10 @@ int main(int argc, char* argv[])
        int opt;
        int rc;
 
-       printf("FUSE exfat %s\n", VERSION);
+       printf("FUSE exfat %s (libfuse%d)\n", VERSION, FUSE_USE_VERSION / 10);
 
        fuse_options = strdup("allow_other,"
-#if defined(__linux__) || defined(__FreeBSD__)
+#if FUSE_USE_VERSION < 30 && (defined(__linux__) || defined(__FreeBSD__))
                        "big_writes,"
 #endif
 #if defined(__linux__)
@@ -600,7 +662,7 @@ int main(int argc, char* argv[])
                case 'V':
                        free(exfat_options);
                        free(fuse_options);
-                       puts("Copyright (C) 2010-2018  Andrew Nayenko");
+                       puts("Copyright (C) 2010-2023  Andrew Nayenko");
                        return 0;
                case 'v':
                        break;
index e0925b2345e528c71e3722a61bea511f310dc0f0..d89f0e26699d2f50aa31db5c2f4ad4f53d9b1e17 100644 (file)
@@ -1,4 +1,4 @@
-.\" Copyright (C) 2010-2016  Andrew Nayenko
+.\" Copyright (C) 2010-2023  Andrew Nayenko
 .\"
 .TH EXFAT-FUSE 8 "November 2015"
 .SH NAME
index 5e94c227848f4016455ff565ab9c48f438396fb4..1cc834dc95bea62d94f18eb4cbd476d452d622c7 100644 (file)
@@ -3,7 +3,7 @@
 #      Automake source.
 #
 #      Free exFAT implementation.
-#      Copyright (C) 2011-2018  Andrew Nayenko
+#      Copyright (C) 2011-2023  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
index 4f55510b67b8e59396b7cf988f5935c20b2f820e..8fac3a54b9f277645c954c27a3770962eb7c40ea 100644 (file)
@@ -1,4 +1,4 @@
-.\" Copyright (C) 2011-2018  Andrew Nayenko
+.\" Copyright (C) 2011-2023  Andrew Nayenko
 .\"
 .TH EXFATLABEL 8 "September 2017"
 .SH NAME
index 398498a52ee9bffda0deb51e3c7406e0b51068d0..5afe73f8a41be7120e212ec7a33486031861eae0 100644 (file)
@@ -3,7 +3,7 @@
        Prints or changes exFAT volume label.
 
        Free exFAT implementation.
-       Copyright (C) 2011-2018  Andrew Nayenko
+       Copyright (C) 2011-2023  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
@@ -34,7 +34,7 @@ int main(int argc, char* argv[])
                if (strcmp(*pp, "-V") == 0)
                {
                        printf("exfatlabel %s\n", VERSION);
-                       puts("Copyright (C) 2011-2018  Andrew Nayenko");
+                       puts("Copyright (C) 2011-2023  Andrew Nayenko");
                        return 0;
                }
 
index d639e13b799b2d2b0599044fa0a97b5a9baea191..781953553aea98e7f60fb00503e25cd3030610e4 100644 (file)
@@ -3,7 +3,7 @@
 #      Automake source.
 #
 #      Free exFAT implementation.
-#      Copyright (C) 2010-2018  Andrew Nayenko
+#      Copyright (C) 2010-2023  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
index ba544109fe1561d6c1759037b08a6db39668b42d..98b93c700c3bd256f7e1624e785ef978c2b4fa17 100644 (file)
@@ -3,7 +3,7 @@
        Endianness stuff. exFAT uses little-endian byte order.
 
        Free exFAT implementation.
-       Copyright (C) 2010-2018  Andrew Nayenko
+       Copyright (C) 2010-2023  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
index 0f2e91b07317e4bfbb9bc180b180a54021bfa7c3..4ee6135fd84f152040188bc0d7041cb7a9065850 100644 (file)
@@ -3,7 +3,7 @@
        exFAT file system implementation library.
 
        Free exFAT implementation.
-       Copyright (C) 2010-2018  Andrew Nayenko
+       Copyright (C) 2010-2023  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
@@ -426,9 +426,14 @@ int exfat_truncate(struct exfat* ef, struct exfat_node* node, uint64_t size,
 
        if (erase)
        {
-               rc = erase_range(ef, node, node->size, size);
+               rc = erase_range(ef, node, node->valid_size, size);
                if (rc != 0)
                        return rc;
+               node->valid_size = size;
+       }
+       else
+       {
+               node->valid_size = MIN(node->valid_size, size);
        }
 
        exfat_update_mtime(node);
index 88d3d7ceefcee03692177f638c6cd84cfb0d0a7a..486582808398406e8be72d9101e65f9e2920b5e9 100644 (file)
@@ -4,7 +4,7 @@
        showstopper.
 
        Free exFAT implementation.
-       Copyright (C) 2010-2018  Andrew Nayenko
+       Copyright (C) 2010-2023  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
index 939fec06f7a15c9e205222c7c48b34bb778b1313..0e146e8f4d916ff1dd5557f7131032f2b91c8d11 100644 (file)
@@ -4,7 +4,7 @@
        implementation.
 
        Free exFAT implementation.
-       Copyright (C) 2010-2018  Andrew Nayenko
+       Copyright (C) 2010-2023  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 @@ struct exfat_node
        bool is_cached : 1;
        bool is_dirty : 1;
        bool is_unlinked : 1;
+       uint64_t valid_size;
        uint64_t size;
        time_t mtime, atime;
        le16_t name[EXFAT_NAME_MAX + 1];
index b9ea268ec61ee745f1a43aa68ffc639dbf2c433f..3618d4d302403239f60de4969464092146ec32c0 100644 (file)
@@ -3,7 +3,7 @@
        Definitions of structures and constants used in exFAT file system.
 
        Free exFAT implementation.
-       Copyright (C) 2010-2018  Andrew Nayenko
+       Copyright (C) 2010-2023  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
index 0fc35d28b7cca2c7687869115c4e5eaf12cf812a..7af5316da70b4b968474b9679271b359026c5a6a 100644 (file)
@@ -3,7 +3,7 @@
        exFAT file system implementation library.
 
        Free exFAT implementation.
-       Copyright (C) 2010-2018  Andrew Nayenko
+       Copyright (C) 2010-2023  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
@@ -390,27 +390,43 @@ ssize_t exfat_pwrite(struct exfat_dev* dev, const void* buffer, size_t size,
 ssize_t exfat_generic_pread(const struct exfat* ef, struct exfat_node* node,
                void* buffer, size_t size, off_t offset)
 {
-       uint64_t newsize = offset;
+       uint64_t uoffset = offset;
        cluster_t cluster;
        char* bufp = buffer;
        off_t lsize, loffset, remainder;
 
        if (offset < 0)
                return -EINVAL;
-       if (newsize >= node->size)
+       if (uoffset >= node->size)
                return 0;
        if (size == 0)
                return 0;
 
-       cluster = exfat_advance_cluster(ef, node, newsize / CLUSTER_SIZE(*ef->sb));
+       if (uoffset + size > node->valid_size)
+       {
+               ssize_t bytes = 0;
+
+               if (uoffset < node->valid_size)
+               {
+                       bytes = exfat_generic_pread(ef, node, buffer,
+                                       node->valid_size - uoffset, offset);
+                       if (bytes < 0 || (size_t) bytes < node->valid_size - uoffset)
+                               return bytes;
+               }
+               memset(buffer + bytes, 0,
+                               MIN(size - bytes, node->size - node->valid_size));
+               return MIN(size, node->size - uoffset);
+       }
+
+       cluster = exfat_advance_cluster(ef, node, uoffset / CLUSTER_SIZE(*ef->sb));
        if (CLUSTER_INVALID(*ef->sb, cluster))
        {
                exfat_error("invalid cluster 0x%x while reading", cluster);
                return -EIO;
        }
 
-       loffset = newsize % CLUSTER_SIZE(*ef->sb);
-       remainder = MIN(size, node->size - newsize);
+       loffset = uoffset % CLUSTER_SIZE(*ef->sb);
+       remainder = MIN(size, node->size - uoffset);
        while (remainder > 0)
        {
                if (CLUSTER_INVALID(*ef->sb, cluster))
@@ -432,13 +448,13 @@ ssize_t exfat_generic_pread(const struct exfat* ef, struct exfat_node* node,
        }
        if (!(node->attrib & EXFAT_ATTRIB_DIR) && !ef->ro && !ef->noatime)
                exfat_update_atime(node);
-       return MIN(size, node->size - newsize) - remainder;
+       return MIN(size, node->size - uoffset) - remainder;
 }
 
 ssize_t exfat_generic_pwrite(struct exfat* ef, struct exfat_node* node,
                const void* buffer, size_t size, off_t offset)
 {
-       uint64_t newsize = offset;
+       uint64_t uoffset = offset;
        int rc;
        cluster_t cluster;
        const char* bufp = buffer;
@@ -446,29 +462,29 @@ ssize_t exfat_generic_pwrite(struct exfat* ef, struct exfat_node* node,
 
        if (offset < 0)
                return -EINVAL;
-       if (newsize > node->size)
+       if (uoffset > node->size)
        {
-               rc = exfat_truncate(ef, node, newsize, true);
+               rc = exfat_truncate(ef, node, uoffset, true);
                if (rc != 0)
                        return rc;
        }
-       if (newsize + size > node->size)
+       if (uoffset + size > node->size)
        {
-               rc = exfat_truncate(ef, node, newsize + size, false);
+               rc = exfat_truncate(ef, node, uoffset + size, false);
                if (rc != 0)
                        return rc;
        }
        if (size == 0)
                return 0;
 
-       cluster = exfat_advance_cluster(ef, node, newsize / CLUSTER_SIZE(*ef->sb));
+       cluster = exfat_advance_cluster(ef, node, uoffset / CLUSTER_SIZE(*ef->sb));
        if (CLUSTER_INVALID(*ef->sb, cluster))
        {
                exfat_error("invalid cluster 0x%x while writing", cluster);
                return -EIO;
        }
 
-       loffset = newsize % CLUSTER_SIZE(*ef->sb);
+       loffset = uoffset % CLUSTER_SIZE(*ef->sb);
        remainder = size;
        while (remainder > 0)
        {
@@ -487,6 +503,7 @@ ssize_t exfat_generic_pwrite(struct exfat* ef, struct exfat_node* node,
                bufp += lsize;
                loffset = 0;
                remainder -= lsize;
+               node->valid_size = MAX(node->valid_size, uoffset + size - remainder);
                cluster = exfat_next_cluster(ef, node, cluster);
        }
        if (!(node->attrib & EXFAT_ATTRIB_DIR))
index 22e5ccdd101cc7d217bc02a54e9972e3287c6253..dd2063b406cdb0bd7f4b5d17cf08f0b1834dd75a 100644 (file)
@@ -3,7 +3,7 @@
        exFAT file system implementation library.
 
        Free exFAT implementation.
-       Copyright (C) 2010-2018  Andrew Nayenko
+       Copyright (C) 2010-2023  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
index 50ad31f5555611c660aba440d5babf7456cbced3..bb7b12436320c44099d66bfc22dd0e02d113ace7 100644 (file)
@@ -3,7 +3,7 @@
        exFAT file system implementation library.
 
        Free exFAT implementation.
-       Copyright (C) 2010-2018  Andrew Nayenko
+       Copyright (C) 2010-2023  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
index f0ca0e3dd635f6d5b2bf5438463b36b68bb25a8b..86fb84db2445f56615f965579e3cd69b04d536d7 100644 (file)
@@ -3,7 +3,7 @@
        exFAT file system implementation library.
 
        Free exFAT implementation.
-       Copyright (C) 2010-2018  Andrew Nayenko
+       Copyright (C) 2010-2023  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
@@ -198,7 +198,7 @@ int exfat_mount(struct exfat* ef, const char* spec, const char* options)
                mode = EXFAT_MODE_RW;
        ef->dev = exfat_open(spec, mode);
        if (ef->dev == NULL)
-               return -EIO;
+               return -ENODEV;
        if (exfat_get_mode(ef->dev) == EXFAT_MODE_RO)
        {
                if (mode == EXFAT_MODE_ANY)
@@ -305,7 +305,7 @@ int exfat_mount(struct exfat* ef, const char* spec, const char* options)
        ef->root->start_cluster = le32_to_cpu(ef->sb->rootdir_cluster);
        ef->root->fptr_cluster = ef->root->start_cluster;
        ef->root->name[0] = cpu_to_le16('\0');
-       ef->root->size = rootdir_size(ef);
+       ef->root->valid_size = ef->root->size = rootdir_size(ef);
        if (ef->root->size == 0)
        {
                exfat_free(ef);
index 9cffbcb8a68cfc36da6965560578ddb0cc1d6c4c..88b1357189c2f3ac2aed6e7bda3550074e437736 100644 (file)
@@ -3,7 +3,7 @@
        exFAT file system implementation library.
 
        Free exFAT implementation.
-       Copyright (C) 2010-2018  Andrew Nayenko
+       Copyright (C) 2010-2023  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
@@ -144,6 +144,7 @@ static void init_node_meta1(struct exfat_node* node,
 static void init_node_meta2(struct exfat_node* node,
                const struct exfat_entry_meta2* meta2)
 {
+       node->valid_size = le64_to_cpu(meta2->valid_size);
        node->size = le64_to_cpu(meta2->size);
        node->start_cluster = le32_to_cpu(meta2->start_cluster);
        node->fptr_cluster = node->start_cluster;
@@ -206,8 +207,7 @@ static bool check_entries(const struct exfat_entry* entry, int n)
 }
 
 static bool check_node(const struct exfat* ef, struct exfat_node* node,
-               le16_t actual_checksum, const struct exfat_entry_meta1* meta1,
-               const struct exfat_entry_meta2* meta2)
+               le16_t actual_checksum, const struct exfat_entry_meta1* meta1)
 {
        int cluster_size = CLUSTER_SIZE(*ef->sb);
        uint64_t clusters_heap_size =
@@ -234,12 +234,11 @@ static bool check_node(const struct exfat* ef, struct exfat_node* node,
           cannot be greater than file size. See SetFileValidData() function
           description in MSDN.
        */
-       if (le64_to_cpu(meta2->valid_size) > node->size)
+       if (node->valid_size > node->size)
        {
                exfat_get_name(node, buffer);
                exfat_error("'%s' has valid size (%"PRIu64") greater than size "
-                               "(%"PRIu64")", buffer, le64_to_cpu(meta2->valid_size),
-                               node->size);
+                               "(%"PRIu64")", buffer, node->valid_size, node->size);
                ret = false;
        }
 
@@ -328,7 +327,7 @@ static int parse_file_entries(struct exfat* ef, struct exfat_node* node,
        init_node_meta2(node, meta2);
        init_node_name(node, entries + 2, mandatory_entries - 2);
 
-       if (!check_node(ef, node, exfat_calc_checksum(entries, n), meta1, meta2))
+       if (!check_node(ef, node, exfat_calc_checksum(entries, n), meta1))
                return -EIO;
 
        return 0;
@@ -659,7 +658,8 @@ int exfat_flush_node(struct exfat* ef, struct exfat_node* node)
                        NULL, &meta1->atime_tzo);
        meta1->adate = edate;
        meta1->atime = etime;
-       meta2->size = meta2->valid_size = cpu_to_le64(node->size);
+       meta2->valid_size = cpu_to_le64(node->valid_size);
+       meta2->size = cpu_to_le64(node->size);
        meta2->start_cluster = cpu_to_le32(node->start_cluster);
        meta2->flags = EXFAT_FLAG_ALWAYS1;
        /* empty files must not be marked as contiguous */
@@ -1128,7 +1128,7 @@ int exfat_rename(struct exfat* ef, const char* old_path, const char* new_path)
                        exfat_put_node(ef, existing);
                        if (rc != 0)
                        {
-                               /* free clusters even if something went wrong; overwise they
+                               /* free clusters even if something went wrong; otherwise they
                                   will be just lost */
                                exfat_cleanup_node(ef, existing);
                                exfat_put_node(ef, dir);
index d42e1ee102a7c4743633a0441e40d48417a10794..9bd125a100a6b759b25704005b2e8f52b4d360f7 100644 (file)
@@ -4,7 +4,7 @@
        same kernel can use different libc implementations.
 
        Free exFAT implementation.
-       Copyright (C) 2010-2018  Andrew Nayenko
+       Copyright (C) 2010-2023  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
index 8e8e962830c3202047fabdb6be0d86a0e3193173..615b8d11f3cdf2a82540b9baceb862cdf1d8d457 100644 (file)
@@ -3,7 +3,7 @@
        exFAT file system implementation library.
 
        Free exFAT implementation.
-       Copyright (C) 2010-2018  Andrew Nayenko
+       Copyright (C) 2010-2023  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
index e2a3b23d631fd7bad127ee979bf62ffe50d8f963..3ab2a1561b8a70ab5e93954e2ad95b3989273ab7 100644 (file)
@@ -3,7 +3,7 @@
        exFAT file system implementation library.
 
        Free exFAT implementation.
-       Copyright (C) 2010-2018  Andrew Nayenko
+       Copyright (C) 2010-2023  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
index 96f4608c8250f925993cc35e17dd820c1f9ea193..b1d09e76478fcca6de6121d50ccc0d40b10a23e9 100644 (file)
@@ -3,7 +3,7 @@
        exFAT file system implementation library.
 
        Free exFAT implementation.
-       Copyright (C) 2010-2018  Andrew Nayenko
+       Copyright (C) 2010-2023  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
index 3a1154e585abaf83beed34a13b8aaee4d2a830d0..0d97b65dcab4c42295d7810ab89171f62db3beb1 100644 (file)
@@ -3,7 +3,7 @@
        exFAT file system implementation library.
 
        Free exFAT implementation.
-       Copyright (C) 2010-2018  Andrew Nayenko
+       Copyright (C) 2010-2023  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
index 4d3c9d6f726127519f38a5f274d1f921d5b3769c..f2314de611d35f5bfd801720a7b39b24ee523a26 100644 (file)
@@ -3,7 +3,7 @@
 #      Automake source.
 #
 #      Free exFAT implementation.
-#      Copyright (C) 2011-2018  Andrew Nayenko
+#      Copyright (C) 2011-2023  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
index ad5accc2a89ba99d67b3285cea659673feb675b3..a54238936fb81769052f296bd77a1ce0193c395f 100644 (file)
@@ -3,7 +3,7 @@
        Clusters Bitmap creation code.
 
        Free exFAT implementation.
-       Copyright (C) 2011-2018  Andrew Nayenko
+       Copyright (C) 2011-2023  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
index 3803b792da11cea575f0882adc2fe84c5db3fc69..f66911a6f7b25e11b0cfb7559bfc767773a5e221 100644 (file)
@@ -3,7 +3,7 @@
        Clusters Bitmap creation code.
 
        Free exFAT implementation.
-       Copyright (C) 2011-2018  Andrew Nayenko
+       Copyright (C) 2011-2023  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
index c5174a7a748d2fa721facabbf2dde2c1723fff2d..3a44b03a284c9ceaa8914623d59e1daa6b1bbfb8 100644 (file)
@@ -3,7 +3,7 @@
        File Allocation Table creation code.
 
        Free exFAT implementation.
-       Copyright (C) 2011-2018  Andrew Nayenko
+       Copyright (C) 2011-2023  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
index fbecaa228803398babbdc59ac0cb582276784c18..7f93fc98656137367a20c274289e38f6030d139a 100644 (file)
@@ -3,7 +3,7 @@
        File Allocation Table creation code.
 
        Free exFAT implementation.
-       Copyright (C) 2011-2018  Andrew Nayenko
+       Copyright (C) 2011-2023  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
index 0762024464c715c741992ed5f10b8b8176510da9..d7f0526179b76a0332daeb01cd9da96525efb515 100644 (file)
@@ -3,7 +3,7 @@
        Creates exFAT file system.
 
        Free exFAT implementation.
-       Copyright (C) 2011-2018  Andrew Nayenko
+       Copyright (C) 2011-2023  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
@@ -228,7 +228,7 @@ int main(int argc, char* argv[])
                        }
                        break;
                case 'V':
-                       puts("Copyright (C) 2011-2018  Andrew Nayenko");
+                       puts("Copyright (C) 2011-2023  Andrew Nayenko");
                        return 0;
                default:
                        usage(argv[0]);
index eadbe96884825339249d9b88b85cbd680012e1d2..5f92ffc322408edd4ef24ba7d33bdc88f818683f 100644 (file)
@@ -3,7 +3,7 @@
        FS creation engine.
 
        Free exFAT implementation.
-       Copyright (C) 2011-2018  Andrew Nayenko
+       Copyright (C) 2011-2023  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
index 963b3e5f21ffd53e9a0360c0ac4c7cdb26b753b2..cecbb8a6d921b2e3efbcfa2358ac6f0a8b5233e6 100644 (file)
@@ -3,7 +3,7 @@
        FS creation engine.
 
        Free exFAT implementation.
-       Copyright (C) 2011-2018  Andrew Nayenko
+       Copyright (C) 2011-2023  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
index 6d3c6534465d0aa423431e5a07d37e7e77689f14..57665a9ea2d15b369a16ecb9bec00e3b7fac33f5 100644 (file)
@@ -1,4 +1,4 @@
-.\" Copyright (C) 2011-2018  Andrew Nayenko
+.\" Copyright (C) 2011-2023  Andrew Nayenko
 .\"
 .TH MKEXFATFS 8 "January 2014"
 .SH NAME
index 4f9b0e8a7e08612f2c3c767f97c69efaabf87502..c687c1b02cd0c7176d07855e82092d8121ec9bfb 100644 (file)
@@ -3,7 +3,7 @@
        Root directory creation code.
 
        Free exFAT implementation.
-       Copyright (C) 2011-2018  Andrew Nayenko
+       Copyright (C) 2011-2023  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
index 87f437f1f07e75fc35019a98ba3cbd926e38a90b..58d10c5811aa9e60ac444eaf6b4cb4cabfe101af 100644 (file)
@@ -3,7 +3,7 @@
        Root directory creation code.
 
        Free exFAT implementation.
-       Copyright (C) 2011-2018  Andrew Nayenko
+       Copyright (C) 2011-2023  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
index 98cdce8fa81efaef8161df6bfc63b2a7210710b1..c85cf1c5493ff4b359109fdea5b83b352b972bb1 100644 (file)
@@ -3,7 +3,7 @@
        Upper Case Table creation code.
 
        Free exFAT implementation.
-       Copyright (C) 2011-2018  Andrew Nayenko
+       Copyright (C) 2011-2023  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
index ce619ecfb4d83eb4deb40628de1b20056e2e83da..ae41c6e3518fd5a7422f2ad32118077af1423fd4 100644 (file)
@@ -3,7 +3,7 @@
        Upper Case Table creation code.
 
        Free exFAT implementation.
-       Copyright (C) 2011-2018  Andrew Nayenko
+       Copyright (C) 2011-2023  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
index 518219cd918e145c8a6a9ca8e3720345cce46f93..e553246eb642c6883fbf907d2f428f6ffdd2deef 100644 (file)
@@ -3,7 +3,7 @@
        Upper Case Table contents.
 
        Free exFAT implementation.
-       Copyright (C) 2011-2018  Andrew Nayenko
+       Copyright (C) 2011-2023  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
index bd5ebb294e2a6c656249ffa4fde065f24482753a..ac269707f2ef09bc35bf1b38e25878510c709377 100644 (file)
@@ -3,7 +3,7 @@
        Upper Case Table declaration.
 
        Free exFAT implementation.
-       Copyright (C) 2011-2018  Andrew Nayenko
+       Copyright (C) 2011-2023  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
index e40081fa9fb213cc036dbf4f726f93d9325716aa..61135845b55f1d928c68618469783f03c967af0f 100644 (file)
@@ -3,7 +3,7 @@
        Volume Boot Record creation code.
 
        Free exFAT implementation.
-       Copyright (C) 2011-2018  Andrew Nayenko
+       Copyright (C) 2011-2023  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
index c1f59a609c3e3a6b260ff0ee84bf967b85ab25d5..2ac6381c0aaa0641e81119a6e45ab33c05117144 100644 (file)
@@ -3,7 +3,7 @@
        Volume Boot Record creation code.
 
        Free exFAT implementation.
-       Copyright (C) 2011-2018  Andrew Nayenko
+       Copyright (C) 2011-2023  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