Commit Graph

99 Commits

Author SHA1 Message Date
Jean-Pierre André
004709fcc1 Silenced warnings about fallthrough situations in switch cases of ntfsprogs
Insert comments to silence compiler about fallthrough situations when
they are wanted.
2020-03-08 09:38:00 +01:00
Erik Larsson
62b5c91420 Fix compiler warnings about mismatching printf format / argument type.
For 64-bit (e.g. x86_64) Linux the 64-bit wide types resolve to long,
not long long as is the case in 32-bit (e.g. i386) Linux. So we need an
explicit cast to long long for 64-bit types since the format string must
specify the 'll' modifier in order to print 64-bit values.
2016-02-16 09:30:49 +01:00
Erik Larsson
9893ea9ee6 Merge endianness fixes.
Conflicts:
	libntfs-3g/attrib.c
2016-01-28 09:22:42 +01:00
Erik Larsson
f076fae75a Fix endianness issues in log and terminal output.
This commit addresses issues where little-endian variables are emitted
raw to a log or output stream which is to be interpreted by the user.

Outputting data in non-native endianness can cause confusion for anybody
attempting to debug issues with a file system.
2015-12-21 23:31:09 +01:00
Jean-Pierre André
4340df770e Supported the directory separator on Windows in ntfsprogs (cosmetic)
On Windows, when an ntfsprogs utility requests a path translation,
translate the '\'s to '/'s so that only '/' have to be interpreted
in libntfs.
2015-04-17 09:15:25 +02:00
Jean-Pierre André
9636ac058f Improved the warning for analyzing an extent in ntfscluster
When analyzing an extent in ntfscluster, mention its base record
2014-03-11 10:47:48 +01:00
Jean-Pierre André
977abdefa2 Fixed endianness bugs in ntfscluster
ntfscluster was not suitable for big-endian CPUs
2014-03-11 10:43:31 +01: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é
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é
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
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
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é
e4a7a56a1a cosmetic : Removed a redundant store in utils_is_metadata() (Fabian Keil) 2011-08-04 15:49:36 +02: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é
9f40bcfc22 Moved ntfs_mbstoucs_libntfscompat() to utils.c 2010-12-21 15:51:07 +01:00
Jean-Pierre André
8f4aa0883b Strengthened variable types 2010-12-21 15:51:07 +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
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
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
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
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
e5690b57d4 Allow mounting volumes with non-clean logfile with force mount option.
Volume left dirty upon umount. So, this is equal to running ntfsfix and then mounting with force option.
2007-09-16 00:15:46 +03:00
Yura Pakhuchiy
37476cf609 Introduce NTFS_MNT_FORCE instead of third parameter of utils_mount_volume 2007-09-15 18:12:32 +03:00
Yura Pakhuchiy
ec2afb736c Fix cache handling in utils_attr_get_name. (Thanks to Bogdan for finding this bug) 2007-09-07 15:31:33 +03:00
Yura Pakhuchiy
95b044cff3 Small enchantments and cleanups from ntfs-3g 2007-09-03 19:51:13 +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
yura
7b60afcc2f fix sparse errors. and first steps towards endianness checking 2006-12-12 15:02:25 +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
fbfbe3b48e force distro developers to fix their broken init scripts 2006-11-25 21:44:35 +00:00
yura
3cd59df400 bit more nice error messages 2006-11-25 18:38:47 +00:00
yura
0ac08318a6 use nice error messages from ntfs-3g 2006-11-13 17:01:53 +00:00
uvman
bd1837335b trace output updates. (Szaka, Yuval) 2006-10-26 20:45:28 +00:00
szaka
c4a3f8b3e9 convert all malloc,calloc to ntfs_{malloc,calloc} 2006-08-13 16:06:57 +00:00
yura
28a2b1f2b0 prepare to Szaka's code merge: remove not working Rich's index code 2006-07-17 11:49:52 +00:00
antona
8bf1dc2232 Update my copyright for the files changed in the last commits. 2006-03-27 22:49:50 +00:00
antona
f4344d6261 Change utils_parse_size() to use a base of 0 instead of 10 when
calling strtoll().  This automagically allows specification of
numbers in hex (and octal if anyone is crazy enough to use that) in
addition to decimal numbers on the command line options to most if
not all utilities.  (Anton)
2006-03-27 22:39:38 +00:00
cha0smaster
eba747ac93 * Add NTFS_DEV_LIST define. Use it everywhere instead of linux-ntfs-dev@lists.sf.net.
* Replace all ntfs_log_trace where we ask to send mail to us with ntfs_log_error
2005-12-18 16:27:20 +00:00
cha0smaster
01787c8c54 update site 2005-12-01 20:44:18 +00:00
flatcap
83b9eddfc9 provide some meaningful function descriptions 2005-11-02 17:34:08 +00:00
szaka
ae42186cf5 utils_inode_get_name(): fix return value in case of success (the function
always returned with failure beforehand)
2005-10-30 22:41:20 +00:00
cha0smaster
1ce16eddb7 minor cleanup 2005-10-27 20:42:10 +00:00
szaka
8b1263c217 Working with regular files needs no longer --force, except for mkntfs 2005-10-27 18:45:45 +00:00
flatcap
5bd198d66e logging renames
utils only uses stderr, now
whitespace fixes
2005-10-26 20:48:00 +00:00
szaka
746dff1a24 NTFS_INDEX_ prefix $I30, $SII, $SDH, $O and $Q indexes 2005-10-23 18:35:58 +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