options: get rid of more .cb option usage we don't need

- The lat/bw/iops log does not need two ways of storing whether
  they are enabled or not. Just change the option to a string
  storing variant, and use the existance of a filename to see
  if it's set or not.

- The trim_percentage option need not have a callback, the
  parser knows the limits and can store it appropriately.

- The verify_offset option can express it's minimum value
  directly, it doesn't need a callback to set it on its own.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/options.c b/options.c
index 962ca19..5f73c10 100644
--- a/options.c
+++ b/options.c
@@ -401,16 +401,6 @@
 }
 #endif
 
-#ifdef FIO_HAVE_TRIM
-static int str_verify_trim_cb(void *data, unsigned long long *val)
-{
-	struct thread_data *td = data;
-
-	td->o.trim_percentage = *val;
-	return 0;
-}
-#endif
-
 static int str_fst_cb(void *data, const char *str)
 {
 	struct thread_data *td = data;
@@ -441,45 +431,6 @@
 }
 #endif
 
-static int check_dir(struct thread_data *td, char *fname)
-{
-#if 0
-	char file[PATH_MAX], *dir;
-	int elen = 0;
-
-	if (td->o.directory) {
-		strcpy(file, td->o.directory);
-		strcat(file, "/");
-		elen = strlen(file);
-	}
-
-	sprintf(file + elen, "%s", fname);
-	dir = dirname(file);
-
-	{
-	struct stat sb;
-	/*
-	 * We can't do this on FIO_DISKLESSIO engines. The engine isn't loaded
-	 * yet, so we can't do this check right here...
-	 */
-	if (lstat(dir, &sb) < 0) {
-		int ret = errno;
-
-		log_err("fio: %s is not a directory\n", dir);
-		td_verror(td, ret, "lstat");
-		return 1;
-	}
-
-	if (!S_ISDIR(sb.st_mode)) {
-		log_err("fio: %s is not a directory\n", dir);
-		return 1;
-	}
-	}
-#endif
-
-	return 0;
-}
-
 /*
  * Return next file in the string. Files are separated with ':'. If the ':'
  * is escaped with a '\', then that ':' is part of the filename and does not
@@ -542,10 +493,6 @@
 	while ((fname = get_next_file_name(&str)) != NULL) {
 		if (!strlen(fname))
 			break;
-		if (check_dir(td, fname)) {
-			free(p);
-			return 1;
-		}
 		add_file(td, fname);
 		td->o.nr_files++;
 	}
@@ -584,19 +531,6 @@
 	return add_dir_files(td, td->o.opendir);
 }
 
-static int str_verify_offset_cb(void *data, unsigned long long *off)
-{
-	struct thread_data *td = data;
-
-	if (*off && *off < sizeof(struct verify_header)) {
-		log_err("fio: verify_offset too small\n");
-		return 1;
-	}
-
-	td->o.verify_offset = *off;
-	return 0;
-}
-
 static int str_verify_pattern_cb(void *data, const char *input)
 {
 	struct thread_data *td = data;
@@ -678,39 +612,6 @@
 	return 0;
 }
 
-static int str_write_bw_log_cb(void *data, const char *str)
-{
-	struct thread_data *td = data;
-
-	if (str)
-		td->o.bw_log_file = strdup(str);
-
-	td->o.write_bw_log = 1;
-	return 0;
-}
-
-static int str_write_lat_log_cb(void *data, const char *str)
-{
-	struct thread_data *td = data;
-
-	if (str)
-		td->o.lat_log_file = strdup(str);
-
-	td->o.write_lat_log = 1;
-	return 0;
-}
-
-static int str_write_iops_log_cb(void *data, const char *str)
-{
-	struct thread_data *td = data;
-
-	if (str)
-		td->o.iops_log_file = strdup(str);
-
-	td->o.write_iops_log = 1;
-	return 0;
-}
-
 static int str_gtod_reduce_cb(void *data, int *il)
 {
 	struct thread_data *td = data;
@@ -1835,8 +1736,8 @@
 		.lname	= "Verify offset",
 		.type	= FIO_OPT_INT,
 		.help	= "Offset verify header location by N bytes",
-		.def	= "0",
-		.cb	= str_verify_offset_cb,
+		.off1	= td_var_offset(verify_offset),
+		.minval	= sizeof(struct verify_header),
 		.parent	= "verify",
 		.hide	= 1,
 		.category = FIO_OPT_C_IO,
@@ -1929,7 +1830,7 @@
 		.name	= "trim_percentage",
 		.lname	= "Trim percentage",
 		.type	= FIO_OPT_INT,
-		.cb	= str_verify_trim_cb,
+		.off1	= td_var_offset(trim_percentage),
 		.minval = 0,
 		.maxval = 100,
 		.help	= "Number of verify blocks to discard/trim",
@@ -2406,9 +2307,8 @@
 	{
 		.name	= "write_bw_log",
 		.lname	= "Write bandwidth log",
-		.type	= FIO_OPT_STR,
-		.off1	= td_var_offset(write_bw_log),
-		.cb	= str_write_bw_log_cb,
+		.type	= FIO_OPT_STR_STORE,
+		.off1	= td_var_offset(bw_log_file),
 		.help	= "Write log of bandwidth during run",
 		.category = FIO_OPT_C_LOG,
 		.group	= FIO_OPT_G_INVALID,
@@ -2416,9 +2316,8 @@
 	{
 		.name	= "write_lat_log",
 		.lname	= "Write latency log",
-		.type	= FIO_OPT_STR,
-		.off1	= td_var_offset(write_lat_log),
-		.cb	= str_write_lat_log_cb,
+		.type	= FIO_OPT_STR_STORE,
+		.off1	= td_var_offset(lat_log_file),
 		.help	= "Write log of latency during run",
 		.category = FIO_OPT_C_LOG,
 		.group	= FIO_OPT_G_INVALID,
@@ -2427,8 +2326,7 @@
 		.name	= "write_iops_log",
 		.lname	= "Write IOPS log",
 		.type	= FIO_OPT_STR,
-		.off1	= td_var_offset(write_iops_log),
-		.cb	= str_write_iops_log_cb,
+		.off1	= td_var_offset(iops_log_file),
 		.help	= "Write log of IOPS during run",
 		.category = FIO_OPT_C_LOG,
 		.group	= FIO_OPT_G_INVALID,