summaryrefslogtreecommitdiff
path: root/os/os-freebsd.h
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2009-08-04 23:03:39 +0200
committerJens Axboe <jens.axboe@oracle.com>2009-08-04 23:03:39 +0200
commit617a2013384ae474177a8a9c151468e3d3fd8944 (patch)
tree82b1291dd2eecf8f430323c6f9d82342f513e28a /os/os-freebsd.h
parent515d18304324c2e11f40742c394c90799913fa67 (diff)
downloadfio-617a2013384ae474177a8a9c151468e3d3fd8944.tar.gz
fio-617a2013384ae474177a8a9c151468e3d3fd8944.tar.bz2
FreeBSD: use generic bdev size retrieval
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'os/os-freebsd.h')
-rw-r--r--os/os-freebsd.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/os/os-freebsd.h b/os/os-freebsd.h
index 3939d652..e517ec0f 100644
--- a/os/os-freebsd.h
+++ b/os/os-freebsd.h
@@ -17,7 +17,13 @@ typedef unsigned int os_random_state_t;
*/
static inline int blockdev_size(int fd, unsigned long long *bytes)
{
- return EINVAL;
+ off_t end = lseek(fd, 0, SEEK_END);
+
+ if (end < 0)
+ return errno;
+
+ *bytes = end;
+ return 0;
}
static inline int blockdev_invalidate_cache(int fd)