X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=os%2Fos-freebsd.h;h=0cb7ae5e5ca079380e20a514f1f0f1b9df3748c2;hb=ecc314ba7c5f02b7e90ac1dfbce1a74cd4e6d6fe;hp=44b60606327ec1d28f1a974047bdac90c8805a1e;hpb=907249cffbdfa26de688c127abb5483154a4eae6;p=fio.git diff --git a/os/os-freebsd.h b/os/os-freebsd.h index 44b60606..0cb7ae5e 100644 --- a/os/os-freebsd.h +++ b/os/os-freebsd.h @@ -3,17 +3,39 @@ #include #include +#include #define FIO_HAVE_POSIXAIO #define FIO_HAVE_ODIRECT -#define FIO_USE_GENERIC_BDEV_SIZE +#define FIO_HAVE_IOPRIO +#define FIO_HAVE_STRSEP #define FIO_USE_GENERIC_RAND +#define FIO_HAVE_CHARDEV_SIZE +#define FIO_HAVE_CLOCK_MONOTONIC #define OS_MAP_ANON MAP_ANON typedef off_t off64_t; -static inline int blockdev_invalidate_cache(int fd) +static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes) +{ + off_t size; + + if (!ioctl(f->fd, DIOCGMEDIASIZE, &size)) { + *bytes = size; + return 0; + } + + *bytes = 0; + return errno; +} + +static inline int chardev_size(struct fio_file *f, unsigned long long *bytes) +{ + return blockdev_size(f->fd, bytes); +} + +static inline int blockdev_invalidate_cache(struct fio_file *f) { return EINVAL; }