Fio 2.8
[fio.git] / os / os-freebsd.h
index 402792a0f7d714f99a41c77ad686d39ef561c548..fa00bb8001a230af4edc4d76c08553299f5f9f07 100644 (file)
@@ -10,6 +10,7 @@
 #include <sys/socket.h>
 #include <sys/param.h>
 #include <sys/cpuset.h>
+#include <sys/statvfs.h>
 
 #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