+/*
+ * Read version 1 iolog data.
+ */
+static int read_iolog(struct thread_data *td, FILE *f)
+{
+ log_err("fio: iolog version 1 is no longer supported\n");
+ return 1;
+}
+
+/*
+ * open iolog, check version, and call appropriate parser
+ */
+static int init_iolog_read(struct thread_data *td)
+{
+ char buffer[256], *p;
+ FILE *f;
+ int ret;
+
+ f = fopen(td->o.read_iolog_file, "r");
+ if (!f) {
+ perror("fopen read iolog");
+ return 1;
+ }
+
+ p = fgets(buffer, sizeof(buffer), f);
+ if (!p) {
+ td_verror(td, errno, "iolog read");
+ log_err("fio: unable to read iolog\n");
+ return 1;
+ }
+
+ /*
+ * version 2 of the iolog stores a specific string as the
+ * first line, check for that
+ */
+ if (!strncmp(iolog_ver2, buffer, strlen(iolog_ver2)))
+ ret = read_iolog2(td, f);
+ else {
+ /*
+ * seek back to the beginning
+ */
+ if (fseek(f, 0, SEEK_SET) < 0) {
+ td_verror(td, errno, "iolog read");
+ log_err("fio: unable to read iolog\n");
+ return 1;
+ }
+
+ ret = read_iolog(td, f);
+ }
+
+ fclose(f);
+ return ret;
+}
+