Commit Graph

78 Commits

Author SHA1 Message Date
Jean-Pierre André
85e208176f 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.
2017-12-22 11:29:00 +01:00
Erik Larsson
f0d3751c98 Fix bad native->little endian byteswap of little endian value. 2017-03-21 11:58:30 +01:00
Jean-Pierre André
38ff4602a7 Cleared the sparse flags when clearing the bad cluster list
The bad cluster list may be updated in ntfsresize and ntfsfix. Though
technically it is organized as a sparse file, Windows does not set
the sparse flags. Do the same to avoid problems with third-party
packages.
2016-07-19 11:44:59 +02:00
Erik Larsson
9893ea9ee6 Merge endianness fixes.
Conflicts:
	libntfs-3g/attrib.c
2016-01-28 09:22:42 +01:00
Erik Larsson
9cf04fd2cd Fix incorrect usage of native/little-endian types, signed types, etc.
This is harmless with regard to code generation but if we turn on strict
type checking these type mismatches will result in errors.
2015-12-21 23:55:31 +01:00
Jean-Pierre André
94f8d2128e Fixed a wrong test report in ntfsfix
When used with the "no-action" option, the test for self-located MFT
still reported the partition to have been repaired. Adapt the report to
only tell repairing is possible.
2015-09-30 08:54:27 +02:00
Jean-Pierre André
4a4ec8c1c6 Fixed a bad sanity check in ntfsfix
Fix misordered checks to avoid potential segfaults on badly damaged partitions.
2015-09-30 08:51:20 +02:00
Jean-Pierre André
d96ae8d7da Removed the double try to unmount partition in ntfsfix
When the unmounting of the partition fails after running ntfsfix, a
second try was attempted. This cannot be done and leads to more errors
because some essential records have been freed, so better quit without
making a second try.
2015-04-17 10:27:24 +02:00
Jean-Pierre André
c0287870e1 Returned success from ntfsprogs utilities with options --version and --help
The ntfsprogs used to return failure when option --version or --help
was used, and this has triggered complains from distribution packagers
who use these options in packaging scripts.
With this patch, success is returned (same behavior as gcc).
2014-04-23 10:13:27 +02:00
Jean-Pierre André
d2daead832 Updated copyright claims 2014-02-16 18:25:09 +01:00
Erik Larsson
7506d8b80b Rename legacy MS_* flags for ntfs_mount with NTFS_MNT_* flags.
The MS_* flags originated from system constants. However the flags
passed to ntfs_mount were really unrelated to the system constants and
many new MS_* flags had to be introduced as different features were
added to the library. Those flags had no counterparts in any system
APIs, so using the same naming scheme is inappropriate.

Instead, let's namespace these flags similarly to what has already been
done in ntfsprogs/libntfs earlier. This avoids any possible conflicts
with system constants.
The values of the flags themselves are kept the same as earlier, so
backward compatibility is retained.
2012-11-07 16:29:48 +01:00
Jean-Pierre André
8ae20018df Fixed the fixing of the backup boot sector in ntfsfix
ntfsfix now checks and update the backup boot sector on the last sector of
the partition (instead of the sector next to end of the file system). After
an ntfsresize the file system generally does not use the maximum size because
of different roundings and required alignments in the resizing and the
repartitioning.
2012-07-06 09:56:50 +02:00
Jean-Pierre André
dba29ee6e7 Implemented the fixing of the backup boot sector in ntfsfix
This checks the backup boot sector and fixes it as needed.
2012-03-21 19:35:30 +01:00
Jean-Pierre André
162b4f8051 Fixed clearing the bad cluster list in ntfsfix
Clearing the bad cluster list was done by truncating $BadClus:$Bad,
this turned out not to be reliable because chkdsk does not adjust
the size of $BadClus:$Bad when declaring a cluster bad.
2012-01-23 16:59:49 +01:00
Jean-Pierre André
1df34a6056 New : implemented an option -d to clear the dirty flag if ntfsfix is successful 2011-11-04 11:15:01 +01:00
Jean-Pierre André
cb3aad8a63 Minor : fixed a test of volume dirty flag in ntfsfix 2011-11-04 11:11:40 +01:00
Jean-Pierre André
c42c502e92 Developped fixing of a self-located MFT data bug in ntfsfix
Under some rare and obscure circumstances probably unrelated to ntfs-3g,
a part of the runlist of MFT describes its own location, therefore
it cannot be loaded. This patch relocates the MFT extent to inode 15
to fix this. Note : chkdsk cannot fix it and destroys all the files.
2011-10-07 11:33:22 +02:00
Jean-Pierre André
2cc1bcb59d Fixed compiling ntfsfix.c for a Sparc 2011-07-06 17:46:31 +02:00
Jean-Pierre André
de151c1add Implemented a new option to clear the list of bad sectors 2011-07-05 12:17:31 +02:00
Jean-Pierre André
1c1c0540e8 Fixed use of uninitialized variable in ntfsfix 2011-07-05 12:17:29 +02:00
Jean-Pierre André
44116675ca Fixed warning for possible use of uninitialized variable in ntfsfix 2011-07-05 12:17:28 +02:00
Jean-Pierre André
86ce44ac58 Made ntfsfix able to use a backup boot sector larger than 512 bytes
When the normal boot sector is not usable, ntfsfix tries to use the last
sector as a boot sector replacement. This implies getting the sector size
and reading both full-sized boot sectors.
2011-03-23 09:46:46 +01:00
Jean-Pierre André
4b408e60ae Strenghtened types in ntfslabel and ntfsfix 2011-03-23 09:27:33 +01:00
Jean-Pierre André
1e7d8809a8 Fixed freeing upcase in ntfsfix (avoiding memory leak detection)
Under some error condition, the upcase table was not freed.
Just cosmetic fix to avoid a memory leak detection.
2011-03-23 09:16:57 +01:00
Jean-Pierre André
309ca32e52 Silenced warning for function with no return 2011-02-08 13:52:13 +01:00
Jean-Pierre André
6b570dfe96 Added tries to fix file systems with incorrect size 2011-02-08 13:52:13 +01:00
Jean-Pierre André
a46a395006 Updated copyright notices 2011-02-08 13:52:12 +01:00
Jean-Pierre André
2842936b74 Checked and fixed the upcase table in ntfsfix.c 2011-02-08 13:52:12 +01:00
Jean-Pierre André
b0849af206 Tried alternate boot sector if cannot start up in ntfsfix.c 2011-02-08 13:52:12 +01:00
Jean-Pierre André
9f765effd3 Defined option -n for no action in ntfsfix.c 2011-02-08 13:52:12 +01:00
Jean-Pierre André
c60ae578bd Exited with failure code from ntfsfix.c 2011-02-08 13:52:12 +01:00
Jean-Pierre André
f22dec0442 Silenced warnings for formats in ntfsfix.c 2010-12-21 15:51:07 +01:00
Erik Larsson
bcdc76f12d Merge remote branch 'linux-ntfs/libntfs-3g_port-v2_0_0' into PERMISSION_HANDLING_BRANCH
Conflicts:
	.cvsignore
	AUTHORS
	CREDITS
	ChangeLog
	NEWS
	README
	TODO.libntfs
	autogen.sh
	configure.ac
	include/ntfs/Makefile.am
	libntfs-3g/misc.c
	libntfs/Makefile.am
	libntfs/gnome-vfs-method.c
	libntfs/gnome-vfs-module.c
	ntfsprogs.spec.in
	ntfsprogs/.cvsignore
	ntfsprogs/mkntfs.c
	ntfsprogs/ntfscat.8.in
	ntfsprogs/ntfsclone.c
	ntfsprogs/ntfscp.8.in
	ntfsprogs/ntfsinfo.c
	ntfsprogs/ntfsprogs.8.in
	ntfsprogs/ntfsresize.c
	ntfsprogs/ntfsrm.c
	ntfsprogs/ntfsundelete.h
	ntfsprogs/upcase.c
	ntfsprogs/utils.c
	test/Makefile.am
2010-12-17 09:04:01 +01:00
Erik Larsson
16dbcbec0c Restored 'local' includes for all the ntfsprogs instead of using system includes (e.g. #include "yada.h" instead of #include <ntfs-3g/yada.h>). 2010-12-16 09:59:42 +01:00
Erik Larsson
6b513b1c55 Replaced references to NVolSetWasDirty with appropriate substitutions.
libntfs (unlike libntfs-3g) sets the volume dirty bit automatically on ntfs_mount (if not already set) and also automatically clears the volume dirty bit on ntfs_umount (if it was not already set before mount). The 'WasDirty' flag is set to indicate that the volume was already dirty when it was mounted, so setting it means bypassing the 'clear dirty flag' behaviour on unmount (it does not mean 'set dirty flag on unmount').

NVolSetWasDirty is accordingly replaced with the actions that were intended:
- If the intention was to leave the dirty bit set on unmount, we explicitly set the bit if it is not already set.
- If the intention was to simply update the 'WasDirty' bit to be consistent with earlier changes, we just comment out the statement.
2010-12-02 22:34:45 +01:00
Erik Larsson
f5f3878a8e Replaced all occurrences of the libntfs-specific NVolWasDirty macro with a test for the VOLUME_IS_DIRTY flag in vol->flags.
This is not a perfect conversion. The VOLUME_IS_DIRTY flag reflects the _current_ state of the volume dirty bit and not the mount-time state.
However, since libntfs-3g (as opposed to libntfs) does not automatically change the dirty bit on mount and unmount (only when ntfs_volume_write_flags is called explicitly), and these tests are done directly after a mount (ntfsclone.c, ntfscp.c, ntfsresize.c, ntfswipe.c, utils.c) or when the volume is in an appropriate state (ntfsfix.c), the result will be the same.
2010-12-02 22:34:35 +01:00
Erik Larsson
713fbb390e Merge commit 'v2_0_0' into libntfs-3g_port-v2_0_0
Conflicts:
	configure.ac
	include/ntfs/Makefile.am
	include/ntfs/attrib.h
	include/ntfs/bitmap.h
	include/ntfs/collate.h
	include/ntfs/debug.h
	include/ntfs/dir.h
	include/ntfs/endians.h
	include/ntfs/index.h
	include/ntfs/inode.h
	include/ntfs/layout.h
	include/ntfs/logfile.h
	include/ntfs/logging.h
	include/ntfs/mft.h
	include/ntfs/ntfstime.h
	include/ntfs/runlist.h
	include/ntfs/support.h
	include/ntfs/types.h
	include/ntfs/unistr.h
	include/ntfs/volume.h
	libntfs/Makefile.am
	libntfs/attrib.c
	libntfs/attrlist.c
	libntfs/bitmap.c
	libntfs/bootsect.c
	libntfs/collate.c
	libntfs/compress.c
	libntfs/debug.c
	libntfs/device.c
	libntfs/device_io.c
	libntfs/dir.c
	libntfs/index.c
	libntfs/inode.c
	libntfs/lcnalloc.c
	libntfs/logfile.c
	libntfs/logging.c
	libntfs/mft.c
	libntfs/mst.c
	libntfs/runlist.c
	libntfs/security.c
	libntfs/unistr.c
	libntfs/unix_io.c
	libntfs/volume.c
	libntfs/win32_io.c
	ntfsprogs/Makefile.am
	ntfsprogs/mkntfs.c
	ntfsprogs/ntfscat.c
	ntfsprogs/ntfsclone.c
	ntfsprogs/ntfscmp.c
	ntfsprogs/ntfscp.c
	ntfsprogs/ntfsinfo.c
	ntfsprogs/ntfsmount.8.in
	ntfsprogs/ntfsmount.c
	ntfsprogs/ntfsundelete.c
	ntfsprogs/upcase.c
2010-12-02 22:31:21 +01:00
Erik Larsson
5b9b4c7e49 Removing all references to the libntfs library version until we have such functionality in libntfs-3g. 2010-12-02 16:38:16 +01:00
Erik Larsson
f03d683fa0 Commented out all references to 'version.h' (which doesn't exist in libntfs-3g) and added a stub implementation of ntfs_libntfs_version in utils.h to allow things to compile. 2010-12-02 15:58:14 +01:00
Erik Larsson
1860eff1da Updated all includes in the basic ntfsprogs utilities for libntfs-3g. 2010-12-02 15:57:58 +01:00
Yura Pakhuchiy
0d264b7d25 Introduce sparse endian annotations. Adopt library (also fix 2 real bugs) and progs (lots of bugs). 2007-06-08 13:47:57 +03:00
yura
10b22550cd more sparse fixes
left only endianness and this stupid problems with s64
2006-12-12 19:00:00 +00:00
aia21
a38ead2f20 Szaka prefers to have the lofgile reset and dirty bit setting done even if they
are already done so remove the conditionals I added.
2006-12-11 10:41:34 +00:00
aia21
8640540b53 Warn about VOLUME_MOUNTED_ON_NT4 wrt Vista in layout.h and do not set the flag
in ntfsfix.
2006-12-09 11:27:37 +00:00
aia21
5302d23f7b - Empty the journal at mount time. (Anton)
- Set the volume dirty bit at mount time (if it is not set already and
  clear it again at umount time but only if it was not set to start
  with.  (Anton)
2006-11-28 10:09:56 +00:00
szaka
c7a53338c0 Fix all incorrect getopt_long() return value usages. 2006-04-05 12:43:06 +00:00
szaka
0887a0e261 Update a few copyrights 2006-03-29 22:54:22 +00:00
antona
8bf1dc2232 Update my copyright for the files changed in the last commits. 2006-03-27 22:49:50 +00:00
antona
cf631e3398 Fix comparison of $MFT and $MFTMirr to not bail out when there are
unused, invalid mft records which are the same in both $MFT and
$MFTMirr.  Ported from kernel driver 2.1.27 release and aplied both
to libntfs/volume.c mount related code and to ntfsprogs/ntfsfix.c's
fixup code.  (Anton)
2006-03-27 22:43:09 +00:00
szaka
67f0045637 Update obsolete description 2006-02-12 02:00:45 +00:00