Move os/arch/compiler headers into directories
authorJens Axboe <jens.axboe@oracle.com>
Mon, 2 Apr 2007 19:36:44 +0000 (21:36 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Mon, 2 Apr 2007 19:36:44 +0000 (21:36 +0200)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
49 files changed:
arch-alpha.h [deleted file]
arch-ia64.h [deleted file]
arch-ppc.h [deleted file]
arch-s390.h [deleted file]
arch-x86.h [deleted file]
arch-x86_64.h [deleted file]
arch.h [deleted file]
arch/arch-alpha.h [new file with mode: 0644]
arch/arch-ia64.h [new file with mode: 0644]
arch/arch-ppc.h [new file with mode: 0644]
arch/arch-s390.h [new file with mode: 0644]
arch/arch-x86.h [new file with mode: 0644]
arch/arch-x86_64.h [new file with mode: 0644]
arch/arch.h [new file with mode: 0644]
compiler-gcc3.h [deleted file]
compiler-gcc4.h [deleted file]
compiler.h [deleted file]
compiler/compiler-gcc3.h [new file with mode: 0644]
compiler/compiler-gcc4.h [new file with mode: 0644]
compiler/compiler.h [new file with mode: 0644]
engines/cpu.c
engines/guasi.c
engines/libaio.c
engines/mmap.c
engines/net.c
engines/null.c
engines/posixaio.c
engines/sg.c
engines/skeleton_external.c
engines/splice.c
engines/sync.c
engines/syslet-rw.c
eta.c
filesetup.c
fio.c
fio.h
gettime.c
io_u.c
ioengines.c
memory.c
os-freebsd.h [deleted file]
os-linux.h [deleted file]
os-solaris.h [deleted file]
os.h [deleted file]
os/os-freebsd.h [new file with mode: 0644]
os/os-linux.h [new file with mode: 0644]
os/os-solaris.h [new file with mode: 0644]
os/os.h [new file with mode: 0644]
verify.c

diff --git a/arch-alpha.h b/arch-alpha.h
deleted file mode 100644 (file)
index 09293bd..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef ARCH_ALPHA_H
-#define ARCH_ALPHA_H
-
-#define ARCH   (arch_alpha)
-
-#ifndef __NR_ioprio_set
-#define __NR_ioprio_set                442
-#define __NR_ioprio_get                443
-#endif
-
-#ifndef __NR_fadvise64
-#define __NR_fadvise64         413
-#endif
-
-#define nop    do { } while (0)
-#define ffz(v) generic_ffz((v))
-
-#endif
diff --git a/arch-ia64.h b/arch-ia64.h
deleted file mode 100644 (file)
index b3ee0c3..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef ARCH_IA64_H
-#define ARCH_IA64_H
-
-#define ARCH   (arch_ia64)
-
-#ifndef __NR_ioprio_set
-#define __NR_ioprio_set                1274
-#define __NR_ioprio_get                1275
-#endif
-
-#ifndef __NR_fadvise64
-#define __NR_fadvise64         1234
-#endif
-
-#ifndef __NR_sys_splice
-#define __NR_sys_splice                1297
-#define __NR_sys_tee           1301
-#define __NR_sys_vmsplice      1302
-#endif
-
-#define nop    asm volatile ("hint @pause" ::: "memory");
-
-#define ia64_popcnt(x)                                                 \
-({                                                                     \
-       unsigned long ia64_intri_res;                                   \
-       asm ("popcnt %0=%1" : "=r" (ia64_intri_res) : "r" (x));         \
-       ia64_intri_res;                                                 \
-})
-
-static inline unsigned long ffz(unsigned long bitmask)
-{
-       return ia64_popcnt(bitmask & (~bitmask - 1));
-}
-
-#endif
diff --git a/arch-ppc.h b/arch-ppc.h
deleted file mode 100644 (file)
index 8bfed59..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef ARCH_PPC_H
-#define ARCH_PPH_H
-
-#define ARCH   (arch_ppc)
-
-#ifndef __NR_ioprio_set
-#define __NR_ioprio_set                273
-#define __NR_ioprio_get                274
-#endif
-
-#ifndef __NR_fadvise64
-#define __NR_fadvise64         233
-#endif
-
-#ifndef __NR_sys_splice
-#define __NR_sys_splice                283
-#define __NR_sys_tee           284
-#define __NR_sys_vmsplice      285
-#endif
-
-#define nop    do { } while (0)
-
-static inline int __ilog2(unsigned long bitmask)
-{
-       int lz;
-
-       asm ("cntlzw %0,%1" : "=r" (lz) : "r" (bitmask));
-       return 31 - lz;
-}
-
-static inline int ffz(unsigned long bitmask)
-{
-       if ((bitmask = ~bitmask) == 0)
-               return 32;
-       return  __ilog2(bitmask & -bitmask);
-}
-
-#endif
diff --git a/arch-s390.h b/arch-s390.h
deleted file mode 100644 (file)
index b7048ad..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef ARCH_S390_H
-#define ARCH_S390_H
-
-#define ARCH   (arch_s390)
-
-#ifndef __NR_ioprio_set
-#define __NR_ioprio_set                282
-#define __NR_ioprio_get                283
-#endif
-
-#ifndef __NR_fadvise64
-#define __NR_fadvise64         253
-#endif
-
-#define nop    asm volatile ("diag 0,0,68" : : : "memory")
-#define ffz(v) generic_ffz((v))
-
-#endif
diff --git a/arch-x86.h b/arch-x86.h
deleted file mode 100644 (file)
index aa10692..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef ARCH_X86_H
-#define ARCH_X86_H
-
-#define ARCH   (arch_i386)
-
-#ifndef __NR_ioprio_set
-#define __NR_ioprio_set                289
-#define __NR_ioprio_get                290
-#endif
-
-#ifndef __NR_fadvise64
-#define __NR_fadvise64         250
-#endif
-
-#ifndef __NR_sys_splice
-#define __NR_sys_splice                313
-#define __NR_sys_tee           315
-#define __NR_sys_vmsplice      316
-#endif
-
-#ifndef __NR_async_exec
-#define __NR_async_exec                320
-#define __NR_async_wait                321
-#define __NR_umem_add          322
-#define __NR_async_thread      323
-#endif
-
-#define        FIO_HUGE_PAGE           4194304
-
-#define FIO_HAVE_SYSLET
-
-#define nop    __asm__ __volatile__("rep;nop": : :"memory")
-
-static inline unsigned long ffz(unsigned long bitmask)
-{
-       __asm__("bsfl %1,%0" :"=r" (bitmask) :"r" (~bitmask));
-       return bitmask;
-}
-
-#endif
diff --git a/arch-x86_64.h b/arch-x86_64.h
deleted file mode 100644 (file)
index 4e0ad5f..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef ARCH_X86_64_h
-#define ARCH_X86_64_h
-
-#define ARCH   (arch_x86_64)
-
-#ifndef __NR_ioprio_set
-#define __NR_ioprio_set                251
-#define __NR_ioprio_get                252
-#endif
-
-#ifndef __NR_fadvise64
-#define __NR_fadvise64         221
-#endif
-
-#ifndef __NR_sys_splice
-#define __NR_sys_splice                275
-#define __NR_sys_tee           276
-#define __NR_sys_vmsplice      278
-#endif
-
-#ifndef __NR_async_exec
-#define __NR_async_exec                280
-#define __NR_async_wait                281
-#define __NR_umem_add          282
-#define __NR_async_thread      283
-#endif
-
-#define        FIO_HUGE_PAGE           2097152
-
-#define FIO_HAVE_SYSLET
-
-#define nop    __asm__ __volatile__("rep;nop": : :"memory")
-
-static inline unsigned long ffz(unsigned long bitmask)
-{
-       __asm__("bsfq %1,%0" :"=r" (bitmask) :"r" (~bitmask));
-       return bitmask;
-}
-
-
-#endif
diff --git a/arch.h b/arch.h
deleted file mode 100644 (file)
index 745bf3a..0000000
--- a/arch.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef ARCH_H
-#define ARCH_H
-
-enum {
-       arch_x86_64,
-       arch_i386,
-       arch_ppc,
-       arch_ia64,
-       arch_s390,
-       arch_alpha,
-};
-
-static inline unsigned long generic_ffz(unsigned long word)
-{
-       unsigned int i;
-
-       for (i = 0; i < sizeof(word) * 8; i++)
-               if ((word & (1UL << i)) == 0)
-                       return i;
-
-       return -1;
-}
-
-#if defined(__i386__)
-#include "arch-x86.h"
-#elif defined(__x86_64__)
-#include "arch-x86_64.h"
-#elif defined(__powerpc__) || defined(__powerpc64__)
-#include "arch-ppc.h"
-#elif defined(__ia64__)
-#include "arch-ia64.h"
-#elif defined(__alpha__)
-#include "arch-alpha.h"
-#elif defined(__s390x__) || defined(__s390__)
-#include "arch-s390.h"
-#else
-#error "Unsupported arch"
-#endif
-
-#define BITS_PER_LONG  (__WORDSIZE)
-
-#endif
diff --git a/arch/arch-alpha.h b/arch/arch-alpha.h
new file mode 100644 (file)
index 0000000..09293bd
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef ARCH_ALPHA_H
+#define ARCH_ALPHA_H
+
+#define ARCH   (arch_alpha)
+
+#ifndef __NR_ioprio_set
+#define __NR_ioprio_set                442
+#define __NR_ioprio_get                443
+#endif
+
+#ifndef __NR_fadvise64
+#define __NR_fadvise64         413
+#endif
+
+#define nop    do { } while (0)
+#define ffz(v) generic_ffz((v))
+
+#endif
diff --git a/arch/arch-ia64.h b/arch/arch-ia64.h
new file mode 100644 (file)
index 0000000..b3ee0c3
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef ARCH_IA64_H
+#define ARCH_IA64_H
+
+#define ARCH   (arch_ia64)
+
+#ifndef __NR_ioprio_set
+#define __NR_ioprio_set                1274
+#define __NR_ioprio_get                1275
+#endif
+
+#ifndef __NR_fadvise64
+#define __NR_fadvise64         1234
+#endif
+
+#ifndef __NR_sys_splice
+#define __NR_sys_splice                1297
+#define __NR_sys_tee           1301
+#define __NR_sys_vmsplice      1302
+#endif
+
+#define nop    asm volatile ("hint @pause" ::: "memory");
+
+#define ia64_popcnt(x)                                                 \
+({                                                                     \
+       unsigned long ia64_intri_res;                                   \
+       asm ("popcnt %0=%1" : "=r" (ia64_intri_res) : "r" (x));         \
+       ia64_intri_res;                                                 \
+})
+
+static inline unsigned long ffz(unsigned long bitmask)
+{
+       return ia64_popcnt(bitmask & (~bitmask - 1));
+}
+
+#endif
diff --git a/arch/arch-ppc.h b/arch/arch-ppc.h
new file mode 100644 (file)
index 0000000..8bfed59
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef ARCH_PPC_H
+#define ARCH_PPH_H
+
+#define ARCH   (arch_ppc)
+
+#ifndef __NR_ioprio_set
+#define __NR_ioprio_set                273
+#define __NR_ioprio_get                274
+#endif
+
+#ifndef __NR_fadvise64
+#define __NR_fadvise64         233
+#endif
+
+#ifndef __NR_sys_splice
+#define __NR_sys_splice                283
+#define __NR_sys_tee           284
+#define __NR_sys_vmsplice      285
+#endif
+
+#define nop    do { } while (0)
+
+static inline int __ilog2(unsigned long bitmask)
+{
+       int lz;
+
+       asm ("cntlzw %0,%1" : "=r" (lz) : "r" (bitmask));
+       return 31 - lz;
+}
+
+static inline int ffz(unsigned long bitmask)
+{
+       if ((bitmask = ~bitmask) == 0)
+               return 32;
+       return  __ilog2(bitmask & -bitmask);
+}
+
+#endif
diff --git a/arch/arch-s390.h b/arch/arch-s390.h
new file mode 100644 (file)
index 0000000..b7048ad
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef ARCH_S390_H
+#define ARCH_S390_H
+
+#define ARCH   (arch_s390)
+
+#ifndef __NR_ioprio_set
+#define __NR_ioprio_set                282
+#define __NR_ioprio_get                283
+#endif
+
+#ifndef __NR_fadvise64
+#define __NR_fadvise64         253
+#endif
+
+#define nop    asm volatile ("diag 0,0,68" : : : "memory")
+#define ffz(v) generic_ffz((v))
+
+#endif
diff --git a/arch/arch-x86.h b/arch/arch-x86.h
new file mode 100644 (file)
index 0000000..aa10692
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef ARCH_X86_H
+#define ARCH_X86_H
+
+#define ARCH   (arch_i386)
+
+#ifndef __NR_ioprio_set
+#define __NR_ioprio_set                289
+#define __NR_ioprio_get                290
+#endif
+
+#ifndef __NR_fadvise64
+#define __NR_fadvise64         250
+#endif
+
+#ifndef __NR_sys_splice
+#define __NR_sys_splice                313
+#define __NR_sys_tee           315
+#define __NR_sys_vmsplice      316
+#endif
+
+#ifndef __NR_async_exec
+#define __NR_async_exec                320
+#define __NR_async_wait                321
+#define __NR_umem_add          322
+#define __NR_async_thread      323
+#endif
+
+#define        FIO_HUGE_PAGE           4194304
+
+#define FIO_HAVE_SYSLET
+
+#define nop    __asm__ __volatile__("rep;nop": : :"memory")
+
+static inline unsigned long ffz(unsigned long bitmask)
+{
+       __asm__("bsfl %1,%0" :"=r" (bitmask) :"r" (~bitmask));
+       return bitmask;
+}
+
+#endif
diff --git a/arch/arch-x86_64.h b/arch/arch-x86_64.h
new file mode 100644 (file)
index 0000000..4e0ad5f
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef ARCH_X86_64_h
+#define ARCH_X86_64_h
+
+#define ARCH   (arch_x86_64)
+
+#ifndef __NR_ioprio_set
+#define __NR_ioprio_set                251
+#define __NR_ioprio_get                252
+#endif
+
+#ifndef __NR_fadvise64
+#define __NR_fadvise64         221
+#endif
+
+#ifndef __NR_sys_splice
+#define __NR_sys_splice                275
+#define __NR_sys_tee           276
+#define __NR_sys_vmsplice      278
+#endif
+
+#ifndef __NR_async_exec
+#define __NR_async_exec                280
+#define __NR_async_wait                281
+#define __NR_umem_add          282
+#define __NR_async_thread      283
+#endif
+
+#define        FIO_HUGE_PAGE           2097152
+
+#define FIO_HAVE_SYSLET
+
+#define nop    __asm__ __volatile__("rep;nop": : :"memory")
+
+static inline unsigned long ffz(unsigned long bitmask)
+{
+       __asm__("bsfq %1,%0" :"=r" (bitmask) :"r" (~bitmask));
+       return bitmask;
+}
+
+
+#endif
diff --git a/arch/arch.h b/arch/arch.h
new file mode 100644 (file)
index 0000000..745bf3a
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef ARCH_H
+#define ARCH_H
+
+enum {
+       arch_x86_64,
+       arch_i386,
+       arch_ppc,
+       arch_ia64,
+       arch_s390,
+       arch_alpha,
+};
+
+static inline unsigned long generic_ffz(unsigned long word)
+{
+       unsigned int i;
+
+       for (i = 0; i < sizeof(word) * 8; i++)
+               if ((word & (1UL << i)) == 0)
+                       return i;
+
+       return -1;
+}
+
+#if defined(__i386__)
+#include "arch-x86.h"
+#elif defined(__x86_64__)
+#include "arch-x86_64.h"
+#elif defined(__powerpc__) || defined(__powerpc64__)
+#include "arch-ppc.h"
+#elif defined(__ia64__)
+#include "arch-ia64.h"
+#elif defined(__alpha__)
+#include "arch-alpha.h"
+#elif defined(__s390x__) || defined(__s390__)
+#include "arch-s390.h"
+#else
+#error "Unsupported arch"
+#endif
+
+#define BITS_PER_LONG  (__WORDSIZE)
+
+#endif
diff --git a/compiler-gcc3.h b/compiler-gcc3.h
deleted file mode 100644 (file)
index ab8ccc4..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef FIO_COMPILER_GCC3_H
-#define FIO_COMPILER_GCC3_H
-
-#if __GNUC_MINOR__ >= 4
-#define __must_check           __attribute__((warn_unused_result))
-#endif
-
-#endif
diff --git a/compiler-gcc4.h b/compiler-gcc4.h
deleted file mode 100644 (file)
index bb9cc7c..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef FIO_COMPILER_GCC4_H
-#define FIO_COMPILER_GCC4_H
-
-#define __must_check           __attribute__((warn_unused_result))
-
-#endif
diff --git a/compiler.h b/compiler.h
deleted file mode 100644 (file)
index 72e8419..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef FIO_COMPILER_H
-#define FIO_COMPILER_H
-
-#if __GNUC__ >= 4
-#include "compiler-gcc4.h"
-#elif __GNUC__ == 3
-#include "compiler-gcc3.h"
-#else
-#error Compiler too old, need gcc at least gcc 3.x
-#endif
-
-#ifndef __must_check
-#define __must_check
-#endif
-
-#endif
diff --git a/compiler/compiler-gcc3.h b/compiler/compiler-gcc3.h
new file mode 100644 (file)
index 0000000..ab8ccc4
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef FIO_COMPILER_GCC3_H
+#define FIO_COMPILER_GCC3_H
+
+#if __GNUC_MINOR__ >= 4
+#define __must_check           __attribute__((warn_unused_result))
+#endif
+
+#endif
diff --git a/compiler/compiler-gcc4.h b/compiler/compiler-gcc4.h
new file mode 100644 (file)
index 0000000..bb9cc7c
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef FIO_COMPILER_GCC4_H
+#define FIO_COMPILER_GCC4_H
+
+#define __must_check           __attribute__((warn_unused_result))
+
+#endif
diff --git a/compiler/compiler.h b/compiler/compiler.h
new file mode 100644 (file)
index 0000000..72e8419
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef FIO_COMPILER_H
+#define FIO_COMPILER_H
+
+#if __GNUC__ >= 4
+#include "compiler-gcc4.h"
+#elif __GNUC__ == 3
+#include "compiler-gcc3.h"
+#else
+#error Compiler too old, need gcc at least gcc 3.x
+#endif
+
+#ifndef __must_check
+#define __must_check
+#endif
+
+#endif
index 9fac418b615cfe76ba9fc1569ea68819abd7d2f8..cfdf281d1b2ede15ecb7aea920af4eca3bb3b0d1 100644 (file)
@@ -6,7 +6,6 @@
  *
  */
 #include "../fio.h"
  *
  */
 #include "../fio.h"
-#include "../os.h"
 
 static int fio_cpuio_queue(struct thread_data *td, struct io_u fio_unused *io_u)
 {
 
 static int fio_cpuio_queue(struct thread_data *td, struct io_u fio_unused *io_u)
 {
index d67699afafae6b82ef59f838863ef458a21aaa18..1d3c77f6bce16752eb688928c523d64fcf23b1bb 100644 (file)
@@ -20,7 +20,6 @@
 #include <assert.h>
 
 #include "../fio.h"
 #include <assert.h>
 
 #include "../fio.h"
-#include "../os.h"
 
 #ifdef FIO_HAVE_GUASI
 
 
 #ifdef FIO_HAVE_GUASI
 
index 7c44927a3b8b5a3ac39b37b4eb43ed6760582d87..871c5a4785d727a72471499ffca93344ff660b1c 100644 (file)
@@ -11,7 +11,6 @@
 #include <assert.h>
 
 #include "../fio.h"
 #include <assert.h>
 
 #include "../fio.h"
-#include "../os.h"
 
 #ifdef FIO_HAVE_LIBAIO
 
 
 #ifdef FIO_HAVE_LIBAIO
 
index da6906947764ba099c377be51bae7c231b070ee6..95ad1d842250049162564a078864070cc28c8f2e 100644 (file)
@@ -13,7 +13,6 @@
 #include <sys/mman.h>
 
 #include "../fio.h"
 #include <sys/mman.h>
 
 #include "../fio.h"
-#include "../os.h"
 
 static int fio_mmapio_queue(struct thread_data *td, struct io_u *io_u)
 {
 
 static int fio_mmapio_queue(struct thread_data *td, struct io_u *io_u)
 {
index 66f1e607ed7f258e6b804ae4471fc23fa3e21c19..4de86c12831c758365fc674359da3b445faaedc4 100644 (file)
@@ -15,7 +15,6 @@
 #include <sys/poll.h>
 
 #include "../fio.h"
 #include <sys/poll.h>
 
 #include "../fio.h"
-#include "../os.h"
 
 struct netio_data {
        int listenfd;
 
 struct netio_data {
        int listenfd;
index 724feca716edea0d105be29fab963ffd6f97341f..70d1fa78f8bed7b9de40e7a0bc6d29d0e3db03c9 100644 (file)
@@ -12,7 +12,6 @@
 #include <assert.h>
 
 #include "../fio.h"
 #include <assert.h>
 
 #include "../fio.h"
-#include "../os.h"
 
 struct null_data {
        struct io_u **io_us;
 
 struct null_data {
        struct io_u **io_us;
index 4aa7420c020dffbfff36a77d74c3d15b7fb6dc3b..88ed40266390a0b0e2d88420f3aef595a6fa7a10 100644 (file)
@@ -11,7 +11,6 @@
 #include <assert.h>
 
 #include "../fio.h"
 #include <assert.h>
 
 #include "../fio.h"
-#include "../os.h"
 
 #ifdef FIO_HAVE_POSIXAIO
 
 
 #ifdef FIO_HAVE_POSIXAIO
 
index 8856c6f9dc6c98c874c0a51dcd90daf51fadfacf..cc50d6b937e747009b39d1651ab279800ee8a446 100644 (file)
@@ -12,7 +12,6 @@
 #include <sys/poll.h>
 
 #include "../fio.h"
 #include <sys/poll.h>
 
 #include "../fio.h"
-#include "../os.h"
 
 #ifdef FIO_HAVE_SGIO
 
 
 #ifdef FIO_HAVE_SGIO
 
index 4c0c926c9cc347c6526cf290cb3be3ec3a0bb347..9000accf5e2d639f28f533993fed775519d3d2da 100644 (file)
@@ -13,7 +13,6 @@
 #include <assert.h>
 
 #include "../fio.h"
 #include <assert.h>
 
 #include "../fio.h"
-#include "../os.h"
 
 /*
  * The core of the module is identical to the ones included with fio,
 
 /*
  * The core of the module is identical to the ones included with fio,
index 6d843538fb73bc01b0ee3e0f58701933fbddac3a..b92da4a85577d1d945b354699861ff412ef6b1d7 100644 (file)
@@ -13,7 +13,6 @@
 #include <sys/poll.h>
 
 #include "../fio.h"
 #include <sys/poll.h>
 
 #include "../fio.h"
-#include "../os.h"
 
 #ifdef FIO_HAVE_SPLICE
 
 
 #ifdef FIO_HAVE_SPLICE
 
index a137282786e8759f0c175230a2c45206a814235d..ee8e3c367360166b7f95b312988ff89c07b5e09e 100644 (file)
@@ -12,7 +12,6 @@
 #include <assert.h>
 
 #include "../fio.h"
 #include <assert.h>
 
 #include "../fio.h"
-#include "../os.h"
 
 static int fio_syncio_prep(struct thread_data *td, struct io_u *io_u)
 {
 
 static int fio_syncio_prep(struct thread_data *td, struct io_u *io_u)
 {
index d225cc41630d0a4838da6d41ae1b7da485f11fa6..7e407d785bfbcbb73125214d48e88d1bbd679c9f 100644 (file)
@@ -13,7 +13,6 @@
 #include <asm/unistd.h>
 
 #include "../fio.h"
 #include <asm/unistd.h>
 
 #include "../fio.h"
-#include "../os.h"
 
 #ifdef FIO_HAVE_SYSLET
 
 
 #ifdef FIO_HAVE_SYSLET
 
diff --git a/eta.c b/eta.c
index a48cadae70684b43e901a2b9fc18bedf23d42504..31028dd840976e4d1137824c1101269351ec7b2a 100644 (file)
--- a/eta.c
+++ b/eta.c
@@ -6,7 +6,6 @@
 #include <string.h>
 
 #include "fio.h"
 #include <string.h>
 
 #include "fio.h"
-#include "os.h"
 
 static char run_str[MAX_JOBS + 1];
 
 
 static char run_str[MAX_JOBS + 1];
 
index 78264d3d5526d4924f8f49e1509bd9d87dce7bf9..c99d5b36dad8195129d40c048eb966d36caebae0 100644 (file)
@@ -8,7 +8,6 @@
 #include <sys/types.h>
 
 #include "fio.h"
 #include <sys/types.h>
 
 #include "fio.h"
-#include "os.h"
 
 static int extend_file(struct thread_data *td, struct fio_file *f)
 {
 
 static int extend_file(struct thread_data *td, struct fio_file *f)
 {
diff --git a/fio.c b/fio.c
index 125cf6fb6cfa93b44aaa468b0f5f6fd7fcfbbb85..a945b856eaf86afe018cb181e083df7a1636712e 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -35,7 +35,6 @@
 #include <sys/mman.h>
 
 #include "fio.h"
 #include <sys/mman.h>
 
 #include "fio.h"
-#include "os.h"
 
 unsigned long page_mask;
 unsigned long page_size;
 
 unsigned long page_mask;
 unsigned long page_size;
diff --git a/fio.h b/fio.h
index a62971d1637d88f09da136d92ed1ee3909944b14..6b70805966d9d93d66cba25136429d563969b7e6 100644 (file)
--- a/fio.h
+++ b/fio.h
 #include <string.h>
 #include <getopt.h>
 
 #include <string.h>
 #include <getopt.h>
 
-#include "compiler.h"
+#include "compiler/compiler.h"
 #include "list.h"
 #include "rbtree.h"
 #include "md5.h"
 #include "crc32.h"
 #include "list.h"
 #include "rbtree.h"
 #include "md5.h"
 #include "crc32.h"
-#include "arch.h"
-#include "os.h"
+#include "arch/arch.h"
+#include "os/os.h"
 #include "mutex.h"
 
 #ifdef FIO_HAVE_SYSLET
 #include "mutex.h"
 
 #ifdef FIO_HAVE_SYSLET
index 4f6ec955c561cf49b9bfae3740f1c4968d51a0ff..136c02c15af797bc9057ea10a1511f1d79e856a4 100644 (file)
--- a/gettime.c
+++ b/gettime.c
@@ -6,7 +6,6 @@
 #include <sys/time.h>
 
 #include "fio.h"
 #include <sys/time.h>
 
 #include "fio.h"
-#include "os.h"
 
 #include "hash.h"
 
 
 #include "hash.h"
 
diff --git a/io_u.c b/io_u.c
index b48c99dad3ed4a3eb25650de53f59203463af850..1ae63789c7edc8703f3edad2d32c770533385e4d 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -6,7 +6,6 @@
 #include <assert.h>
 
 #include "fio.h"
 #include <assert.h>
 
 #include "fio.h"
-#include "os.h"
 
 /*
  * Change this define to play with the timeout handling
 
 /*
  * Change this define to play with the timeout handling
index 3cfa773ac07ea2e79d6f17c6ef38ffc360947035..998c13ee7ce96c1123ec913e550ef0d6519d63d7 100644 (file)
@@ -17,7 +17,6 @@
 #include <assert.h>
 
 #include "fio.h"
 #include <assert.h>
 
 #include "fio.h"
-#include "os.h"
 
 static LIST_HEAD(engine_list);
 
 
 static LIST_HEAD(engine_list);
 
index 8d6f95579a3366cb633226237965c5de971243e4..b5a71d5397fd852d42e2fb73f4d45b2a90d38e3b 100644 (file)
--- a/memory.c
+++ b/memory.c
@@ -6,7 +6,6 @@
 #include <sys/mman.h>
 
 #include "fio.h"
 #include <sys/mman.h>
 
 #include "fio.h"
-#include "os.h"
 
 static void *pinned_mem;
 
 
 static void *pinned_mem;
 
diff --git a/os-freebsd.h b/os-freebsd.h
deleted file mode 100644 (file)
index 01c5ce9..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-#ifndef FIO_OS_FREEBSD_H
-#define FIO_OS_FREEBSD_H
-
-#include <sys/sysctl.h>
-
-#undef FIO_HAVE_LIBAIO
-#define FIO_HAVE_POSIXAIO
-#undef FIO_HAVE_FADVISE
-#undef FIO_HAVE_CPU_AFFINITY
-#undef FIO_HAVE_DISK_UTIL
-#undef FIO_HAVE_SGIO
-#define FIO_HAVE_ODIRECT
-
-#define OS_MAP_ANON            (MAP_ANON)
-
-typedef unsigned long os_cpu_mask_t;
-typedef unsigned int os_random_state_t;
-
-/*
- * FIXME
- */
-static inline int blockdev_size(int fd, unsigned long long *bytes)
-{
-       return EINVAL;
-}
-
-static inline int blockdev_invalidate_cache(int fd)
-{
-       return EINVAL;
-}
-
-static inline unsigned long long os_phys_mem(void)
-{
-       int mib[2] = { CTL_HW, HW_PHYSMEM };
-       unsigned long long mem;
-       size_t len = sizeof(mem);
-
-       sysctl(mib, 2, &mem, &len, NULL, 0);
-       return mem;
-}
-
-static inline void os_random_seed(unsigned long seed, os_random_state_t *rs)
-{
-       srand(seed);
-}
-
-static inline long os_random_long(os_random_state_t *rs)
-{
-       long val;
-
-       val = rand_r(rs);
-       return val;
-}
-
-static inline double os_random_double(os_random_state_t *rs)
-{
-       double val;
-
-       val = (double) rand_r(rs);
-       return val;
-}
-#endif
diff --git a/os-linux.h b/os-linux.h
deleted file mode 100644 (file)
index 561b273..0000000
+++ /dev/null
@@ -1,203 +0,0 @@
-#ifndef FIO_OS_LINUX_H
-#define FIO_OS_LINUX_H
-
-#include <sys/ioctl.h>
-#include <sys/uio.h>
-#include <sys/syscall.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <linux/unistd.h>
-#include <linux/raw.h>
-#include <linux/major.h>
-
-#define FIO_HAVE_LIBAIO
-#define FIO_HAVE_POSIXAIO
-#define FIO_HAVE_FADVISE
-#define FIO_HAVE_CPU_AFFINITY
-#define FIO_HAVE_DISK_UTIL
-#define FIO_HAVE_SGIO
-#define FIO_HAVE_IOPRIO
-#define FIO_HAVE_SPLICE
-#define FIO_HAVE_IOSCHED_SWITCH
-#define FIO_HAVE_ODIRECT
-#define FIO_HAVE_HUGETLB
-#define FIO_HAVE_RAWBIND
-
-#define OS_MAP_ANON            (MAP_ANONYMOUS)
-
-typedef cpu_set_t os_cpu_mask_t;
-typedef struct drand48_data os_random_state_t;
-
-/*
- * we want fadvise64 really, but it's so tangled... later
- */
-#define fadvise(fd, off, len, advice)  \
-       posix_fadvise((fd), (off_t)(off), (len), (advice))
-
-#define fio_setaffinity(td)            \
-       sched_setaffinity((td)->pid, sizeof((td)->o.cpumask), &(td)->o.cpumask)
-#define fio_getaffinity(pid, ptr)      \
-       sched_getaffinity((pid), sizeof(cpu_set_t), (ptr))
-
-static inline int ioprio_set(int which, int who, int ioprio)
-{
-       return syscall(__NR_ioprio_set, which, who, ioprio);
-}
-
-/*
- * Just check for SPLICE_F_MOVE, if that isn't there, assume the others
- * aren't either.
- */
-#ifndef SPLICE_F_MOVE
-#define SPLICE_F_MOVE  (0x01)  /* move pages instead of copying */
-#define SPLICE_F_NONBLOCK (0x02) /* don't block on the pipe splicing (but */
-                                /* we may still block on the fd we splice */
-                                /* from/to, of course */
-#define SPLICE_F_MORE  (0x04)  /* expect more data */
-#define SPLICE_F_GIFT   (0x08)  /* pages passed in are a gift */
-
-static inline int splice(int fdin, loff_t *off_in, int fdout, loff_t *off_out,
-                        size_t len, unsigned long flags)
-{
-       return syscall(__NR_sys_splice, fdin, off_in, fdout, off_out, len, flags);
-}
-
-static inline int tee(int fdin, int fdout, size_t len, unsigned int flags)
-{
-       return syscall(__NR_sys_tee, fdin, fdout, len, flags);
-}
-
-static inline int vmsplice(int fd, const struct iovec *iov,
-                          unsigned long nr_segs, unsigned int flags)
-{
-       return syscall(__NR_sys_vmsplice, fd, iov, nr_segs, flags);
-}
-#endif
-
-#define SPLICE_DEF_SIZE        (64*1024)
-
-#ifdef FIO_HAVE_SYSLET
-
-struct syslet_uatom;
-struct async_head_user;
-
-/*
- * syslet stuff
- */
-static inline struct syslet_uatom *
-async_exec(struct syslet_uatom *atom, struct async_head_user *ahu)
-{
-       return (void *) syscall(__NR_async_exec, atom, ahu);
-}
-
-static inline long
-async_wait(unsigned long min_wait_events, unsigned long user_ring_idx,
-          struct async_head_user *ahu)
-{
-       return syscall(__NR_async_wait, min_wait_events,
-                       user_ring_idx, ahu);
-}
-
-static inline long async_thread(void *event, struct async_head_user *ahu)
-{
-       return syscall(__NR_async_thread, event, ahu);
-}
-
-static inline long umem_add(unsigned long *uptr, unsigned long inc)
-{
-       return syscall(__NR_umem_add, uptr, inc);
-}
-#endif /* FIO_HAVE_SYSLET */
-
-enum {
-       IOPRIO_WHO_PROCESS = 1,
-       IOPRIO_WHO_PGRP,
-       IOPRIO_WHO_USER,
-};
-
-#define IOPRIO_CLASS_SHIFT     13
-
-#ifndef BLKGETSIZE64
-#define BLKGETSIZE64   _IOR(0x12,114,size_t)
-#endif
-
-#ifndef BLKFLSBUF
-#define BLKFLSBUF      _IO(0x12,97)
-#endif
-
-static inline int blockdev_invalidate_cache(int fd)
-{
-       return ioctl(fd, BLKFLSBUF);
-}
-
-static inline int blockdev_size(int fd, unsigned long long *bytes)
-{
-       if (!ioctl(fd, BLKGETSIZE64, bytes))
-               return 0;
-
-       return errno;
-}
-
-static inline unsigned long long os_phys_mem(void)
-{
-       long pagesize, pages;
-
-       pagesize = sysconf(_SC_PAGESIZE);
-       pages = sysconf(_SC_PHYS_PAGES);
-       if (pages == -1 || pagesize == -1)
-               return 0;
-
-       return (unsigned long long) pages * (unsigned long long) pagesize;
-}
-
-static inline void os_random_seed(unsigned long seed, os_random_state_t *rs)
-{
-       srand48_r(seed, rs);
-}
-
-static inline long os_random_long(os_random_state_t *rs)
-{
-       long val;
-
-       lrand48_r(rs, &val);
-       return val;
-}
-
-static inline double os_random_double(os_random_state_t *rs)
-{
-       double val;
-
-       drand48_r(rs, &val);
-       return val;
-}
-
-static inline void fio_lookup_raw(dev_t dev, int *majdev, int *mindev)
-{
-       struct raw_config_request rq;
-       int fd;
-
-       if (major(dev) != RAW_MAJOR)
-               return;
-
-       /*
-        * we should be able to find /dev/rawctl or /dev/raw/rawctl
-        */
-       fd = open("/dev/rawctl", O_RDONLY);
-       if (fd < 0) {
-               fd = open("/dev/raw/rawctl", O_RDONLY);
-               if (fd < 0)
-                       return;
-       }
-
-       rq.raw_minor = minor(dev);
-       if (ioctl(fd, RAW_GETBIND, &rq) < 0) {
-               close(fd);
-               return;
-       }
-
-       close(fd);
-       *majdev = rq.block_major;
-       *mindev = rq.block_minor;
-}
-
-#endif
diff --git a/os-solaris.h b/os-solaris.h
deleted file mode 100644 (file)
index 898da18..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifndef FIO_OS_SOLARIS_H
-#define FIO_OS_SOLARIS_H
-
-#undef FIO_HAVE_LIBAIO
-#define FIO_HAVE_POSIXAIO
-#undef FIO_HAVE_FADVISE
-#undef FIO_HAVE_CPU_AFFINITY
-#undef FIO_HAVE_DISK_UTIL
-#undef FIO_HAVE_SGIO
-#undef FIO_HAVE_ODIRECT
-
-#define OS_MAP_ANON            (MAP_ANON)
-
-typedef unsigned long os_cpu_mask_t;
-typedef unsigned int os_random_state_t;
-
-/*
- * FIXME
- */
-static inline int blockdev_size(int fd, unsigned long long *bytes)
-{
-       return EINVAL;
-}
-
-static inline int blockdev_invalidate_cache(int fd)
-{
-       return EINVAL;
-}
-
-static inline unsigned long long os_phys_mem(void)
-{
-#if 0
-       int mib[2] = { CTL_HW, HW_PHYSMEM };
-       unsigned long long mem;
-       size_t len = sizeof(mem);
-
-       sysctl(mib, 2, &mem, &len, NULL, 0);
-       return mem;
-#else
-       return 0;
-#endif
-}
-
-static inline void os_random_seed(unsigned long seed, os_random_state_t *rs)
-{
-       srand(seed);
-}
-
-static inline long os_random_long(os_random_state_t *rs)
-{
-       long val;
-
-       val = rand_r(rs);
-       return val;
-}
-
-static inline double os_random_double(os_random_state_t *rs)
-{
-       double val;
-
-       val = (double) rand_r(rs);
-       return val;
-}
-
-#endif
diff --git a/os.h b/os.h
deleted file mode 100644 (file)
index 104f4a8..0000000
--- a/os.h
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef FIO_OS_H
-#define FIO_OS_H
-
-#if defined(__linux__)
-#include "os-linux.h"
-#elif defined(__FreeBSD__)
-#include "os-freebsd.h"
-#elif defined(__sun__)
-#include "os-solaris.h"
-#else
-#error "unsupported os"
-#endif
-
-#ifdef FIO_HAVE_LIBAIO
-#include <libaio.h>
-#endif
-
-#ifdef FIO_HAVE_POSIXAIO
-#include <aio.h>
-#endif
-
-#ifdef FIO_HAVE_SGIO
-#include <linux/fs.h>
-#include <scsi/sg.h>
-#endif
-
-#ifndef FIO_HAVE_FADVISE
-#define fadvise(fd, off, len, advice)  (0)
-
-#define POSIX_FADV_DONTNEED    (0)
-#define POSIX_FADV_SEQUENTIAL  (0)
-#define POSIX_FADV_RANDOM      (0)
-#endif /* FIO_HAVE_FADVISE */
-
-#ifndef FIO_HAVE_CPU_AFFINITY
-#define fio_setaffinity(td)            (0)
-#define fio_getaffinity(pid, mask)     (0)
-#endif
-
-#ifndef FIO_HAVE_IOPRIO
-#define ioprio_set(which, who, prio)   (0)
-#endif
-
-#ifndef FIO_HAVE_ODIRECT
-#define OS_O_DIRECT                    0
-#else
-#define OS_O_DIRECT                    O_DIRECT
-#endif
-
-#ifndef FIO_HAVE_HUGETLB
-#define SHM_HUGETLB                    0
-#define FIO_HUGE_PAGE                  0
-#else
-#ifndef FIO_HUGE_PAGE
-#define FIO_HUGE_PAGE                  4194304
-#endif
-#endif
-
-#ifndef FIO_HAVE_RAWBIND
-#define fio_lookup_raw(dev, majdev, mindev)
-#endif
-
-#endif
diff --git a/os/os-freebsd.h b/os/os-freebsd.h
new file mode 100644 (file)
index 0000000..01c5ce9
--- /dev/null
@@ -0,0 +1,62 @@
+#ifndef FIO_OS_FREEBSD_H
+#define FIO_OS_FREEBSD_H
+
+#include <sys/sysctl.h>
+
+#undef FIO_HAVE_LIBAIO
+#define FIO_HAVE_POSIXAIO
+#undef FIO_HAVE_FADVISE
+#undef FIO_HAVE_CPU_AFFINITY
+#undef FIO_HAVE_DISK_UTIL
+#undef FIO_HAVE_SGIO
+#define FIO_HAVE_ODIRECT
+
+#define OS_MAP_ANON            (MAP_ANON)
+
+typedef unsigned long os_cpu_mask_t;
+typedef unsigned int os_random_state_t;
+
+/*
+ * FIXME
+ */
+static inline int blockdev_size(int fd, unsigned long long *bytes)
+{
+       return EINVAL;
+}
+
+static inline int blockdev_invalidate_cache(int fd)
+{
+       return EINVAL;
+}
+
+static inline unsigned long long os_phys_mem(void)
+{
+       int mib[2] = { CTL_HW, HW_PHYSMEM };
+       unsigned long long mem;
+       size_t len = sizeof(mem);
+
+       sysctl(mib, 2, &mem, &len, NULL, 0);
+       return mem;
+}
+
+static inline void os_random_seed(unsigned long seed, os_random_state_t *rs)
+{
+       srand(seed);
+}
+
+static inline long os_random_long(os_random_state_t *rs)
+{
+       long val;
+
+       val = rand_r(rs);
+       return val;
+}
+
+static inline double os_random_double(os_random_state_t *rs)
+{
+       double val;
+
+       val = (double) rand_r(rs);
+       return val;
+}
+#endif
diff --git a/os/os-linux.h b/os/os-linux.h
new file mode 100644 (file)
index 0000000..561b273
--- /dev/null
@@ -0,0 +1,203 @@
+#ifndef FIO_OS_LINUX_H
+#define FIO_OS_LINUX_H
+
+#include <sys/ioctl.h>
+#include <sys/uio.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <linux/unistd.h>
+#include <linux/raw.h>
+#include <linux/major.h>
+
+#define FIO_HAVE_LIBAIO
+#define FIO_HAVE_POSIXAIO
+#define FIO_HAVE_FADVISE
+#define FIO_HAVE_CPU_AFFINITY
+#define FIO_HAVE_DISK_UTIL
+#define FIO_HAVE_SGIO
+#define FIO_HAVE_IOPRIO
+#define FIO_HAVE_SPLICE
+#define FIO_HAVE_IOSCHED_SWITCH
+#define FIO_HAVE_ODIRECT
+#define FIO_HAVE_HUGETLB
+#define FIO_HAVE_RAWBIND
+
+#define OS_MAP_ANON            (MAP_ANONYMOUS)
+
+typedef cpu_set_t os_cpu_mask_t;
+typedef struct drand48_data os_random_state_t;
+
+/*
+ * we want fadvise64 really, but it's so tangled... later
+ */
+#define fadvise(fd, off, len, advice)  \
+       posix_fadvise((fd), (off_t)(off), (len), (advice))
+
+#define fio_setaffinity(td)            \
+       sched_setaffinity((td)->pid, sizeof((td)->o.cpumask), &(td)->o.cpumask)
+#define fio_getaffinity(pid, ptr)      \
+       sched_getaffinity((pid), sizeof(cpu_set_t), (ptr))
+
+static inline int ioprio_set(int which, int who, int ioprio)
+{
+       return syscall(__NR_ioprio_set, which, who, ioprio);
+}
+
+/*
+ * Just check for SPLICE_F_MOVE, if that isn't there, assume the others
+ * aren't either.
+ */
+#ifndef SPLICE_F_MOVE
+#define SPLICE_F_MOVE  (0x01)  /* move pages instead of copying */
+#define SPLICE_F_NONBLOCK (0x02) /* don't block on the pipe splicing (but */
+                                /* we may still block on the fd we splice */
+                                /* from/to, of course */
+#define SPLICE_F_MORE  (0x04)  /* expect more data */
+#define SPLICE_F_GIFT   (0x08)  /* pages passed in are a gift */
+
+static inline int splice(int fdin, loff_t *off_in, int fdout, loff_t *off_out,
+                        size_t len, unsigned long flags)
+{
+       return syscall(__NR_sys_splice, fdin, off_in, fdout, off_out, len, flags);
+}
+
+static inline int tee(int fdin, int fdout, size_t len, unsigned int flags)
+{
+       return syscall(__NR_sys_tee, fdin, fdout, len, flags);
+}
+
+static inline int vmsplice(int fd, const struct iovec *iov,
+                          unsigned long nr_segs, unsigned int flags)
+{
+       return syscall(__NR_sys_vmsplice, fd, iov, nr_segs, flags);
+}
+#endif
+
+#define SPLICE_DEF_SIZE        (64*1024)
+
+#ifdef FIO_HAVE_SYSLET
+
+struct syslet_uatom;
+struct async_head_user;
+
+/*
+ * syslet stuff
+ */
+static inline struct syslet_uatom *
+async_exec(struct syslet_uatom *atom, struct async_head_user *ahu)
+{
+       return (void *) syscall(__NR_async_exec, atom, ahu);
+}
+
+static inline long
+async_wait(unsigned long min_wait_events, unsigned long user_ring_idx,
+          struct async_head_user *ahu)
+{
+       return syscall(__NR_async_wait, min_wait_events,
+                       user_ring_idx, ahu);
+}
+
+static inline long async_thread(void *event, struct async_head_user *ahu)
+{
+       return syscall(__NR_async_thread, event, ahu);
+}
+
+static inline long umem_add(unsigned long *uptr, unsigned long inc)
+{
+       return syscall(__NR_umem_add, uptr, inc);
+}
+#endif /* FIO_HAVE_SYSLET */
+
+enum {
+       IOPRIO_WHO_PROCESS = 1,
+       IOPRIO_WHO_PGRP,
+       IOPRIO_WHO_USER,
+};
+
+#define IOPRIO_CLASS_SHIFT     13
+
+#ifndef BLKGETSIZE64
+#define BLKGETSIZE64   _IOR(0x12,114,size_t)
+#endif
+
+#ifndef BLKFLSBUF
+#define BLKFLSBUF      _IO(0x12,97)
+#endif
+
+static inline int blockdev_invalidate_cache(int fd)
+{
+       return ioctl(fd, BLKFLSBUF);
+}
+
+static inline int blockdev_size(int fd, unsigned long long *bytes)
+{
+       if (!ioctl(fd, BLKGETSIZE64, bytes))
+               return 0;
+
+       return errno;
+}
+
+static inline unsigned long long os_phys_mem(void)
+{
+       long pagesize, pages;
+
+       pagesize = sysconf(_SC_PAGESIZE);
+       pages = sysconf(_SC_PHYS_PAGES);
+       if (pages == -1 || pagesize == -1)
+               return 0;
+
+       return (unsigned long long) pages * (unsigned long long) pagesize;
+}
+
+static inline void os_random_seed(unsigned long seed, os_random_state_t *rs)
+{
+       srand48_r(seed, rs);
+}
+
+static inline long os_random_long(os_random_state_t *rs)
+{
+       long val;
+
+       lrand48_r(rs, &val);
+       return val;
+}
+
+static inline double os_random_double(os_random_state_t *rs)
+{
+       double val;
+
+       drand48_r(rs, &val);
+       return val;
+}
+
+static inline void fio_lookup_raw(dev_t dev, int *majdev, int *mindev)
+{
+       struct raw_config_request rq;
+       int fd;
+
+       if (major(dev) != RAW_MAJOR)
+               return;
+
+       /*
+        * we should be able to find /dev/rawctl or /dev/raw/rawctl
+        */
+       fd = open("/dev/rawctl", O_RDONLY);
+       if (fd < 0) {
+               fd = open("/dev/raw/rawctl", O_RDONLY);
+               if (fd < 0)
+                       return;
+       }
+
+       rq.raw_minor = minor(dev);
+       if (ioctl(fd, RAW_GETBIND, &rq) < 0) {
+               close(fd);
+               return;
+       }
+
+       close(fd);
+       *majdev = rq.block_major;
+       *mindev = rq.block_minor;
+}
+
+#endif
diff --git a/os/os-solaris.h b/os/os-solaris.h
new file mode 100644 (file)
index 0000000..898da18
--- /dev/null
@@ -0,0 +1,65 @@
+#ifndef FIO_OS_SOLARIS_H
+#define FIO_OS_SOLARIS_H
+
+#undef FIO_HAVE_LIBAIO
+#define FIO_HAVE_POSIXAIO
+#undef FIO_HAVE_FADVISE
+#undef FIO_HAVE_CPU_AFFINITY
+#undef FIO_HAVE_DISK_UTIL
+#undef FIO_HAVE_SGIO
+#undef FIO_HAVE_ODIRECT
+
+#define OS_MAP_ANON            (MAP_ANON)
+
+typedef unsigned long os_cpu_mask_t;
+typedef unsigned int os_random_state_t;
+
+/*
+ * FIXME
+ */
+static inline int blockdev_size(int fd, unsigned long long *bytes)
+{
+       return EINVAL;
+}
+
+static inline int blockdev_invalidate_cache(int fd)
+{
+       return EINVAL;
+}
+
+static inline unsigned long long os_phys_mem(void)
+{
+#if 0
+       int mib[2] = { CTL_HW, HW_PHYSMEM };
+       unsigned long long mem;
+       size_t len = sizeof(mem);
+
+       sysctl(mib, 2, &mem, &len, NULL, 0);
+       return mem;
+#else
+       return 0;
+#endif
+}
+
+static inline void os_random_seed(unsigned long seed, os_random_state_t *rs)
+{
+       srand(seed);
+}
+
+static inline long os_random_long(os_random_state_t *rs)
+{
+       long val;
+
+       val = rand_r(rs);
+       return val;
+}
+
+static inline double os_random_double(os_random_state_t *rs)
+{
+       double val;
+
+       val = (double) rand_r(rs);
+       return val;
+}
+
+#endif
diff --git a/os/os.h b/os/os.h
new file mode 100644 (file)
index 0000000..104f4a8
--- /dev/null
+++ b/os/os.h
@@ -0,0 +1,63 @@
+#ifndef FIO_OS_H
+#define FIO_OS_H
+
+#if defined(__linux__)
+#include "os-linux.h"
+#elif defined(__FreeBSD__)
+#include "os-freebsd.h"
+#elif defined(__sun__)
+#include "os-solaris.h"
+#else
+#error "unsupported os"
+#endif
+
+#ifdef FIO_HAVE_LIBAIO
+#include <libaio.h>
+#endif
+
+#ifdef FIO_HAVE_POSIXAIO
+#include <aio.h>
+#endif
+
+#ifdef FIO_HAVE_SGIO
+#include <linux/fs.h>
+#include <scsi/sg.h>
+#endif
+
+#ifndef FIO_HAVE_FADVISE
+#define fadvise(fd, off, len, advice)  (0)
+
+#define POSIX_FADV_DONTNEED    (0)
+#define POSIX_FADV_SEQUENTIAL  (0)
+#define POSIX_FADV_RANDOM      (0)
+#endif /* FIO_HAVE_FADVISE */
+
+#ifndef FIO_HAVE_CPU_AFFINITY
+#define fio_setaffinity(td)            (0)
+#define fio_getaffinity(pid, mask)     (0)
+#endif
+
+#ifndef FIO_HAVE_IOPRIO
+#define ioprio_set(which, who, prio)   (0)
+#endif
+
+#ifndef FIO_HAVE_ODIRECT
+#define OS_O_DIRECT                    0
+#else
+#define OS_O_DIRECT                    O_DIRECT
+#endif
+
+#ifndef FIO_HAVE_HUGETLB
+#define SHM_HUGETLB                    0
+#define FIO_HUGE_PAGE                  0
+#else
+#ifndef FIO_HUGE_PAGE
+#define FIO_HUGE_PAGE                  4194304
+#endif
+#endif
+
+#ifndef FIO_HAVE_RAWBIND
+#define fio_lookup_raw(dev, majdev, mindev)
+#endif
+
+#endif
index 47335107452a13dee3cded9fc2fe5907e1d3cb14..46e610d713fd221d0e10b7cc74579f5ffb54fc10 100644 (file)
--- a/verify.c
+++ b/verify.c
@@ -6,7 +6,6 @@
 #include <string.h>
 
 #include "fio.h"
 #include <string.h>
 
 #include "fio.h"
-#include "os.h"
 
 static void fill_random_bytes(struct thread_data *td,
                              unsigned char *p, unsigned int len)
 
 static void fill_random_bytes(struct thread_data *td,
                              unsigned char *p, unsigned int len)