X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=os%2Fos-freebsd.h;h=fa00bb8001a230af4edc4d76c08553299f5f9f07;hb=e39c0676d1af779004194ae4b3cc111db49bef7a;hp=e35c8354ad9b9bd8372153e1579bb88f5b54bd72;hpb=50b5860bcdc7dfb448c98c913203184e339756d7;p=fio.git diff --git a/os/os-freebsd.h b/os/os-freebsd.h index e35c8354..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 @@ -33,7 +35,7 @@ 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_isset(mask, cpu) CPU_ISSET((cpu), (mask)) -#define fio_cpu_count(maks) CPU_COUNT((mask)) +#define fio_cpu_count(mask) CPU_COUNT((mask)) static inline int fio_cpuset_init(os_cpu_mask_t *mask) { @@ -99,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