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