+#if BYTE_ORDER == LITTLE_ENDIAN
+#define FIO_LITTLE_ENDIAN
+#else
+#define FIO_BIG_ENDIAN
+#endif
+
+#define fio_swap16(x) bswap16(x)
+#define fio_swap32(x) bswap32(x)
+#define fio_swap64(x) bswap64(x)
+
+typedef off_t off64_t;
+
+static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
+{
+ off_t size;
+
+ if (!ioctl(f->fd, DIOCGMEDIASIZE, &size)) {
+ *bytes = size;
+ return 0;
+ }
+
+ *bytes = 0;
+ return errno;
+}
+
+static inline int chardev_size(struct fio_file *f, unsigned long long *bytes)
+{
+ return blockdev_size(f, bytes);
+}
+
+static inline int blockdev_invalidate_cache(struct fio_file *f)