X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=os%2Fos-freebsd.h;h=3115b605064bc7a55b5d162ab59c872475f4c8ee;hp=44b60606327ec1d28f1a974047bdac90c8805a1e;hb=aa5e69b26d16ae4c1680d05b25149f3198036714;hpb=68b0316f581c3c881d7dbf7c9dafef4a10100a66;ds=inline 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 #include +#include #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;