X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=os%2Fos-dragonfly.h;h=3c460ae2f33105574769450cba7fe817362c66a6;hp=423b2369a071bd2de9096178ee2d3c118decabb2;hb=de5ed0e4d398bc9d4576f9b2b82d7686989c27e1;hpb=63463983ce10e9678c5ad309608630eea873b4df diff --git a/os/os-dragonfly.h b/os/os-dragonfly.h index 423b2369..3c460ae2 100644 --- a/os/os-dragonfly.h +++ b/os/os-dragonfly.h @@ -10,14 +10,21 @@ #include #include #include -#include #include #include +/* API changed during "5.3 development" */ +#if __DragonFly_version < 500302 +#include +#define DAIOCTRIM IOCTLTRIM +#else +#include +#endif + #include "../file.h" +#include "../lib/types.h" #define FIO_HAVE_ODIRECT -#define FIO_USE_GENERIC_RAND #define FIO_USE_GENERIC_INIT_RANDOM_STATE #define FIO_HAVE_FS_STAT #define FIO_HAVE_TRIM @@ -107,12 +114,9 @@ static inline void fio_cpu_set(os_cpu_mask_t *mask, int cpu) CPUMASK_ORBIT(*mask, cpu); } -static inline int fio_cpu_isset(os_cpu_mask_t *mask, int cpu) +static inline bool fio_cpu_isset(os_cpu_mask_t *mask, int cpu) { - if (CPUMASK_TESTBIT(*mask, cpu)) - return 1; - - return 0; + return CPUMASK_TESTBIT(*mask, cpu) != 0; } static inline int fio_setaffinity(int pid, os_cpu_mask_t mask) @@ -198,10 +202,12 @@ static inline unsigned long long os_phys_mem(void) return mem; } +#ifndef CONFIG_HAVE_GETTID static inline int gettid(void) { return (int) lwp_gettid(); } +#endif static inline unsigned long long get_fs_free_size(const char *path) { @@ -224,7 +230,7 @@ static inline int os_trim(struct fio_file *f, unsigned long long start, range[0] = start; range[1] = len; - if (!ioctl(f->fd, IOCTLTRIM, range)) + if (!ioctl(f->fd, DAIOCTRIM, range)) return 0; return errno;