char *host_traddr;
char *hostnqn;
char *hostid;
- char *nr_io_queues;
- char *queue_size;
- char *keep_alive_tmo;
- char *reconnect_delay;
- char *ctrl_loss_tmo;
+ int nr_io_queues;
+ int queue_size;
+ int keep_alive_tmo;
+ int reconnect_delay;
+ int ctrl_loss_tmo;
char *raw;
char *device;
int duplicate_connect;
return 0;
}
+static int
+add_int_argument(char **argstr, int *max_len, char *arg_str, int arg)
+{
+ int len;
+
+ if (arg) {
+ len = snprintf(*argstr, *max_len, ",%s=%d", arg_str, arg);
+ if (len < 0)
+ return -EINVAL;
+ *argstr += len;
+ *max_len -= len;
+ }
+
+ return 0;
+}
+
static int
add_argument(char **argstr, int *max_len, char *arg_str, char *arg)
{
add_argument(&argstr, &max_len, "hostnqn", cfg.hostnqn)) ||
((cfg.hostid || nvmf_hostid_file()) &&
add_argument(&argstr, &max_len, "hostid", cfg.hostid)) ||
- add_argument(&argstr, &max_len, "nr_io_queues",
+ add_int_argument(&argstr, &max_len, "nr_io_queues",
cfg.nr_io_queues) ||
- add_argument(&argstr, &max_len, "queue_size", cfg.queue_size) ||
- add_argument(&argstr, &max_len, "keep_alive_tmo",
+ add_int_argument(&argstr, &max_len, "queue_size", cfg.queue_size) ||
+ add_int_argument(&argstr, &max_len, "keep_alive_tmo",
cfg.keep_alive_tmo) ||
- add_argument(&argstr, &max_len, "reconnect_delay",
+ add_int_argument(&argstr, &max_len, "reconnect_delay",
cfg.reconnect_delay) ||
- add_argument(&argstr, &max_len, "ctrl_loss_tmo",
+ add_int_argument(&argstr, &max_len, "ctrl_loss_tmo",
cfg.ctrl_loss_tmo) ||
add_bool_argument(&argstr, &max_len, "duplicate_connect",
cfg.duplicate_connect))
}
if (cfg.queue_size) {
- len = sprintf(p, ",queue_size=%s", cfg.queue_size);
+ len = sprintf(p, ",queue_size=%d", cfg.queue_size);
if (len < 0)
return -EINVAL;
p += len;
}
if (cfg.nr_io_queues) {
- len = sprintf(p, ",nr_io_queues=%s", cfg.nr_io_queues);
+ len = sprintf(p, ",nr_io_queues=%d", cfg.nr_io_queues);
if (len < 0)
return -EINVAL;
p += len;
}
if (cfg.ctrl_loss_tmo) {
- len = sprintf(p, ",ctrl_loss_tmo=%s", cfg.ctrl_loss_tmo);
+ len = sprintf(p, ",ctrl_loss_tmo=%d", cfg.ctrl_loss_tmo);
if (len < 0)
return -EINVAL;
p += len;
}
if (cfg.keep_alive_tmo && !discover) {
- len = sprintf(p, ",keep_alive_tmo=%s", cfg.keep_alive_tmo);
+ len = sprintf(p, ",keep_alive_tmo=%d", cfg.keep_alive_tmo);
if (len < 0)
return -EINVAL;
p += len;
{"hostnqn", 'q', "LIST", CFG_STRING, &cfg.hostnqn, required_argument, "user-defined hostnqn (if default not used)" },
{"hostid", 'I', "LIST", CFG_STRING, &cfg.hostid, required_argument, "user-defined hostid (if default not used)"},
{"raw", 'r', "LIST", CFG_STRING, &cfg.raw, required_argument, "raw output file" },
- {"keep-alive-tmo", 'k', "LIST", CFG_STRING, &cfg.keep_alive_tmo, required_argument, "keep alive timeout period in seconds" },
- {"reconnect-delay", 'c', "LIST", CFG_STRING, &cfg.reconnect_delay, required_argument, "reconnect timeout period in seconds" },
- {"ctrl-loss-tmo", 'l', "LIST", CFG_STRING, &cfg.ctrl_loss_tmo, required_argument, "controller loss timeout period in seconds" },
+ {"keep-alive-tmo", 'k', "LIST", CFG_INT, &cfg.keep_alive_tmo, required_argument, "keep alive timeout period in seconds" },
+ {"reconnect-delay", 'c', "LIST", CFG_INT, &cfg.reconnect_delay, required_argument, "reconnect timeout period in seconds" },
+ {"ctrl-loss-tmo", 'l', "LIST", CFG_INT, &cfg.ctrl_loss_tmo, required_argument, "controller loss timeout period in seconds" },
{NULL},
};
{"host-traddr", 'w', "LIST", CFG_STRING, &cfg.host_traddr, required_argument, "host traddr (e.g. FC WWN's)" },
{"hostnqn", 'q', "LIST", CFG_STRING, &cfg.hostnqn, required_argument, "user-defined hostnqn" },
{"hostid", 'I', "LIST", CFG_STRING, &cfg.hostid, required_argument, "user-defined hostid (if default not used)"},
- {"nr-io-queues", 'i', "LIST", CFG_STRING, &cfg.nr_io_queues, required_argument, "number of io queues to use (default is core count)" },
- {"queue-size", 'Q', "LIST", CFG_STRING, &cfg.queue_size, required_argument, "number of io queue elements to use (default 128)" },
- {"keep-alive-tmo", 'k', "LIST", CFG_STRING, &cfg.keep_alive_tmo, required_argument, "keep alive timeout period in seconds" },
- {"reconnect-delay", 'c', "LIST", CFG_STRING, &cfg.reconnect_delay, required_argument, "reconnect timeout period in seconds" },
- {"ctrl-loss-tmo", 'l', "LIST", CFG_STRING, &cfg.ctrl_loss_tmo, required_argument, "controller loss timeout period in seconds" },
+ {"nr-io-queues", 'i', "LIST", CFG_INT, &cfg.nr_io_queues, required_argument, "number of io queues to use (default is core count)" },
+ {"queue-size", 'Q', "LIST", CFG_INT, &cfg.queue_size, required_argument, "number of io queue elements to use (default 128)" },
+ {"keep-alive-tmo", 'k', "LIST", CFG_INT, &cfg.keep_alive_tmo, required_argument, "keep alive timeout period in seconds" },
+ {"reconnect-delay", 'c', "LIST", CFG_INT, &cfg.reconnect_delay, required_argument, "reconnect timeout period in seconds" },
+ {"ctrl-loss-tmo", 'l', "LIST", CFG_INT, &cfg.ctrl_loss_tmo, required_argument, "controller loss timeout period in seconds" },
{"duplicate_connect", 'D', "", CFG_NONE, &cfg.duplicate_connect, no_argument, "allow duplicate connections between same transport host and subsystem port" },
{NULL},
};