summaryrefslogtreecommitdiff
path: root/os/binject.h
diff options
context:
space:
mode:
authorJens Axboe <jaxboe@fusionio.com>2010-09-07 13:28:58 +0200
committerJens Axboe <jaxboe@fusionio.com>2010-09-07 13:28:58 +0200
commit79a43187163eb99eaabaa496cb8b5e3a164f3e09 (patch)
tree04db71d0b1c248e4b8034aab6a250a80adc9ad87 /os/binject.h
parent1c04bf783c681219455f33f097155fc61f714999 (diff)
downloadfio-79a43187163eb99eaabaa496cb8b5e3a164f3e09.tar.gz
fio-79a43187163eb99eaabaa496cb8b5e3a164f3e09.tar.bz2
Add binject IO engine
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'os/binject.h')
-rw-r--r--os/binject.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/os/binject.h b/os/binject.h
new file mode 100644
index 00000000..1f358f36
--- /dev/null
+++ b/os/binject.h
@@ -0,0 +1,65 @@
+#ifndef BINJECT_H
+#define BINJECT_H
+
+#include <linux/types.h>
+
+#define BINJECT_MAGIC 0x89
+#define BINJECT_VER 0x01
+#define BINJECT_MAGIC_SHIFT 8
+#define BINJECT_VER_MASK ((1 << BINJECT_MAGIC_SHIFT) - 1)
+
+struct b_user_cmd {
+ __u16 magic; /* INPUT */
+ __u16 type; /* INPUT */
+ __u32 error; /* OUTPUT */
+ __u32 flags; /* INPUT */
+ __u32 len; /* INPUT */
+ __u64 offset; /* INPUT */
+ __u64 buf; /* INPUT */
+ __u64 usr_ptr; /* PASSED THROUGH */
+ __u64 nsec; /* OUTPUT */
+};
+
+struct b_ioctl_cmd {
+ int fd;
+ int minor;
+};
+
+enum {
+ B_TYPE_READ = 0,
+ B_TYPE_WRITE,
+ B_TYPE_DISCARD,
+ B_TYPE_READVOID,
+ B_TYPE_WRITEZERO,
+ B_TYPE_NR
+};
+
+enum {
+ __B_FLAG_SYNC = 0,
+ __B_FLAG_UNPLUG,
+ __B_FLAG_NOIDLE,
+ __B_FLAG_BARRIER,
+ __B_FLAG_META,
+ __B_FLAG_RAHEAD,
+ __B_FLAG_FAILFAST_DEV,
+ __B_FLAG_FAILFAST_TRANSPORT,
+ __B_FLAG_FAILFAST_DRIVER,
+ __B_FLAG_NR,
+
+ B_FLAG_SYNC = 1 << __B_FLAG_SYNC,
+ B_FLAG_UNPLUG = 1 << __B_FLAG_UNPLUG,
+ B_FLAG_NOIDLE = 1 << __B_FLAG_NOIDLE,
+ B_FLAG_BARRIER = 1 << __B_FLAG_BARRIER,
+ B_FLAG_META = 1 << __B_FLAG_META,
+ B_FLAG_RAHEAD = 1 << __B_FLAG_RAHEAD,
+ B_FLAG_FAILFAST_DEV = 1 << __B_FLAG_FAILFAST_DEV,
+ B_FLAG_FAILFAST_TRANSPORT = 1 << __B_FLAG_FAILFAST_TRANSPORT,
+ B_FLAG_FAILFAST_DRIVER = 1 << __B_FLAG_FAILFAST_DRIVER,
+};
+
+static inline void binject_buc_set_magic(struct b_user_cmd *buc)
+{
+ buc->magic = (BINJECT_MAGIC << BINJECT_MAGIC_SHIFT) | BINJECT_VER;
+}
+
+#endif