+/* str_dp_scheme_cb() is a callback function for parsing the fdp_scheme option
+ This function validates the fdp_scheme filename. */
+static int str_dp_scheme_cb(void *data, const char *input)
+{
+ struct thread_data *td = cb_data_to_td(data);
+ struct stat sb;
+ char *filename;
+ int ret = 0;
+
+ if (parse_dryrun())
+ return 0;
+
+ filename = strdup(td->o.dp_scheme_file);
+ strip_blank_front(&filename);
+ strip_blank_end(filename);
+
+ strcpy(td->o.dp_scheme_file, filename);
+
+ if (lstat(filename, &sb) < 0){
+ ret = errno;
+ log_err("fio: lstat() error related to %s\n", filename);
+ td_verror(td, ret, "lstat");
+ goto out;
+ }
+
+ if (!S_ISREG(sb.st_mode)) {
+ ret = errno;
+ log_err("fio: %s is not a file\n", filename);
+ td_verror(td, ret, "S_ISREG");
+ goto out;
+ }
+
+out:
+ free(filename);
+ return ret;
+}
+