Lines Matching refs:vmsg
57 static void vmsg_close_fds(VhostUserMsg *vmsg) in vmsg_close_fds() argument
60 for (i = 0; i < vmsg->fd_num; i++) { in vmsg_close_fds()
61 close(vmsg->fds[i]); in vmsg_close_fds()
65 static void vmsg_unblock_fds(VhostUserMsg *vmsg) in vmsg_unblock_fds() argument
75 if (vmsg->request == VHOST_USER_ADD_MEM_REG || in vmsg_unblock_fds()
76 vmsg->request == VHOST_USER_SET_MEM_TABLE) { in vmsg_unblock_fds()
80 for (i = 0; i < vmsg->fd_num; i++) { in vmsg_unblock_fds()
81 qemu_socket_set_nonblock(vmsg->fds[i]); in vmsg_unblock_fds()
111 vu_message_read(VuDev *vu_dev, int conn_fd, VhostUserMsg *vmsg) in vu_message_read() argument
114 .iov_base = (char *)vmsg, in vu_message_read()
119 const size_t max_fds = G_N_ELEMENTS(vmsg->fds); in vu_message_read()
123 vmsg->fd_num = 0; in vu_message_read()
157 if (vmsg->fd_num + nfds > max_fds) { in vu_message_read()
160 max_fds, vmsg->fd_num + nfds); in vu_message_read()
164 memcpy(vmsg->fds + vmsg->fd_num, fds, nfds * sizeof(vmsg->fds[0])); in vu_message_read()
165 vmsg->fd_num += nfds; in vu_message_read()
179 vmsg_unblock_fds(vmsg); in vu_message_read()
180 if (vmsg->size > sizeof(vmsg->payload)) { in vu_message_read()
184 vmsg->request, vmsg->size, sizeof(vmsg->payload)); in vu_message_read()
189 .iov_base = (char *)&vmsg->payload, in vu_message_read()
190 .iov_len = vmsg->size, in vu_message_read()
192 if (vmsg->size) { in vu_message_read()
205 vmsg_close_fds(vmsg); in vu_message_read()