Add generic bdev_size function
[fio.git] / os / os-freebsd.h
CommitLineData
ebac4655
JA
1#ifndef FIO_OS_FREEBSD_H
2#define FIO_OS_FREEBSD_H
3
690dec6e 4#include <errno.h>
5c4e1dbc
JA
5#include <sys/sysctl.h>
6
ebac4655 7#define FIO_HAVE_POSIXAIO
2c0ecd28 8#define FIO_HAVE_ODIRECT
792d5517 9#define FIO_USE_GENERIC_BDEV_SIZE
ebac4655 10
dc873b6f 11#define OS_MAP_ANON MAP_ANON
ebac4655
JA
12
13typedef unsigned long os_cpu_mask_t;
6dfd46b9 14typedef unsigned int os_random_state_t;
ebac4655 15
e5b401d4
JA
16static inline int blockdev_invalidate_cache(int fd)
17{
18 return EINVAL;
ebac4655
JA
19}
20
32cd46a0
JA
21static inline unsigned long long os_phys_mem(void)
22{
23 int mib[2] = { CTL_HW, HW_PHYSMEM };
24 unsigned long long mem;
25 size_t len = sizeof(mem);
26
27 sysctl(mib, 2, &mem, &len, NULL, 0);
28 return mem;
29}
30
6dfd46b9
JA
31static inline void os_random_seed(unsigned long seed, os_random_state_t *rs)
32{
33 srand(seed);
34}
35
36static inline long os_random_long(os_random_state_t *rs)
37{
38 long val;
39
40 val = rand_r(rs);
41 return val;
42}
43
a1c58075
JA
44#ifdef MADV_FREE
45#define FIO_MADV_FREE MADV_FREE
46#endif
47
ebac4655 48#endif