0001
0002
0003
0004
0005
0006
0007
0008 #ifndef _HV_UTILS_TRANSPORT_H
0009 #define _HV_UTILS_TRANSPORT_H
0010
0011 #include <linux/connector.h>
0012 #include <linux/miscdevice.h>
0013
0014 enum hvutil_transport_mode {
0015 HVUTIL_TRANSPORT_INIT = 0,
0016 HVUTIL_TRANSPORT_NETLINK,
0017 HVUTIL_TRANSPORT_CHARDEV,
0018 HVUTIL_TRANSPORT_DESTROY,
0019 };
0020
0021 struct hvutil_transport {
0022 int mode;
0023 struct file_operations fops;
0024 struct miscdevice mdev;
0025 struct cb_id cn_id;
0026 struct list_head list;
0027 int (*on_msg)(void *, int);
0028 void (*on_reset)(void);
0029 void (*on_read)(void);
0030 u8 *outmsg;
0031 int outmsg_len;
0032 wait_queue_head_t outmsg_q;
0033 struct mutex lock;
0034 struct completion release;
0035 };
0036
0037 struct hvutil_transport *hvutil_transport_init(const char *name,
0038 u32 cn_idx, u32 cn_val,
0039 int (*on_msg)(void *, int),
0040 void (*on_reset)(void));
0041 int hvutil_transport_send(struct hvutil_transport *hvt, void *msg, int len,
0042 void (*on_read_cb)(void));
0043 void hvutil_transport_destroy(struct hvutil_transport *hvt);
0044
0045 #endif