[PATCH v3 6/8] fssum: Use htobe64() instead of a custom macro

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



Remove unnecessary htonll() macro definition.

Macros and functions starting with two underscores are usually internal
and shouldn't be used by applications when a version without "__" is
available.

Signed-off-by: Rostislav Skudnov <rostislav@xxxxxxxxxx>
---
Christoph, I agree with you about this. Using htobe64() is indeed the proper
function to use.
 src/fssum.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/fssum.c b/src/fssum.c
index 13111d6..2eaa236 100644
--- a/src/fssum.c
+++ b/src/fssum.c
@@ -40,6 +40,7 @@
 #include <netinet/in.h>
 #include <inttypes.h>
 #include <assert.h>
+#include <endian.h>
 
 #define CS_SIZE 16
 #define CHUNKS	128
@@ -49,12 +50,6 @@
 #define SEEK_DATA 3
 #define SEEK_HOLE 4
 #endif
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define htonll(x)     __bswap_64 (x)
-#else
-#define htonll(x)     (x)
-#endif
 #endif
 
 /* TODO: add hardlink recognition */
@@ -216,7 +211,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 = htobe64(val);
 	sum_add(dst, &v, sizeof(v));
 }
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux