void add_file(struct thread_data *td, const char *fname)
{
int cur_files = td->files_index;
+ char file_name[PATH_MAX];
struct fio_file *f;
+ int len = 0;
td->files = realloc(td->files, (cur_files + 1) * sizeof(*f));
f = &td->files[cur_files];
memset(f, 0, sizeof(*f));
f->fd = -1;
- f->file_name = strdup(fname);
+
+ if (td->o.directory)
+ len = sprintf(file_name, "%s/", td->o.directory);
+
+ sprintf(file_name + len, "%s", fname);
+ f->file_name = strdup(file_name);
get_file_type(f);
return 0;
}
-
/*
* Adds a job to the list of things todo. Sanitizes the various options
* to make sure we don't have conflicts, and initializes various
const char *ddir_str[] = { NULL, "read", "write", "rw", NULL,
"randread", "randwrite", "randrw" };
unsigned int i;
- struct fio_file *f;
const char *engine;
char fname[PATH_MAX];
int numjobs, file_alloced;
if (fixup_options(td))
goto err;
- for_each_file(td, f, i) {
- if (td->o.directory && f->filetype == FIO_TYPE_FILE) {
- sprintf(fname, "%s/%s", td->o.directory, f->file_name);
- f->file_name = strdup(fname);
- }
- }
-
td->mutex = fio_sem_init(0);
td->ts.clat_stat[0].min_val = td->ts.clat_stat[1].min_val = ULONG_MAX;