summaryrefslogtreecommitdiff
path: root/os/os.h
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2009-09-22 17:12:29 +0200
committerJens Axboe <jens.axboe@oracle.com>2009-09-22 17:12:29 +0200
commit792d551747e83601121afce033a66f357c9fc439 (patch)
tree768ad2fd76eb87f3661929a3aa27188ad586a5eb /os/os.h
parent783500ad13ededece6c8912af1c937f990880e1f (diff)
downloadfio-792d551747e83601121afce033a66f357c9fc439.tar.gz
fio-792d551747e83601121afce033a66f357c9fc439.tar.bz2
Add generic bdev_size function
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'os/os.h')
-rw-r--r--os/os.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/os/os.h b/os/os.h
index 10e796fb..1afb4b22 100644
--- a/os/os.h
+++ b/os/os.h
@@ -106,4 +106,17 @@ static inline int os_cache_line_size(void)
#endif
}
+#ifdef FIO_USE_GENERIC_BDEV_SIZE
+static inline int blockdev_size(int fd, unsigned long long *bytes)
+{
+ off_t end = lseek(fd, 0, SEEK_END);
+
+ if (end < 0)
+ return errno;
+
+ *bytes = end;
+ return 0;
+}
+#endif
+
#endif