[PATCH] Add exec_prerun/exec_postrun options
[fio.git] / fio-ini.c
index 315622d5b1271f66db29fcb50f051a3fbb68584f..0c874085f466002c5893c994914ead475d412f4a 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;
 }
 
        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;
 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;
                        }
                                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;
 
                        printf("Client%d: bad option %s\n",td->thread_number,p);
                        return 1;