- if (td->filetype == FIO_TYPE_FILE) {
- if (!td->overwrite)
- flags |= O_TRUNC;
-
- flags |= O_CREAT;
- }
-
- open_file(td, f, flags, 0600);
- } else {
- if (td->filetype == FIO_TYPE_CHAR)
- flags |= O_RDWR;
- else
- flags |= O_RDONLY;
-
- open_file(td, f, flags, 0);
- }
- }
-
- if (f->fd == -1) {
- int __e = errno;
-
- td_verror(td, __e, "open");
- if (__e == EINVAL && td->odirect)
- log_err("fio: destination does not support O_DIRECT\n");
- return 1;
- }
-
- if (get_file_size(td, f)) {
- close_file(td, f);
- return 1;
- }
-
- return 0;
-}
-
-int open_files(struct thread_data *td)
-{
- struct fio_file *f;
- int i, err = 0;
-
- for_each_file(td, f, i) {
- err = setup_file(td, f);
- if (err)