Remove endianness TODO, should be done now
[fio.git] / os / os.h
diff --git a/os/os.h b/os/os.h
index 3df7b41be4b6447c73783abf03808b38ca2ee586..189041f5546c20e703deaeb499683963fd5a6b1f 100644 (file)
--- a/os/os.h
+++ b/os/os.h
@@ -32,6 +32,9 @@
 
 #ifdef FIO_HAVE_POSIXAIO
 #include <aio.h>
+#ifndef FIO_OS_HAVE_AIOCB_TYPEDEF
+typedef struct aiocb os_aiocb_t;
+#endif
 #endif
 
 #ifdef FIO_HAVE_SGIO
@@ -112,6 +115,34 @@ typedef unsigned long os_cpu_mask_t;
 #define FIO_MAX_JOBS           2048
 #endif
 
+#ifndef FIO_OS_HAVE_SOCKLEN_T
+typedef socklen_t fio_socklen_t;
+#endif
+
+#ifdef FIO_USE_GENERIC_SWAP
+static inline uint16_t fio_swap16(uint16_t val)
+{
+       return (val << 8) | (val >> 8);
+}
+
+static inline uint32_t fio_swap32(uint32_t val)
+{
+       val = ((val & 0xff00ff00UL) >> 8) | ((val & 0x00ff00ffUL) << 8);
+
+       return (val >> 16) | (val << 16);
+}
+
+static inline uint64_t fio_swap64(uint64_t val)
+{
+       val = ((val & 0xff00ff00ff00ff00ULL) >> 8) |
+             ((val & 0x00ff00ff00ff00ffULL) << 8);
+       val = ((val & 0xffff0000ffff0000ULL) >> 16) |
+             ((val & 0x0000ffff0000ffffULL) << 16);
+
+       return (val >> 32) | (val << 32);
+}
+#endif
+
 #ifndef FIO_HAVE_BLKTRACE
 static inline int is_blktrace(const char *fname)
 {
@@ -187,4 +218,11 @@ static inline unsigned int cpus_online(void)
 }
 #endif
 
+#ifndef FIO_HAVE_GETTID
+static inline int gettid(void)
+{
+       return getpid();
+}
+#endif
+
 #endif