Lines Matching refs:msg

332 	struct xs_stored_msg *msg, *tmsg;  in close_free_msgs()  local
334 list_for_each_entry_safe(msg, tmsg, &h->reply_list, list) { in close_free_msgs()
335 free(msg->body); in close_free_msgs()
336 free(msg); in close_free_msgs()
339 list_for_each_entry_safe(msg, tmsg, &h->watch_list, list) { in close_free_msgs()
340 free(msg->body); in close_free_msgs()
341 free(msg); in close_free_msgs()
452 struct xs_stored_msg *msg; in read_reply() local
472 msg = list_top(&h->reply_list, struct xs_stored_msg, list); in read_reply()
473 list_del(&msg->list); in read_reply()
477 *type = msg->hdr.type; in read_reply()
479 *len = msg->hdr.len; in read_reply()
480 body = msg->body; in read_reply()
482 free(msg); in read_reply()
494 struct xsd_sockmsg msg; in xs_talkv() local
500 msg.tx_id = t; in xs_talkv()
501 msg.req_id = 0; in xs_talkv()
502 msg.type = type; in xs_talkv()
503 msg.len = 0; in xs_talkv()
505 msg.len += iovec[i].iov_len; in xs_talkv()
507 if (msg.len > XENSTORE_PAYLOAD_MAX) { in xs_talkv()
519 if (!xs_write_all(h->fd, &msg, sizeof(msg))) in xs_talkv()
526 ret = read_reply(h, &msg.type, len); in xs_talkv()
533 if (msg.type == XS_ERROR) { in xs_talkv()
540 if (msg.type != type) { in xs_talkv()
895 struct xs_stored_msg *msg; in read_watch_internal() local
930 msg = list_top(&h->watch_list, struct xs_stored_msg, list); in read_watch_internal()
931 list_del(&msg->list); in read_watch_internal()
936 assert(msg->hdr.type == XS_WATCH_EVENT); in read_watch_internal()
938 strings = msg->body; in read_watch_internal()
939 num_strings = xs_count_strings(strings, msg->hdr.len); in read_watch_internal()
941 ret = malloc(sizeof(char*) * num_strings + msg->hdr.len); in read_watch_internal()
944 free_no_errno(msg); in read_watch_internal()
949 memcpy(ret[0], strings, msg->hdr.len); in read_watch_internal()
952 free(msg); in read_watch_internal()
986 struct xs_stored_msg *msg, *tmsg; in xs_unwatch() local
1012 list_for_each_entry_safe(msg, tmsg, &h->watch_list, list) { in xs_unwatch()
1013 assert(msg->hdr.type == XS_WATCH_EVENT); in xs_unwatch()
1015 s = msg->body; in xs_unwatch()
1020 for (p = s, i = 0; p < msg->body + msg->hdr.len; p++) { in xs_unwatch()
1034 list_del(&msg->list); in xs_unwatch()
1035 free(msg); in xs_unwatch()
1247 struct xs_stored_msg *msg = NULL; in read_message() local
1253 msg = malloc(sizeof(*msg)); in read_message()
1254 if (msg == NULL) in read_message()
1256 cleanup_push_heap(msg); in read_message()
1257 if (!read_all(h->fd, &msg->hdr, sizeof(msg->hdr), nonblocking)) { /* Cancellation point */ in read_message()
1263 if (msg->hdr.len > XENSTORE_PAYLOAD_MAX) { in read_message()
1269 body = msg->body = malloc(msg->hdr.len + 1); in read_message()
1273 if (!read_all(h->fd, body, msg->hdr.len, 0)) { /* Cancellation point */ in read_message()
1278 body[msg->hdr.len] = '\0'; in read_message()
1280 if (msg->hdr.type == XS_WATCH_EVENT) { in read_message()
1290 list_add_tail(&msg->list, &h->watch_list); in read_message()
1305 list_add_tail(&msg->list, &h->reply_list); in read_message()
1316 cleanup_pop_heap(ret == -1, msg); in read_message()