diff options
author | Marcelo Tosatti <mtosatti@redhat.com> | 2011-02-16 18:48:04 -0200 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2011-02-16 18:48:04 -0200 |
commit | 2d36363f9dedfb536486d132c2fd51e302d4e080 (patch) | |
tree | b6433e86e1706f00e9f9a2a9f32a0a0511e3b1f1 /cutils.c | |
parent | 084a270c2fd51329de682da458ab2c131d366da8 (diff) | |
parent | 79f2b6fcdb7c06cdce6eccc796f5651f3efb843e (diff) |
Merge commit '79f2b6fcdb7c06cdce6eccc796f5651f3efb843e' into upstream-merge
* commit '79f2b6fcdb7c06cdce6eccc796f5651f3efb843e':
Handle icount for powerpc tbl/tbu/decr load and store.
Merge mainstone.h header into mainstone.c
mainstone: convert FPGA emulation code to use QDev/SysBus
mainstone: correct and simplify irq handling
Fix build from previous commit
PATCH] slirp: fix buffer overrun
correctly check ppr priority during interrupt injection]
io-thread: make sure to initialize qemu_work_cond and qemu_cpu_cond
qcow2: Fix order in L2 table COW
blockdev: Plug memory leak in drive_init() error paths
blockdev: Plug memory leak in drive_uninit()
qemu-img: Improve error messages for failed bdrv_open
qed: Report error for unsupported features
qcow2: Report error for version > 2
qerror: Add QERR_UNKNOWN_BLOCK_FORMAT_FEATURE
qcow2: Fix error handling for reading compressed clusters
qcow2: Fix error handling for immediate backing file read failure
QCOW2: bug fix - read base image beyond its size
Change snapshot_blkdev hmp to use correct argument type for device
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'cutils.c')
-rw-r--r-- | cutils.c | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -272,6 +272,37 @@ 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) +{ + int i; + size_t done; + void *iov_base; + uint64_t iov_len; + + done = 0; + for (i = 0; (i < qiov->niov) && (done != count); i++) { + if (skip >= qiov->iov[i].iov_len) { + /* Skip the whole iov */ + skip -= qiov->iov[i].iov_len; + continue; + } else { + /* Skip only part (or nothing) of the iov */ + iov_base = (uint8_t*) qiov->iov[i].iov_base + skip; + iov_len = qiov->iov[i].iov_len - skip; + skip = 0; + } + + if (done + iov_len > count) { + memset(iov_base, c, count - done); + break; + } else { + memset(iov_base, c, iov_len); + } + done += iov_len; + } +} + #ifndef _WIN32 /* Sets a specific flag */ int fcntl_setfl(int fd, int flag) |