OSDN Git Service

android-x86/external-ntfs-3g.git
3 years agoMerge branch 'edge' of git://git.code.sf.net/p/ntfs-3g/ntfs-3g into pie-x86 pie-x86
Chih-Wei Huang [Tue, 6 Jul 2021 08:32:32 +0000 (16:32 +0800)]
Merge branch 'edge' of git://git.code.sf.net/p/ntfs-3g/ntfs-3g into pie-x86

Change-Id: I78a7e202bfb0934e5000b8c4904c9a5d79dc35d5

3 years agoRevert "Change ioctl() cmd argument to be unsigned int"
Chih-Wei Huang [Tue, 6 Jul 2021 08:32:15 +0000 (16:32 +0800)]
Revert "Change ioctl() cmd argument to be unsigned int"

This reverts commit aa8f2fcf2ba6bd9ab1973c48e06970f33d1e90b0.

3 years agoFixed a constant string concatenation
Jean-Pierre André [Tue, 26 Jan 2021 09:06:18 +0000 (10:06 +0100)]
Fixed a constant string concatenation

Adjust for recent compilers requiring a space between concatenated strings.

3 years agoFixed a minor endianness ajustment bug
Jean-Pierre André [Tue, 26 Jan 2021 09:06:18 +0000 (10:06 +0100)]
Fixed a minor endianness ajustment bug

The endianness ajustment was the wrong one though it did the correct thing.

3 years agoChecked the locations of MFT and MFTMirr at startup
Jean-Pierre André [Tue, 26 Jan 2021 09:06:18 +0000 (10:06 +0100)]
Checked the locations of MFT and MFTMirr at startup

On startup make sure the lcns of the MFT and the MFTMirr are not null and
they are different, so that the mounting is denied gracefully if they are.

3 years agoEnabled Recording the special files the same way as WSL
Jean-Pierre André [Tue, 26 Jan 2021 09:06:18 +0000 (10:06 +0100)]
Enabled Recording the special files the same way as WSL

Optionally record the special files (symlinks, fifos, sockets, character
and block devices) using reparse points instead of using Interix representation.
Doing so, the special files are interoperable with Windows Subsystem for
linux (WSL).

3 years agoDropped rejecting having both EA and reparse data
Jean-Pierre André [Tue, 26 Jan 2021 09:06:17 +0000 (10:06 +0100)]
Dropped rejecting having both EA and reparse data

Windows traditionally rejected having both EA and reparse data assigned
to a file, but Windows 10 has dropped the constraint and it uses this
condition massively, so do the same. Note that pre-Windows 10 chkdsk.exe
removes the EA' on reparse points, potentially damaging more recent
volumes.

3 years agoSupported use of WSL special file
Jean-Pierre André [Tue, 26 Jan 2021 09:06:17 +0000 (10:06 +0100)]
Supported use of WSL special file

The Windows Subsystem for Linux (WSL) of Windows 10 uses reparse points
to record special files (symlinks, fifos, sockets, char or block devices).
Honor such reparse points with the same meaning as WSL.

3 years agoRelocated the mount point field in volume
Jean-Pierre André [Tue, 26 Jan 2021 09:06:17 +0000 (10:06 +0100)]
Relocated the mount point field in volume

The location of the mount point field in the volume attributes was
dependent on compiling options, thus creating an uneasy dependency
for plugins. So relocate the field to be independent on options.

3 years agoDefined ntfs_realloc() and ntfs_free()
Jean-Pierre André [Tue, 26 Jan 2021 09:06:17 +0000 (10:06 +0100)]
Defined ntfs_realloc() and ntfs_free()

Currently memory allocations are done through ntfs_malloc() and
ntfs_calloc(), but releases are done through free(3). Defining an
ntfs_free() relay facilitates the debugging of memory leaks in
plugins.

3 years agoBuilt reparse symlinks from mount point recorded in volume
Jean-Pierre André [Tue, 26 Jan 2021 09:06:17 +0000 (10:06 +0100)]
Built reparse symlinks from mount point recorded in volume

When building a symlink to emulate a Windows junction or absolute
symlink, use the mount point recorded in the volume attributes.
This enables the plugins to emulate object as symlinks.

3 years agoChecked file type on OpenIndiana when deleting a file with a reparse point
Jean-Pierre André [Tue, 26 Jan 2021 09:06:17 +0000 (10:06 +0100)]
Checked file type on OpenIndiana when deleting a file with a reparse point

On OpenIndiana a check is needed to ensure directories are not removed
by rm(1) and files not removed by rmdir(1)

3 years agoInserted the reparse tag in the bad reparse symlink
Jean-Pierre André [Tue, 26 Jan 2021 09:06:17 +0000 (10:06 +0100)]
Inserted the reparse tag in the bad reparse symlink

The reparse tag is not quoted in the "unsupported reparse point"
fake symlink shown when a reparse point cannot be processed. The tag
is useful to determine which plugin, if any, is missing.

3 years agoEnabled actions on directories in reparse plugins
Jean-Pierre André [Tue, 26 Jan 2021 09:06:17 +0000 (10:06 +0100)]
Enabled actions on directories in reparse plugins

The plugins triggered by reparse points can now act on a directory
through link(2) unlink(2) and creat(2).

3 years agoFixed maintining the allocated size when updating sparse files
Jean-Pierre André [Wed, 18 Nov 2020 10:33:49 +0000 (11:33 +0100)]
Fixed maintining the allocated size when updating sparse files

When filling a hole in a sparse file, the beginning of the runlist
does not need to be updated. However the allocated size is within
the extent holding its beginning and it needs to be updated.

3 years agoAllowed customization of sbin for tool directory
Jean-Pierre André [Wed, 18 Nov 2020 10:29:05 +0000 (11:29 +0100)]
Allowed customization of sbin for tool directory

Enabled the configure option --sbindir to define where a few ntfsprogs
tools should be installed

3 years agoChange default xattr access method to 'openxattr' for macOS builds.
Erik Larsson [Tue, 25 Aug 2020 08:29:42 +0000 (11:29 +0300)]
Change default xattr access method to 'openxattr' for macOS builds.

The namespaced way of accessing extended attributes doesn't make sense
in macOS which doesn't use namespaces.

3 years agoAdd support for 'position' argument in macOS xattr functions.
Erik Larsson [Tue, 25 Aug 2020 08:26:29 +0000 (11:26 +0300)]
Add support for 'position' argument in macOS xattr functions.

The 'position' argument is only used for the legacy resource fork and is
disallowed for other extended attributes. The name check is placed first
in the functions as this is how macOS behaves (EINVAL is returned if the
attribute is not the resource fork attribute and the position is non-0
even when the attribute does not exist).

3 years agoReplace ENODATA with ENOATTR in xattrs functions for macOS builds.
Erik Larsson [Mon, 24 Aug 2020 13:50:18 +0000 (16:50 +0300)]
Replace ENODATA with ENOATTR in xattrs functions for macOS builds.

The contract in macOS xattr functions is to return ENOATTR when an
extended attribute cannot be found.

3 years agoFixed possible null dereferencings
Jean-Pierre André [Fri, 14 Aug 2020 10:03:09 +0000 (12:03 +0200)]
Fixed possible null dereferencings

A null directory pointer could appear as being dereferenced. Fix that,
though it probably never occurs in real conditions.

3 years agoRecovered space when an index root is shortened
Jean-Pierre André [Fri, 14 Aug 2020 09:57:02 +0000 (11:57 +0200)]
Recovered space when an index root is shortened

In rare situations, removing an entry from an index root while
rebalancing the index tree, its space was not recovered from the index
root, causing chkdsk to complain. Truncate the index root when this
happens.

3 years agoDefined option "posix_nlink" to compute a Posix compliant st_nlink
Jean-Pierre André [Fri, 14 Aug 2020 09:50:35 +0000 (11:50 +0200)]
Defined option "posix_nlink" to compute a Posix compliant st_nlink

When the mount option "posix_nlink" is used, the number of links
returned by stat complies with Posix : the legacy 8.3 names are not
taken into account, and the subdirectories are taken into account
for directories. This causes some overhead for recomputing the
number of links.

3 years agoAvoided information leak when processing garbled compressed data
Jean-Pierre André [Fri, 14 Aug 2020 09:36:57 +0000 (11:36 +0200)]
Avoided information leak when processing garbled compressed data

When a compressed file has been deteriorated through hardware error
or accidental overwriting, some unrelated data could be leaked.
Make sure to zero fill the buffer when this happens.

3 years agoDisplayed the plugin path in the basic help message
Jean-Pierre André [Fri, 14 Aug 2020 09:32:50 +0000 (11:32 +0200)]
Displayed the plugin path in the basic help message

The ntfs-3g plugin directory depends on the distribution and may be
difficult to determine. This displays the directory in the basic help.

3 years agoUsed kernel cacheing on read-only mounts or with lowntfs-3g
Jean-Pierre André [Fri, 14 Aug 2020 09:27:24 +0000 (11:27 +0200)]
Used kernel cacheing on read-only mounts or with lowntfs-3g

Kernel cacheing is now safe when using lowntfs-3g on Linux. It is also
safe on read-only mounts with both ntfs-3g and lowntfs-3g.

4 years agoFixed defining the request argument of ioctl()
Jean-Pierre André [Sun, 8 Mar 2020 09:34:17 +0000 (10:34 +0100)]
Fixed defining the request argument of ioctl()

An occurrence of changing the request from int to unsigned long was
missing.

4 years agoExported the translations of Windows paths
Jean-Pierre André [Sun, 8 Mar 2020 09:17:21 +0000 (10:17 +0100)]
Exported the translations of Windows paths

The translations of Windows paths designed for translating Windows symlinks
and mount points may also be used in plugins for translation execlinks,
so make them available.

4 years agoFixed object types returned in readdir() for reparse points
Jean-Pierre André [Sun, 8 Mar 2020 09:03:23 +0000 (10:03 +0100)]
Fixed object types returned in readdir() for reparse points

The types of reparse point objects cannot be decided upon the data
available in a directory, so we must delegate their determination to a
specific plugin when available, and be consistent if there is none.

4 years agoDecoded execlink reparse data
Jean-Pierre André [Sun, 8 Mar 2020 08:57:27 +0000 (09:57 +0100)]
Decoded execlink reparse data

Add execlink to the list of recognized reparse tags.

4 years agoFixed ntfsfallocate on a void file
Jean-Pierre André [Sun, 8 Mar 2020 08:51:48 +0000 (09:51 +0100)]
Fixed ntfsfallocate on a void file

The situation when there were no runlist when ntfsfallocate is applied
was not taken into account.

4 years agoFixed a poorly sized string in ntfsinfo
Jean-Pierre André [Sun, 8 Mar 2020 08:44:52 +0000 (09:44 +0100)]
Fixed a poorly sized string in ntfsinfo

A string overflow was possible, extend its size to worst case.

4 years agoFixed a wrong fallthrough situation in ntfscat
Jean-Pierre André [Sun, 8 Mar 2020 08:42:15 +0000 (09:42 +0100)]
Fixed a wrong fallthrough situation in ntfscat

A fallthrough situation was not intentional.

4 years agoSilenced warnings about fallthrough situations in switch cases of ntfsprogs
Jean-Pierre André [Sun, 8 Mar 2020 08:38:00 +0000 (09:38 +0100)]
Silenced warnings about fallthrough situations in switch cases of ntfsprogs

Insert comments to silence compiler about fallthrough situations when
they are wanted.

4 years agoSilenced warnings about string lengths in snprintf()
Jean-Pierre André [Sun, 8 Mar 2020 08:29:04 +0000 (09:29 +0100)]
Silenced warnings about string lengths in snprintf()

Adjust string lengths to the worst case estimated by the compiler, even
though they cannot be reached.

4 years agoSilenced warnings about fallthrough situations in libntfs-3g
Jean-Pierre André [Sat, 7 Mar 2020 11:00:11 +0000 (12:00 +0100)]
Silenced warnings about fallthrough situations in libntfs-3g

Insert a comment when fallthrough situations are desired in switch cases.

4 years agoAvoided using a truncate strncpy() in the fuse library
Jean-Pierre André [Sat, 7 Mar 2020 10:56:46 +0000 (11:56 +0100)]
Avoided using a truncate strncpy() in the fuse library

Replace strncpy() by memcpy() when the exact size if known, thus
silencing the compiler warnings.

4 years agoRemoved <linux/fs.h> from lowntfs-3g.c
Jean-Pierre André [Sat, 7 Mar 2020 10:50:26 +0000 (11:50 +0100)]
Removed <linux/fs.h> from lowntfs-3g.c

The headers from <linux.fs.h> now conflicts with <sys/uio.h> and are
not needed any more, so remove them.

4 years agoDisabled the use of cache in lowntfs-3g
Jean-Pierre André [Sat, 7 Mar 2020 10:43:49 +0000 (11:43 +0100)]
Disabled the use of cache in lowntfs-3g

Following some change in the Linux kernel, the kernel cacheing of
attributes is not satisfactory (at least the number of hard links is
not refreshed), and has to be disabled.

4 years agoFixed returning EPERM when not allowed as owner
Jean-Pierre André [Sat, 7 Mar 2020 10:35:48 +0000 (11:35 +0100)]
Fixed returning EPERM when not allowed as owner

For actions which may be allowed depending on the ownership rather than
permissions (such as utime()), return EPERM if the owner cannot be
determined.

4 years agoFixed returning errno in setxattr
Jean-Pierre André [Sat, 7 Mar 2020 09:51:53 +0000 (10:51 +0100)]
Fixed returning errno in setxattr

In case of error in setxattr, it must be returned in errno instead
of the return value.

4 years agoAccepted alternative recording of cluster size
Jean-Pierre André [Sat, 7 Mar 2020 09:43:00 +0000 (10:43 +0100)]
Accepted alternative recording of cluster size

Since Windows 10, the cluster size may be greater than 128 sectors, and
it has to be recorded as a power of 2 in the boot sector. Hence there
are two possible ways of cluster size. Accept both ways leading to
valid values.

4 years agoDefined the request argument of ioctl() as unsigned long
Jean-Pierre André [Sat, 7 Mar 2020 09:31:12 +0000 (10:31 +0100)]
Defined the request argument of ioctl() as unsigned long

On linux the request argument of ioctl() is defined as an unsigned long,
but the fuse protocol squashes it into a signed int. As a consequence
the value received by ntfs-3g may appear as negative and different from
the value defined by the corresponding macro.
So define the request argument as unsigned long in ntfs-3g. It has
however to be fed as unsigned from fuse until the fuse protocol is
updated.

4 years agoUpdated the copyright notice
Jean-Pierre André [Sat, 7 Mar 2020 09:18:01 +0000 (10:18 +0100)]
Updated the copyright notice

Updated the copyright notice to 2019

5 years agoAndroid: move libfuse-lite to Android.bp q-x86 r-x86 android-x86-9.0-r1 android-x86-9.0-r2
Chih-Wei Huang [Wed, 3 Apr 2019 17:47:38 +0000 (01:47 +0800)]
Android: move libfuse-lite to Android.bp

The library is also used by exfat.

5 years agoChange ioctl() cmd argument to be unsigned int
Chih-Wei Huang [Fri, 22 Mar 2019 11:38:30 +0000 (19:38 +0800)]
Change ioctl() cmd argument to be unsigned int

On Linux, the ioctl() function is defined in <sys/ioctl.h> with a request
argument defined as an unsigned long. However the libfuse library defines
it as a signed int. This is inconsistent.

The values defined for the ioctl() command are meant to be unsigned. For
instance FITRIM is defined as 0xc0185879 in <linux/fs.h>, which does not
fit into a signed int.

As a consequence the clang compiler complains:

 external/ntfs-3g/libntfs-3g/ioctl.c:398:7: error: overflow converting case value to switch condition type (3222820985 to 18446744072637405305) [-Werror,-Wswitch]
         case FITRIM:
              ^
 bionic/libc/kernel/uapi/linux/fs.h:169:16: note: expanded from macro 'FITRIM'
 #define FITRIM _IOWR('X', 121, struct fstrim_range)
                ^
 bionic/libc/kernel/uapi/asm-generic/ioctl.h:51:29: note: expanded from macro '_IOWR'
 #define _IOWR(type,nr,size) _IOC(_IOC_READ | _IOC_WRITE, (type), (nr), (_IOC_TYPECHECK(size)))
                             ^
 bionic/libc/kernel/uapi/asm-generic/ioctl.h:46:32: note: expanded from macro '_IOC'
 #define _IOC(dir,type,nr,size) (((dir) << _IOC_DIRSHIFT) | ((type) << _IOC_TYPESHIFT) | ((nr) << _IOC_NRSHIFT) | ((size) << _IOC_SIZESHIFT))
                                ^
 1 error generated.

Th problem has been reported to https://github.com/libfuse/libfuse/issues/367

According to the discussion, we should change unsigned int. If change it to
unsigned long, an int would be sign extended to a wrong value.

5 years agoMerge branch 'edge' of git://git.code.sf.net/p/ntfs-3g/ntfs-3g into oreo-x86 oreo-x86 android-x86-8.1-r2 android-x86-8.1-r3 android-x86-8.1-r4 android-x86-8.1-r5 android-x86-8.1-r6
Chih-Wei Huang [Thu, 21 Feb 2019 16:33:58 +0000 (00:33 +0800)]
Merge branch 'edge' of git://git.code.sf.net/p/ntfs-3g/ntfs-3g into oreo-x86

5 years agoandroid: define HAVE_STRUCT_STAT_ST_ATIM
Chih-Wei Huang [Thu, 21 Feb 2019 16:32:53 +0000 (00:32 +0800)]
android: define HAVE_STRUCT_STAT_ST_ATIM

In bionic `st_atim' is a member of `struct stat'.

5 years agoandroid: fix warnings
Chih-Wei Huang [Thu, 21 Feb 2019 16:31:51 +0000 (00:31 +0800)]
android: fix warnings

5 years agoandroid: define _FILE_OFFSET_BITS=64
Chih-Wei Huang [Thu, 21 Feb 2019 14:39:07 +0000 (22:39 +0800)]
android: define _FILE_OFFSET_BITS=64

This works in the current bionic.

Remove unused _LARGEFILE_SOURCE.

5 years agoandroid: remove unnecessary macros
Chih-Wei Huang [Thu, 21 Feb 2019 14:34:10 +0000 (22:34 +0800)]
android: remove unnecessary macros

These have been defined in newer bionic.

5 years agoTruncated SSD trimming zones to granularity supported by the device
Jean-Pierre André [Wed, 23 Jan 2019 16:43:47 +0000 (17:43 +0100)]
Truncated SSD trimming zones to granularity supported by the device

When the trimming granularity is greater than the cluster size, the
free zones have to be truncated to match the granularity.

5 years agoReturned a low level error when an ioctl fails
Jean-Pierre André [Wed, 23 Jan 2019 16:40:23 +0000 (17:40 +0100)]
Returned a low level error when an ioctl fails

When an ioctl fails, the errno is not correctly propagated, and the
log was wrong.

5 years agoFixed an endianness error in ntfscp
Jean-Pierre André [Wed, 23 Jan 2019 16:38:10 +0000 (17:38 +0100)]
Fixed an endianness error in ntfscp

The file timestamp was not set according to CPU endianness.

5 years agoFixed reacting to missing plugin
Jean-Pierre André [Wed, 23 Jan 2019 16:33:15 +0000 (17:33 +0100)]
Fixed reacting to missing plugin

When a plugin is missing, dlopen() does not set errno, which leads
to erratic behavior. Set errno as ELIBACC when this occurs.

5 years agoCleaned object ids beyond the updated part
Jean-Pierre André [Wed, 23 Jan 2019 16:27:25 +0000 (17:27 +0100)]
Cleaned object ids beyond the updated part

An earlier patch enabled updating a file proper id without changing
the other id (birth, volume, domain). However the first time the id
is set, these other ids have to be zeroed.

5 years agoReverted accessing reparse directories through internal plugins
Jean-Pierre André [Wed, 23 Jan 2019 16:13:12 +0000 (17:13 +0100)]
Reverted accessing reparse directories through internal plugins

As similar reparse tags are being used for accessing OneDrive files
and directories, a similar policy has to be used for accessing them.
Until giving full access to OneDrive files with a local copy is
mature enough to have it processed internally, it is safer to have
it delegated to an external plugin. This reverts [4f450a]

5 years agoFixed reporting an error when setxattr is rejected
Jean-Pierre André [Wed, 19 Dec 2018 15:01:53 +0000 (16:01 +0100)]
Fixed reporting an error when setxattr is rejected

When permissions are enabled and setxattr() is rejected, an error
must be returned even though the option silent is set. This is needed
for "cp -p" to know it has to try setting the permissions again and use
chmod().

5 years agoFixed reporting an error when failed to build the mountpoint
Jean-Pierre André [Wed, 19 Dec 2018 14:57:50 +0000 (15:57 +0100)]
Fixed reporting an error when failed to build the mountpoint

The size check was inefficient because getcwd() uses an unsigned int
argument.

5 years agoFixed a typo in the ntfscluster manual
Jean-Pierre André [Wed, 19 Dec 2018 14:53:08 +0000 (15:53 +0100)]
Fixed a typo in the ntfscluster manual

An essential word was missing.

5 years agoRealigned times set from extended attribute
Jean-Pierre André [Wed, 19 Dec 2018 14:48:03 +0000 (15:48 +0100)]
Realigned times set from extended attribute

The alignment of times set in an extended attribute value cannot be
asserted, and this cause alignment errors on some CPUs (met on ARM).
Be safe by copying them in a properly aligned array.

5 years agoFixed collecting the label argument in mkntfs
Jean-Pierre André [Wed, 22 Aug 2018 07:46:30 +0000 (09:46 +0200)]
Fixed collecting the label argument in mkntfs

The label argument could be wrongly interpreted, depending on the syntax
use to state the options.

5 years agoAttempted mounting read-only after failed permission to read-write
Jean-Pierre André [Wed, 22 Aug 2018 07:43:19 +0000 (09:43 +0200)]
Attempted mounting read-only after failed permission to read-write

If a partition image could not be opened read-write, retry as read-only

5 years agoRemoved an unused field (cleanup)
Jean-Pierre André [Thu, 2 Aug 2018 14:51:57 +0000 (16:51 +0200)]
Removed an unused field (cleanup)

Cleanup imported from the fuse library project.

5 years agoPrevented locally defined headers from interfering with ntfs-3g ones
Jean-Pierre André [Thu, 2 Aug 2018 14:47:16 +0000 (16:47 +0200)]
Prevented locally defined headers from interfering with ntfs-3g ones

Order the include directories so that those defined for ntfs-3g have
priority over locally defined ones.

5 years agoAllocated full clusters for reading and rescuing in ntfsclone
Jean-Pierre André [Thu, 2 Aug 2018 14:41:19 +0000 (16:41 +0200)]
Allocated full clusters for reading and rescuing in ntfsclone

Even though mft or index records may be smaller than a cluster,
reading and rescuing them is done on a full cluster base, so
full clusters must be allocated for processing them.

6 years agoExtended the allowed cluster size to 2MB
Jean-Pierre André [Fri, 1 Jun 2018 14:29:01 +0000 (16:29 +0200)]
Extended the allowed cluster size to 2MB

From Windows 10 Creators edition, the cluster size limit has been
extended to 2MB. This has implied redefining the boot sector field
"sectors_per_cluster" so that values greater than 128 can be recorded.

6 years agoAppended a number to undeleted file name to avoid overwriting an existing one
Jean-Pierre André [Fri, 1 Jun 2018 14:21:33 +0000 (16:21 +0200)]
Appended a number to undeleted file name to avoid overwriting an existing one

When an undeleted file name conflicts with an existing one, it is
renamed in order to preserve the existing one.

6 years agoAdded an option to ntfscp to copy the modification time
Jean-Pierre André [Fri, 1 Jun 2018 14:18:51 +0000 (16:18 +0200)]
Added an option to ntfscp to copy the modification time

When using option -t the modification timestamp is copied by ntfscp

6 years agoMade accessing reparse directories through internal plugins
Jean-Pierre André [Fri, 1 Jun 2018 14:08:33 +0000 (16:08 +0200)]
Made accessing reparse directories through internal plugins

When the bit 28 of a reparse tag is set on a directory, the reparse
information should be ignored and the directory should be accessed
the usual way (this setting is new to Windows 10). In such a situation
access to the directory through an internal plugin rather than through
an external one.
The same policy applies to REPARSE_TAG_WCI which had been defined
earlier without the bit 28 being set.

6 years agoChecked whether the device to mount was forced read-only
Jean-Pierre André [Fri, 1 Jun 2018 13:59:09 +0000 (15:59 +0200)]
Checked whether the device to mount was forced read-only

Force the read-only mount mode when the device was set so through a
command "blockdev --setro".

6 years agoDouble-checked whether record 15 is an extent of MFT
Jean-Pierre André [Tue, 13 Feb 2018 08:06:49 +0000 (09:06 +0100)]
Double-checked whether record 15 is an extent of MFT

When extents are needed to store the runlist of the MFT, the first one
must be located in record 15 so that its location can be determined from
the part in the base extent. As this record is always marked in use,
determining whether it is not really in use requires a specific logic.

6 years agoDelayed updating the MFT runlist when resizing in read-only mode
Jean-Pierre André [Tue, 13 Feb 2018 07:54:12 +0000 (08:54 +0100)]
Delayed updating the MFT runlist when resizing in read-only mode

When trying a resize in "no action" (read-only) mode, and the MFT runlist
has to be reorganized to take its new fragmentation into account, the updated
runlist cannot be read from the device while updating the runlist of
normal files. To avoid having to read the updated runlist, the update
is delayed so that the original runlist is used. As a consequence the test
of reorganizing the runlists is only an approximation of what would happen
in a real resize.

6 years agoFixed displaying an inode number in an error message
Jean-Pierre André [Tue, 13 Feb 2018 07:47:00 +0000 (08:47 +0100)]
Fixed displaying an inode number in an error message

In an error message, the inode number was displayed in decimal without
taking off its generation number, making it difficult to interpret.

6 years agoRemoved an obsolete reference for getting support
Jean-Pierre André [Tue, 13 Feb 2018 07:43:53 +0000 (08:43 +0100)]
Removed an obsolete reference for getting support

Remove from the ntfsresize man page an archaic url for getting support.

6 years agoSupported reparse tags for OneDrive cloud storage
Jean-Pierre André [Mon, 15 Jan 2018 10:04:29 +0000 (11:04 +0100)]
Supported reparse tags for OneDrive cloud storage

Newer versions of Windows 10 use several reparse tags for files which
are synchronized to OneDrive cloud storage (0x9000301a, 0x9000601a,
0x9000701a, ...). identify them as IO_REPARSE_TAG_CLOUD and use a
single plugin to process them.

6 years agoSilenced compiler warnings in ntfsrecover
Jean-Pierre André [Fri, 22 Dec 2017 10:37:58 +0000 (11:37 +0100)]
Silenced compiler warnings in ntfsrecover

Silence the compiler warnings which were introduced in a recent update.

6 years agoStopped checking matches of MFTMirr against MFT at record 16
Jean-Pierre André [Fri, 22 Dec 2017 10:29:00 +0000 (11:29 +0100)]
Stopped checking matches of MFTMirr against MFT at record 16

Since its 2017 edition, Windows 10 has stopped mirroring $MFT to the
full size of $MFTMirr leading to mounts of partitions with big clusters
to be rejected because of mismatches. With this patch, only 16 records
are checked, though mirroring is still done for all records in $MFTMirr.

6 years agoDocumented read-only mount when Windows is hibernated
Jean-Pierre André [Fri, 22 Dec 2017 10:26:08 +0000 (11:26 +0100)]
Documented read-only mount when Windows is hibernated

Document an earlier update which forced read-only mode when mounting
a partition which has been left by Windows in an inconsistent state
through hibernation or fast restarting.

6 years agoAllowed setting a file object id without defining its birth ids
Jean-Pierre André [Fri, 22 Dec 2017 10:24:58 +0000 (11:24 +0100)]
Allowed setting a file object id without defining its birth ids

Object ids can be used to locate files which have been move to another
volume. This is only possible when the birth ids are recorded, but in most
cases files reside on their birth volume and their birth ids are not set.
The patch enables setting a file id without changing its birth id, by
setting an extended attribute "system.ntfs_object_id" limited to 16
bytes.

6 years agoFix building errors on Android 8.1 android-x86-8.1-r1
Chih-Wei Huang [Tue, 12 Dec 2017 09:20:00 +0000 (17:20 +0800)]
Fix building errors on Android 8.1

Define MAJOR_IN_SYSMACROS to provide prototypes of major and minor.

6 years agoandroid: fix parsing issue of Android 8.0
Chih-Wei Huang [Thu, 30 Nov 2017 06:23:56 +0000 (14:23 +0800)]
android: fix parsing issue of Android 8.0

Android 8.0 stupidly uses comma in vold's device node name, say
"/dev/block/vold/public:8,32". The libfuse-lite can't parse it
correctly since a comma is usually used as a separator between
options.

Modify the options parser to handle it specially.

6 years agoMerge branch 'edge' of git://git.code.sf.net/p/ntfs-3g/ntfs-3g into oreo-x86
Chih-Wei Huang [Wed, 29 Nov 2017 07:35:50 +0000 (15:35 +0800)]
Merge branch 'edge' of git://git.code.sf.net/p/ntfs-3g/ntfs-3g into oreo-x86

6 years agoProcessed redo log actions associated to undoing a CompensationlogRecord
Jean-Pierre André [Thu, 26 Oct 2017 08:44:36 +0000 (10:44 +0200)]
Processed redo log actions associated to undoing a CompensationlogRecord

At least when there is a shortage of space on the target device, several
redo actions are associated to undoing a CompensationlogRecord, and they
should be redone upon recovery.

6 years agoChecked log file blocks more recent than temporary ones
Jean-Pierre André [Thu, 26 Oct 2017 08:40:17 +0000 (10:40 +0200)]
Checked log file blocks more recent than temporary ones

Under some circumstances, the temporary log file blocks are not the
latest ones, so check whether there are more recent ones.
Only done for log version 1.x, as log version 2.x follow a different
logic.

6 years agoAligned internal log buffers on CPUs which require them
Jean-Pierre André [Thu, 26 Oct 2017 08:33:29 +0000 (10:33 +0200)]
Aligned internal log buffers on CPUs which require them

The generic buffer structure should respect the alignment of included
log structures. This is required by some CPUs (such as Sparc).

6 years agolowntfs-3g.c: Fix compile error when struct stat doesn't have st_*tim.
Erik Larsson [Wed, 20 Sep 2017 02:56:06 +0000 (04:56 +0200)]
lowntfs-3g.c: Fix compile error when struct stat doesn't have st_*tim.

The struct members for the time fields in struct stat vary depending on
platform, so introduce #ifdefs using the config.h-supplied definitions
for determining which stat time definition is appropriate.

6 years agoLogged falling back to mounting read-only
Jean-Pierre André [Fri, 11 Aug 2017 07:56:44 +0000 (09:56 +0200)]
Logged falling back to mounting read-only

When the ntfs image is unclean, usually because it was not unmounted
properly from Windows, mounting read-write is denied and falls back
to read-only. Log this situation in the syslog, so that users mounting
through /etc/fstab can more easily know what is going on. Also remove
the "rw" option if it was stated.

6 years agoDecoded more reparse tags in ntfsinfo
Jean-Pierre André [Fri, 11 Aug 2017 07:52:54 +0000 (09:52 +0200)]
Decoded more reparse tags in ntfsinfo

Displayed some information in ntfsinfo output about a few new types of
reparse point brought by Windows 10.

6 years agoEnabled directory operations in plugins
Jean-Pierre André [Fri, 11 Aug 2017 07:42:37 +0000 (09:42 +0200)]
Enabled directory operations in plugins

Windows 10 brought a new type of reparse point for directories (0x80000018),
so add opendir() and readdir() to the plugin interface to take directories
into account. The interface for releasedir() is merged with release() as
the plugins can discriminate them if needed.

6 years agoRelaxed limitations on security descriptors
Jean-Pierre André [Fri, 11 Aug 2017 07:34:31 +0000 (09:34 +0200)]
Relaxed limitations on security descriptors

Windows 10 brought security descriptors which contain ACE's related to
new ways of accessing files or directories. These ACE are now accepted
with minimal consistency checks. They are still ignored for translating
permissions and for Windows-type inheritance.

6 years agoFixed a typo
Jean-Pierre André [Fri, 11 Aug 2017 07:29:52 +0000 (09:29 +0200)]
Fixed a typo

A typo made a directive for plugin developers difficult to understand

7 years agoFixed updating the vcn of subtree in ntfsrecover
Jean-Pierre André [Tue, 20 Jun 2017 06:56:00 +0000 (08:56 +0200)]
Fixed updating the vcn of subtree in ntfsrecover

The logic for determining where the actions SetIndexEntryVcnRoot and
SetIndexEntryVcnAllocation had to insert a new vcn was unclear and was
wrong in some situations. This is to fix the logic as determined by new
evidence.

7 years agoMentioned ntfsfallocate and ntfsrecover in the general ntfsprogs manual
Jean-Pierre André [Tue, 20 Jun 2017 06:51:09 +0000 (08:51 +0200)]
Mentioned ntfsfallocate and ntfsrecover in the general ntfsprogs manual

The most recent ntfsprogs utilities should be referenced in the table of
contents.

7 years agoMerge branch 'edge' of git://git.code.sf.net/p/ntfs-3g/ntfs-3g into nougat-x86 nougat-x86 android-x86-7.1-r1 android-x86-7.1-r2 android-x86-7.1-r3 android-x86-7.1-r4 android-x86-7.1-r5
Chih-Wei Huang [Thu, 1 Jun 2017 03:18:38 +0000 (11:18 +0800)]
Merge branch 'edge' of git://git.code.sf.net/p/ntfs-3g/ntfs-3g into nougat-x86

7 years agoFixed the computation of highest_vcn when applying a runlist fixup
Jean-Pierre André [Thu, 25 May 2017 08:52:54 +0000 (10:52 +0200)]
Fixed the computation of highest_vcn when applying a runlist fixup

When a file is partially truncated, the highest_vcn has to be recomputed
before the file size is adjusted. As a consequence the unmapped run
inserted at the end of runlist to match the file size should not be taken
into account when determining the higest_vcn.

7 years agoUpgraded ntfsrecover to support log files 2.0
Jean-Pierre André [Thu, 25 May 2017 08:44:18 +0000 (10:44 +0200)]
Upgraded ntfsrecover to support log files 2.0

When the fast restart mode of Windows 8 (or later) is activated, the
log file format is different (version 2.0 instead of 1.1), having 32
temporaty blocks instead of 2. This patch upgrades ntfsrecover to take
the new format into account.

7 years agoBypassed cluster allocation errors using --ignore-fs-check in ntfsclone
Jean-Pierre André [Thu, 25 May 2017 08:28:05 +0000 (10:28 +0200)]
Bypassed cluster allocation errors using --ignore-fs-check in ntfsclone

When using option --ignore-fs-check in ntfsclone, doubly allocated cluster
still lead to aborting the process. Bypassing the error is useful for
creating a metadata image intended for debugging, for example when the
partition was not closed properly and the logfile has to be applied to
restore the integrity of metadata.

7 years agoMerge branch 'edge' of git://git.code.sf.net/p/ntfs-3g/ntfs-3g into marshmallow-x86 marshmallow-x86 android-x86-6.0-r3
Chih-Wei Huang [Thu, 23 Mar 2017 13:16:19 +0000 (21:16 +0800)]
Merge branch 'edge' of git://git.code.sf.net/p/ntfs-3g/ntfs-3g into marshmallow-x86

7 years agoVersion 2017.3.23
Jean-Pierre André [Thu, 23 Mar 2017 09:39:59 +0000 (10:39 +0100)]
Version 2017.3.23

7 years agoFixed computing the replacement bytes in ntfswipe
Jean-Pierre André [Wed, 22 Mar 2017 16:49:40 +0000 (17:49 +0100)]
Fixed computing the replacement bytes in ntfswipe

The computing of replacement bytes for overwriting undeletable files
uses random values and standard ones instead of the values provided in
option --bytes. Fix the mixup between both logics, mention the difference
in the documentation and reject defining both options --bytes and --undel.