X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=os%2Fos-freebsd.h;h=fa00bb8001a230af4edc4d76c08553299f5f9f07;hb=37db59d6ef74a8e6f5625c65dfbf4b72fd5fa84d;hp=402792a0f7d714f99a41c77ad686d39ef561c548;hpb=c2acfbac7e9eb8ac5407ac024c0fd000614c77e2;p=fio.git diff --git a/os/os-freebsd.h b/os/os-freebsd.h index 402792a0..fa00bb80 100644 --- a/os/os-freebsd.h +++ b/os/os-freebsd.h @@ -10,6 +10,7 @@ #include #include #include +#include #include "../file.h" @@ -17,6 +18,7 @@ #define FIO_USE_GENERIC_RAND #define FIO_USE_GENERIC_INIT_RANDOM_STATE #define FIO_HAVE_CHARDEV_SIZE +#define FIO_HAVE_FS_STAT #define FIO_HAVE_GETTID #define FIO_HAVE_CPU_AFFINITY @@ -32,7 +34,8 @@ typedef cpuset_t os_cpu_mask_t; #define fio_cpu_clear(mask, cpu) (void) CPU_CLR((cpu), (mask)) #define fio_cpu_set(mask, cpu) (void) CPU_SET((cpu), (mask)) -#define fio_cpu_count(maks) CPU_COUNT((mask)) +#define fio_cpu_isset(mask, cpu) CPU_ISSET((cpu), (mask)) +#define fio_cpu_count(mask) CPU_COUNT((mask)) static inline int fio_cpuset_init(os_cpu_mask_t *mask) { @@ -98,6 +101,19 @@ static inline int gettid(void) return (int) lwpid; } +static inline unsigned long long get_fs_free_size(const char *path) +{ + unsigned long long ret; + struct statvfs s; + + if (statvfs(path, &s) < 0) + return -1ULL; + + ret = s.f_frsize; + ret *= (unsigned long long) s.f_bfree; + return ret; +} + #ifdef MADV_FREE #define FIO_MADV_FREE MADV_FREE #endif