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, td->o.bssplit_nr * sizeof(struct bssplit));
72 perc_str = strstr(fname, "/");
76 perc = atoi(perc_str);
84 if (str_to_decimal(fname, &val, 1)) {
85 log_err("fio: bssplit conversion failed\n");
95 td->o.bssplit[i].bs = val;
96 td->o.bssplit[i].perc = perc;
100 td->o.bssplit_nr = i;
103 * Now check if the percentages add up, and how much is missing
105 perc = perc_missing = 0;
106 for (i = 0; i < td->o.bssplit_nr; i++) {
107 struct bssplit *bsp = &td->o.bssplit[i];
109 if (bsp->perc == (unsigned char) -1)
116 log_err("fio: bssplit percentages add to more than 100%%\n");
121 * If values didn't have a percentage set, divide the remains between
125 for (i = 0; i < td->o.bssplit_nr; i++) {
126 struct bssplit *bsp = &td->o.bssplit[i];
128 if (bsp->perc == (unsigned char) -1)
129 bsp->perc = (100 - perc) / perc_missing;
133 td->o.min_bs[DDIR_READ] = td->o.min_bs[DDIR_WRITE] = min_bs;
134 td->o.max_bs[DDIR_READ] = td->o.max_bs[DDIR_WRITE] = max_bs;
137 * now sort based on percentages, for ease of lookup
139 qsort(td->o.bssplit, td->o.bssplit_nr, sizeof(struct bssplit), bs_cmp);
145 static int str_rw_cb(void *data, const char *str)
147 struct thread_data *td = data;
148 char *nr = get_opt_postfix(str);
152 td->o.ddir_nr = atoi(nr);
157 static int str_mem_cb(void *data, const char *mem)
159 struct thread_data *td = data;
161 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP) {
162 td->mmapfile = get_opt_postfix(mem);
163 if (td->o.mem_type == MEM_MMAPHUGE && !td->mmapfile) {
164 log_err("fio: mmaphuge:/path/to/file\n");
172 static int str_lockmem_cb(void fio_unused *data, unsigned long *val)
178 #ifdef FIO_HAVE_IOPRIO
179 static int str_prioclass_cb(void *data, unsigned int *val)
181 struct thread_data *td = data;
185 * mask off old class bits, str_prio_cb() may have set a default class
187 mask = (1 << IOPRIO_CLASS_SHIFT) - 1;
190 td->ioprio |= *val << IOPRIO_CLASS_SHIFT;
195 static int str_prio_cb(void *data, unsigned int *val)
197 struct thread_data *td = data;
202 * If no class is set, assume BE
204 if ((td->ioprio >> IOPRIO_CLASS_SHIFT) == 0)
205 td->ioprio |= IOPRIO_CLASS_BE << IOPRIO_CLASS_SHIFT;
212 static int str_exitall_cb(void)
214 exitall_on_terminate = 1;
218 #ifdef FIO_HAVE_CPU_AFFINITY
219 static int str_cpumask_cb(void *data, unsigned int *val)
221 struct thread_data *td = data;
224 CPU_ZERO(&td->o.cpumask);
226 for (i = 0; i < sizeof(int) * 8; i++)
228 CPU_SET(*val, &td->o.cpumask);
230 td->o.cpumask_set = 1;
234 static int str_cpus_allowed_cb(void *data, const char *input)
236 struct thread_data *td = data;
239 CPU_ZERO(&td->o.cpumask);
241 p = str = strdup(input);
243 strip_blank_front(&str);
244 strip_blank_end(str);
246 while ((cpu = strsep(&str, ",")) != NULL) {
249 CPU_SET(atoi(cpu), &td->o.cpumask);
253 td->o.cpumask_set = 1;
258 static int str_fst_cb(void *data, const char *str)
260 struct thread_data *td = data;
261 char *nr = get_opt_postfix(str);
263 td->file_service_nr = 1;
265 td->file_service_nr = atoi(nr);
270 static int str_filename_cb(void *data, const char *input)
272 struct thread_data *td = data;
273 char *fname, *str, *p;
275 p = str = strdup(input);
277 strip_blank_front(&str);
278 strip_blank_end(str);
280 if (!td->files_index)
283 while ((fname = strsep(&str, ":")) != NULL) {
294 static int str_directory_cb(void *data, const char fio_unused *str)
296 struct thread_data *td = data;
299 if (lstat(td->o.directory, &sb) < 0) {
300 log_err("fio: %s is not a directory\n", td->o.directory);
301 td_verror(td, errno, "lstat");
304 if (!S_ISDIR(sb.st_mode)) {
305 log_err("fio: %s is not a directory\n", td->o.directory);
312 static int str_opendir_cb(void *data, const char fio_unused *str)
314 struct thread_data *td = data;
316 if (!td->files_index)
319 return add_dir_files(td, td->o.opendir);
322 static int str_verify_offset_cb(void *data, unsigned int *off)
324 struct thread_data *td = data;
326 if (*off && *off < sizeof(struct verify_header)) {
327 log_err("fio: verify_offset too small\n");
331 td->o.verify_offset = *off;
335 static int str_verify_pattern_cb(void *data, unsigned int *off)
337 struct thread_data *td = data;
342 td->o.verify_pattern_bytes = 1;
344 td->o.verify_pattern_bytes = 2;
346 td->o.verify_pattern_bytes = 3;
348 td->o.verify_pattern_bytes = 4;
350 td->o.verify_pattern = *off;
354 static int str_lockfile_cb(void *data, const char *str)
356 struct thread_data *td = data;
357 char *nr = get_opt_postfix(str);
359 td->o.lockfile_batch = 1;
361 td->o.lockfile_batch = atoi(nr);
366 #define __stringify_1(x) #x
367 #define __stringify(x) __stringify_1(x)
370 * Map of job/command line options
372 static struct fio_option options[] = {
374 .name = "description",
375 .type = FIO_OPT_STR_STORE,
376 .off1 = td_var_offset(description),
377 .help = "Text job description",
381 .type = FIO_OPT_STR_STORE,
382 .off1 = td_var_offset(name),
383 .help = "Name of this job",
387 .type = FIO_OPT_STR_STORE,
388 .off1 = td_var_offset(directory),
389 .cb = str_directory_cb,
390 .help = "Directory to store files in",
394 .type = FIO_OPT_STR_STORE,
395 .off1 = td_var_offset(filename),
396 .cb = str_filename_cb,
397 .help = "File(s) to use for the workload",
402 .cb = str_lockfile_cb,
403 .off1 = td_var_offset(file_lock_mode),
404 .help = "Lock file when doing IO to it",
405 .parent = "filename",
409 .oval = FILE_LOCK_NONE,
410 .help = "No file locking",
412 { .ival = "exclusive",
413 .oval = FILE_LOCK_EXCLUSIVE,
414 .help = "Exclusive file lock",
418 .oval = FILE_LOCK_READWRITE,
419 .help = "Read vs write lock",
425 .type = FIO_OPT_STR_STORE,
426 .off1 = td_var_offset(opendir),
427 .cb = str_opendir_cb,
428 .help = "Recursively add files from this directory and down",
432 .alias = "readwrite",
435 .off1 = td_var_offset(td_ddir),
436 .help = "IO direction",
440 .oval = TD_DDIR_READ,
441 .help = "Sequential read",
444 .oval = TD_DDIR_WRITE,
445 .help = "Sequential write",
447 { .ival = "randread",
448 .oval = TD_DDIR_RANDREAD,
449 .help = "Random read",
451 { .ival = "randwrite",
452 .oval = TD_DDIR_RANDWRITE,
453 .help = "Random write",
457 .help = "Sequential read and write mix",
460 .oval = TD_DDIR_RANDRW,
461 .help = "Random read and write mix"
467 .type = FIO_OPT_STR_STORE,
468 .off1 = td_var_offset(ioengine),
469 .help = "IO engine to use",
473 .help = "Use read/write",
476 .help = "Use pread/pwrite",
479 .help = "Use readv/writev",
481 #ifdef FIO_HAVE_LIBAIO
483 .help = "Linux native asynchronous IO",
486 #ifdef FIO_HAVE_POSIXAIO
487 { .ival = "posixaio",
488 .help = "POSIX asynchronous IO",
492 .help = "Memory mapped IO",
494 #ifdef FIO_HAVE_SPLICE
496 .help = "splice/vmsplice based IO",
498 { .ival = "netsplice",
499 .help = "splice/vmsplice to/from the network",
504 .help = "SCSI generic v3 IO",
508 .help = "Testing engine (no data transfer)",
511 .help = "Network IO",
513 #ifdef FIO_HAVE_SYSLET
514 { .ival = "syslet-rw",
515 .help = "syslet enabled async pread/pwrite IO",
519 .help = "CPU cycler burner engine",
521 #ifdef FIO_HAVE_GUASI
523 .help = "GUASI IO engine",
526 { .ival = "external",
527 .help = "Load external engine (append name)",
534 .off1 = td_var_offset(iodepth),
535 .help = "Amount of IO buffers to keep in flight",
540 .name = "iodepth_batch",
542 .off1 = td_var_offset(iodepth_batch),
543 .help = "Number of IO to submit in one go",
549 .name = "iodepth_low",
551 .off1 = td_var_offset(iodepth_low),
552 .help = "Low water mark for queuing depth",
557 .type = FIO_OPT_STR_VAL,
558 .off1 = td_var_offset(size),
560 .help = "Total size of device or files",
563 .name = "fill_device",
564 .type = FIO_OPT_BOOL,
565 .off1 = td_var_offset(fill_device),
566 .help = "Write until an ENOSPC error occurs",
571 .type = FIO_OPT_STR_VAL,
572 .off1 = td_var_offset(file_size_low),
573 .off2 = td_var_offset(file_size_high),
575 .help = "Size of individual files",
579 .alias = "fileoffset",
580 .type = FIO_OPT_STR_VAL,
581 .off1 = td_var_offset(start_offset),
582 .help = "Start IO from this offset",
587 .alias = "blocksize",
588 .type = FIO_OPT_STR_VAL_INT,
589 .off1 = td_var_offset(bs[DDIR_READ]),
590 .off2 = td_var_offset(bs[DDIR_WRITE]),
592 .help = "Block size unit",
598 .alias = "blocksize_range",
599 .type = FIO_OPT_RANGE,
600 .off1 = td_var_offset(min_bs[DDIR_READ]),
601 .off2 = td_var_offset(max_bs[DDIR_READ]),
602 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
603 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
605 .help = "Set block size range (in more detail than bs)",
611 .cb = str_bssplit_cb,
612 .help = "Set a specific mix of block sizes",
616 .name = "bs_unaligned",
617 .alias = "blocksize_unaligned",
618 .type = FIO_OPT_STR_SET,
619 .off1 = td_var_offset(bs_unaligned),
620 .help = "Don't sector align IO buffer sizes",
624 .name = "randrepeat",
625 .type = FIO_OPT_BOOL,
626 .off1 = td_var_offset(rand_repeatable),
627 .help = "Use repeatable random IO pattern",
632 .name = "norandommap",
633 .type = FIO_OPT_STR_SET,
634 .off1 = td_var_offset(norandommap),
635 .help = "Accept potential duplicate random blocks",
641 .off1 = td_var_offset(nr_files),
642 .help = "Split job workload between this number of files",
648 .off1 = td_var_offset(open_files),
649 .help = "Number of files to keep open at the same time",
652 .name = "file_service_type",
655 .off1 = td_var_offset(file_service_type),
656 .help = "How to select which file to service next",
660 .oval = FIO_FSERVICE_RANDOM,
661 .help = "Choose a file at random",
663 { .ival = "roundrobin",
664 .oval = FIO_FSERVICE_RR,
665 .help = "Round robin select files",
671 .name = "fadvise_hint",
672 .type = FIO_OPT_BOOL,
673 .off1 = td_var_offset(fadvise_hint),
674 .help = "Use fadvise() to advise the kernel on IO pattern",
680 .off1 = td_var_offset(fsync_blocks),
681 .help = "Issue fsync for writes every given number of blocks",
686 .type = FIO_OPT_BOOL,
687 .off1 = td_var_offset(odirect),
688 .help = "Use O_DIRECT IO (negates buffered)",
693 .type = FIO_OPT_BOOL,
694 .off1 = td_var_offset(odirect),
696 .help = "Use buffered IO (negates direct)",
701 .type = FIO_OPT_BOOL,
702 .off1 = td_var_offset(overwrite),
703 .help = "When writing, set whether to overwrite current data",
709 .off1 = td_var_offset(loops),
710 .help = "Number of times to run the job",
716 .off1 = td_var_offset(numjobs),
717 .help = "Duplicate this job this many times",
721 .name = "startdelay",
723 .off1 = td_var_offset(start_delay),
724 .help = "Only start job when this period has passed",
730 .type = FIO_OPT_STR_VAL_TIME,
731 .off1 = td_var_offset(timeout),
732 .help = "Stop workload when this amount of time has passed",
736 .name = "time_based",
737 .type = FIO_OPT_STR_SET,
738 .off1 = td_var_offset(time_based),
739 .help = "Keep running until runtime/timeout is met",
746 .off1 = td_var_offset(mem_type),
747 .help = "Backing type for IO buffers",
752 .help = "Use malloc(3) for IO buffers",
756 .help = "Use shared memory segments for IO buffers",
758 #ifdef FIO_HAVE_HUGETLB
761 .help = "Like shm, but use huge pages",
766 .help = "Use mmap(2) (file or anon) for IO buffers",
768 #ifdef FIO_HAVE_HUGETLB
769 { .ival = "mmaphuge",
770 .oval = MEM_MMAPHUGE,
771 .help = "Like mmap, but use huge pages",
779 .off1 = td_var_offset(verify),
780 .help = "Verify data written",
785 .help = "Don't do IO verification",
789 .help = "Use md5 checksums for verification",
792 .oval = VERIFY_CRC64,
793 .help = "Use crc64 checksums for verification",
796 .oval = VERIFY_CRC32,
797 .help = "Use crc32 checksums for verification",
800 .oval = VERIFY_CRC16,
801 .help = "Use crc16 checksums for verification",
805 .help = "Use crc7 checksums for verification",
808 .oval = VERIFY_SHA256,
809 .help = "Use sha256 checksums for verification",
812 .oval = VERIFY_SHA512,
813 .help = "Use sha512 checksums for verification",
817 .help = "Use io information",
822 .help = "Pretend to verify",
828 .type = FIO_OPT_BOOL,
829 .off1 = td_var_offset(do_verify),
830 .help = "Run verification stage after write",
835 .name = "verifysort",
836 .type = FIO_OPT_BOOL,
837 .off1 = td_var_offset(verifysort),
838 .help = "Sort written verify blocks for read back",
843 .name = "verify_interval",
844 .type = FIO_OPT_STR_VAL_INT,
845 .off1 = td_var_offset(verify_interval),
846 .minval = 2 * sizeof(struct verify_header),
847 .help = "Store verify buffer header every N bytes",
851 .name = "verify_offset",
852 .type = FIO_OPT_STR_VAL_INT,
853 .help = "Offset verify header location by N bytes",
855 .cb = str_verify_offset_cb,
859 .name = "verify_pattern",
861 .cb = str_verify_pattern_cb,
862 .help = "Fill pattern for IO buffers",
866 .name = "verify_fatal",
867 .type = FIO_OPT_BOOL,
868 .off1 = td_var_offset(verify_fatal),
870 .help = "Exit on a single verify failure, don't continue",
874 .name = "write_iolog",
875 .type = FIO_OPT_STR_STORE,
876 .off1 = td_var_offset(write_iolog_file),
877 .help = "Store IO pattern to file",
880 .name = "read_iolog",
881 .type = FIO_OPT_STR_STORE,
882 .off1 = td_var_offset(read_iolog_file),
883 .help = "Playback IO pattern from file",
886 .name = "exec_prerun",
887 .type = FIO_OPT_STR_STORE,
888 .off1 = td_var_offset(exec_prerun),
889 .help = "Execute this file prior to running job",
892 .name = "exec_postrun",
893 .type = FIO_OPT_STR_STORE,
894 .off1 = td_var_offset(exec_postrun),
895 .help = "Execute this file after running job",
897 #ifdef FIO_HAVE_IOSCHED_SWITCH
899 .name = "ioscheduler",
900 .type = FIO_OPT_STR_STORE,
901 .off1 = td_var_offset(ioscheduler),
902 .help = "Use this IO scheduler on the backing device",
907 .type = FIO_OPT_STR_VAL,
908 .off1 = td_var_offset(zone_size),
909 .help = "Give size of an IO zone",
914 .type = FIO_OPT_STR_VAL,
915 .off1 = td_var_offset(zone_skip),
916 .help = "Space between IO zones",
921 .type = FIO_OPT_STR_VAL,
922 .cb = str_lockmem_cb,
923 .help = "Lock down this amount of memory",
929 .off1 = td_var_offset(rwmix[DDIR_READ]),
931 .help = "Percentage of mixed workload that is reads",
935 .name = "rwmixwrite",
937 .off1 = td_var_offset(rwmix[DDIR_WRITE]),
939 .help = "Percentage of mixed workload that is writes",
943 .name = "rwmixcycle",
945 .off1 = td_var_offset(rwmixcycle),
946 .help = "Cycle period for mixed read/write workloads (msec)",
948 .parent = "rwmixread",
953 .off1 = td_var_offset(nice),
954 .help = "Set job CPU nice value",
959 #ifdef FIO_HAVE_IOPRIO
964 .help = "Set job IO priority value",
971 .cb = str_prioclass_cb,
972 .help = "Set job IO priority class",
980 .off1 = td_var_offset(thinktime),
981 .help = "Idle time between IO buffers (usec)",
985 .name = "thinktime_spin",
987 .off1 = td_var_offset(thinktime_spin),
988 .help = "Start think time by spinning this amount (usec)",
990 .parent = "thinktime",
993 .name = "thinktime_blocks",
995 .off1 = td_var_offset(thinktime_blocks),
996 .help = "IO buffer period between 'thinktime'",
998 .parent = "thinktime",
1002 .type = FIO_OPT_INT,
1003 .off1 = td_var_offset(rate),
1004 .help = "Set bandwidth rate",
1008 .type = FIO_OPT_INT,
1009 .off1 = td_var_offset(ratemin),
1010 .help = "Job must meet this rate or it will be shutdown",
1014 .name = "rate_iops",
1015 .type = FIO_OPT_INT,
1016 .off1 = td_var_offset(rate_iops),
1017 .help = "Limit IO used to this number of IO operations/sec",
1020 .name = "rate_iops_min",
1021 .type = FIO_OPT_INT,
1022 .off1 = td_var_offset(rate_iops_min),
1023 .help = "Job must meet this rate or it will be shutdown",
1024 .parent = "rate_iops",
1027 .name = "ratecycle",
1028 .type = FIO_OPT_INT,
1029 .off1 = td_var_offset(ratecycle),
1030 .help = "Window average for rate limits (msec)",
1035 .name = "invalidate",
1036 .type = FIO_OPT_BOOL,
1037 .off1 = td_var_offset(invalidate_cache),
1038 .help = "Invalidate buffer/page cache prior to running job",
1043 .type = FIO_OPT_BOOL,
1044 .off1 = td_var_offset(sync_io),
1045 .help = "Use O_SYNC for buffered writes",
1047 .parent = "buffered",
1050 .name = "bwavgtime",
1051 .type = FIO_OPT_INT,
1052 .off1 = td_var_offset(bw_avg_time),
1053 .help = "Time window over which to calculate bandwidth (msec)",
1057 .name = "create_serialize",
1058 .type = FIO_OPT_BOOL,
1059 .off1 = td_var_offset(create_serialize),
1060 .help = "Serialize creating of job files",
1064 .name = "create_fsync",
1065 .type = FIO_OPT_BOOL,
1066 .off1 = td_var_offset(create_fsync),
1067 .help = "Fsync file after creation",
1072 .type = FIO_OPT_INT,
1073 .off1 = td_var_offset(cpuload),
1074 .help = "Use this percentage of CPU",
1077 .name = "cpuchunks",
1078 .type = FIO_OPT_INT,
1079 .off1 = td_var_offset(cpucycle),
1080 .help = "Length of the CPU burn cycles (usecs)",
1082 .parent = "cpuload",
1084 #ifdef FIO_HAVE_CPU_AFFINITY
1087 .type = FIO_OPT_INT,
1088 .cb = str_cpumask_cb,
1089 .help = "CPU affinity mask",
1092 .name = "cpus_allowed",
1093 .type = FIO_OPT_STR,
1094 .cb = str_cpus_allowed_cb,
1095 .help = "Set CPUs allowed",
1099 .name = "end_fsync",
1100 .type = FIO_OPT_BOOL,
1101 .off1 = td_var_offset(end_fsync),
1102 .help = "Include fsync at the end of job",
1106 .name = "fsync_on_close",
1107 .type = FIO_OPT_BOOL,
1108 .off1 = td_var_offset(fsync_on_close),
1109 .help = "fsync files on close",
1114 .type = FIO_OPT_BOOL,
1115 .off1 = td_var_offset(unlink),
1116 .help = "Unlink created files after job has completed",
1121 .type = FIO_OPT_STR_SET,
1122 .cb = str_exitall_cb,
1123 .help = "Terminate all jobs when one exits",
1126 .name = "stonewall",
1127 .type = FIO_OPT_STR_SET,
1128 .off1 = td_var_offset(stonewall),
1129 .help = "Insert a hard barrier between this job and previous",
1132 .name = "new_group",
1133 .type = FIO_OPT_STR_SET,
1134 .off1 = td_var_offset(new_group),
1135 .help = "Mark the start of a new group (for reporting)",
1139 .type = FIO_OPT_STR_SET,
1140 .off1 = td_var_offset(use_thread),
1141 .help = "Use threads instead of forks",
1144 .name = "write_bw_log",
1145 .type = FIO_OPT_STR_SET,
1146 .off1 = td_var_offset(write_bw_log),
1147 .help = "Write log of bandwidth during run",
1150 .name = "write_lat_log",
1151 .type = FIO_OPT_STR_SET,
1152 .off1 = td_var_offset(write_lat_log),
1153 .help = "Write log of latency during run",
1156 .name = "hugepage-size",
1157 .type = FIO_OPT_STR_VAL_INT,
1158 .off1 = td_var_offset(hugepage_size),
1159 .help = "When using hugepages, specify size of each page",
1160 .def = __stringify(FIO_HUGE_PAGE),
1163 .name = "group_reporting",
1164 .type = FIO_OPT_STR_SET,
1165 .off1 = td_var_offset(group_reporting),
1166 .help = "Do reporting on a per-group basis",
1169 .name = "zero_buffers",
1170 .type = FIO_OPT_STR_SET,
1171 .off1 = td_var_offset(zero_buffers),
1172 .help = "Init IO buffers to all zeroes",
1174 #ifdef FIO_HAVE_DISK_UTIL
1176 .name = "disk_util",
1177 .type = FIO_OPT_BOOL,
1178 .off1 = td_var_offset(do_disk_util),
1179 .help = "Log disk utilization stats",
1188 void fio_options_dup_and_init(struct option *long_options)
1190 struct fio_option *o;
1193 options_init(options);
1196 while (long_options[i].name)
1201 long_options[i].name = o->name;
1202 long_options[i].val = FIO_GETOPT_JOB;
1203 if (o->type == FIO_OPT_STR_SET)
1204 long_options[i].has_arg = no_argument;
1206 long_options[i].has_arg = required_argument;
1210 assert(i < FIO_NR_OPTIONS);
1214 int fio_option_parse(struct thread_data *td, const char *opt)
1216 return parse_option(opt, options, td);
1219 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
1221 return parse_cmd_option(opt, val, options, td);
1224 void fio_fill_default_options(struct thread_data *td)
1226 fill_default_options(td, options);
1229 int fio_show_option_help(const char *opt)
1231 return show_cmd_help(options, opt);
1234 static void __options_mem(struct thread_data *td, int alloc)
1236 struct thread_options *o = &td->o;
1237 struct fio_option *opt;
1241 for (i = 0, opt = &options[0]; opt->name; i++, opt = &options[i]) {
1242 if (opt->type != FIO_OPT_STR_STORE)
1245 ptr = (void *) o + opt->off1;
1248 *ptr = strdup(*ptr);
1258 * dupe FIO_OPT_STR_STORE options
1260 void options_mem_dupe(struct thread_data *td)
1262 __options_mem(td, 1);
1265 void options_mem_free(struct thread_data fio_unused *td)
1268 __options_mem(td, 0);