server: endianness bug and exit command
- flags should be converted to network native format
- add separate EXIT command for server, regular job completion should
not quit it
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/server.c b/server.c
index 727666c..d1de0e4 100644
--- a/server.c
+++ b/server.c
@@ -176,7 +176,7 @@
fio_init_net_cmd(cmd, opcode, buf, this_len);
if (this_len < size)
- cmd->flags |= FIO_NET_CMD_F_MORE;
+ cmd->flags = cpu_to_le32(FIO_NET_CMD_F_MORE);
fio_net_cmd_crc(cmd);
@@ -264,6 +264,8 @@
switch (cmd->opcode) {
case FIO_NET_CMD_QUIT:
+ return 1;
+ case FIO_NET_CMD_EXIT:
exit_backend = 1;
return 1;
case FIO_NET_CMD_ACK:
diff --git a/server.h b/server.h
index 008cb25..5e691e0 100644
--- a/server.h
+++ b/server.h
@@ -26,12 +26,13 @@
FIO_SERVER_MAX_PDU = 64,
FIO_NET_CMD_QUIT = 1,
- FIO_NET_CMD_JOB = 2,
- FIO_NET_CMD_ACK = 3,
- FIO_NET_CMD_NAK = 4,
- FIO_NET_CMD_TEXT = 5,
+ FIO_NET_CMD_EXIT = 2,
+ FIO_NET_CMD_JOB = 3,
+ FIO_NET_CMD_ACK = 4,
+ FIO_NET_CMD_NAK = 5,
+ FIO_NET_CMD_TEXT = 6,
- FIO_NET_CMD_F_MORE = 1,
+ FIO_NET_CMD_F_MORE = 1UL << 0,
/* crc does not include the crc fields */
FIO_NET_CMD_CRC_SZ = sizeof(struct fio_net_cmd) -