static int send_file_buf(char *buf, off_t size)
{
- struct fio_net_cmd *cmd;
- int ret;
-
- cmd = malloc(sizeof(*cmd) + size);
-
- fio_init_net_cmd(cmd);
- cmd->opcode = cpu_to_le16(FIO_NET_CMD_JOB_END);
- cmd->pdu_len = cpu_to_le32(size);
-
- memcpy(&cmd->payload, buf, size);
-
- fio_net_cmd_crc(cmd);
-
- ret = fio_send_data(fio_client_fd, cmd, sizeof(*cmd) + size);
- free(cmd);
- return ret;
+ return fio_net_send_cmd(fio_client_fd, FIO_NET_CMD_JOB, buf, size);
}
/*
free(cmd);
continue;
}
+ if (cmd->opcode == FIO_NET_CMD_QUIT) {
+ free(cmd);
+ break;
+ }
if (cmd->opcode != FIO_NET_CMD_TEXT) {
printf("non text: %d\n", cmd->opcode);
free(cmd);
continue;
}
- printf("%s", cmd->payload);
+ fwrite(cmd->payload, cmd->pdu_len, 1, stdout);
fflush(stdout);
free(cmd);
}