Searched refs:hvt (Results 1 - 5 of 5) sorted by relevance

/linux-4.4.14/drivers/hv/
H A Dhv_utils_transport.c28 static void hvt_reset(struct hvutil_transport *hvt) hvt_reset() argument
30 mutex_lock(&hvt->outmsg_lock); hvt_reset()
31 kfree(hvt->outmsg); hvt_reset()
32 hvt->outmsg = NULL; hvt_reset()
33 hvt->outmsg_len = 0; hvt_reset()
34 mutex_unlock(&hvt->outmsg_lock); hvt_reset()
35 if (hvt->on_reset) hvt_reset()
36 hvt->on_reset(); hvt_reset()
42 struct hvutil_transport *hvt; hvt_op_read() local
45 hvt = container_of(file->f_op, struct hvutil_transport, fops); hvt_op_read()
47 if (wait_event_interruptible(hvt->outmsg_q, hvt->outmsg_len > 0)) hvt_op_read()
50 mutex_lock(&hvt->outmsg_lock); hvt_op_read()
51 if (!hvt->outmsg) { hvt_op_read()
56 if (count < hvt->outmsg_len) { hvt_op_read()
61 if (!copy_to_user(buf, hvt->outmsg, hvt->outmsg_len)) hvt_op_read()
62 ret = hvt->outmsg_len; hvt_op_read()
66 kfree(hvt->outmsg); hvt_op_read()
67 hvt->outmsg = NULL; hvt_op_read()
68 hvt->outmsg_len = 0; hvt_op_read()
71 mutex_unlock(&hvt->outmsg_lock); hvt_op_read()
78 struct hvutil_transport *hvt; hvt_op_write() local
81 hvt = container_of(file->f_op, struct hvutil_transport, fops); hvt_op_write()
88 if (hvt->on_msg(inmsg, count)) hvt_op_write()
97 struct hvutil_transport *hvt; hvt_op_poll() local
99 hvt = container_of(file->f_op, struct hvutil_transport, fops); hvt_op_poll()
101 poll_wait(file, &hvt->outmsg_q, wait); hvt_op_poll()
102 if (hvt->outmsg_len > 0) hvt_op_poll()
110 struct hvutil_transport *hvt; hvt_op_open() local
112 hvt = container_of(file->f_op, struct hvutil_transport, fops); hvt_op_open()
118 if (hvt->mode == HVUTIL_TRANSPORT_INIT) hvt_op_open()
119 hvt->mode = HVUTIL_TRANSPORT_CHARDEV; hvt_op_open()
120 else if (hvt->mode == HVUTIL_TRANSPORT_NETLINK) { hvt_op_open()
125 hvt_reset(hvt); hvt_op_open()
126 hvt->mode = HVUTIL_TRANSPORT_CHARDEV; hvt_op_open()
135 struct hvutil_transport *hvt; hvt_op_release() local
137 hvt = container_of(file->f_op, struct hvutil_transport, fops); hvt_op_release()
139 hvt->mode = HVUTIL_TRANSPORT_INIT; hvt_op_release()
144 hvt_reset(hvt); hvt_op_release()
151 struct hvutil_transport *hvt, *hvt_found = NULL; hvt_cn_callback() local
154 list_for_each_entry(hvt, &hvt_list, list) { hvt_cn_callback()
155 if (hvt->cn_id.idx == msg->id.idx && hvt_cn_callback()
156 hvt->cn_id.val == msg->id.val) { hvt_cn_callback()
157 hvt_found = hvt; hvt_cn_callback()
171 if (hvt->mode == HVUTIL_TRANSPORT_INIT) hvt_cn_callback()
172 hvt->mode = HVUTIL_TRANSPORT_NETLINK; hvt_cn_callback()
174 if (hvt->mode == HVUTIL_TRANSPORT_NETLINK) hvt_cn_callback()
180 int hvutil_transport_send(struct hvutil_transport *hvt, void *msg, int len) hvutil_transport_send() argument
185 if (hvt->mode == HVUTIL_TRANSPORT_INIT) { hvutil_transport_send()
187 } else if (hvt->mode == HVUTIL_TRANSPORT_NETLINK) { hvutil_transport_send()
191 cn_msg->id.idx = hvt->cn_id.idx; hvutil_transport_send()
192 cn_msg->id.val = hvt->cn_id.val; hvutil_transport_send()
200 mutex_lock(&hvt->outmsg_lock); hvutil_transport_send()
201 if (hvt->outmsg) { hvutil_transport_send()
206 hvt->outmsg = kzalloc(len, GFP_KERNEL); hvutil_transport_send()
207 memcpy(hvt->outmsg, msg, len); hvutil_transport_send()
208 hvt->outmsg_len = len; hvutil_transport_send()
209 wake_up_interruptible(&hvt->outmsg_q); hvutil_transport_send()
211 mutex_unlock(&hvt->outmsg_lock); hvutil_transport_send()
220 struct hvutil_transport *hvt; hvutil_transport_init() local
222 hvt = kzalloc(sizeof(*hvt), GFP_KERNEL); hvutil_transport_init()
223 if (!hvt) hvutil_transport_init()
226 hvt->cn_id.idx = cn_idx; hvutil_transport_init()
227 hvt->cn_id.val = cn_val; hvutil_transport_init()
229 hvt->mdev.minor = MISC_DYNAMIC_MINOR; hvutil_transport_init()
230 hvt->mdev.name = name; hvutil_transport_init()
232 hvt->fops.owner = THIS_MODULE; hvutil_transport_init()
233 hvt->fops.read = hvt_op_read; hvutil_transport_init()
234 hvt->fops.write = hvt_op_write; hvutil_transport_init()
235 hvt->fops.poll = hvt_op_poll; hvutil_transport_init()
236 hvt->fops.open = hvt_op_open; hvutil_transport_init()
237 hvt->fops.release = hvt_op_release; hvutil_transport_init()
239 hvt->mdev.fops = &hvt->fops; hvutil_transport_init()
241 init_waitqueue_head(&hvt->outmsg_q); hvutil_transport_init()
242 mutex_init(&hvt->outmsg_lock); hvutil_transport_init()
245 list_add(&hvt->list, &hvt_list); hvutil_transport_init()
248 hvt->on_msg = on_msg; hvutil_transport_init()
249 hvt->on_reset = on_reset; hvutil_transport_init()
251 if (misc_register(&hvt->mdev)) hvutil_transport_init()
255 if (hvt->cn_id.idx > 0 && hvt->cn_id.val > 0 && hvutil_transport_init()
256 cn_add_callback(&hvt->cn_id, name, hvt_cn_callback)) hvutil_transport_init()
259 return hvt; hvutil_transport_init()
262 kfree(hvt); hvutil_transport_init()
266 void hvutil_transport_destroy(struct hvutil_transport *hvt) hvutil_transport_destroy() argument
269 list_del(&hvt->list); hvutil_transport_destroy()
271 if (hvt->cn_id.idx > 0 && hvt->cn_id.val > 0) hvutil_transport_destroy()
272 cn_del_callback(&hvt->cn_id); hvutil_transport_destroy()
273 misc_deregister(&hvt->mdev); hvutil_transport_destroy()
274 kfree(hvt->outmsg); hvutil_transport_destroy()
275 kfree(hvt); hvutil_transport_destroy()
H A Dhv_utils_transport.h48 int hvutil_transport_send(struct hvutil_transport *hvt, void *msg, int len);
49 void hvutil_transport_destroy(struct hvutil_transport *hvt);
H A Dhv_snapshot.c69 static struct hvutil_transport *hvt; variable in typeref:struct:hvutil_transport
108 if (hvutil_transport_send(hvt, &our_ver, sizeof(our_ver))) vss_handle_handshake()
171 rc = hvutil_transport_send(hvt, vss_msg, sizeof(*vss_msg)); vss_send_op()
351 hvt = hvutil_transport_init(vss_devname, CN_VSS_IDX, CN_VSS_VAL, hv_vss_init()
353 if (!hvt) hv_vss_init()
364 hvutil_transport_destroy(hvt); hv_vss_deinit()
H A Dhv_fcopy.c64 static struct hvutil_transport *hvt; variable in typeref:struct:hvutil_transport
97 if (hvutil_transport_send(hvt, &our_ver, sizeof(our_ver))) fcopy_handle_handshake()
166 rc = hvutil_transport_send(hvt, out_src, out_len); fcopy_send_data()
338 hvt = hvutil_transport_init(fcopy_devname, 0, 0, hv_fcopy_init()
340 if (!hvt) hv_fcopy_init()
350 hvutil_transport_destroy(hvt); hv_fcopy_deinit()
H A Dhv_kvp.c89 static struct hvutil_transport *hvt; variable in typeref:struct:hvutil_transport
111 hvutil_transport_send(hvt, kvp_msg, sizeof(*kvp_msg)); kvp_register()
446 rc = hvutil_transport_send(hvt, message, sizeof(*message)); kvp_send_key()
707 hvt = hvutil_transport_init(kvp_devname, CN_KVP_IDX, CN_KVP_VAL, hv_kvp_init()
709 if (!hvt) hv_kvp_init()
720 hvutil_transport_destroy(hvt); hv_kvp_deinit()

Completed in 116 milliseconds