Cigy Cyriac | bf2e821 | 2010-08-10 19:51:11 -0400 | [diff] [blame] | 1 | #ifndef FIO_OS_AIX_H |
| 2 | #define FIO_OS_AIX_H |
| 3 | |
| 4 | #include <errno.h> |
| 5 | #include <unistd.h> |
| 6 | #include <sys/devinfo.h> |
| 7 | #include <sys/ioctl.h> |
| 8 | |
Jens Axboe | e2e5888 | 2011-01-04 08:36:06 +0100 | [diff] [blame] | 9 | #include "../file.h" |
| 10 | |
Cigy Cyriac | bf2e821 | 2010-08-10 19:51:11 -0400 | [diff] [blame] | 11 | #define FIO_HAVE_POSIXAIO |
Cigy Cyriac | bf2e821 | 2010-08-10 19:51:11 -0400 | [diff] [blame] | 12 | #define FIO_HAVE_ODIRECT |
| 13 | #define FIO_USE_GENERIC_RAND |
Bruce Cran | ecc314b | 2011-01-04 10:59:30 +0100 | [diff] [blame] | 14 | #define FIO_HAVE_CLOCK_MONOTONIC |
Cigy Cyriac | bf2e821 | 2010-08-10 19:51:11 -0400 | [diff] [blame] | 15 | |
Jens Axboe | 282cc16 | 2010-08-11 16:14:56 -0400 | [diff] [blame] | 16 | /* |
| 17 | * This is broken on AIX if _LARGE_FILES is defined... |
| 18 | */ |
| 19 | #if 0 |
| 20 | #define FIO_HAVE_FALLOCATE |
| 21 | #endif |
| 22 | |
Cigy Cyriac | bf2e821 | 2010-08-10 19:51:11 -0400 | [diff] [blame] | 23 | #define FIO_HAVE_PSHARED_MUTEX |
| 24 | |
| 25 | #define OS_MAP_ANON MAP_ANON |
Jens Axboe | 8e239ca | 2010-08-11 10:29:12 -0400 | [diff] [blame] | 26 | #define OS_MSG_DONTWAIT 0 |
Cigy Cyriac | bf2e821 | 2010-08-10 19:51:11 -0400 | [diff] [blame] | 27 | |
Bruce Cran | 9b83656 | 2011-01-08 19:49:54 +0100 | [diff] [blame] | 28 | static inline int blockdev_invalidate_cache(struct fio_file *f) |
Cigy Cyriac | bf2e821 | 2010-08-10 19:51:11 -0400 | [diff] [blame] | 29 | { |
| 30 | return EINVAL; |
| 31 | } |
| 32 | |
Bruce Cran | ecc314b | 2011-01-04 10:59:30 +0100 | [diff] [blame] | 33 | static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes) |
Cigy Cyriac | bf2e821 | 2010-08-10 19:51:11 -0400 | [diff] [blame] | 34 | { |
| 35 | struct devinfo info; |
| 36 | |
Bruce Cran | ecc314b | 2011-01-04 10:59:30 +0100 | [diff] [blame] | 37 | if (!ioctl(f->fd, IOCINFO, &info)) { |
Cigy Cyriac | bf2e821 | 2010-08-10 19:51:11 -0400 | [diff] [blame] | 38 | *bytes = (unsigned long long)info.un.scdk.numblks * |
| 39 | info.un.scdk.blksize; |
| 40 | return 0; |
| 41 | } |
| 42 | |
| 43 | return errno; |
| 44 | } |
| 45 | |
| 46 | static inline unsigned long long os_phys_mem(void) |
| 47 | { |
| 48 | long mem = sysconf(_SC_AIX_REALMEM); |
| 49 | |
| 50 | if (mem == -1) |
| 51 | return 0; |
| 52 | |
| 53 | return (unsigned long long) mem * 1024; |
| 54 | } |
| 55 | |
| 56 | #endif |