Separate the act of adding and starting a job

CMD_JOB or CMD_JOB_LINE only adds the necessary jobs, which will
automatically return the job option info to the client. Let the
client do what it wants with the options, then have the client
send a CMD_RUN command to actually start the jobs.

Next we'll have a command for passing back edited options, so that
the client can update existing options.

This adds a new button to gfio, to note this split of add and run
as well.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/client.c b/client.c
index a77dc93..10dc53b 100644
--- a/client.c
+++ b/client.c
@@ -40,15 +40,6 @@
 
 static struct timeval eta_tv;
 
-enum {
-	Client_created		= 0,
-	Client_connected	= 1,
-	Client_started		= 2,
-	Client_running		= 3,
-	Client_stopped		= 4,
-	Client_exited		= 5,
-};
-
 static FLIST_HEAD(client_list);
 static FLIST_HEAD(eta_list);
 
@@ -469,6 +460,33 @@
 	return !nr_clients;
 }
 
+int fio_start_client(struct fio_client *client)
+{
+	dprint(FD_NET, "client: start %s\n", client->hostname);
+	return fio_net_send_simple_cmd(client->fd, FIO_NET_CMD_RUN, 0, NULL);
+}
+
+int fio_start_all_clients(void)
+{
+	struct fio_client *client;
+	struct flist_head *entry, *tmp;
+	int ret;
+
+	dprint(FD_NET, "client: start all\n");
+
+	flist_for_each_safe(entry, tmp, &client_list) {
+		client = flist_entry(entry, struct fio_client, list);
+
+		ret = fio_start_client(client);
+		if (ret) {
+			remove_client(client);
+			continue;
+		}
+	}
+
+	return flist_empty(&client_list);
+}
+
 /*
  * Send file contents to server backend. We could use sendfile(), but to remain
  * more portable lets just read/write the darn thing.
@@ -891,8 +909,8 @@
 	if (!cmd)
 		return 0;
 
-	dprint(FD_NET, "client: got cmd op %s from %s\n",
-				fio_server_op(cmd->opcode), client->hostname);
+	dprint(FD_NET, "client: got cmd op %s from %s (pdu=%u)\n",
+		fio_server_op(cmd->opcode), client->hostname, cmd->pdu_len);
 
 	switch (cmd->opcode) {
 	case FIO_NET_CMD_QUIT: