From: Jens Axboe Date: Tue, 4 Aug 2009 21:03:39 +0000 (+0200) Subject: FreeBSD: use generic bdev size retrieval X-Git-Tag: fio-1.33~10 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=617a2013384ae474177a8a9c151468e3d3fd8944;p=fio.git FreeBSD: use generic bdev size retrieval Signed-off-by: Jens Axboe --- 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)