server: endianness bug and exit command
authorJens Axboe <axboe@kernel.dk>
Mon, 3 Oct 2011 09:48:39 +0000 (11:48 +0200)
committerJens Axboe <axboe@kernel.dk>
Mon, 3 Oct 2011 09:48:39 +0000 (11:48 +0200)
- 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>
server.c
server.h

index 727666c9721d44cd51538d11402a00e7251125b7..d1de0e48ad4aa44065a357db1c7f5693416d856a 100644 (file)
--- 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:
index 008cb25055c2673364fbfb45cfd77a3eaf5ac675..5e691e01bb143eadb39ccb0187f539232a073dfa 100644 (file)
--- 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) -