aboutsummaryrefslogtreecommitdiffstats
path: root/tools/blktap
diff options
context:
space:
mode:
authorRoger Pau Monne <roger.pau@entel.upc.edu>2011-12-20 08:31:40 +0100
committerRoger Pau Monne <roger.pau@entel.upc.edu>2011-12-20 08:31:40 +0100
commit5b4d77e1bd3a48f91207d3c2246fea007875c3c3 (patch)
tree7811f9dab3e017537a72e235b4c63995cbba927c /tools/blktap
parent8f76fc6c983e3bf7c8c32fae2c7264f718e2b467 (diff)
downloadxen-5b4d77e1bd3a48f91207d3c2246fea007875c3c3.tar.gz
xen-5b4d77e1bd3a48f91207d3c2246fea007875c3c3.tar.bz2
xen-5b4d77e1bd3a48f91207d3c2246fea007875c3c3.zip
blktap: remove local definitions and include byteswap.h
Use the same approach as tools/blktap2/include/libvhd.h, remove local definitions of bswap* and include byteswap.h. Also remove the HAVE_BYTESWAP_H ifdef, since it was not defined in this context (it's defined by QEMU). Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu> Committed-by: Ian Jackson <ian.jackson.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/blktap')
-rw-r--r--tools/blktap/drivers/bswap.h38
1 files changed, 1 insertions, 37 deletions
diff --git a/tools/blktap/drivers/bswap.h b/tools/blktap/drivers/bswap.h
index 45016b978b..5578913fd6 100644
--- a/tools/blktap/drivers/bswap.h
+++ b/tools/blktap/drivers/bswap.h
@@ -13,45 +13,9 @@
#define bswap_16(x) swap16(x)
#define bswap_32(x) swap32(x)
#define bswap_64(x) swap64(x)
-#else
+#elif defined(__linux__)
-#ifdef HAVE_BYTESWAP_H
#include <byteswap.h>
-#else
-
-#define bswap_16(x) \
-({ \
- uint16_t __x = (x); \
- ((uint16_t)( \
- (((uint16_t)(__x) & (uint16_t)0x00ffU) << 8) | \
- (((uint16_t)(__x) & (uint16_t)0xff00U) >> 8) )); \
-})
-
-#define bswap_32(x) \
-({ \
- uint32_t __x = (x); \
- ((uint32_t)( \
- (((uint32_t)(__x) & (uint32_t)0x000000ffUL) << 24) | \
- (((uint32_t)(__x) & (uint32_t)0x0000ff00UL) << 8) | \
- (((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >> 8) | \
- (((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) )); \
-})
-
-#define bswap_64(x) \
-({ \
- uint64_t __x = (x); \
- ((uint64_t)( \
- (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000000000ffULL) << 56) | \
- (uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000000000ff00ULL) << 40) | \
- (uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000000000ff0000ULL) << 24) | \
- (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000ff000000ULL) << 8) | \
- (uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000ff00000000ULL) >> 8) | \
- (uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \
- (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \
- (uint64_t)(((uint64_t)(__x) & (uint64_t)0xff00000000000000ULL) >> 56) )); \
-})
-
-#endif /* !HAVE_BYTESWAP_H */
static inline uint16_t bswap16(uint16_t x)
{