Commit | Line | Data |
---|---|---|
a94ea28b JA |
1 | /* |
2 | * null engine - doesn't do any transfers. Used to test fio. | |
3 | * | |
4 | */ | |
5 | #include <stdio.h> | |
6 | #include <stdlib.h> | |
7 | #include <unistd.h> | |
8 | #include <errno.h> | |
9 | #include <assert.h> | |
10 | ||
11 | #include "../fio.h" | |
12 | #include "../os.h" | |
13 | ||
36167d82 | 14 | static int fio_null_queue(struct thread_data fio_unused *td, struct io_u *io_u) |
a94ea28b | 15 | { |
a94ea28b JA |
16 | io_u->resid = 0; |
17 | io_u->error = 0; | |
36167d82 | 18 | return FIO_Q_COMPLETED; |
a94ea28b JA |
19 | } |
20 | ||
2fd233b7 JA |
21 | static int fio_null_setup(struct thread_data *td) |
22 | { | |
23 | struct fio_file *f; | |
24 | int i; | |
25 | ||
26 | if (!td->total_file_size) { | |
27 | log_err("fio: need size= set\n"); | |
28 | return 1; | |
29 | } | |
30 | ||
31 | td->io_size = td->total_file_size; | |
32 | td->total_io_size = td->io_size; | |
33 | ||
34 | for_each_file(td, f, i) { | |
35 | f->fd = dup(STDOUT_FILENO); | |
36 | f->real_file_size = td->total_io_size / td->nr_files; | |
37 | f->file_size = f->real_file_size; | |
38 | } | |
39 | ||
40 | td->nr_open_files = td->nr_files; | |
41 | return 0; | |
42 | } | |
43 | ||
a94ea28b JA |
44 | static struct ioengine_ops ioengine = { |
45 | .name = "null", | |
46 | .version = FIO_IOOPS_VERSION, | |
2fd233b7 | 47 | .setup = fio_null_setup, |
a94ea28b | 48 | .queue = fio_null_queue, |
2fd233b7 | 49 | .flags = FIO_SYNCIO | FIO_DISKLESSIO | FIO_SELFOPEN, |
a94ea28b JA |
50 | }; |
51 | ||
52 | static void fio_init fio_null_register(void) | |
53 | { | |
54 | register_ioengine(&ioengine); | |
55 | } | |
56 | ||
57 | static void fio_exit fio_null_unregister(void) | |
58 | { | |
59 | unregister_ioengine(&ioengine); | |
60 | } |