Commit Graph

4930 Commits (34bb449324e886b2714a1d872c1aacedf474c0f9)
 

Author SHA1 Message Date
Erik Larsson 34bb449324 Merge branch 'edge' into edge.strict_endians
Conflicts:
	libntfs-3g/dir.c
	libntfs-3g/index.c
	libntfs-3g/runlist.c
	ntfsprogs/ntfsfix.c
	ntfsprogs/ntfsinfo.c
2016-02-05 18:02:02 +01:00
Erik Larsson a2efc3ec9f Change type of all LSN struct members in ntfsrecover.h to leLSN.
This is done to match the type of the LSN struct members in layout.h.
The effect of this change is that while these members were declared with
the le64 type previously, leLSN resolves to sle64. I.e. what was
previously unsigned fields are now signed.

Following this change we also need to switch over a few macros from
unsigned to signed versions in the code that uses these struct
definitions.
2016-01-29 12:36:06 +01:00
Erik Larsson ee4c48f4b1 playlog.c: Use const macro for byteswapping const expression. 2016-01-29 10:49:52 +01:00
Erik Larsson 81fce3b70e playlog.c: Fix improper byteswapping macros used for sle64 members. 2016-01-29 10:49:25 +01:00
Erik Larsson 9893ea9ee6 Merge endianness fixes.
Conflicts:
	libntfs-3g/attrib.c
2016-01-28 09:22:42 +01:00
Erik Larsson 760ddd62cf Merge endianness fixes required for the strict endians code to compile.
Conflicts:
	libntfs-3g/attrib.c
	libntfs-3g/dir.c
	libntfs-3g/logfile.c
	libntfs-3g/volume.c
	ntfsprogs/ntfscp.c
	ntfsprogs/ntfsdump_logfile.c
	ntfsprogs/ntfsfallocate.c
	ntfsprogs/ntfsfix.c
	ntfsprogs/ntfsinfo.c
	ntfsprogs/ntfsresize.c
	ntfsprogs/ntfstruncate.c
2016-01-28 09:21:09 +01:00
Erik Larsson e37258bf01 ntfscmp.c: Fix missing byteswap of little-endian attribute type value. 2016-01-28 09:11:55 +01:00
Erik Larsson 1984a714e5 Enable strict checking of endian-specific types.
Strict checking of endian-specific types mean that types that have a
fixed endianness in the data representation of the value are now defined
as complex types, enabling the compiler to catch mixed usage of these
types with native-endian types. This allows us to catch most issues
relating to usage on big-endian systems since we cannot anymore assign a
fixed-endian value to a native-endian variable and vice-versa without a
compiler error.

The downside is that we aren't able to apply simple binary operators to
the fixed-endian types anymore since they are complex... so all
combining fixed-endian constants and values with |, &, etc. and
comparison with ==, !=, <=, etc. must be replaced with a macro which
unpacks the wrapped value and performs the operation. Lots of changes,
lots of work but in the interest of good code quality it's justified.
2016-01-28 08:29:03 +01:00
Erik Larsson 7e85b4ccd4 Replace switch statements for le/be types with equivalent if statements.
Since the le/be-types are now typedef'd to aggregate types, we can't use
those in switch statements.
2016-01-28 08:29:02 +01:00
Erik Larsson 1fdd4fbb71 Replace all le64 "not" negations with le64_not(...). 2016-01-28 08:29:01 +01:00
Erik Larsson 597adff2bb Replace all le32 "not" negations with le32_not(...). 2016-01-28 08:29:00 +01:00
Erik Larsson 85588b8e92 Replace all le16 "not" negations with le16_not(...). 2016-01-28 08:28:59 +01:00
Erik Larsson 46dfbe17ec Replace all le64 "xor" calculations with le64_xor(...). 2016-01-28 08:28:58 +01:00
Erik Larsson 14190d81b3 Replace all le32 "xor" calculations with le32_xor(...). 2016-01-28 08:28:57 +01:00
Erik Larsson 1118a56eea Replace all le16 "xor" calculations with le16_xor(...). 2016-01-28 08:28:56 +01:00
Erik Larsson cc414d9e8b Replace all le64 "or" calculations with le64_or(...). 2016-01-28 08:28:55 +01:00
Erik Larsson 1500a77676 Replace all le32 "or" calculations with le32_or(...). 2016-01-28 08:28:54 +01:00
Erik Larsson b61e7ff449 Replace all le16 "or" calculations with le16_or(...). 2016-01-28 08:28:53 +01:00
Erik Larsson 66d7b85573 Replace all le64 "and" calculations with le64_and(...). 2016-01-28 08:28:52 +01:00
Erik Larsson 7b3700ed5e Replace all le32 "and" calculations with le32_and(...). 2016-01-28 08:28:51 +01:00
Erik Larsson 2b4c3a618c Replace all le16 "and" calculations with le16_and(...). 2016-01-28 08:28:50 +01:00
Erik Larsson e970b57c74 Replace all le32 zero "and" test conditions with le32_andz(...). 2016-01-28 08:28:49 +01:00
Erik Larsson 9f5ad52e5f Replace all le32 non-zero "and" test conditions with !le32_andz(...). 2016-01-28 08:28:48 +01:00
Erik Larsson 1b7bfaa133 Replace all le16 zero "and" test conditions with le16_andz(...). 2016-01-28 08:28:47 +01:00
Erik Larsson 35c72761c7 Replace all le16 non-zero "and" test conditions with !le16_andz(...). 2016-01-28 08:28:46 +01:00
Erik Larsson 01c493f16c Replace all be16 zero test conditions with "be16_cmpz(...)". 2016-01-28 08:28:45 +01:00
Erik Larsson 5097bb9ea3 Replace all sle64 zero test conditions with "sle64_cmpz(...)". 2016-01-28 08:28:44 +01:00
Erik Larsson 97ccd587d6 Replace all sle64 non-zero test conditions with "!sle64_cmpz(...)". 2016-01-28 08:28:43 +01:00
Erik Larsson 65eea3fe0a Replace all le64 zero test conditions with "le64_cmpz(...)". 2016-01-28 08:28:42 +01:00
Erik Larsson 17a2c5f58e Replace all le64 non-zero test conditions with "!le64_cmpz(...)". 2016-01-28 08:28:41 +01:00
Erik Larsson ed87a4dffa Replace all le32 zero test conditions with "le32_cmpz(...)". 2016-01-28 08:28:40 +01:00
Erik Larsson 18990412fa Replace all le32 non-zero test conditions with "!le32_cmpz(...)". 2016-01-28 08:28:39 +01:00
Erik Larsson e366bef954 Replace all le16 zero test conditions with "le16_cmpz(...)". 2016-01-28 08:28:38 +01:00
Erik Larsson 90697bb5ab Replace all le16 non-zero test conditions with "!le16_cmpz(...)". 2016-01-28 08:28:37 +01:00
Erik Larsson c29924872f Replace all be32 usage of the '==' operation with "be32_eq(...)". 2016-01-28 08:28:36 +01:00
Erik Larsson e616a84f21 Replace all be16 usage of the '==' operation with "be16_eq(...)". 2016-01-28 08:28:35 +01:00
Erik Larsson 0657987a0b Replace all sle64 usage of the '!=' operation with "!sle64_eq(...)". 2016-01-28 08:28:34 +01:00
Erik Larsson 7b85755080 Replace all sle64 usage of the '==' operation with "sle64_eq(...)". 2016-01-28 08:28:33 +01:00
Erik Larsson e1bd02ed74 Replace all sle16 usage of the '!=' operation with "!sle16_eq(...)". 2016-01-28 08:28:32 +01:00
Erik Larsson 94589cde03 Replace all sle16 usage of the '==' operation with "sle16_eq(...)". 2016-01-28 08:28:31 +01:00
Erik Larsson d61f8615d9 Replace all le64 usage of the '!=' operation with "!le64_eq(...)". 2016-01-28 08:28:30 +01:00
Erik Larsson 7a88d7821e Replace all le64 usage of the '==' operation with "le64_eq(...)". 2016-01-28 08:28:28 +01:00
Erik Larsson 0876896169 Replace all le32 usage of the '!=' operation with "!le32_eq(...)". 2016-01-28 08:28:27 +01:00
Erik Larsson 011a9e9e5e Replace all le32 usage of the '==' operation with "le32_eq(...)". 2016-01-28 08:28:26 +01:00
Erik Larsson 59a05b5c34 Replace all le16 usage of the '!=' operation with "!le16_eq(...)". 2016-01-28 08:28:25 +01:00
Erik Larsson 347bdf21ec Replace all le16 usage of the '==' operation with "le16_eq(...)". 2016-01-28 08:28:23 +01:00
Erik Larsson 8aca3d4800 ntfsmove.c: Fix multiple cases of raw usage of little-endian fields.
There were multiple cases of little-endian fields being used as
CPU-endian without byte swapping. This would result in incorrect
behaviour on big-endian systems.
2016-01-27 15:28:55 +01:00
Erik Larsson 8daa92717e ntfsdump_logfile.c: Fix use of wrong byteswapping macro for le16 field. 2016-01-27 15:26:51 +01:00
Erik Larsson 0741f54b2e ntfsdump_logfile.c: Fix incorrectly parenthesized expression.
On big-endian systems the result of the '!=' operation would be
endian-swapped rather than the first argument (which must have been the
intended action).
2016-01-27 15:24:52 +01:00
Erik Larsson 55dafda732 ntfsck.c: Fix comparing le32 values as u32.
This is harmless except when we do strict endianness checking, in which
case this results in a compile error. Fixed by converting values to
CPU endianness before comparing them.
2016-01-27 15:23:13 +01:00