13 #define td_var_offset(var) ((size_t) &((struct thread_options *)0)->var)
16 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
18 static char *get_opt_postfix(const char *str)
20 char *p = strstr(str, ":");
26 strip_blank_front(&p);
31 static int bs_cmp(const void *p1, const void *p2)
33 const struct bssplit *bsp1 = p1;
34 const struct bssplit *bsp2 = p2;
36 return bsp1->perc < bsp2->perc;
39 static int str_bssplit_cb(void *data, const char *input)
41 struct thread_data *td = data;
42 char *fname, *str, *p;
43 unsigned int i, perc, perc_missing;
44 unsigned int max_bs, min_bs;
47 p = str = strdup(input);
49 strip_blank_front(&str);
53 td->o.bssplit = malloc(4 * sizeof(struct bssplit));
58 while ((fname = strsep(&str, ":")) != NULL) {
65 * grow struct buffer, if needed
67 if (i == td->o.bssplit_nr) {
68 td->o.bssplit_nr <<= 1;
69 td->o.bssplit = realloc(td->o.bssplit,
71 * sizeof(struct bssplit));
74 perc_str = strstr(fname, "/");
78 perc = atoi(perc_str);
86 if (str_to_decimal(fname, &val, 1)) {
87 log_err("fio: bssplit conversion failed\n");
97 td->o.bssplit[i].bs = val;
98 td->o.bssplit[i].perc = perc;
102 td->o.bssplit_nr = i;
105 * Now check if the percentages add up, and how much is missing
107 perc = perc_missing = 0;
108 for (i = 0; i < td->o.bssplit_nr; i++) {
109 struct bssplit *bsp = &td->o.bssplit[i];
111 if (bsp->perc == (unsigned char) -1)
118 log_err("fio: bssplit percentages add to more than 100%%\n");
123 * If values didn't have a percentage set, divide the remains between
127 for (i = 0; i < td->o.bssplit_nr; i++) {
128 struct bssplit *bsp = &td->o.bssplit[i];
130 if (bsp->perc == (unsigned char) -1)
131 bsp->perc = (100 - perc) / perc_missing;
135 td->o.min_bs[DDIR_READ] = td->o.min_bs[DDIR_WRITE] = min_bs;
136 td->o.max_bs[DDIR_READ] = td->o.max_bs[DDIR_WRITE] = max_bs;
139 * now sort based on percentages, for ease of lookup
141 qsort(td->o.bssplit, td->o.bssplit_nr, sizeof(struct bssplit), bs_cmp);
147 static int str_rw_cb(void *data, const char *str)
149 struct thread_data *td = data;
150 char *nr = get_opt_postfix(str);
154 td->o.ddir_nr = atoi(nr);
159 static int str_mem_cb(void *data, const char *mem)
161 struct thread_data *td = data;
163 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP) {
164 td->mmapfile = get_opt_postfix(mem);
165 if (td->o.mem_type == MEM_MMAPHUGE && !td->mmapfile) {
166 log_err("fio: mmaphuge:/path/to/file\n");
174 static int str_lockmem_cb(void fio_unused *data, unsigned long *val)
180 #ifdef FIO_HAVE_IOPRIO
181 static int str_prioclass_cb(void *data, unsigned int *val)
183 struct thread_data *td = data;
187 * mask off old class bits, str_prio_cb() may have set a default class
189 mask = (1 << IOPRIO_CLASS_SHIFT) - 1;
192 td->ioprio |= *val << IOPRIO_CLASS_SHIFT;
197 static int str_prio_cb(void *data, unsigned int *val)
199 struct thread_data *td = data;
204 * If no class is set, assume BE
206 if ((td->ioprio >> IOPRIO_CLASS_SHIFT) == 0)
207 td->ioprio |= IOPRIO_CLASS_BE << IOPRIO_CLASS_SHIFT;
214 static int str_exitall_cb(void)
216 exitall_on_terminate = 1;
220 #ifdef FIO_HAVE_CPU_AFFINITY
221 static int str_cpumask_cb(void *data, unsigned int *val)
223 struct thread_data *td = data;
226 CPU_ZERO(&td->o.cpumask);
228 for (i = 0; i < sizeof(int) * 8; i++)
230 CPU_SET(*val, &td->o.cpumask);
232 td->o.cpumask_set = 1;
236 static int str_cpus_allowed_cb(void *data, const char *input)
238 struct thread_data *td = data;
241 CPU_ZERO(&td->o.cpumask);
243 p = str = strdup(input);
245 strip_blank_front(&str);
246 strip_blank_end(str);
248 while ((cpu = strsep(&str, ",")) != NULL) {
251 CPU_SET(atoi(cpu), &td->o.cpumask);
255 td->o.cpumask_set = 1;
260 static int str_fst_cb(void *data, const char *str)
262 struct thread_data *td = data;
263 char *nr = get_opt_postfix(str);
265 td->file_service_nr = 1;
267 td->file_service_nr = atoi(nr);
272 static int str_filename_cb(void *data, const char *input)
274 struct thread_data *td = data;
275 char *fname, *str, *p;
277 p = str = strdup(input);
279 strip_blank_front(&str);
280 strip_blank_end(str);
282 if (!td->files_index)
285 while ((fname = strsep(&str, ":")) != NULL) {
296 static int str_directory_cb(void *data, const char fio_unused *str)
298 struct thread_data *td = data;
301 if (lstat(td->o.directory, &sb) < 0) {
302 log_err("fio: %s is not a directory\n", td->o.directory);
303 td_verror(td, errno, "lstat");
306 if (!S_ISDIR(sb.st_mode)) {
307 log_err("fio: %s is not a directory\n", td->o.directory);
314 static int str_opendir_cb(void *data, const char fio_unused *str)
316 struct thread_data *td = data;
318 if (!td->files_index)
321 return add_dir_files(td, td->o.opendir);
324 static int str_verify_offset_cb(void *data, unsigned int *off)
326 struct thread_data *td = data;
328 if (*off && *off < sizeof(struct verify_header)) {
329 log_err("fio: verify_offset too small\n");
333 td->o.verify_offset = *off;
337 static int str_verify_pattern_cb(void *data, unsigned int *off)
339 struct thread_data *td = data;
344 td->o.verify_pattern_bytes = 1;
346 td->o.verify_pattern_bytes = 2;
348 td->o.verify_pattern_bytes = 3;
350 td->o.verify_pattern_bytes = 4;
352 td->o.verify_pattern = *off;
356 static int str_lockfile_cb(void *data, const char *str)
358 struct thread_data *td = data;
359 char *nr = get_opt_postfix(str);
361 td->o.lockfile_batch = 1;
363 td->o.lockfile_batch = atoi(nr);
368 #define __stringify_1(x) #x
369 #define __stringify(x) __stringify_1(x)
372 * Map of job/command line options
374 static struct fio_option options[] = {
376 .name = "description",
377 .type = FIO_OPT_STR_STORE,
378 .off1 = td_var_offset(description),
379 .help = "Text job description",
383 .type = FIO_OPT_STR_STORE,
384 .off1 = td_var_offset(name),
385 .help = "Name of this job",
389 .type = FIO_OPT_STR_STORE,
390 .off1 = td_var_offset(directory),
391 .cb = str_directory_cb,
392 .help = "Directory to store files in",
396 .type = FIO_OPT_STR_STORE,
397 .off1 = td_var_offset(filename),
398 .cb = str_filename_cb,
399 .help = "File(s) to use for the workload",
404 .cb = str_lockfile_cb,
405 .off1 = td_var_offset(file_lock_mode),
406 .help = "Lock file when doing IO to it",
407 .parent = "filename",
411 .oval = FILE_LOCK_NONE,
412 .help = "No file locking",
414 { .ival = "exclusive",
415 .oval = FILE_LOCK_EXCLUSIVE,
416 .help = "Exclusive file lock",
420 .oval = FILE_LOCK_READWRITE,
421 .help = "Read vs write lock",
427 .type = FIO_OPT_STR_STORE,
428 .off1 = td_var_offset(opendir),
429 .cb = str_opendir_cb,
430 .help = "Recursively add files from this directory and down",
434 .alias = "readwrite",
437 .off1 = td_var_offset(td_ddir),
438 .help = "IO direction",
442 .oval = TD_DDIR_READ,
443 .help = "Sequential read",
446 .oval = TD_DDIR_WRITE,
447 .help = "Sequential write",
449 { .ival = "randread",
450 .oval = TD_DDIR_RANDREAD,
451 .help = "Random read",
453 { .ival = "randwrite",
454 .oval = TD_DDIR_RANDWRITE,
455 .help = "Random write",
459 .help = "Sequential read and write mix",
462 .oval = TD_DDIR_RANDRW,
463 .help = "Random read and write mix"
469 .type = FIO_OPT_STR_STORE,
470 .off1 = td_var_offset(ioengine),
471 .help = "IO engine to use",
475 .help = "Use read/write",
478 .help = "Use pread/pwrite",
481 .help = "Use readv/writev",
483 #ifdef FIO_HAVE_LIBAIO
485 .help = "Linux native asynchronous IO",
488 #ifdef FIO_HAVE_POSIXAIO
489 { .ival = "posixaio",
490 .help = "POSIX asynchronous IO",
494 .help = "Memory mapped IO",
496 #ifdef FIO_HAVE_SPLICE
498 .help = "splice/vmsplice based IO",
500 { .ival = "netsplice",
501 .help = "splice/vmsplice to/from the network",
506 .help = "SCSI generic v3 IO",
510 .help = "Testing engine (no data transfer)",
513 .help = "Network IO",
515 #ifdef FIO_HAVE_SYSLET
516 { .ival = "syslet-rw",
517 .help = "syslet enabled async pread/pwrite IO",
521 .help = "CPU cycler burner engine",
523 #ifdef FIO_HAVE_GUASI
525 .help = "GUASI IO engine",
528 { .ival = "external",
529 .help = "Load external engine (append name)",
536 .off1 = td_var_offset(iodepth),
537 .help = "Amount of IO buffers to keep in flight",
542 .name = "iodepth_batch",
544 .off1 = td_var_offset(iodepth_batch),
545 .help = "Number of IO to submit in one go",
551 .name = "iodepth_low",
553 .off1 = td_var_offset(iodepth_low),
554 .help = "Low water mark for queuing depth",
559 .type = FIO_OPT_STR_VAL,
560 .off1 = td_var_offset(size),
562 .help = "Total size of device or files",
565 .name = "fill_device",
566 .type = FIO_OPT_BOOL,
567 .off1 = td_var_offset(fill_device),
568 .help = "Write until an ENOSPC error occurs",
573 .type = FIO_OPT_STR_VAL,
574 .off1 = td_var_offset(file_size_low),
575 .off2 = td_var_offset(file_size_high),
577 .help = "Size of individual files",
581 .alias = "fileoffset",
582 .type = FIO_OPT_STR_VAL,
583 .off1 = td_var_offset(start_offset),
584 .help = "Start IO from this offset",
589 .alias = "blocksize",
590 .type = FIO_OPT_STR_VAL_INT,
591 .off1 = td_var_offset(bs[DDIR_READ]),
592 .off2 = td_var_offset(bs[DDIR_WRITE]),
594 .help = "Block size unit",
600 .alias = "blocksize_range",
601 .type = FIO_OPT_RANGE,
602 .off1 = td_var_offset(min_bs[DDIR_READ]),
603 .off2 = td_var_offset(max_bs[DDIR_READ]),
604 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
605 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
607 .help = "Set block size range (in more detail than bs)",
613 .cb = str_bssplit_cb,
614 .help = "Set a specific mix of block sizes",
618 .name = "bs_unaligned",
619 .alias = "blocksize_unaligned",
620 .type = FIO_OPT_STR_SET,
621 .off1 = td_var_offset(bs_unaligned),
622 .help = "Don't sector align IO buffer sizes",
626 .name = "randrepeat",
627 .type = FIO_OPT_BOOL,
628 .off1 = td_var_offset(rand_repeatable),
629 .help = "Use repeatable random IO pattern",
634 .name = "norandommap",
635 .type = FIO_OPT_STR_SET,
636 .off1 = td_var_offset(norandommap),
637 .help = "Accept potential duplicate random blocks",
643 .off1 = td_var_offset(nr_files),
644 .help = "Split job workload between this number of files",
650 .off1 = td_var_offset(open_files),
651 .help = "Number of files to keep open at the same time",
654 .name = "file_service_type",
657 .off1 = td_var_offset(file_service_type),
658 .help = "How to select which file to service next",
662 .oval = FIO_FSERVICE_RANDOM,
663 .help = "Choose a file at random",
665 { .ival = "roundrobin",
666 .oval = FIO_FSERVICE_RR,
667 .help = "Round robin select files",
673 .name = "fadvise_hint",
674 .type = FIO_OPT_BOOL,
675 .off1 = td_var_offset(fadvise_hint),
676 .help = "Use fadvise() to advise the kernel on IO pattern",
682 .off1 = td_var_offset(fsync_blocks),
683 .help = "Issue fsync for writes every given number of blocks",
688 .type = FIO_OPT_BOOL,
689 .off1 = td_var_offset(odirect),
690 .help = "Use O_DIRECT IO (negates buffered)",
695 .type = FIO_OPT_BOOL,
696 .off1 = td_var_offset(odirect),
698 .help = "Use buffered IO (negates direct)",
703 .type = FIO_OPT_BOOL,
704 .off1 = td_var_offset(overwrite),
705 .help = "When writing, set whether to overwrite current data",
711 .off1 = td_var_offset(loops),
712 .help = "Number of times to run the job",
718 .off1 = td_var_offset(numjobs),
719 .help = "Duplicate this job this many times",
723 .name = "startdelay",
725 .off1 = td_var_offset(start_delay),
726 .help = "Only start job when this period has passed",
732 .type = FIO_OPT_STR_VAL_TIME,
733 .off1 = td_var_offset(timeout),
734 .help = "Stop workload when this amount of time has passed",
738 .name = "time_based",
739 .type = FIO_OPT_STR_SET,
740 .off1 = td_var_offset(time_based),
741 .help = "Keep running until runtime/timeout is met",
748 .off1 = td_var_offset(mem_type),
749 .help = "Backing type for IO buffers",
754 .help = "Use malloc(3) for IO buffers",
758 .help = "Use shared memory segments for IO buffers",
760 #ifdef FIO_HAVE_HUGETLB
763 .help = "Like shm, but use huge pages",
768 .help = "Use mmap(2) (file or anon) for IO buffers",
770 #ifdef FIO_HAVE_HUGETLB
771 { .ival = "mmaphuge",
772 .oval = MEM_MMAPHUGE,
773 .help = "Like mmap, but use huge pages",
781 .off1 = td_var_offset(verify),
782 .help = "Verify data written",
787 .help = "Don't do IO verification",
791 .help = "Use md5 checksums for verification",
794 .oval = VERIFY_CRC64,
795 .help = "Use crc64 checksums for verification",
798 .oval = VERIFY_CRC32,
799 .help = "Use crc32 checksums for verification",
802 .oval = VERIFY_CRC16,
803 .help = "Use crc16 checksums for verification",
807 .help = "Use crc7 checksums for verification",
810 .oval = VERIFY_SHA256,
811 .help = "Use sha256 checksums for verification",
814 .oval = VERIFY_SHA512,
815 .help = "Use sha512 checksums for verification",
819 .help = "Use io information",
824 .help = "Pretend to verify",
830 .type = FIO_OPT_BOOL,
831 .off1 = td_var_offset(do_verify),
832 .help = "Run verification stage after write",
837 .name = "verifysort",
838 .type = FIO_OPT_BOOL,
839 .off1 = td_var_offset(verifysort),
840 .help = "Sort written verify blocks for read back",
845 .name = "verify_interval",
846 .type = FIO_OPT_STR_VAL_INT,
847 .off1 = td_var_offset(verify_interval),
848 .minval = 2 * sizeof(struct verify_header),
849 .help = "Store verify buffer header every N bytes",
853 .name = "verify_offset",
854 .type = FIO_OPT_STR_VAL_INT,
855 .help = "Offset verify header location by N bytes",
857 .cb = str_verify_offset_cb,
861 .name = "verify_pattern",
863 .cb = str_verify_pattern_cb,
864 .help = "Fill pattern for IO buffers",
868 .name = "verify_fatal",
869 .type = FIO_OPT_BOOL,
870 .off1 = td_var_offset(verify_fatal),
872 .help = "Exit on a single verify failure, don't continue",
876 .name = "write_iolog",
877 .type = FIO_OPT_STR_STORE,
878 .off1 = td_var_offset(write_iolog_file),
879 .help = "Store IO pattern to file",
882 .name = "read_iolog",
883 .type = FIO_OPT_STR_STORE,
884 .off1 = td_var_offset(read_iolog_file),
885 .help = "Playback IO pattern from file",
888 .name = "exec_prerun",
889 .type = FIO_OPT_STR_STORE,
890 .off1 = td_var_offset(exec_prerun),
891 .help = "Execute this file prior to running job",
894 .name = "exec_postrun",
895 .type = FIO_OPT_STR_STORE,
896 .off1 = td_var_offset(exec_postrun),
897 .help = "Execute this file after running job",
899 #ifdef FIO_HAVE_IOSCHED_SWITCH
901 .name = "ioscheduler",
902 .type = FIO_OPT_STR_STORE,
903 .off1 = td_var_offset(ioscheduler),
904 .help = "Use this IO scheduler on the backing device",
909 .type = FIO_OPT_STR_VAL,
910 .off1 = td_var_offset(zone_size),
911 .help = "Give size of an IO zone",
916 .type = FIO_OPT_STR_VAL,
917 .off1 = td_var_offset(zone_skip),
918 .help = "Space between IO zones",
923 .type = FIO_OPT_STR_VAL,
924 .cb = str_lockmem_cb,
925 .help = "Lock down this amount of memory",
931 .off1 = td_var_offset(rwmix[DDIR_READ]),
933 .help = "Percentage of mixed workload that is reads",
937 .name = "rwmixwrite",
939 .off1 = td_var_offset(rwmix[DDIR_WRITE]),
941 .help = "Percentage of mixed workload that is writes",
945 .name = "rwmixcycle",
947 .off1 = td_var_offset(rwmixcycle),
948 .help = "Cycle period for mixed read/write workloads (msec)",
950 .parent = "rwmixread",
955 .off1 = td_var_offset(nice),
956 .help = "Set job CPU nice value",
961 #ifdef FIO_HAVE_IOPRIO
966 .help = "Set job IO priority value",
973 .cb = str_prioclass_cb,
974 .help = "Set job IO priority class",
982 .off1 = td_var_offset(thinktime),
983 .help = "Idle time between IO buffers (usec)",
987 .name = "thinktime_spin",
989 .off1 = td_var_offset(thinktime_spin),
990 .help = "Start think time by spinning this amount (usec)",
992 .parent = "thinktime",
995 .name = "thinktime_blocks",
997 .off1 = td_var_offset(thinktime_blocks),
998 .help = "IO buffer period between 'thinktime'",
1000 .parent = "thinktime",
1004 .type = FIO_OPT_INT,
1005 .off1 = td_var_offset(rate),
1006 .help = "Set bandwidth rate",
1010 .type = FIO_OPT_INT,
1011 .off1 = td_var_offset(ratemin),
1012 .help = "Job must meet this rate or it will be shutdown",
1016 .name = "rate_iops",
1017 .type = FIO_OPT_INT,
1018 .off1 = td_var_offset(rate_iops),
1019 .help = "Limit IO used to this number of IO operations/sec",
1022 .name = "rate_iops_min",
1023 .type = FIO_OPT_INT,
1024 .off1 = td_var_offset(rate_iops_min),
1025 .help = "Job must meet this rate or it will be shutdown",
1026 .parent = "rate_iops",
1029 .name = "ratecycle",
1030 .type = FIO_OPT_INT,
1031 .off1 = td_var_offset(ratecycle),
1032 .help = "Window average for rate limits (msec)",
1037 .name = "invalidate",
1038 .type = FIO_OPT_BOOL,
1039 .off1 = td_var_offset(invalidate_cache),
1040 .help = "Invalidate buffer/page cache prior to running job",
1045 .type = FIO_OPT_BOOL,
1046 .off1 = td_var_offset(sync_io),
1047 .help = "Use O_SYNC for buffered writes",
1049 .parent = "buffered",
1052 .name = "bwavgtime",
1053 .type = FIO_OPT_INT,
1054 .off1 = td_var_offset(bw_avg_time),
1055 .help = "Time window over which to calculate bandwidth"
1060 .name = "create_serialize",
1061 .type = FIO_OPT_BOOL,
1062 .off1 = td_var_offset(create_serialize),
1063 .help = "Serialize creating of job files",
1067 .name = "create_fsync",
1068 .type = FIO_OPT_BOOL,
1069 .off1 = td_var_offset(create_fsync),
1070 .help = "Fsync file after creation",
1075 .type = FIO_OPT_INT,
1076 .off1 = td_var_offset(cpuload),
1077 .help = "Use this percentage of CPU",
1080 .name = "cpuchunks",
1081 .type = FIO_OPT_INT,
1082 .off1 = td_var_offset(cpucycle),
1083 .help = "Length of the CPU burn cycles (usecs)",
1085 .parent = "cpuload",
1087 #ifdef FIO_HAVE_CPU_AFFINITY
1090 .type = FIO_OPT_INT,
1091 .cb = str_cpumask_cb,
1092 .help = "CPU affinity mask",
1095 .name = "cpus_allowed",
1096 .type = FIO_OPT_STR,
1097 .cb = str_cpus_allowed_cb,
1098 .help = "Set CPUs allowed",
1102 .name = "end_fsync",
1103 .type = FIO_OPT_BOOL,
1104 .off1 = td_var_offset(end_fsync),
1105 .help = "Include fsync at the end of job",
1109 .name = "fsync_on_close",
1110 .type = FIO_OPT_BOOL,
1111 .off1 = td_var_offset(fsync_on_close),
1112 .help = "fsync files on close",
1117 .type = FIO_OPT_BOOL,
1118 .off1 = td_var_offset(unlink),
1119 .help = "Unlink created files after job has completed",
1124 .type = FIO_OPT_STR_SET,
1125 .cb = str_exitall_cb,
1126 .help = "Terminate all jobs when one exits",
1129 .name = "stonewall",
1130 .type = FIO_OPT_STR_SET,
1131 .off1 = td_var_offset(stonewall),
1132 .help = "Insert a hard barrier between this job and previous",
1135 .name = "new_group",
1136 .type = FIO_OPT_STR_SET,
1137 .off1 = td_var_offset(new_group),
1138 .help = "Mark the start of a new group (for reporting)",
1142 .type = FIO_OPT_STR_SET,
1143 .off1 = td_var_offset(use_thread),
1144 .help = "Use threads instead of forks",
1147 .name = "write_bw_log",
1148 .type = FIO_OPT_STR_SET,
1149 .off1 = td_var_offset(write_bw_log),
1150 .help = "Write log of bandwidth during run",
1153 .name = "write_lat_log",
1154 .type = FIO_OPT_STR_SET,
1155 .off1 = td_var_offset(write_lat_log),
1156 .help = "Write log of latency during run",
1159 .name = "hugepage-size",
1160 .type = FIO_OPT_STR_VAL_INT,
1161 .off1 = td_var_offset(hugepage_size),
1162 .help = "When using hugepages, specify size of each page",
1163 .def = __stringify(FIO_HUGE_PAGE),
1166 .name = "group_reporting",
1167 .type = FIO_OPT_STR_SET,
1168 .off1 = td_var_offset(group_reporting),
1169 .help = "Do reporting on a per-group basis",
1172 .name = "zero_buffers",
1173 .type = FIO_OPT_STR_SET,
1174 .off1 = td_var_offset(zero_buffers),
1175 .help = "Init IO buffers to all zeroes",
1177 #ifdef FIO_HAVE_DISK_UTIL
1179 .name = "disk_util",
1180 .type = FIO_OPT_BOOL,
1181 .off1 = td_var_offset(do_disk_util),
1182 .help = "Log disk utilization stats",
1191 void fio_options_dup_and_init(struct option *long_options)
1193 struct fio_option *o;
1196 options_init(options);
1199 while (long_options[i].name)
1204 long_options[i].name = o->name;
1205 long_options[i].val = FIO_GETOPT_JOB;
1206 if (o->type == FIO_OPT_STR_SET)
1207 long_options[i].has_arg = no_argument;
1209 long_options[i].has_arg = required_argument;
1213 assert(i < FIO_NR_OPTIONS);
1217 int fio_option_parse(struct thread_data *td, const char *opt)
1219 return parse_option(opt, options, td);
1222 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
1224 return parse_cmd_option(opt, val, options, td);
1227 void fio_fill_default_options(struct thread_data *td)
1229 fill_default_options(td, options);
1232 int fio_show_option_help(const char *opt)
1234 return show_cmd_help(options, opt);
1237 static void __options_mem(struct thread_data *td, int alloc)
1239 struct thread_options *o = &td->o;
1240 struct fio_option *opt;
1244 for (i = 0, opt = &options[0]; opt->name; i++, opt = &options[i]) {
1245 if (opt->type != FIO_OPT_STR_STORE)
1248 ptr = (void *) o + opt->off1;
1251 *ptr = strdup(*ptr);
1261 * dupe FIO_OPT_STR_STORE options
1263 void options_mem_dupe(struct thread_data *td)
1265 __options_mem(td, 1);
1268 void options_mem_free(struct thread_data fio_unused *td)
1271 __options_mem(td, 0);