gfio: fix error handling in send_job_files()
[fio.git] / client.h
CommitLineData
dd366728
SC
1#ifndef CLIENT_H
2#define CLIENT_H
3
0f92bd20
JA
4#include <sys/socket.h>
5#include <sys/un.h>
6#include <netinet/in.h>
7#include <arpa/inet.h>
8
3e47bd25
JA
9#include "stat.h"
10
dd366728
SC
11struct fio_net_cmd;
12
0f92bd20
JA
13struct fio_client {
14 struct flist_head list;
15 struct flist_head hash_list;
16 struct flist_head arg_list;
17 union {
18 struct sockaddr_in addr;
19 struct sockaddr_in6 addr6;
20 struct sockaddr_un addr_un;
21 };
22 char *hostname;
23 int port;
24 int fd;
25
26 char *name;
27
28 int state;
29
30 int skip_newline;
31 int is_sock;
32 int disk_stats_shown;
33 unsigned int jobs;
34 int error;
35 int ipv6;
36 int sent_job;
37
38 struct flist_head eta_list;
39 struct client_eta *eta_in_flight;
40
41 struct flist_head cmd_list;
42
43 uint16_t argc;
44 char **argv;
45};
46
dd366728
SC
47typedef void (*client_text_op_func)(struct fio_client *client,
48 FILE *f, __u16 pdu_len, const char *buf);
49
50typedef void (*client_disk_util_op_func)(struct fio_client *client, struct fio_net_cmd *cmd);
51
52typedef void (*client_thread_status_op)(struct fio_net_cmd *cmd);
53
54typedef void (*client_group_stats_op)(struct fio_net_cmd *cmd);
55
56typedef void (*client_eta_op)(struct fio_client *client, struct fio_net_cmd *cmd);
57
58typedef void (*client_probe_op)(struct fio_client *client, struct fio_net_cmd *cmd);
59
04cc6b77 60typedef void (*client_thread_status_display_op)(char *status_message, double perc);
ba936c4b 61
dd366728
SC
62struct client_ops {
63 client_text_op_func text_op;
64 client_disk_util_op_func disk_util;
65 client_thread_status_op thread_status;
66 client_group_stats_op group_stats;
0420ba6a 67 client_eta_op eta;
dd366728
SC
68 client_probe_op probe;
69};
70
71extern struct client_ops fio_client_ops;
72
3e47bd25
JA
73struct client_eta {
74 struct jobs_eta eta;
75 unsigned int pending;
76};
77
78extern int fio_handle_client(struct fio_client *, struct client_ops *ops);
79extern void fio_client_dec_jobs_eta(struct client_eta *eta, void (*fn)(struct jobs_eta *));
80extern void fio_client_sum_jobs_eta(struct jobs_eta *dst, struct jobs_eta *je);
81extern void fio_client_convert_jobs_eta(struct jobs_eta *je);
82
dd366728
SC
83#endif
84