Commit Graph

1514 Commits (f1960238411d0a7286ed279749968398df83e10f)

Author SHA1 Message Date
Jean-Pierre André ddd3a8a329 Reset the output file to favour appending to image in ntfsclone
When ntfsclone'ing to a file, the target file was truncated to the volume
size. This is not useful on file systems which support sparse files. In
the case of ntfs-3g this leads to prevent optimizations specific to
appending data. So when a sparse output file is detected, it is emptied
to benefit from subsequent appending of data.
2014-03-11 09:54:53 +01:00
Jean-Pierre André 7e38a29656 Avoided double opening of parent directory name in ntfscp
Double openings of a file or directory lead to double memory copies and
may lead to inconsistencies. On such situation could occur in ntfscp.
2014-03-11 09:50:02 +01:00
Jean-Pierre André 1d2fc42593 Avoided unnormalized parent directory name in ntfscp
Avoid leading '/' in directory names and use in ntfscp the same rule as fuse.
2014-03-11 09:44:50 +01:00
Jean-Pierre André 0f892b92d6 Added option --min-fragments to reduce fragmentation in ntfscp
When copying a file through ntfscp, the file size is known, hence the
space allocation can be optimized to get minimal fragmentation.
2014-03-11 09:24:34 +01:00
Jean-Pierre André 8520af7f7d Avoided displaying sync errors in ntfscp with --no-action
Do not loop on displaying errors when nothing is to be done
2014-03-11 09:19:06 +01:00
Jean-Pierre André fb4a2a6292 Fixed an endianness error in ntfsundelete
Name matching was wrong on big endian CPUs when not using regex
2014-03-11 09:12:41 +01:00
Jean-Pierre André 44d74a5b22 Allowed setting the serial number to 0x8000000000000000 or greater
The serial number of an ntfs volume should be processed as an unsigned
number (fix by E. Talsma)
2014-03-11 09:07:59 +01:00
Jean-Pierre André d2daead832 Updated copyright claims 2014-02-16 18:25:09 +01:00
Jean-Pierre André b921b09fb8 Made ntfsdecrypt compatible with libgrypt-1.6
The upcoming libgrypt-1.6 drops the "module" interface which was used
by ntfsdecrypt for decrypting files which were encrypted with the "DESX"
algorithm. This algorithm is a Microsoft variant of DES with a key size
of 128 bits, and is not natively supported by libgrypt. The module interface
made possible to declare an external algorithm so that all the encryption
modes could be processed the same way whether the algorithm was internal
or external.
This patch makes DESX a specific case, so that the module interface is
not needed any more. It is compatible with current libgrypt and upcoming
libgrypt-1.6
2014-01-13 15:21:51 +01:00
Jean-Pierre André e9a2d29b33 Fixed memory leak while comparing attributes with bad sectors
When bad sectors were found when comparing attributes, the attribute
descriptors were not closed and freed (fixed by Rakesh Pandit)
2013-09-09 19:46:00 +02:00
Jean-Pierre André 5e18e97d0b Silenced warnings by gcc >= 4.8 about aliasing
Added intermediate variables to avoid warnings by gcc >= 4.8
2013-09-09 15:34:14 +02:00
Jean-Pierre André 50db448f02 Fixed format translations for Windows
Translating "%ll" print formats to "%I64" for Windows was wrong.
2013-07-30 11:27:16 +02:00
Jean-Pierre André 1120b9c0b0 Removed duplicated code in mkntfs
Removed a meaningless duplicated test.
2013-07-30 11:22:34 +02:00
Jean-Pierre André ad40849149 Forced 64-bit computation of inode number in ntfsundelete
An inode number computation was done with 32 bits, and could (theoretically)
lead to truncation.
2013-07-30 11:07:12 +02:00
Jean-Pierre André bcbd157cfc Output the modification time when scanning files by ntfsundelete
When trying to undelete a file which was modified several times the
same day, it is difficult to tell which one is the latest unless the
modification time is displayed.
2013-07-30 11:00:46 +02:00
Jean-Pierre André c8a43e3f9f Improved the manual description of the size option of ntfsresize
Tried to make clear an NTFS file system size is smaller than the
partition size, and the size wanted by ntfsresize is the partition
size.
2013-07-30 10:45:22 +02:00
Jean-Pierre André 397848e21d Reserved a single sector for the backup boot sector
Reserve a single sector, instead of a full cluster, for the backup boot
sector.
2013-07-30 10:35:13 +02:00
Jean-Pierre André 9d730b0da1 Set the backup boot sector in ntfsresize when the size is reliable
Traditionally the backup boot sector is not set by ntfsresize because
the exact partition size is not yet known. A chkdsk is triggered to
subsequently insert it.
However ntfsresize is frequently activated by a partition editor which
has an exact knowledge of the wanted layout, and the backup boot sector
can be inserted by ntfsresize. This is only done if the target partition
size is defined with no unit suffix, and it is a multiple of the sector
size. Anyway the backup boot sector cannot overwrite useful data as it
is inserted between the file system size and the target partition size.
2013-07-30 10:17:28 +02:00
Jean-Pierre André be58b3b1f6 Fixed usa checking by ntfsck on 4K sectors
The usa sequence is used to make sure the sectors containing metadata
are fully written. The values are always put at the end of 512-byte
chunks even if the sectors are greater.
2013-04-22 19:14:48 +02:00
Jean-Pierre André baf13fe555 Fixed updating all the MFT runs in a relocated MFT in ntfsresize
When the MFT is partially located beyond the end of a resized partition,
it has to be relocated after the other files have been processed
because the MFT data is needed to do the relocations. When the MFT runlist
is split over extents, all of them have to be processed.
2013-04-22 18:55:26 +02:00
Jean-Pierre André 28cacf40b0 Fixed trying to update the MFT and Bitmap on a test run of ntfsresize
When the beginning of the MFT is beyond the end of the resized
partition, a specific procedure has to be used to relocate this part
of the MFT and adjust the bitmap accordingly. On a test run, these
updates should not be done.
2013-04-22 18:45:48 +02:00
Jean-Pierre André b35a204d01 Increased the maximum format size on Windows
The long long printing formats (such as %lld or %llx) have to be
translated to %I64 on older Windows systems, and the buffers to
receive the translated format must be able to hold the tool banners
which can be quite lengthy.
2013-04-22 18:31:16 +02:00
Jean-Pierre André 0e91e1a9ae Made compilation with --enable-really-static option to ./configure work
Author: Anton Altaparmakov
Date:   Wed Feb 13 02:29:47 2013 +0000

This is a fix to the use of hd library to get the legacy BIOS geometry.
2013-02-13 08:51:47 +01:00
Jean-Pierre André 1e625a9563 Made the meaning of the size argument of ntfsresize more clear in the manual
The size argument of ntfsresize is the target partition size. This is
not the file system size as returned by df(1) or statvfs(3) because a
sector is reserved for the backup boot sector, and the remaining sector
count might not be a multiple of clusters per sector.
2013-02-09 15:19:34 +01:00
Jean-Pierre André a6b765c824 Fixed rescuing clusters by physical sectors in ntfsclone
When a sector is unreadable, consider the whole sector as bad, instead
of trying to find which 512-byte parts of it are bad. This was causing
unwanted retries for devices with 4K sectors.
2013-02-09 15:07:06 +01:00
Jean-Pierre André a086683ece Fixed setting a magic header to unreadable sectors in ntfsclone
The magic header of an unreadable sectors should have the size of
"BadSectoR", not the size of a pointer to it.
2013-02-09 15:04:41 +01:00
Jean-Pierre André c73b805062 Rejected reading a volume from stdin in ntfsclone
Reading a volume must be done in a seekable way. Better throw a proper
error.
2013-02-09 15:01:36 +01:00
Jean-Pierre André c72b569da1 Ported ntfsundelete to Windows
Made a few adaptations to what is available on Windows.
2013-02-09 14:56:46 +01:00
Jean-Pierre André c17512cde5 Translated %ll print editing formats to %I64 on Windows
Older msvcrt.dll (on XP and earlier) did not support "%ll" print editing
formats frequently used by ntfsclone. So translate them to "%I64" when
running on Windows. This format appears to be supported by all Windows
versions. Error messages from libntfs-3g are still not translated.
2013-02-09 12:57:22 +01:00
Jean-Pierre André e6eae9fa16 Ported ntfsclone to Windows
This mainly means using the functions in win32_io.c instead of the
standard msvcrt.dll ones in order to be able to truncate files and
create sparse ones.
2013-02-09 12:54:44 +01:00
Jean-Pierre André 88de9987a0 Fixed bad copying of the backup boot sector in ntfsclone
This patch fixes the sector offset to the backup boot sector when creating
a metadata image.
2013-02-09 12:53:38 +01:00
Jean-Pierre André d32c593521 Revert "Ported ntfsclone to Windows", should be "Fixed bad copying of the backup boot sector"
This reverts commit 92cd41b6e5.

The title and description were wrong
2013-02-09 12:50:16 +01:00
Jean-Pierre André 92cd41b6e5 Ported ntfsclone to Windows
This mainly means using the functions in win32_io.c instead of the
standard msvcrt.dll ones in order to be able to truncate files and
create sparse ones.
2013-02-09 12:14:19 +01:00
Jean-Pierre André c4f65e05c4 Cleaned selecting stdout or stderr for messages from ntfsclone
Depending on the options selected, ntfsclone messages are output on
stdout or stderr. This is now done through standard logging procedures.
2013-02-09 12:12:02 +01:00
Jean-Pierre André 2e2550026e Avoided displaying in non-verbose mode information which is not computed
The summary of 'runcount.runs' and 'runcount.fragments' was displayed in
non-verbose mode. However these variables are not updated in non-verbose
mode, so they would always be 0.
We now only display this summary in verbose mode.
2013-02-09 12:08:58 +01:00
Jean-Pierre André aebfcf3d27 Enabled relocating the MFT when shrinking a volume
This patch makes it possible to shrink a volume to a small size such that
the existing $MFT is beyond the new size.
2013-02-09 12:00:02 +01:00
Jean-Pierre André b2e1dbbf38 Made possible to run ntfsundelete on systems with no regex.h
The filtering of files to undelete is usually done through the regex
library. This patch offers an alternate way when such a library is
not readily available (typically on Windows).
2013-02-09 11:56:09 +01:00
Jean-Pierre André c972652876 Avoided meaningless errors logging during ntfsundelete scans
When ntfsundelete scans the $MFT for possible deleted files, it may
examine extries which have never been used, producing error messages
which most users do not understand. This patch silences such messages.
2013-02-09 11:51:40 +01:00
Jean-Pierre André 61eceb2fe5 Cosmetic : use symbolic names for ntfsclone control codes
Defining symbolic names makes it easier to identify where they are used.
2013-02-09 11:48:54 +01:00
Jean-Pierre André 81eb7baf88 Allowed cloning a file system despite allocation errors
Allow the "--ignore-fs-check" option to be used when cloning a file system
which has allocation errors. This is useful when there is a fear that
repairing the file system might create further damage, or when the repair
has to be made on another computer.
2013-02-09 11:41:39 +01:00
Jean-Pierre André c820cb6d76 Added a display of the location of an inconsistency in an image
When an ntfsclone image appears to be corrupted, show at which position
the error happens. This is useful for providing support.
2013-02-09 11:37:31 +01:00
Jean-Pierre André 412f09d87d Fixed the ntfsfix option for testing in the manual
The option for checking the behavior of ntfsfix without writing anything
is "--no-action", not "--do-nothing".
2013-02-09 11:33:17 +01:00
Jean-Pierre André 7c83060553 Added a new option for testing the consistency of an ntfsclone image
This patch adds a new option -n to ntfsclone for simulating a restore
without writing anything. This is useful for checking the consistency
of an image without destroying the original partition.
2013-02-09 11:29:21 +01:00
Jean-Pierre André 44fbf02a97 Upgraded the Win32 interface for use with ntfsprogs
Upgrade the Win32 interface (win32_io.c) which was designed for Cygwin
so that it can be used for using the ntfsprogs utilities on native Windows.
Two new entries are added for truncating a file and creating a sparse
file, both of which not being supported through msvcrt.dll.
2013-02-09 11:22:41 +01:00
Jean-Pierre André 7cb4b99627 Fixed wiping fragmented metadata when creating a metadata image
When creating a metadata image, all user data is supposed to be wiped off,
but this was wrong for $MFT and directory indexes when they were
fragmented. This patch cleans the tails of metadata fragments.
2013-02-09 11:12:45 +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
Erik Larsson 11a7e8297d ntfsclone.c: Cleanup in error message. 2012-11-06 08:23:04 +01:00
Erik Larsson e85f9305c1 ntfsclone.c: Fix missing space in error message. 2012-11-06 02:07:53 +01:00
Erik Larsson 7c600754dd ntfsinfo.c: Fix printing all the flags in hex in 'ntfs_dump_flags'.
The variable 'flags' was modified along the way and did not contain the
original flags at the end as assumed by the last printout. Fixed by
storing the original state of the flags in a temporary const variable.
2012-08-27 21:26:57 +02:00
Jean-Pierre André 3461acd0c2 Changed "blocks" to "sectors" in the mkntfs manual
The last (optional) argument in mkntfs was described as a block count,
which may be confusing because in ext[123] a block means a cluster.
2012-08-20 14:17:09 +02:00
Jean-Pierre André eecc700df1 Inserted in the manual an explanation for the $Info stream in $UpCase 2012-08-20 14:14:15 +02:00
Jean-Pierre André 9d22736044 Inserted an $Info stream in $UpCase to comply with Windows 8
Since Windows 8 a new stream is added to the upper case file to record
a CRC of the upper case data. This way, if the file does not match the
one defined on the current Windows system, chkdsk can tell whether the
file is damaged or just out of date, and an error is only displayed if
the file is damaged.

The $Info data has been checked to be ignored by Windows XP, Windows
Vista and Windows 7. If not present, chkdsk for Windows 8 complains about
a wrong upper case file.
2012-08-20 14:01:53 +02:00
Jean-Pierre André 262a0559ac Fixed the computation of named attributes sizes in mkntfs
The named attributes sizes were wrongly computed in mkntfs. This did not
lead to visible errors so far owing to 8-byte alignments in attribute
records (current names $SDS, $R, $O, etc).
2012-08-20 13:57:00 +02:00
Jean-Pierre André f793ead700 Cosmetic : avoided having a hardcoded knowledge of upcase table size in mkntfs 2012-08-20 13:53:48 +02:00
Jean-Pierre André ba3cb2c88b Fixed displaying progress percentage for metadata images
When building (options -ms) or restoring a metadata image, the progress
percentages were wrong (evaluated against a wrong base)
2012-08-20 13:44:33 +02: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é ab6f7c027d Extended the wiping of file tails to all data attributes in ntfswipe
This patch adds the wiping of the tails of named data attributes to
ntfswipe.
2012-06-18 13:00:17 +02:00
Jean-Pierre André 24c9f19065 Added optional wiping of file tails and undelete data to ntfswipe (Bogdan)
Added more wiping options to ntfswipe (to avoid leaking of deleted data).
2012-06-18 12:41:51 +02:00
Jean-Pierre André 9ae4165ee8 Added allocation data to output of "ntfsinfo -m"
Volume state and the level of allocation were added to the output
of "ntfsinfo -m", they are useful to identify the state of a volume.
2012-06-18 12:19:27 +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é 37ae85a9d5 Cosmetic : moved the basename(3) redefinition to a better location
basename(3) is not available on OpenIndiana and had to be redefined.
Just move the redefinition to a more standard location
2012-03-21 19:09:52 +01:00
Jean-Pierre André 66d30c86b3 Implemented an option to set a new serial number in ntfslabel
Defined new options --new-serial and --new-half-serial to set a new
serial number (either the given one or a random one) to a file system.
Useful for mounting the original and the cloned file system at the
same time.
2012-01-23 18:22:59 +01:00
Jean-Pierre André 54f96e4af1 Implemented an option to set a new serial number in ntfsclone
Defined new options --new-serial and --new-half-serial to set a new
random serial number when cloning or restoring a file system.
Useful for mounting the original and the cloned file system at the
same time.
2012-01-23 18:19:17 +01:00
Jean-Pierre André e7bfd31de4 Fixed clearing user data when creating metadata images
Clearing of user data was wrong when extracting the metadata into a
special format image. In this situation the clearing has to be done
without mounting the file system.
2012-01-23 18:13:59 +01:00
Jean-Pierre André 4a0892eb26 Implemented a new option -q to avoid updating the progress information (Matthew Boyle)
The progress bars complexify the integration of ntfsclone into other
tools, the option -q (or --quiet) gets rid of them.
2012-01-23 18:10:26 +01:00
Jean-Pierre André a5e656751d Worked around basename(3) not present on OpenIndiana 2012-01-23 18:03:59 +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é 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é 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
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é 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é 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
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é 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é 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é e4a7a56a1a cosmetic : Removed a redundant store in utils_is_metadata() (Fabian Keil) 2011-08-04 15:49:36 +02:00
Jean-Pierre André f10f067c7b revert : Reverted to old behavior for errored reply in ntfsresize 2011-08-04 15:49:35 +02:00
Jean-Pierre André a3579a1674 documentation : Improved the description of the -f option in the manual for ntfsresize 2011-08-04 15:49:35 +02:00
Erik Larsson 277c8c8cdf ntfsprogs/Makefile.am: Fix for conflicting usage of EXTRA_PROGRAMS.
After the '--enable-extras' patch, EXTRA_PROGRAMS and bin_PROGRAMS were both defined when ENABLE_EXTRAS was enabled.
This created a conflict, where at least automake 1.10 attempted to emit targets for the binaries twice, resulting in failure when running 'autogen.sh'.

Conflict was resolved by defining the names of the binaries in a non-reserved variable EXTRA_PROGRAM_NAMES, which is then included either in EXTRA_PROGRAMS or bin_PROGRAMS but never in both.
2011-07-06 19:11:49 +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é 17caba34db Implemented expanding runlists in ntfsresize (Fedora 689275) 2011-07-05 12:17:30 +02:00
Jean-Pierre André bde75a7bce Optionally closed volume and cleaned memory when leaving ntfsresize (kept disabled) 2011-07-05 12:17:30 +02:00
Jean-Pierre André c54db11d96 Fixed dead http links in ntfsprogs manuals (Daniel Baumann) 2011-07-05 12:17:30 +02:00
Jean-Pierre André 1673ce9c91 Accepted the backup bootsector not be to accounted for when cloning 2011-07-05 12:17:29 +02:00
Jean-Pierre André 5a56ad9ff1 Silenced apparent out-of-range subscripts warned by gcc 4.6 2011-07-05 12:17:29 +02:00
Jean-Pierre André 5cd49257b0 Removed unneeded variables as warned by gcc 4.6 2011-07-05 12:17:29 +02:00
Jean-Pierre André 1c1c0540e8 Fixed use of uninitialized variable in ntfsfix 2011-07-05 12:17:29 +02:00
Jean-Pierre André 2c248202f5 Fixed accessing an unmounted volume in ntfsck 2011-07-05 12:17:28 +02:00
Jean-Pierre André 0ec31405c6 Fixed casting data to printf format in ntfsck, ntfsmove and ntfswipe 2011-07-05 12:17:28 +02:00
Jean-Pierre André fe1a7b22a2 Fixed checking file system type in ntfsck 2011-07-05 12:17:28 +02:00
Jean-Pierre André 473d03d4b7 Fixed a bug causing SEGV in ntfsck (but nothing done anyway) 2011-07-05 12:17:28 +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é 5aa84db792 Silenced warning for ignoring the result of fgets in ntfsresize 2011-07-05 12:17:11 +02:00
Jean-Pierre André 683d0a0a4f Defined an option --enable-extras for extra ntfsprogs tools (from Fedora) 2011-07-05 12:17:11 +02:00
Jean-Pierre André 259b8ab308 Fixed compilation on OpenIndiana (Apostolos Syropoulos) 2011-07-05 12:17:11 +02:00
Jean-Pierre André 0289d1a6c3 Fixed the included files into ntfsck.c (from Fedora) 2011-07-05 12:17:11 +02:00
Szaka f246d6ce97 Update ntfs-3g.org references 2011-03-27 15:29:48 +03:00
Jean-Pierre André 04f3e94dff Added mention of contributors for porting ntfsprogs to ntfs-3g 2011-03-23 10:09:20 +01:00
Jean-Pierre André 67f07ac3ad Added option --check to ntfsresize (from fedora) 2011-03-23 09:50:12 +01:00
Jean-Pierre André 71488598d7 Added option --info-mb-only to ntfsresize (from fedora) 2011-03-23 09:48:40 +01: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é c6043ec2c9 Set the same timestamp per file in all attributes in mkntfs
mkntfs did not set the same timestamp in inode and index.
2011-03-23 09:43:13 +01:00
Jean-Pierre André b4d1c6165b Used a stream to produce aligned writes in image creation
When creating a partition image, ntfsclone write an extra byte to
describe each cluster, this causes two unneeded ntfs-3g calls per cluster,
and inefficiency when imaging to ntfs.
2011-03-23 09:35:24 +01:00
Jean-Pierre André 0ce2d5bc57 Freed a search context in ntfslabel
Avoids a memory leak detection
2011-03-23 09:30:51 +01:00
Jean-Pierre André 2a2d94897c Silenced warnings for no-return functions in ntfsresize 2011-03-23 09:29:27 +01:00
Jean-Pierre André 4b408e60ae Strenghtened types in ntfslabel and ntfsfix 2011-03-23 09:27:33 +01:00
Jean-Pierre André 6d68c74f37 Fixed a segfaulting bug in ntfsundelete (from Fedora) 2011-03-23 09:24:55 +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é 2594a6c983 Fixed allocated size for resident unnamed data in mkntfs
The recorded allocated size depends on unnamed data being non resident,
which depends on MFT record size, hence on sector size.
The allocated size was wrong for $AttrDef when sector size is 4K bytes
(chkdsk silently fixes it).
2011-03-23 09:14:55 +01:00
Jean-Pierre André 7ac015451c Fixed allocated size to MFT in mkntfs
mkntfs stored a different value for allocated size in inode and index.
2011-03-23 09:06:27 +01:00
Jean-Pierre André c6da530efc Synced the created image before remounting in ntfsclone
Better sync before remounting, but probably not an error
2011-03-23 08:59:49 +01:00
Jean-Pierre André e20c1df1e5 Fixed copying the backup boot sector on a partial cluster
A recent patch added copying the backup boot sector when cloning,
saving or restoring a partition, but when the total number of sectors is
not a multiple of the number of sectors per cluster, the last cluster
containing the backup boot sector is shorter than usual.
When this happens, the present patch avoids overflowing from partition
when accessing the last cluster.
2011-02-17 16:11:26 +01:00
Jean-Pierre André 8034e9be25 Fixed the location of the backup boot sector 2011-02-16 12:20:46 +01:00
Jean-Pierre André f68259e0c2 Copied the alternate boot sector when cloning 2011-02-16 12:18:56 +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é 7eccaa3c53 Fixed the type of argument of utils_mount_volume() 2011-01-10 11:19:54 +01:00
Jean-Pierre André b3d62451e8 Silenced compiler warnings on the use of aggregates 2011-01-10 11:18:55 +01:00
Jean-Pierre André 70490ce10e Silenced warnings for no return 2010-12-21 15:51:08 +01:00
Jean-Pierre André bfb648b99c Silenced warning on redefinition of ntfs_time 2010-12-21 15:51:08 +01:00
Jean-Pierre André 0cb35ac7aa Enabled expanding an attribute without creating a hole 2010-12-21 15:51:07 +01:00
Jean-Pierre André d4e2a501a5 Enabled forensic mounting 2010-12-21 15:51:07 +01:00
Jean-Pierre André 5b03804c73 Set a volume UUID unless option -U 2010-12-21 15:51:07 +01:00
Jean-Pierre André fd22595518 Avoided storing the full logfile in memory 2010-12-21 15:51:07 +01:00
Jean-Pierre André 94cab92a24 Avoided storing the full bitmap in memory 2010-12-21 15:51:07 +01:00
Jean-Pierre André 3a6ea1f2c9 Avoided writing beyond allocated variable 2010-12-21 15:51:07 +01:00
Jean-Pierre André f21110f9a3 Closed volume and cleaned up when exiting from ntfsclone 2010-12-21 15:51:07 +01:00
Jean-Pierre André 936ca1193f Displayed times in UTC in ntfsinfo 2010-12-21 15:51:07 +01:00
Jean-Pierre André 31ce5db142 Added option for not clearing the timestamps in ntfsclone 2010-12-21 15:51:07 +01:00
Jean-Pierre André f3e6a1af01 Fixed reading old big-endian ntfsclone images 2010-12-21 15:51:07 +01:00
Jean-Pierre André 9f40bcfc22 Moved ntfs_mbstoucs_libntfscompat() to utils.c 2010-12-21 15:51:07 +01:00
Jean-Pierre André 1c9ef6293b Moved the definition of leMFT_REF to layout.h 2010-12-21 15:51:07 +01:00
Jean-Pierre André f22dec0442 Silenced warnings for formats in ntfsfix.c 2010-12-21 15:51:07 +01:00
Jean-Pierre André dc7317dbcc Fixed included files in ntfscmp.c 2010-12-21 15:51:07 +01:00
Jean-Pierre André 8f4aa0883b Strengthened variable types 2010-12-21 15:51:07 +01:00
Jean-Pierre André 1ca4a556b2 Silenced warnings for unmatching printf-type formats 2010-12-21 15:51:07 +01:00
Erik Larsson c5ecb91ffe Merge remote branch 'linux-ntfs/libntfs-3g_port-edge' into ntfsprogs_merge.edge
Conflicts:
	ChangeLog
	libntfs/libntfs.8.in
2010-12-19 15:20:24 +01:00
Erik Larsson 2a1fb5f489 Merge branch 'ntfsprogs_merge' into ntfsprogs_merge.v2_0_0 2010-12-19 15:12:57 +01:00
Erik Larsson de22c98ec0 Removed the 'ntfs_home' string from utils.c/h since it was referring to Linux-NTFS and it was a duplicate symbol (an equivalent string exists in volume.c/h). 2010-12-19 15:11:28 +01:00
Erik Larsson ef0190cbd7 Merge branch 'master' into libntfs-3g_port-edge
Conflicts:
	configure.ac
	libntfs/bootsect.c
	libntfs/logging.c
	ntfsprogs/ntfsmount.c
2010-12-19 09:06:45 +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 e12b5f2c7f ntfsclone manpage: Fixed typo 'clonning'. 2010-12-16 17:36:25 +01:00
Erik Larsson cdc930e4bf ntfsprogs manpage: Added a reference to the ntfs-3g manpage in the "SEE ALSO" section. 2010-12-16 17:36:12 +01:00
Erik Larsson 8deb6a323c ntfsprogs manpages: Updated the link to where the package can be downloaded. It now points at "http://www.tuxera.com/community/". 2010-12-16 17:35:59 +01:00
Erik Larsson 64d5d4da1d ntfsprogs manpages: Updated references to the 'ntfsprogs package' to reference the ntfs-3g package instead. 2010-12-16 17:35:48 +01:00
Erik Larsson 2188eab0a0 ntfsprogs manpages: Replaced all references to the linux-ntfs-dev mailing list with the ntfs-3g-devel mailing list. 2010-12-16 17:35:40 +01:00
Erik Larsson 2d8befcc07 ntfsprogs manpages: Changed 'ntfsprogs' reference in headers into 'ntfs-3g'.
The version number following 'ntfsprogs' is really the ntfs-3g version number, so the substitution seems appropriate.
2010-12-16 17:35:22 +01:00
Erik Larsson dedaf225e3 Cleaned out a seemingly unused declaration from Makefile.am in ntfsprogs. 2010-12-16 17:35:14 +01:00
Erik Larsson 7287c05ff4 Made ntfsprogs compilation conditional and turned off by default. It is enabled with '--enable-ntfsprogs'. 2010-12-16 17:35:06 +01:00
Erik Larsson f3a30779dd Moved list.h into ntfsprogs and got rid of include/ntfs completely. 2010-12-16 17:34:47 +01:00
Erik Larsson daa1f3edcd Bugfixes for 'make extra'. 2010-12-16 10:08:34 +01:00
Erik Larsson 5a41022810 Removed the libntfs-gnomevfs module as it does not seem reasonable to keep maintaining it in ntfs-3g. 2010-12-16 10:08:27 +01:00
Erik Larsson 3efdd4cf0b Merge remote branch 'linux-ntfs/libntfs-3g_port' into ntfsprogs_merge.redo
Conflicts:
        configure.ac
2010-12-16 10:04:22 +01:00
Erik Larsson 2634f01ef0 Cleaned out some .cvsignore files that came from ntfsprogs. 2010-12-16 10:00:56 +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 639bd5475c Fixed ntfsprogs/Makefile.am to link against internally built libntfs-3g. 2010-12-15 17:19:20 +01:00
Erik Larsson 7a95c46e3d Bugfix for ntfs_mbstoucs_libntfscompat: Take the the \0 terminator into account when determining whether reallocing is necessary. 2010-12-09 12:17:11 +01:00
Erik Larsson e81fd0ee2a Important bugfix for ntfs_mbstoucs_libntfscompat: We reallocated too little memory. 2010-12-09 12:15:50 +01:00
Erik Larsson 9c581432cb Important bugfix for ntfs_mbstoucs_libntfscompat: Typo in memcpy operation led to the wrong data being copied! 2010-12-09 12:14:13 +01:00
Erik Larsson 78b40e4b4c mkntfs.c: Fixed two references to missing member 'guid' in 'ntfs_volume'. 2010-12-03 07:52:31 +01:00
Erik Larsson 9c0c2bf633 ntfsprogs/Makefile.am: Added libgcrypt's CFLAGS and LIBS when building ntfsdecrypt. 2010-12-03 07:50:47 +01:00
Erik Larsson 6bf6464aeb Merge branch 'libntfs-3g_port' into libntfs-3g_port-v2_0_0 2010-12-02 22:40:15 +01:00
Erik Larsson 7b62a83286 utils.h: Added missing typedef leMFT_REF. 2010-12-02 22:39:06 +01:00
Erik Larsson 3ddcb40f23 ntfsdump_logfile.c: Removed unnecessary reference to unsupported mount option NTFS_MNT_FORENSIC. (The mount option is pointless as we are mounting the volume in read-only mode anyway.) 2010-12-02 22:37:23 +01:00
Erik Larsson d52190c3cb Fixed reference to deprecated utility 'libgnutls-config' in ntfsprogs' Makefile.am. 2010-12-02 22:37:16 +01:00
Erik Larsson 18789cdeaa Replaced all occurrences of the libntfs mount flag NTFS_MNT_FORCE with the libntfs-3g mount flag MS_RECOVER.
Note: The NTFS_MNT_FORCE, in addition to what MS_RECOVER does, also bypasses the check for the 'dirty' bit in libntfs' ntfs_mount.
However, this check does not exist in libntfs-3g (libntfs-3g will not check or change the dirty bit, being confident that it can handle volumes marked as 'dirty'), so in essence the same behaviour is achieved with MS_RECOVER.
2010-12-02 22:37:06 +01:00
Erik Larsson 6ff5d3f8a7 Replaced all occurrences of the libntfs mount flag NTFS_MNT_RDONLY with the corresponding libntfs-3g mount flag MS_RDONLY. 2010-12-02 22:36:58 +01:00
Erik Larsson 665555491b ntfsundelete.h: Added missing include 'utils.h'. 2010-12-02 22:36:46 +01:00
Erik Larsson 6b65b6024e ntfscp.c: libntfs-3g has added an additional argument to ntfs_create (le32 securid). We pass 0 as 'securid' as this is what should be passed when there is no inheritable security descriptor.
This can of course be discussed. Maybe we should inherit something? From parent? I don't know enough about this.
2010-12-02 22:36:37 +01:00
Erik Larsson 2acadfd360 mkntfs.c: Fixed reference to 'guid' member of ntfs_volume which does not exist in libntfs-3g. 2010-12-02 22:35:20 +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 dd3d394010 utils.h: Added ntfs_attr_get_name, a simple inline function from libntfs that was referenced in the ntfsprogs code. 2010-12-02 22:34:00 +01:00
Erik Larsson 41e27e116a Added 'misc.h' as an include to some source files because of missing ntfs_malloc / ntfs_calloc signatures. 2010-12-02 22:31:56 +01:00
Erik Larsson 844d3213a9 ntfsck.c: Adapted includes to libntfs-3g. 2010-12-02 22:31:44 +01:00