#include <sys/sysctl.h>
#include <sys/statvfs.h>
#include <sys/diskslice.h>
-#include <sys/ioctl_compat.h>
#include <sys/usched.h>
#include <sys/resource.h>
+/* API changed during "5.3 development" */
+#if __DragonFly_version < 500302
+#include <sys/ioctl_compat.h>
+#define DAIOCTRIM IOCTLTRIM
+#else
+#include <bus/cam/scsi/scsi_daio.h>
+#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
/* This is supposed to equal (sizeof(cpumask_t)*8) */
#define FIO_MAX_CPUS SMP_MAXCPU
-typedef off_t off64_t;
typedef cpumask_t os_cpu_mask_t;
/*
/* No CPU_COUNT(), but use the default function defined in os/os.h */
#define fio_cpu_count(mask) CPU_COUNT((mask))
+#ifdef CONFIG_PTHREAD_GETAFFINITY
+#define FIO_HAVE_GET_THREAD_AFFINITY
+#define fio_get_thread_affinity(mask) \
+ pthread_getaffinity_np(pthread_self(), sizeof(mask), &(mask))
+#endif
+
static inline int fio_cpuset_init(os_cpu_mask_t *mask)
{
CPUMASK_ASSZERO(*mask);
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)
* ioprio_set() with 4 arguments, so define fio's ioprio_set() as a macro.
* Note that there is no idea of class within ioprio_set(2) unlike Linux.
*/
-#define ioprio_set(which, who, ioprio_class, ioprio) \
+#define ioprio_value(ioprio_class, ioprio, ioprio_hint) (ioprio)
+#define ioprio_set(which, who, ioprio_class, ioprio, ioprio_hint) \
ioprio_set(which, who, ioprio)
+#define ioprio(ioprio) (ioprio)
+
static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
{
struct partinfo pi;
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)
{
return ret;
}
-static inline int os_trim(int fd, unsigned long long start,
+static inline int os_trim(struct fio_file *f, unsigned long long start,
unsigned long long len)
{
off_t range[2];
range[0] = start;
range[1] = len;
- if (!ioctl(fd, IOCTLTRIM, range))
+ if (!ioctl(f->fd, DAIOCTRIM, range))
return 0;
return errno;