Commit Graph

4641 Commits

Author SHA1 Message Date
Jean-Pierre André
528b4303b2 Accepted multiple read-only mounts
Multiple mounts of a partition is now allowed provided they are all
in read-only mode.
2012-01-23 17:31:15 +01:00
Jean-Pierre André
c9edd32113 changed error return for user access to trusted xattr
When a user queries an extended attribute in the trusted namespace,
the traditional error return was EPERM. This has been recently changed
to ENODATA. See https://lkml.org/lkml/2011/5/27/199
2012-01-23 17:25:55 +01:00
Jean-Pierre André
0aa68c128d output the numbers of runs and fragments in ntfsinfo
It is difficult to identify whether a file from a user complaining about
bad throughput is over-fragmented, so get the information from ntfsinfo.
2012-01-23 17:20:20 +01:00
Jean-Pierre André
3c6e88cb0f fixed checking whether Windows 7 was hibernated
On Windows XP and Vista, the system hibernation is identified by the
sequence "hibr" at the beginning of hiberfil.sys. This had been changed
to "HIBR" in Windows 7, so both sequences have to be accepted as
hibernation criteria.
2012-01-23 17:16:07 +01:00
Jean-Pierre André
5593ee2711 fixed clearing the end of extents when extracting metadata
When extracting the metadata, unused data at the end of MFT records is
supposed to be cleared. This was done for the base record of each file,
but not for the extent records.
2012-01-23 17:11:46 +01:00
Jean-Pierre André
4ce33daf6c Cosmetic : fixed an indentation in unistr 2012-01-23 17:09:19 +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é
9b5bd2cbbc Allowed building for kfreebsd (Robert Millan)
Extended several #ifdef's to account for "FreeBSD kernel"
2012-01-23 16:55:04 +01:00
Jean-Pierre André
d06ee35332 Used ENOENT instead of ENODATA when the latter is not defined (Robert Millan)
ENODATA is not defined by Posix and is lacking on FreeBSD
2012-01-23 16:50:25 +01:00
Szabolcs Szakacsits
e38154dde2 Version 2012.1.15 2012-01-15 15:21:52 +02:00
Erik Larsson
e08c40170b Prefix all functions and macros in ntfsprogs/list.h with 'ntfs_/NTFS_'.
This avoids name collisions with Mac OS X system headers (specifically
/usr/include/sys/queue.h). It's quite possible that other operating
systems also have similarly named macros in their system headers since
the function/macro names are very generic.
2012-01-13 13:37:33 +01:00
Erik Larsson
9fca9caf5c ntfswipe.c: Deduplicated MFT write code in wipe_mft. 2012-01-13 08:54:46 +01:00
Erik Larsson
50774cd274 ntfswipe.c: Code cleanup.
Changed the code to use the structs in layout.h instead of addressing
byte addresses directly. This makes the code a lot more readable.
2012-01-13 08:54:46 +01:00
Erik Larsson
7e2ee67097 ntfswipe.c: Big endian fix for wipe_mft.
The 'bytes_in_use' member was not byteswapped after being read from the
buffer and used in a calculation.
2012-01-13 08:54:46 +01:00
Erik Larsson
887ccbf868 ntfswipe.c: Write newly manufactured MFT entries to $MFTMirr if needed.
'wipe_mft' didn't write any $MFTMirr entries for newly manufactured
entries (i.e. entries that were unused and therefore competely wiped and
replaced with a newly initialized copy).
2012-01-13 08:54:46 +01:00
Erik Larsson
7213211c96 ntfswipe.c: Fixed writing incorrect $MFTMirr entries in wipe_mft.
The dereferencing of 'offset' and 'usa' from the MFT record wasn't an
le16* dereference but a u8* dereference, leading to only the least
significant byte (little-endian systems) or the most significant byte
(big-endian systems) being part of the value. (So while this bug could
go unnoticed on little-endian systems for volumes with small values of
'usa', it caused even more significant problems on big-endian systems.)

Fixed by properly casting the address to le16* before dereferencing.
2012-01-13 08:54:46 +01:00
Erik Larsson
82ea9c6e07 ntfswipe.c: Fix support for non-1024 byte MFT record sizes in wipe_mft.
'wipe_mft' was hardcoded to use the USA size of a 1024 byte MFT record
when creating new blank MFT entries. It now calculates the USA size
based on vol->mft_record_size.
2012-01-13 08:54:45 +01:00
Erik Larsson
5f7c535b55 utils.c: Fixed apparently incorrect initial value of 'bmpmref'.
This bug led 'utils_mftrec_in_use' to use 'cached' data before it had
been initialized (i.e. its contents was undefined), producing incorrect
results for the first 3584 MFT entries.
2012-01-13 08:54:45 +01:00
Jean-Pierre André
debeb762c1 secaudit : minor : fixed a false memory leak detection 2011-11-10 21:34:39 +01:00
Jean-Pierre André
2fb7a43638 secaudit : prefixed owner and group SID in ACL display 2011-11-10 21:33:06 +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é
b76883dc84 major : Fixed computation of index block size (Anton Altaparmakov)
When the cluster size is bigger than the index block size, the index
block size unit is 512 (not the sector size) instead of the cluster size.
The partitions formatted by mkntfs and used by ntfs-3g were not
interoperable with Windows when the cluster size is bigger than 4K
and the sector size is not 512.
2011-11-04 11:01:11 +01:00
Jean-Pierre André
4629a7af14 manual : Added a warning against checks at boot time
The booting process has recently been changed so that partitions
which are requested to be checked at mount time with no checker
available, cause a specific user interaction while booting.
The patch warns users against requesting such a check, as there
is no known open-source ntfs file system checker.
2011-10-20 19:11:38 +02:00
Jean-Pierre André
864cf7232e Fixed huge data writes
When computing the runlist for the first non-resident write to an
attribute, an inconsistency was created between the attribute image
and the ntfs_attr structure, which could cause an MFT record overflow
when the first write is huge and fragmented (reported by Vito Caputo).
2011-10-20 19:05:27 +02:00
Jean-Pierre André
59ecea5c80 new : allow compression in default setup
With the default mount options, compression of new files are now done
if the parent directory is marked for compression. The mount option
"compression" is not needed any more, but the option "nocompression"
can be used to disable compression of new files.

The default option also applies to applications using libntfs-3g with
no mount command.
2011-10-20 18:55:32 +02:00
Jean-Pierre André
69549be496 fix : fed in the available space in ntfscp 2011-10-20 18:51:15 +02:00
Jean-Pierre André
650eaddb89 new : allowed compression in ntfscp 2011-10-20 18:49:58 +02:00
Szabolcs Szakacsits
360e9475f4 Release 2011.10.9-RC 2011-10-09 11:29:41 +03:00
Jean-Pierre André
328f36447e Inserted the inode number when naming unnamed undeleted files
When undeleting a file whose name cannot be recovered, this patch
defines a name to which the inode number is appended to facilitate
a bulk recovery (recovering the unwanted deletion of a subtree).
2011-10-07 11:52:21 +02:00
Jean-Pierre André
6e52a39608 Added to ntfsundelete an attempt to recover the name of a deleted file
When a file is deleted, ntfs-3g deletes the name from the MFT record,
so the name is not available when the file has to be undeleted.
This patch tries to recover the name when it has not been overwritten.
This is mostly possible when data is non-resident and not fragmented.
2011-10-07 11:45:47 +02:00
Jean-Pierre André
42597c830d Developped creating a metadata image in ntfsclone
With this patch a metadata image can be created without creating
an intermediate file. Use both option -m and -s.
2011-10-07 11:42:08 +02: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é
b41ad439f9 Developped expanding an NTFS volume downwards in ntfsresize
When the lower bound of an ntfs partition is moved down this patch
recreated new metadata in the expanded space without copying the
actual data. The existing code for moving the upper bound of the
partition has been kept unchanged.
2011-10-07 11:26:58 +02:00
Jean-Pierre André
a7c61d83a7 Defined option delay_mtime to delay updates of mtime+ctime
This patch avoid updating the time stamps whenever a file is modified,
by delaying the time stamps updating until the file is closed.
This is mostly useful when the ntfs file system hosts another loop-monted
file system to avoid frequent updates of the time stamps in the outer
file system.
2011-10-07 11:16:23 +02:00
Jean-Pierre André
8a762bee41 Cosmetic : fixed an error message (hggdh2) 2011-09-30 09:06:42 +02:00
Jean-Pierre André
c0955e5d74 cosmetic : fixed improper wordings (hggdh2) 2011-09-28 16:41:12 +02:00
Jean-Pierre André
35fbb698ba Fixed a bug when undeleting a sparse file
An old typo leading to a badly recovered file and sometimes to a segfault
2011-09-26 15:03:38 +02:00
Jean-Pierre André
08bf2b5bcb Avoided logging meaningless fixup errors in ntfsclone and ntfsresize
Logging of fixup errors for uninitialized inodes cause unnecessary
worries and suspicion of malfunctions in ntfs-3g. This patch silences
these loggings in ntfsclone and ntfsresize which have to analyze all
inodes, including the uninitialized ones.
2011-09-23 11:28:42 +02:00
Jean-Pierre André
ad53f4c24a Enabled getting the sector size from an ioctl on FreeBSD and MacOSX (Erik Larsson)
The sector size is needed for formatting a volume unless forced through
an option or using the traditional sector size.
2011-09-14 12:21:59 +02:00
Jean-Pierre André
3c03e056f1 Fixed the size limits for the volume label set by mkntfs 2011-09-14 08:32:28 +02:00
Erik Larsson
c3e651047a Replaced some usages of ntfs_mbstoucs_libntfscompat with ntfs_mbstoucs.
Some calls to ntfs_mbstoucs_libntfscompat were unnecessary as they only used
functionality that can be provided by ntfs_mbstoucs.
2011-09-13 09:51:55 +02:00
Erik Larsson
8d06955ea4 Cleaned up and moved label changing functionality into libntfs-3g.
The label changing code in ntfslabel was cleaned up and modified to use the more
advanced functionality of libntfs-3g instead of using older custom code to
resize and create resident attributes.
The core label changing functionality was also moved into the library so it can
be reused by other programs.
2011-09-13 09:43:30 +02:00
Jean-Pierre André
4dd63e0fd1 Fixed the setting of attributes by secaudit
The setting of attributes was done in the "standard information",
it must also be propagated to the indexes in parent directories.
2011-09-12 18:41:25 +02:00
Erik Larsson
b8103bbcfe Permit $VOLUME_NAME to be 0-sized, even when $AttrDef says otherwise.
When clearing a volume name in Windows, $VOLUME_NAME is set to size 0, even if
the standard $AttrDef says that the minimum size is 2.

So the definition in $AttrDef doesn't reflect actual Windows behaviour in this
particular case, and to clear volume names ourselves the way Windows does it,
we must must add a special rule to permit us to truncate the $VOLUME_NAME
attribute to 0 even when $AttrDef specifies a higher value as minimum size.
2011-09-12 09:07:00 +02:00
Jean-Pierre André
178ae712c3 Fixed the truncation of dos file names
Truncate dos file names to 12 ntfschars instead of 12 utf-8 bytes
2011-09-08 09:52:51 +02:00
Jean-Pierre André
0b8b7521a4 Fixed the FullyMapped flag when making an attribute resident
When an attribute is truncated and made resident, the NAttrFullyMapped
flags has to be cleared, otherwise the attribute cannot be properly
mapped when the attribute is later made non-resident again.
2011-08-30 16:02:32 +02:00
Jean-Pierre André
0b827cc978 Avoid endless recursion when MFT extents are described in themselves
When getting extents of MFT, we must be sure they are in the MFT part which
has already been mapped, otherwise we fall into an endless recursion.

Situations have been met where extents locations are described in themselves,
as a consequence of a bug, probably unrelated to ntfs-3g.
This is a severe error which chkdsk cannot fix.
2011-08-30 15:56:36 +02:00
Jean-Pierre André
a1161d552f cosmetic : Removed a pointless store in ntfs_attr_make_resident() (Fabian Keil) 2011-08-04 15:49:36 +02:00
Jean-Pierre André
e4a7a56a1a cosmetic : Removed a redundant store in utils_is_metadata() (Fabian Keil) 2011-08-04 15:49:36 +02:00