X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=os%2Fos-netbsd.h;h=4c629ddea9a03021c0df6c94116d00cf8158929b;hb=a016c83881fbdc30a62da231314cc21054cd10af;hp=e03866dfc86c131ea6fa9cf32f4786b45042baf8;hpb=b939683e7b997653a35bd7d55f733fc96030b246;p=fio.git diff --git a/os/os-netbsd.h b/os/os-netbsd.h index e03866df..4c629dde 100644 --- a/os/os-netbsd.h +++ b/os/os-netbsd.h @@ -1,9 +1,12 @@ #ifndef FIO_OS_NETBSD_H #define FIO_OS_NETBSD_H +#define FIO_OS os_netbsd + #include +#include #include -#include +#include /* XXX hack to avoid confilcts between rbtree.h and */ #define rb_node _rb_node #include @@ -13,13 +16,11 @@ #include "../file.h" -#define FIO_HAVE_POSIXAIO -#define FIO_HAVE_FADVISE #define FIO_HAVE_ODIRECT -#define FIO_HAVE_STRSEP -#define FIO_HAVE_FDATASYNC #define FIO_USE_GENERIC_BDEV_SIZE #define FIO_USE_GENERIC_RAND +#define FIO_USE_GENERIC_INIT_RANDOM_STATE +#define FIO_HAVE_FS_STAT #define FIO_HAVE_GETTID #undef FIO_HAVE_CPU_AFFINITY /* XXX notyet */ @@ -30,6 +31,10 @@ #define PTHREAD_STACK_MIN 4096 #endif +#define fio_swap16(x) bswap16(x) +#define fio_swap32(x) bswap32(x) +#define fio_swap64(x) bswap64(x) + typedef off_t off64_t; static inline int blockdev_invalidate_cache(struct fio_file *f) @@ -49,10 +54,20 @@ static inline unsigned long long os_phys_mem(void) static inline int gettid(void) { - long lwpid; + return (int) _lwp_self(); +} + +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; - thr_self(&lwpid); - return (int) lwpid; + ret = s.f_frsize; + ret *= (unsigned long long) s.f_bfree; + return ret; } #ifdef MADV_FREE