dst->min_val = le64_to_cpu(src->min_val);
dst->samples = le64_to_cpu(src->samples);
/* FIXME */
- dst->mean = le64_to_cpu(src->mean);
- dst->S = le64_to_cpu(src->S);
+ dst->mean = __le64_to_cpu(src->mean);
+ dst->S = __le64_to_cpu(src->S);
}
static void convert_ts(struct thread_stat *dst, struct thread_stat *src)
dst->total_run_time = le64_to_cpu(src->total_run_time);
dst->continue_on_error = le16_to_cpu(src->continue_on_error);
dst->total_err_count = le64_to_cpu(src->total_err_count);
- dst->first_error = le64_to_cpu(src->first_error);
- dst->kb_base = le64_to_cpu(src->kb_base);
+ dst->first_error = le32_to_cpu(src->first_error);
+ dst->kb_base = le32_to_cpu(src->kb_base);
}
static void convert_gs(struct group_run_stats *dst, struct group_run_stats *src)
{
uint32_t pdu_len;
- cmd->cmd_crc16 = cpu_to_le16(crc16(cmd, FIO_NET_CMD_CRC_SZ));
+ cmd->cmd_crc16 = __cpu_to_le16(crc16(cmd, FIO_NET_CMD_CRC_SZ));
pdu_len = le32_to_cpu(cmd->pdu_len);
if (pdu_len)
- cmd->pdu_crc16 = cpu_to_le16(crc16(cmd->payload, pdu_len));
+ cmd->pdu_crc16 = __cpu_to_le16(crc16(cmd->payload, pdu_len));
}
int fio_net_send_cmd(int fd, uint16_t opcode, const void *buf, off_t size)
fio_init_net_cmd(cmd, opcode, buf, this_len);
if (this_len < size)
- cmd->flags = cpu_to_le32(FIO_NET_CMD_F_MORE);
+ cmd->flags = __cpu_to_le32(FIO_NET_CMD_F_MORE);
fio_net_cmd_crc(cmd);
static int send_simple_command(int sk, uint16_t opcode, uint64_t serial)
{
struct fio_net_cmd cmd = {
- .version = cpu_to_le16(FIO_SERVER_VER1),
+ .version = __cpu_to_le16(FIO_SERVER_VER1),
.opcode = cpu_to_le16(opcode),
.serial = cpu_to_le64(serial),
};
dst->min_val = cpu_to_le64(src->min_val);
dst->samples = cpu_to_le64(src->samples);
/* FIXME */
- dst->mean = cpu_to_le64(src->mean);
- dst->S = cpu_to_le64(src->S);
+ dst->mean = __cpu_to_le64(src->mean);
+ dst->S = __cpu_to_le64(src->S);
}
static void convert_gs(struct group_run_stats *dst, struct group_run_stats *src)
strcpy(p.ts.verror, ts->verror);
strcpy(p.ts.description, ts->description);
- p.ts.error = cpu_to_le32(ts->error);
+ p.ts.error = cpu_to_le32(ts->error);
p.ts.groupid = cpu_to_le32(ts->groupid);
- p.ts.pid = cpu_to_le32(ts->pid);
+ p.ts.pid = cpu_to_le32(ts->pid);
p.ts.members = cpu_to_le32(ts->members);
for (i = 0; i < 2; i++) {
p.ts.total_run_time = cpu_to_le64(ts->total_run_time);
p.ts.continue_on_error = cpu_to_le16(ts->continue_on_error);
p.ts.total_err_count = cpu_to_le64(ts->total_err_count);
- p.ts.first_error = cpu_to_le64(ts->first_error);
- p.ts.kb_base = cpu_to_le64(ts->kb_base);
+ p.ts.first_error = cpu_to_le32(ts->first_error);
+ p.ts.kb_base = cpu_to_le32(ts->kb_base);
convert_gs(&p.rs, rs);
extern int fio_net_port;
#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define le16_to_cpu(x) (x)
-#define le32_to_cpu(x) (x)
-#define le64_to_cpu(x) (x)
-#define cpu_to_le16(x) (x)
-#define cpu_to_le32(x) (x)
-#define cpu_to_le64(x) (x)
+#define __le16_to_cpu(x) (x)
+#define __le32_to_cpu(x) (x)
+#define __le64_to_cpu(x) (x)
+#define __cpu_to_le16(x) (x)
+#define __cpu_to_le32(x) (x)
+#define __cpu_to_le64(x) (x)
#elif __BYTE_ORDER == __BIG_ENDIAN
-#define le16_to_cpu(x) __bswap_16(x)
-#define le32_to_cpu(x) __bswap_32(x)
-#define le64_to_cpu(x) __bswap_64(x)
-#define cpu_to_le16(x) __bswap_16(x)
-#define cpu_to_le32(x) __bswap_32(x)
-#define cpu_to_le64(x) __bswap_64(x)
+#define __le16_to_cpu(x) __bswap_16(x)
+#define __le32_to_cpu(x) __bswap_32(x)
+#define __le64_to_cpu(x) __bswap_64(x)
+#define __cpu_to_le16(x) __bswap_16(x)
+#define __cpu_to_le32(x) __bswap_32(x)
+#define __cpu_to_le64(x) __bswap_64(x)
#else
#error "Endianness not detected"
#endif
+#define le16_to_cpu(val) ({ \
+ uint16_t *__val = &(val); \
+ __le16_to_cpu(*__val); \
+})
+#define le32_to_cpu(val) ({ \
+ uint32_t *__val = &(val); \
+ __le32_to_cpu(*__val); \
+})
+#define le64_to_cpu(val) ({ \
+ uint64_t *__val = &(val); \
+ __le64_to_cpu(*__val); \
+})
+#define cpu_to_le16(val) ({ \
+ uint16_t *__val = &(val); \
+ __cpu_to_le16(*__val); \
+})
+#define cpu_to_le32(val) ({ \
+ uint32_t *__val = &(val); \
+ __cpu_to_le32(*__val); \
+})
+#define cpu_to_le64(val) ({ \
+ uint64_t *__val = &(val); \
+ __cpu_to_le64(*__val); \
+})
+
static inline void fio_init_net_cmd(struct fio_net_cmd *cmd, uint16_t opcode,
const void *pdu, uint32_t pdu_len)
{
memset(cmd, 0, sizeof(*cmd));
- cmd->version = cpu_to_le16(FIO_SERVER_VER1);
+ cmd->version = __cpu_to_le16(FIO_SERVER_VER1);
cmd->opcode = cpu_to_le16(opcode);
if (pdu) {
struct thread_stat {
char name[FIO_JOBNAME_SIZE];
char verror[FIO_VERROR_SIZE];
- int32_t error;
- int32_t groupid;
+ uint32_t error;
+ uint32_t groupid;
uint32_t pid;
char description[FIO_JOBNAME_SIZE];
uint32_t members;
*/
uint16_t continue_on_error;
uint64_t total_err_count;
- int32_t first_error;
+ uint32_t first_error;
uint32_t kb_base;
};