Commit Graph

163 Commits (ab4c6a614164ac4c124451ffeabd6e9673be0c93)

Author SHA1 Message Date
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 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 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 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 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 4a641c85e0 Adapted code to latest libntfs-3g, based on PERMISSION_HANDLING_BRANCH. Now requires libntfs-3g version 2010.5.22 minimum. 2010-12-02 16:35:27 +01:00
Erik Larsson 36b876375e Commented out all instances of MS_NOATIME being passed to ntfs_mount, as libntfs-3g does not support that flag.
In fact, this is how libntfs-3g operates normally, so the MS_NOATIME flag is not needed. However, other utilities might incorrectly assume that the library updates access times for them.
Investigating whether access time needs to be manually updated in other utilities is TODO.
2010-12-02 16:31:43 +01:00
Erik Larsson 058e47afbd Updated references to members of INDEX_HEADER and INDEX_ENTRY that have been renamed in libntfs-3g.
INDEX_HEADER: flags -> ih_flags
INDEX_ENTRY: flags -> ie_flags
2010-12-02 16:10:18 +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
Olaf Rempel 48f652e0e1 ntfsclone: fix restore from stdin
When doing a ntfclone-restore from stdin and stdin is then closed,
ntfsclone will loop forever:
$ cat corrupt_image.gz | gzip -d | ntfsclone -r -O somedisk -

With this patch the io_all() loop will return an error when the
input-stream is closed.
2009-03-28 00:25:58 +02:00
Anton Altaparmakov fb4a13008e ntfsclone: Allow metadata cloning to block devices when --force option
is supplied. (Anton)
2007-10-26 11:28:51 +01:00
Yura Pakhuchiy 82df6c1fea Rework time updates
- Library no longer perform time updates, only provide API for this
- Remove ntfs_inode_update_{a,}time() and introduce ntfs_inode_update_times()
- Make ntfsmount properly update times
- ntfs_delete() now takes pointer to pointer to ntfs_inode for while to delete and closes inode only in cases no more hard links left to file
2007-09-06 18:34:38 +03:00
Yura Pakhuchiy 65a81e3563 ntfsclone do bad things about endians, so revert it to original state and put mark on it to not perform sparse bitwise checks 2007-08-23 17:58:52 +03: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
aia21 1a4fb3431c - mkntfs: Generate a random DCE compliant UUID for the created volume
and include --with-uuid[=PFX] and --without-uuid options.  (Anton)
- configure.ac: Set language to C.  (Anton)
- mkntfs: Always set default cluster size to 4096 bytes regardless of
  volume size.  This is what Windows Vista does and it makes perfect
  sense from a performance point of view.  (Anton)
2006-12-13 00:11:50 +00:00
yura 10b22550cd more sparse fixes
left only endianness and this stupid problems with s64
2006-12-12 19:00:00 +00:00
szaka 3cd5cb9c8a Don't check free space if output file is FIFO (Andree Leidenfrost) 2006-12-03 18:26:58 +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
yura cb27c9f616 * Rename MS_{RDONLY,NOATIME} to NTFS_MNT_{RDONLY,NOATIME}.

							
						
2006-11-12 22:46:50 +00:00
uvman 15eb2c38a6 constify string argument. 2006-10-28 23:41:41 +00:00
uvman ff55ecb513 Whitespace cleanup 2006-10-27 12:24:29 +00:00
uvman acb04c0435 Remove unneeded padding. The compiler will pad if it wan't to. 2006-10-18 14:41:41 +00:00
aia21 2afc70711a Forgot to not apply endianness swapping for old style images when restoring... 2006-08-23 13:21:04 +00:00
aia21 35dcfaac9e Fix endianness problems in both image restore and image create (and in metadata
cloning as well).  (Anton)
2006-08-23 11:58:55 +00:00
aia21 cb35fe2fea Make ntfsclone image format extensible. (Anton) 2006-08-23 11:22:07 +00:00
aia21 5128685d88 - ntfsclone: Define endianness safe image format. (Anton)
- ntfsclone: Redefine image format version number to be the image
  format version and not the NTFS version of the imaged volume which is
  totally useless.  (Anton)
2006-08-23 10:18:34 +00:00
szaka 39b9061d8b wipe_index_allocation_timestamps(): don't try to dump empty ia 2006-08-13 15:15:08 +00:00
szaka 5c0ce5407e metadata cloning: write out extent records 2006-08-13 15:00:27 +00:00
szaka 58699ef91b more detailed error messages 2006-08-13 14:52:19 +00:00
szaka d727768a80 convert all malloc,calloc to ntfs_{malloc,calloc} 2006-08-13 14:49:35 +00:00
szaka bd659977c2 don't create image files with executable bit set 2006-08-13 14:40:28 +00:00
szaka 0dae4a9c77 fix missing error outputs 2006-08-13 14:34:07 +00:00
szaka f61d45b970 fix 64 bit destination size calculation on Mac OS X 2006-06-15 18:43:24 +00:00
szaka c7a53338c0 Fix all incorrect getopt_long() return value usages. 2006-04-05 12:43:06 +00:00
szaka 6772bb4649 Fix ntfsclone idempotency 2006-04-05 02:50:44 +00:00
szaka 813933e1bc libntfs: add ntfs_mft_usn_dec() and convert all copy-pastes to use them 2006-04-05 02:49:24 +00:00
szaka be823c7a1e libntfs: add ntfs_str2ucs and ntfs_freeucs function, and convert
copy-pastes to use them
2006-04-05 02:45:55 +00:00
szaka b4fa78dc58 ntfsclone: the --metadata option will wipe the timestamps in the
index allocation attributes as well. This further decreases the
compressed metadata image size by 10-25% and more importantly it
eliminates non-interesting ntfscmp differences.
2006-03-27 21:40:26 +00:00
szaka 31cc1d2f45 Wiped timestamp data stats were off by 5% in general 2006-02-06 22:17:24 +00:00
szaka 43b4d8a4e1 --metadata sets timestamps to the Epoch time as mkntfs does with -T. This
increases the compressed image sizes by only 0.3-0.8% but ntfsclone creates
now the exact same metadata images as mkntfs, which fact can be used for QA.
2006-02-06 20:51:17 +00:00
szaka fae8feea65 Explain dirty volume 2006-02-05 22:10:01 +00:00
szaka 16b8bc1fd4 Write MFT records with the same USN during metadata cloning. This eases
ntfsclone self-regression, which itself is going to validate other codes
2006-02-05 19:35:20 +00:00
szaka fefc3e5195 ntfsresize, ntfsclone: always use MS_NOATIME 2006-02-05 16:39:35 +00:00
szaka c940df9079 remove usage of old logging macros 2005-11-27 12:31:39 +00:00
szaka 3db9973bcf ntfsclone: --metadata also wipes out the timestamps in the $I30 and
in the /$Extend/$Quota:$Q index root attributes
2005-11-18 00:24:45 +00:00
szaka 2db620bda1 ntfsclone: check the available free space for --save-image too 2005-11-13 21:48:35 +00:00
szaka caa0bf5c4b metadata cloning: wipe metadata timestamps too 2005-11-07 21:38:58 +00:00
szaka da654b4207 shortened opt.metadata_only to opt.metadata 2005-11-07 21:13:31 +00:00
szaka 594c23aff0 ntfsclone: check available free space on the destination 2005-11-07 20:49:18 +00:00
uvman 5b949d07fa Fix comment formats. 2005-10-28 12:55:41 +00:00
flatcap 8a584700c5 whitespace fixes - no code changes 2005-10-26 22:54:57 +00:00
flatcap 1ee8d8b9e2 restore call to ntfs_set_locale
(utils only uses stderr, now)
2005-10-26 20:48:38 +00:00
uvman 0dd0cdc6be Remove {Dputs, Dprintf, Dperror} and convert callers to ntfs_log_*. Make ntfsinfo use ntfs_logging_parse_option(). 2005-10-25 01:28:10 +00:00
szaka f9cdaed3db temporary fix for the corrupted stdout due to the recent logging changes 2005-10-24 21:20:10 +00:00
flatcap f4e427e91a implement logging in libntfs
fix whitespace
fix build problems
tidy source code
and more...
2005-10-21 18:05:13 +00:00
antona f5961c075e - Fix compilation on OSX in ntfsclone.c where stderr = stdout
is not legal (but happens to work on Linux) to do proper
  low-level file descriptor mangling which is portable.  (Anton)
- Add test/runlist-data to EXTRA_DIST so it gets included in the
  distribution otherwise make test fails on released sources.  Solution
  is not perfect as it also adds the test/runlist-data/CVS directory
  but it will do at least for me.  (Anton)
2005-10-15 21:44:17 +00:00
flatcap 42de4cf905 tidy up some __attribute__ usage 2005-10-12 11:52:40 +00:00
antona 0c293d0407 - Add API (actually renamed from what Rich/FlatCap did):
volume.[hc]::ntfs_libntfs_version() which returns a pointer to a
  static const string of the libntfs verion, i.e. at the moment this is
  "8.0.0".  This required moving the version specifications from
  libntfs/Makefile.am to configure.ac.  This should hopefully have the
  sideeffect that I will remember to increment it when incrementing the
  ntfsprogs version number when making a release given the two are
  right under one another.  (Anton)
- Change ALL utilities to display the libntfs version they are running
  on.  This should make debugging easier in the case that people are
  running mismatched utilities/library.  (Anton)
2005-10-07 14:10:56 +00:00
uvman 62579b84d4 compiler warnings fixes. 2005-10-04 20:36:42 +00:00
szaka 54891f3112 Emphasize Windows needs to be rebooted twice after chkdsk /f 2005-09-30 20:29:58 +00:00
szaka ab2ad80ae7 Accept incorrect $Bitmap size if it covers the entire volume 2005-09-29 23:30:15 +00:00
antona 8db479a6b1 Patch from Christophe:
A lot of headers are checked by autoconf (AC_CHECK_HEADERS in configure.ac).
Please find a patch that add the missing "#ifdef" to the source code.
2005-09-28 13:47:47 +00:00
szaka 431258997d Fix saving by sectors during --rescue 2005-09-25 21:42:47 +00:00
antona 2a104d8eda Megapatch!!! Check evecrything!!! I probably broke everything!!! 2005-09-24 22:54:55 +00:00
szaka 99e18269b7 Hint user the --rescue option if they have bad sectors 2005-09-24 21:36:51 +00:00
szaka c5e05165c9 Fix memory leak in ignore_bad_clusters() 2005-07-13 17:07:13 +00:00
szaka 60d0ed80a5 Detect and hint users if the destination fs doesn't support sparse files 2005-06-27 21:03:06 +00:00
flatcap 949043ab36 Tidy whitespace: trailing space; <space><tab> at the beginning of lines
Fix warnings about sign differences
Fix warnings about unused parameters
Tidy a few functions that didn't have { on a new line
2005-06-19 21:09:40 +00:00
szaka 6e1106fc79 - fix mangled formatting in ntfsclone: use more space for wipe statistics 2005-06-12 14:35:57 +00:00
szaka b4a712b9e1 - Use consistent option and parameter naming convention 2005-06-12 11:02:50 +00:00
szaka 4fcd676f63 - More explanatory error message about failing to open a volume 2005-06-12 10:15:21 +00:00
szaka 8dae1da562 - Revised ntfsclone's usage() message 2005-06-12 09:55:45 +00:00
cantab.net!aia21 50bde64860 For a long while asked feature. The attached patch should be against the
latest ntfsprogs snapshot. Includes,

  - ntfsclone: --rescue works at the lowest, sector and not cluster level
    thus more data can be rescued. The contents of the unreadable sectors
    are filled by character '?' and the beginning of such sectors are
    marked as "BadSectoR\0". Thanks to Krishna Mohan Gundu for his help.

  - ntfsclone: fixed an off-by-one error during --metadata in function
    wipe_data().

Szaka

(Logical change 1.699)
2005-04-25 07:26:08 +00:00
elisa-laajakaista.fi!szaka c5f5dfb4c3 Make --metadata work with the new $Logfile checking code.
Save at least the first 16 KiB of $Logfile (the two RSTR records
should always be included if present). Save also records used for
checking empty $Logfile. (Szaka)

(Logical change 1.691)
2005-03-05 19:08:57 +00:00
elisa-laajakaista.fi!szaka f1780f9d64 Added a new option, --rescue. It ignores read errors so disks having
bad sectors (dying disks) can be rescued. The content of the cluster
having bad sectors is filled by character '2' and the start of the
cluster is marked by "BadClusteR".

(Logical change 1.682)
2005-03-01 21:48:00 +00:00
elisa-laajakaista.fi!szaka 1d176ad7e0 Added a new option, --ignore-fs-check. It can be used only with the --metadata option. The clusters causing the inconsistency are saved too.
(Logical change 1.681)
2005-02-28 19:23:20 +00:00
cantab.net!aia21 3009ea72ab Fix compiler warning.
(Logical change 1.617)
2004-10-18 10:24:25 +00:00
elisa-laajakaista.fi!szaka ec00d338cb honor bad clusters list ($BadClus:$Bad), known bad sectors aren't tried to be saved anymore (Szaka)
(Logical change 1.587)
2004-09-30 18:16:48 +00:00
elisa-laajakaista.fi!szaka e68a61101a - ntfsclone: save by using our, not NTFS cluster allocation bitmap.
This gives more control in the future what to save.

(Logical change 1.582)
2004-09-28 23:43:15 +00:00
cantab.net!aia21 b82469ba50 Remove vol->nr_mft_records and update all users. (Anton)
(Logical change 1.549)
2004-09-13 10:28:54 +00:00
elisa-laajakaista.fi!szaka 0b2c6586d8 Fix ntfsclone crash when --restore-image was used for block device outputs (Masaru Kawashima, Szaka)
(Logical change 1.529)
2004-09-03 20:00:47 +00:00
!uv 9747580a05 Warning fixes: printf complains, so add a cast.
(Logical change 1.508)
2004-08-20 12:30:34 +00:00
!uv 0106f54ff0 printf format fix.
(Logical change 1.507)
2004-08-20 12:18:22 +00:00
!uv e7545d7e24 Reorder/pad struct members in order to align to 32 and 64 bit bounderies.
(Logical change 1.505)
2004-08-20 12:01:17 +00:00
!uv 27bf9c0ea0 Allow better compiler optimization/error checking.
(Logical change 1.504)
2004-08-20 11:58:24 +00:00
elisa-laajakaista.fi!szaka 87a2d1bfef added special image format support (Per Olofsson)
(Logical change 1.451)
2004-07-10 20:01:17 +00:00
elisa-laajakaista.fi!szaka b6d50b08ad Fix message, mount -t smbfs doesn't understand 'lfs', only smbmount
(Logical change 1.411)
2004-06-04 08:59:26 +00:00
cantab.net!aia21 d990c89479 - Make endian safe. (Anton)
- Fix some compiler warnings.  (Yuval)

(Logical change 1.379)
2004-04-23 10:12:49 +00:00
cantab.net!aia21 71c1fe3af8 Update
(Logical change 1.374)
2004-04-16 20:54:34 +00:00
elisa-laajakaista.fi!szaka 8c67ce1c36 Fix incorrect getopt_long() usage: converted argv[optind-1] to optarg
so utilities won't do bogus and unexpected things

(Logical change 1.366)
2004-04-15 00:42:33 +00:00
elisa-laajakaista.fi!szaka 61ea0f59d8 ntfsclone --metadata also saves at least the first 8 KiB of the $LogFile
(Logical change 1.365)
2004-04-14 23:31:11 +00:00
elisa-laajakaista.fi!szaka 443662a5d6 destination device must be opened O_RDWR because device_size_get() might need to read()
(Logical change 1.363)
2004-04-13 22:56:11 +00:00
omakaista.fi!szaka 37cf1d9b38 Added some diagnostic and explanatory messages to ntfsclone.
(Logical change 1.354)
2004-04-01 21:30:42 +00:00
omakaista.fi!szaka 5154256c62 - Check the mount state of the output device in ntfsclone.
- Correct a too strong sanity check in ntfsclone that prevented
  cloning from larger device to a smaller one but the NTFS image
  could have fit fully.

(Logical change 1.344)
2004-03-23 02:00:56 +00:00
cantab.net!aia21 60231ba412 - Fix to include sys/ioctl.h.
- Define the ioctls we use if they are not defined, as it is done
  in device.c.

(Logical change 1.336)
2004-03-17 12:22:03 +00:00
cantab.net!aia21 cf419787bd Use sizeof(MFT_RECORD) instead of sizeof(MFT_RECORD) + 6 as MFT_RECORD now
includes the NTFS 3.1+ specific fields.

(Logical change 1.333)
2004-03-15 11:34:30 +00:00
cantab.net!aia21 9193cb6298 Update
Fix warnings on powerpc architecture where it would seem char is
unsigned so comparisons with -1 cause a warning that comparison is
always true/wrong.  (Thanks to Ender for reporting.)

(Logical change 1.324)
2004-03-12 09:30:03 +00:00
cantab.net!aia21 43280fed03 Auto merged
2004/03/09 14:38:50+00:00 cantab.net!aia21
Fix all occurences of printf with %ll length modifiers but 64 bit
arguments to typecast the arguments to (unsigned) long long to avoid
the warnings when compiling on 64 bit architectures.

(Logical change 1.306)
2004-03-09 14:47:34 +00:00