Jens Axboe | d6aed79 | 2009-06-03 08:41:15 +0200 | [diff] [blame] | 1 | #ifndef FIO_DDIR_H |
| 2 | #define FIO_DDIR_H |
| 3 | |
| 4 | enum fio_ddir { |
| 5 | DDIR_READ = 0, |
| 6 | DDIR_WRITE, |
| 7 | DDIR_SYNC, |
Jens Axboe | 5f9099e | 2009-06-16 22:40:26 +0200 | [diff] [blame] | 8 | DDIR_DATASYNC, |
Glen Ogilvie | 457bf39 | 2009-11-03 21:52:36 +0100 | [diff] [blame] | 9 | DDIR_WAIT, |
Jens Axboe | d6aed79 | 2009-06-03 08:41:15 +0200 | [diff] [blame] | 10 | DDIR_INVAL = -1, |
| 11 | }; |
| 12 | |
| 13 | enum td_ddir { |
| 14 | TD_DDIR_READ = 1 << 0, |
| 15 | TD_DDIR_WRITE = 1 << 1, |
| 16 | TD_DDIR_RAND = 1 << 2, |
| 17 | TD_DDIR_RW = TD_DDIR_READ | TD_DDIR_WRITE, |
| 18 | TD_DDIR_RANDREAD = TD_DDIR_READ | TD_DDIR_RAND, |
| 19 | TD_DDIR_RANDWRITE = TD_DDIR_WRITE | TD_DDIR_RAND, |
| 20 | TD_DDIR_RANDRW = TD_DDIR_RW | TD_DDIR_RAND, |
| 21 | }; |
| 22 | |
Jens Axboe | 29c8e86 | 2009-06-05 22:10:51 +0200 | [diff] [blame] | 23 | #define td_read(td) ((td)->o.td_ddir & TD_DDIR_READ) |
| 24 | #define td_write(td) ((td)->o.td_ddir & TD_DDIR_WRITE) |
| 25 | #define td_rw(td) (((td)->o.td_ddir & TD_DDIR_RW) == TD_DDIR_RW) |
| 26 | #define td_random(td) ((td)->o.td_ddir & TD_DDIR_RAND) |
| 27 | #define file_randommap(td, f) (!(td)->o.norandommap && (f)->file_map) |
| 28 | |
Jens Axboe | 5f9099e | 2009-06-16 22:40:26 +0200 | [diff] [blame] | 29 | static inline int ddir_sync(enum fio_ddir ddir) |
| 30 | { |
| 31 | return ddir == DDIR_SYNC || ddir == DDIR_DATASYNC; |
| 32 | } |
| 33 | |
Jens Axboe | d6aed79 | 2009-06-03 08:41:15 +0200 | [diff] [blame] | 34 | #endif |