|
@@ -300,32 +300,29 @@ struct qemu_work_item {
|
|
|
void qemu_init_vcpu(void *env);
|
|
|
#endif
|
|
|
|
|
|
-/**
|
|
|
- * Sends an iovec (or optionally a part of it) down a socket, yielding
|
|
|
- * when the socket is full.
|
|
|
- */
|
|
|
-int qemu_co_sendv(int sockfd, struct iovec *iov,
|
|
|
- int len, int iov_offset);
|
|
|
|
|
|
/**
|
|
|
- * Receives data into an iovec (or optionally into a part of it) from
|
|
|
- * a socket, yielding when there is no data in the socket.
|
|
|
+ * Sends a (part of) iovec down a socket, yielding when the socket is full, or
|
|
|
+ * Receives data into a (part of) iovec from a socket,
|
|
|
+ * yielding when there is no data in the socket.
|
|
|
+ * The same interface as qemu_sendv_recvv(), with added yielding.
|
|
|
+ * XXX should mark these as coroutine_fn
|
|
|
*/
|
|
|
-int qemu_co_recvv(int sockfd, struct iovec *iov,
|
|
|
- int len, int iov_offset);
|
|
|
-
|
|
|
+ssize_t qemu_co_sendv_recvv(int sockfd, struct iovec *iov, unsigned iov_cnt,
|
|
|
+ size_t offset, size_t bytes, bool do_send);
|
|
|
+#define qemu_co_recvv(sockfd, iov, iov_cnt, offset, bytes) \
|
|
|
+ qemu_co_sendv_recvv(sockfd, iov, iov_cnt, offset, bytes, false)
|
|
|
+#define qemu_co_sendv(sockfd, iov, iov_cnt, offset, bytes) \
|
|
|
+ qemu_co_sendv_recvv(sockfd, iov, iov_cnt, offset, bytes, true)
|
|
|
|
|
|
/**
|
|
|
- * Sends a buffer down a socket, yielding when the socket is full.
|
|
|
+ * The same as above, but with just a single buffer
|
|
|
*/
|
|
|
-int qemu_co_send(int sockfd, void *buf, int len);
|
|
|
-
|
|
|
-/**
|
|
|
- * Receives data into a buffer from a socket, yielding when there
|
|
|
- * is no data in the socket.
|
|
|
- */
|
|
|
-int qemu_co_recv(int sockfd, void *buf, int len);
|
|
|
-
|
|
|
+ssize_t qemu_co_send_recv(int sockfd, void *buf, size_t bytes, bool do_send);
|
|
|
+#define qemu_co_recv(sockfd, buf, bytes) \
|
|
|
+ qemu_co_send_recv(sockfd, buf, bytes, false)
|
|
|
+#define qemu_co_send(sockfd, buf, bytes) \
|
|
|
+ qemu_co_send_recv(sockfd, buf, bytes, true)
|
|
|
|
|
|
typedef struct QEMUIOVector {
|
|
|
struct iovec *iov;
|