+/*
+ * If 'list' is non-NULL, then allocate and store the sent command for
+ * later verification.
+ */
+int fio_net_send_simple_cmd(int sk, uint16_t opcode, uint64_t tag,
+ struct flist_head *list)
+{
+ struct fio_net_int_cmd *cmd;
+ int ret;
+
+ if (!list)
+ return fio_net_send_simple_stack_cmd(sk, opcode, tag);
+
+ cmd = malloc(sizeof(*cmd));
+
+ fio_init_net_cmd(&cmd->cmd, opcode, NULL, 0, (uint64_t) cmd);
+ fio_net_cmd_crc(&cmd->cmd);
+
+ INIT_FLIST_HEAD(&cmd->list);
+ gettimeofday(&cmd->tv, NULL);
+ cmd->saved_tag = tag;
+
+ ret = fio_send_data(sk, &cmd->cmd, sizeof(cmd->cmd));
+ if (ret) {
+ free(cmd);
+ return ret;
+ }
+
+ flist_add_tail(&cmd->list, list);
+ return 0;
+}
+