mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 23:03:54 -06:00
change qemu_iovec_to_buf() to match other to,from_buf functions
It now allows specifying offset within qiov to start from and amount of bytes to copy. Actual implementation is just a call to iov_to_buf(). Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
parent
1b093c480a
commit
d5e6b1619c
7 changed files with 10 additions and 15 deletions
11
cutils.c
11
cutils.c
|
@ -220,15 +220,10 @@ void qemu_iovec_reset(QEMUIOVector *qiov)
|
|||
qiov->size = 0;
|
||||
}
|
||||
|
||||
void qemu_iovec_to_buffer(QEMUIOVector *qiov, void *buf)
|
||||
size_t qemu_iovec_to_buf(QEMUIOVector *qiov, size_t offset,
|
||||
void *buf, size_t bytes)
|
||||
{
|
||||
uint8_t *p = (uint8_t *)buf;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < qiov->niov; ++i) {
|
||||
memcpy(p, qiov->iov[i].iov_base, qiov->iov[i].iov_len);
|
||||
p += qiov->iov[i].iov_len;
|
||||
}
|
||||
return iov_to_buf(qiov->iov, qiov->niov, offset, buf, bytes);
|
||||
}
|
||||
|
||||
size_t qemu_iovec_from_buf(QEMUIOVector *qiov, size_t offset,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue