[PATCH] fio: BLKGETSIZE64 is os specific, not arch.
authorJens Axboe <axboe@suse.de>
Wed, 7 Dec 2005 12:52:34 +0000 (13:52 +0100)
committerJens Axboe <axboe@suse.de>
Wed, 7 Dec 2005 12:52:34 +0000 (13:52 +0100)
arch.h
fio.c
os-freebsd.h
os-linux.h

diff --git a/arch.h b/arch.h
index da4a6a8e5ba3a4f064f18f961fd3a700fcce2b42..745bf3a4d0a6260dffc37b475e3b3479e966ba48 100644 (file)
--- a/arch.h
+++ b/arch.h
@@ -39,8 +39,4 @@ static inline unsigned long generic_ffz(unsigned long word)
 
 #define BITS_PER_LONG  (__WORDSIZE)
 
-#ifndef BLKGETSIZE64
-#define BLKGETSIZE64   _IOR(0x12,114,size_t)
-#endif
-
 #endif
diff --git a/fio.c b/fio.c
index d7fa0d1eff557ea9e9d21b30cef8d1c29f263542..e166f49850e1528c95f58223079c708a6bea6ef5 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -1175,9 +1175,11 @@ static int file_size(struct thread_data *td)
 static int bdev_size(struct thread_data *td)
 {
        size_t bytes;
+       int r;
 
-       if (ioctl(td->fd, BLKGETSIZE64, &bytes) < 0) {
-               td_verror(td, errno);
+       r = blockdev_size(td->fd, &bytes);
+       if (r) {
+               td_verror(td, r);
                return 1;
        }
 
index e59822bc816b87b9c539e5cc034f1083833a4deb..a79483b839cff1b348ae49670b43779195dbf6db 100644 (file)
 
 typedef unsigned long os_cpu_mask_t;
 
+/*
+ * FIXME
+ */
+static inline int blockdev_size(int fd, size_t *bytes)
+{
+       return 1;
+}
+
 #endif
index 8d9ad1a08029208024ff01d5385809a405b5ec1b..e414364402a8555ccd878110fc8a48a0e870b8c3 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef FIO_OS_LINUX_H
 #define FIO_OS_LINUX_H
 
+#include <sys/ioctl.h>
+
 #define FIO_HAVE_LIBAIO
 #define FIO_HAVE_POSIXAIO
 #define FIO_HAVE_FADVISE
@@ -35,4 +37,16 @@ enum {
 
 #define IOPRIO_CLASS_SHIFT     13
 
+#ifndef BLKGETSIZE64
+#define BLKGETSIZE64   _IOR(0x12,114,size_t)
+#endif
+
+static inline int blockdev_size(int fd, size_t *bytes)
+{
+       if (!ioctl(fd, BLKGETSIZE64, bytes))
+               return 0;
+
+       return errno;
+}
+
 #endif