1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18#ifndef _HV_UTILS_TRANSPORT_H
19#define _HV_UTILS_TRANSPORT_H
20
21#include <linux/connector.h>
22#include <linux/miscdevice.h>
23
24enum hvutil_transport_mode {
25 HVUTIL_TRANSPORT_INIT = 0,
26 HVUTIL_TRANSPORT_NETLINK,
27 HVUTIL_TRANSPORT_CHARDEV,
28 HVUTIL_TRANSPORT_DESTROY,
29};
30
31struct hvutil_transport {
32 int mode;
33 struct file_operations fops;
34 struct miscdevice mdev;
35 struct cb_id cn_id;
36 struct list_head list;
37 int (*on_msg)(void *, int);
38 void (*on_reset)(void);
39 u8 *outmsg;
40 int outmsg_len;
41 wait_queue_head_t outmsg_q;
42 struct mutex lock;
43};
44
45struct hvutil_transport *hvutil_transport_init(const char *name,
46 u32 cn_idx, u32 cn_val,
47 int (*on_msg)(void *, int),
48 void (*on_reset)(void));
49int hvutil_transport_send(struct hvutil_transport *hvt, void *msg, int len);
50void hvutil_transport_destroy(struct hvutil_transport *hvt);
51
52#endif
53