mirror of
https://github.com/mii443/qemu.git
synced 2025-12-16 17:18:49 +00:00
Merge remote-tracking branch 'mjt/mjt-iov2' into staging
* mjt/mjt-iov2:
rewrite iov_send_recv() and move it to iov.c
cleanup qemu_co_sendv(), qemu_co_recvv() and friends
export iov_send_recv() and use it in iov_send() and iov_recv()
rename qemu_sendv to iov_send, change proto and move declarations to iov.h
change qemu_iovec_to_buf() to match other to,from_buf functions
consolidate qemu_iovec_copy() and qemu_iovec_concat() and make them consistent
allow qemu_iovec_from_buffer() to specify offset from which to start copying
consolidate qemu_iovec_memset{,_skip}() into single function and use existing iov_memset()
rewrite iov_* functions
change iov_* function prototypes to be more appropriate
virtio-serial-bus: use correct lengths in control_out() message
Conflicts:
tests/Makefile
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
@@ -206,9 +206,6 @@ 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);
|
||||
@@ -312,32 +309,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;
|
||||
@@ -349,16 +343,16 @@ typedef struct QEMUIOVector {
|
||||
void qemu_iovec_init(QEMUIOVector *qiov, int alloc_hint);
|
||||
void qemu_iovec_init_external(QEMUIOVector *qiov, struct iovec *iov, int niov);
|
||||
void qemu_iovec_add(QEMUIOVector *qiov, void *base, size_t len);
|
||||
void qemu_iovec_copy(QEMUIOVector *dst, QEMUIOVector *src, uint64_t skip,
|
||||
size_t size);
|
||||
void qemu_iovec_concat(QEMUIOVector *dst, QEMUIOVector *src, size_t size);
|
||||
void qemu_iovec_concat(QEMUIOVector *dst,
|
||||
QEMUIOVector *src, size_t soffset, size_t sbytes);
|
||||
void qemu_iovec_destroy(QEMUIOVector *qiov);
|
||||
void qemu_iovec_reset(QEMUIOVector *qiov);
|
||||
void qemu_iovec_to_buffer(QEMUIOVector *qiov, void *buf);
|
||||
void qemu_iovec_from_buffer(QEMUIOVector *qiov, const void *buf, size_t count);
|
||||
void qemu_iovec_memset(QEMUIOVector *qiov, int c, size_t count);
|
||||
void qemu_iovec_memset_skip(QEMUIOVector *qiov, int c, size_t count,
|
||||
size_t skip);
|
||||
size_t qemu_iovec_to_buf(QEMUIOVector *qiov, size_t offset,
|
||||
void *buf, size_t bytes);
|
||||
size_t qemu_iovec_from_buf(QEMUIOVector *qiov, size_t offset,
|
||||
const void *buf, size_t bytes);
|
||||
size_t qemu_iovec_memset(QEMUIOVector *qiov, size_t offset,
|
||||
int fillc, size_t bytes);
|
||||
|
||||
bool buffer_is_zero(const void *buf, size_t len);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user