diff options
| author | Anthony Liguori <aliguori@us.ibm.com> | 2011-12-27 08:52:42 -0600 |
|---|---|---|
| committer | Anthony Liguori <aliguori@us.ibm.com> | 2011-12-27 08:52:42 -0600 |
| commit | ebdfc3c83cef33f8f619ffcb57d297c6063db59d (patch) | |
| tree | af4c54a676ecc8b9c6bae7370a27261b640a247c /qemu-common.h | |
| parent | a0fa82085e175bf8ce6d69a3f83695f81af2a649 (diff) | |
| parent | 44f76b289a33399abedfbca2d92d21d910792264 (diff) | |
| download | focaccia-qemu-ebdfc3c83cef33f8f619ffcb57d297c6063db59d.tar.gz focaccia-qemu-ebdfc3c83cef33f8f619ffcb57d297c6063db59d.zip | |
Merge remote-tracking branch 'bonzini/nbd-for-anthony' into staging
* bonzini/nbd-for-anthony: (26 commits) nbd: add myself as maintainer qemu-nbd: throttle requests qemu-nbd: asynchronous operation qemu-nbd: add client pointer to NBDRequest qemu-nbd: move client handling to nbd.c qemu-nbd: use common main loop link the main loop and its dependencies into the tools qemu-nbd: introduce NBDRequest qemu-nbd: introduce NBDExport qemu-nbd: introduce nbd_do_receive_request qemu-nbd: more robust handling of invalid requests qemu-nbd: introduce nbd_do_send_reply qemu-nbd: simplify nbd_trip move corking functions to osdep.c qemu-nbd: remove data_size argument to nbd_trip qemu-nbd: remove offset argument to nbd_trip Update ioctl order in nbd_init() to detect EBUSY nbd: add support for NBD_CMD_TRIM nbd: add support for NBD_CMD_FLUSH nbd: add support for NBD_CMD_FLAG_FUA ...
Diffstat (limited to 'qemu-common.h')
| -rw-r--r-- | qemu-common.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/qemu-common.h b/qemu-common.h index b2de015629..6ab7dfb1b9 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -173,6 +173,10 @@ void *qemu_oom_check(void *ptr); int qemu_open(const char *name, int flags, ...); ssize_t qemu_write_full(int fd, const void *buf, size_t count) QEMU_WARN_UNUSED_RESULT; +ssize_t qemu_send_full(int fd, const void *buf, size_t count, int flags) + QEMU_WARN_UNUSED_RESULT; +ssize_t qemu_recv_full(int fd, void *buf, size_t count, int flags) + QEMU_WARN_UNUSED_RESULT; void qemu_set_cloexec(int fd); #ifndef _WIN32 @@ -186,6 +190,9 @@ int qemu_pipe(int pipefd[2]); #define qemu_recv(sockfd, buf, len, flags) recv(sockfd, buf, len, flags) #endif +int qemu_recvv(int sockfd, struct iovec *iov, int len, int iov_offset); +int qemu_sendv(int sockfd, struct iovec *iov, int len, int iov_offset); + /* Error handling. */ void QEMU_NORETURN hw_error(const char *fmt, ...) GCC_FMT_ATTR(1, 2); @@ -272,6 +279,33 @@ 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. + */ +int qemu_co_recvv(int sockfd, struct iovec *iov, + int len, int iov_offset); + + +/** + * Sends a buffer down a socket, yielding when the socket is full. + */ +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); + + typedef struct QEMUIOVector { struct iovec *iov; int niov; |