[PATCH] Add exec_prerun/exec_postrun options
[fio.git] / fio-ini.c
index 315622d..0c87408 100644 (file)
--- a/fio-ini.c
+++ b/fio-ini.c
@@ -652,6 +652,18 @@ static int str_iolog_cb(struct thread_data *td, char *file)
        return 0;
 }
 
+static int str_prerun_cb(struct thread_data *td, char *file)
+{
+       td->exec_prerun = strdup(file);
+       return 0;
+}
+
+static int str_postrun_cb(struct thread_data *td, char *file)
+{
+       td->exec_postrun = strdup(file);
+       return 0;
+}
+
 int parse_jobs_ini(char *file)
 {
        unsigned int prioclass, prio, cpu, global, il;
@@ -907,6 +919,14 @@ int parse_jobs_ini(char *file)
                                fgetpos(f, &off);
                                continue;
                        }
+                       if (!check_str(p, "exec_prerun", str_prerun_cb, td)) {
+                               fgetpos(f, &off);
+                               continue;
+                       }
+                       if (!check_str(p, "exec_postrun", str_postrun_cb, td)) {
+                               fgetpos(f, &off);
+                               continue;
+                       }
 
                        printf("Client%d: bad option %s\n",td->thread_number,p);
                        return 1;