+#ifndef CONFIG_CLOCKID_T
+typedef unsigned int clockid_t;
+#endif
+
+#define FIO_OS_DIRECTIO
+static inline int fio_set_odirect(struct fio_file *f)
+{
+ if (fcntl(f->fd, F_NOCACHE, 1) == -1)
+ return errno;
+ return 0;
+}
+
+static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
+{
+ uint32_t block_size;
+ uint64_t block_count;
+
+ if (ioctl(f->fd, DKIOCGETBLOCKCOUNT, &block_count) == -1)
+ return errno;
+ if (ioctl(f->fd, DKIOCGETBLOCKSIZE, &block_size) == -1)
+ return errno;
+
+ *bytes = block_size;
+ *bytes *= block_count;
+ return 0;
+}
+
+static inline int chardev_size(struct fio_file *f, unsigned long long *bytes)
+{
+ /*
+ * Could be a raw block device, this is better than just assuming
+ * we can't get the size at all.
+ */
+ if (!blockdev_size(f, bytes))
+ return 0;
+
+ *bytes = -1ULL;
+ return 0;
+}
+
+static inline int blockdev_invalidate_cache(struct fio_file *f)