Merge branch 'master' of ssh://router/data/git/fio
[fio.git] / fio-ini.c
index 0fec342d4b65271387a2ca76c39df29d8f2f0c39..73cebf220d5f761c6797993b402a556f4af0ca27 100644 (file)
--- a/fio-ini.c
+++ b/fio-ini.c
@@ -38,6 +38,7 @@
 #define DEF_ZONE_SKIP          (0)
 #define DEF_RWMIX_CYCLE                (500)
 #define DEF_RWMIX_READ         (50)
+#define DEF_NICE               (0)
 
 static char fio_version_string[] = "fio 1.3";
 
@@ -405,8 +406,12 @@ typedef int (str_cb_fn)(struct thread_data *, char *);
 
 static int check_str(char *p, char *name, str_cb_fn *cb, struct thread_data *td)
 {
-       char *s = strstr(p, name);
+       char *s;
 
+       if (strncmp(p, name, strlen(name)))
+               return 1;
+
+       s = strstr(p, name);
        if (!s)
                return 1;
 
@@ -421,8 +426,12 @@ static int check_str(char *p, char *name, str_cb_fn *cb, struct thread_data *td)
 
 static int check_strstore(char *p, char *name, char *dest)
 {
-       char *s = strstr(p, name);
+       char *s;
+
+       if (strncmp(p, name, strlen(name)))
+               return 1;
 
+       s = strstr(p, name);
        if (!s)
                return 1;
 
@@ -457,6 +466,9 @@ static int check_range(char *p, char *name, unsigned long *s, unsigned long *e)
        char option[128];
        char *str, *p1, *p2;
 
+       if (strncmp(p, name, strlen(name)))
+               return 1;
+
        strcpy(option, p);
        p = option;
 
@@ -637,7 +649,6 @@ static int str_ioengine_cb(struct thread_data *td, char *str)
 static int str_iolog_cb(struct thread_data *td, char *file)
 {
        strncpy(td->iolog_file, file, sizeof(td->iolog_file) - 1);
-
        return 0;
 }
 
@@ -802,6 +813,10 @@ int parse_jobs_ini(char *file)
                                fgetpos(f, &off);
                                continue;
                        }
+                       if (!check_int(p, "nice", &td->nice)) {
+                               fgetpos(f, &off);
+                               continue;
+                       }
                        if (!check_range(p, "bsrange", &ul1, &ul2)) {
                                if (ul1 > ul2) {
                                        td->max_bs = ul1;
@@ -879,7 +894,16 @@ int parse_jobs_ini(char *file)
                                continue;
                        }
                        if (!check_str(p, "iolog", str_iolog_cb, td)) {
-                               td->iolog = 1;
+                               printf("got read iolog\n");
+                               td->read_iolog = 1;
+                               td->write_iolog = 0;
+                               fgetpos(f, &off);
+                               continue;
+                       }
+                       if (!td->read_iolog &&
+                           !check_str(p, "write_iolog", str_iolog_cb, td)) {
+                               printf("got write iolog\n");
+                               td->write_iolog = 1;
                                fgetpos(f, &off);
                                continue;
                        }
@@ -937,6 +961,7 @@ static int fill_def_thread(void)
        def_thread.use_thread = DEF_USE_THREAD;
        def_thread.rwmixcycle = DEF_RWMIX_CYCLE;
        def_thread.rwmixread = DEF_RWMIX_READ;
+       def_thread.nice = DEF_NICE;
 #ifdef FIO_HAVE_DISK_UTIL
        def_thread.do_disk_util = 1;
 #endif