diff options
author | David Sterba <dsterba@suse.com> | 2017-03-14 19:01:35 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2017-03-16 17:02:44 +0100 |
commit | 855b4272a4297ee1156304f86a5e9bf81d54a489 (patch) | |
tree | 6cdad48e61c169e5ecd479bbfc78b2c216e3a0d7 /tests | |
parent | 12cae4c2c6c020cbde440e96a6444ba7dc7ba613 (diff) |
btrfs-progs: tests: fssum, use our endianity helper
The function htonll is not provided by the standard library and we can
replace it by our cpu-to-XX helpers. This switches the endianity of the
checksummed value to LE, but this is not a problem.
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/fssum.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/tests/fssum.c b/tests/fssum.c index ebfecf53..2d62ba66 100644 --- a/tests/fssum.c +++ b/tests/fssum.c @@ -21,6 +21,8 @@ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif + +#include "kerncompat.h" #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -43,12 +45,6 @@ #define SEEK_HOLE 4 #endif -#if __BYTE_ORDER == __LITTLE_ENDIAN -#define htonll(x) __bswap_64 (x) -#else -#define htonll(x) (x) -#endif - /* TODO: add hardlink recognition */ /* TODO: add xattr/acl */ @@ -208,7 +204,7 @@ sum_add_sum(sum_t *dst, sum_t *src) void sum_add_u64(sum_t *dst, uint64_t val) { - uint64_t v = htonll(val); + uint64_t v = cpu_to_le64(val); sum_add(dst, &v, sizeof(v)); } |