From: Jens Axboe Date: Mon, 3 Oct 2011 09:48:39 +0000 (+0200) Subject: server: endianness bug and exit command X-Git-Tag: fio-1.99~60 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=d7959186aa6f8ca6ee5bdcd773d77280fc806617 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 --- diff --git a/server.c b/server.c index 727666c9..d1de0e48 100644 --- a/server.c +++ b/server.c @@ -176,7 +176,7 @@ int fio_net_send_cmd(int fd, uint16_t opcode, const char *buf, off_t size) 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 @@ static int handle_command(struct fio_net_cmd *cmd) 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 008cb250..5e691e01 100644 --- a/server.h +++ b/server.h @@ -26,12 +26,13 @@ enum { 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) -