diff options
author | Jens Axboe <jaxboe@fusionio.com> | 2010-06-24 09:25:15 +0200 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2010-06-24 09:25:15 +0200 |
commit | aa5e69b26d16ae4c1680d05b25149f3198036714 (patch) | |
tree | 33f6c05184e0e2f207a685c4dbe66272e3dea877 /os/os-freebsd.h | |
parent | 68b0316f581c3c881d7dbf7c9dafef4a10100a66 (diff) | |
download | fio-aa5e69b26d16ae4c1680d05b25149f3198036714.tar.gz fio-aa5e69b26d16ae4c1680d05b25149f3198036714.tar.bz2 |
Add real blockdev_size() for FreeBSD
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'os/os-freebsd.h')
-rw-r--r-- | os/os-freebsd.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/os/os-freebsd.h b/os/os-freebsd.h index 44b60606..3115b605 100644 --- a/os/os-freebsd.h +++ b/os/os-freebsd.h @@ -3,16 +3,28 @@ #include <errno.h> #include <sys/sysctl.h> +#include <sys/disk.h> #define FIO_HAVE_POSIXAIO #define FIO_HAVE_ODIRECT -#define FIO_USE_GENERIC_BDEV_SIZE #define FIO_USE_GENERIC_RAND #define OS_MAP_ANON MAP_ANON typedef off_t off64_t; +static inline int blockdev_size(int fd, unsigned long long *bytes) +{ + off_t size; + + if (!ioctl(fd, DIOCGMEDIASIZE, &size)) { + *bytes = size; + return 0; + } + + return errno; +} + static inline int blockdev_invalidate_cache(int fd) { return EINVAL; |