[PATCH] Unlink and directory fix
authorJens Axboe <jens.axboe@oracle.com>
Mon, 8 Jan 2007 09:47:43 +0000 (10:47 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Mon, 8 Jan 2007 09:47:43 +0000 (10:47 +0100)
Make 'unlink' a bool and fix bug in directory setup.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
HOWTO
init.c

diff --git a/HOWTO b/HOWTO
index c9d29f299bd4109fcbcf3c504925986d28979c18..1b34c283af0f385e00407a9167c6ec02820ad4a1 100644 (file)
--- a/HOWTO
+++ b/HOWTO
@@ -414,7 +414,7 @@ create_serialize=bool       If true, serialize the file creating for the jobs.
 create_fsync=bool      fsync the data file after creation. This is the
                        default.
 
 create_fsync=bool      fsync the data file after creation. This is the
                        default.
 
-unlink         Unlink the job files when done. fio defaults to doing this,
+unlink=bool    Unlink the job files when done. fio defaults to doing this,
                if it created the file itself.
 
 loops=int      Run the specified number of iterations of this job. Used
                if it created the file itself.
 
 loops=int      Run the specified number of iterations of this job. Used
diff --git a/init.c b/init.c
index 8422655548fc64d2631be4c8c9e32472d825dc0f..bb47c439c92984caf011633b0894ac9bdbd2a665 100644 (file)
--- a/init.c
+++ b/init.c
@@ -327,7 +327,7 @@ static struct fio_option options[] = {
        },
        {
                .name   = "unlink",
        },
        {
                .name   = "unlink",
-               .type   = FIO_OPT_STR_SET,
+               .type   = FIO_OPT_INT,
                .off1   = td_var_offset(unlink),
        },
        {
                .off1   = td_var_offset(unlink),
        },
        {
@@ -602,7 +602,7 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num)
                int len = 0;
 
                if (td->directory && td->directory[0] != '\0')
                int len = 0;
 
                if (td->directory && td->directory[0] != '\0')
-                       sprintf(tmp, "%s/", td->directory);
+                       len = sprintf(tmp, "%s/", td->directory);
 
                td->files = malloc(sizeof(struct fio_file) * td->nr_files);
 
 
                td->files = malloc(sizeof(struct fio_file) * td->nr_files);
 
@@ -615,6 +615,7 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num)
                        else
                                sprintf(tmp + len, "%s.%d.%d", jobname, td->thread_number, i);
                        f->file_name = strdup(tmp);
                        else
                                sprintf(tmp + len, "%s.%d.%d", jobname, td->thread_number, i);
                        f->file_name = strdup(tmp);
+                       fprintf(stderr, "%s\n", f->file_name);
                }
        } else {
                td->nr_files = 1;
                }
        } else {
                td->nr_files = 1;