Increase maximum length of line in jobs file to 8192
authorNick Principe <nick@princi.pe>
Mon, 1 Jul 2019 19:45:21 +0000 (15:45 -0400)
committerNick Principe <nick@princi.pe>
Mon, 1 Jul 2019 20:21:09 +0000 (16:21 -0400)
Increase OPT_LEN_MAX to 8192, use OPT_LEN_MAX for string in
__parse_jobs_ini(), and document line length limit for job files in man
page.

Signed-off-by: Nick Principe nick@princi.pe
fio.1
init.c
parse.h

diff --git a/fio.1 b/fio.1
index 84b80eee3cf91692346ee65a9fafd65808c6c6d2..156201ad7822528043a39546810865bbe5e0968a 100644 (file)
--- a/fio.1
+++ b/fio.1
@@ -201,6 +201,8 @@ argument, \fB\-\-cmdhelp\fR will detail the given \fIcommand\fR.
 See the `examples/' directory for inspiration on how to write job files. Note
 the copyright and license requirements currently apply to
 `examples/' files.
+
+Note that the maximum length of a line in the job file is 8192 bytes.
 .SH "JOB FILE PARAMETERS"
 Some parameters take an option of a given type, such as an integer or a
 string. Anywhere a numeric value is required, an arithmetic expression may be
diff --git a/init.c b/init.c
index 738342799c5cc391494b43d3de8433939698cb35..f7e7296fda9b495053b964ff789794dd2009218a 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1887,7 +1887,7 @@ static int __parse_jobs_ini(struct thread_data *td,
                }
        }
 
-       string = malloc(4096);
+       string = malloc(OPT_LEN_MAX);
 
        /*
         * it's really 256 + small bit, 280 should suffice
@@ -1920,7 +1920,7 @@ static int __parse_jobs_ini(struct thread_data *td,
                        if (is_buf)
                                p = strsep(&file, "\n");
                        else
-                               p = fgets(string, 4096, f);
+                               p = fgets(string, OPT_LEN_MAX, f);
                        if (!p)
                                break;
                }
@@ -1989,7 +1989,7 @@ static int __parse_jobs_ini(struct thread_data *td,
                                if (is_buf)
                                        p = strsep(&file, "\n");
                                else
-                                       p = fgets(string, 4096, f);
+                                       p = fgets(string, OPT_LEN_MAX, f);
                                if (!p)
                                        break;
                                dprint(FD_PARSE, "%s", p);
diff --git a/parse.h b/parse.h
index b47a02c78263d038c6cd8d3c04c61611c3c55c2e..9b4e2f32535cbd8c31bbc4f059dd1f76b76a25fc 100644 (file)
--- a/parse.h
+++ b/parse.h
@@ -37,7 +37,7 @@ struct value_pair {
        void *cb;                       /* sub-option callback */
 };
 
-#define OPT_LEN_MAX    4096
+#define OPT_LEN_MAX    8192
 #define PARSE_MAX_VP   24
 
 /*