History | View | Annotate | Download (7.2 kB)
fdsets: use weak aliases instead of qemu-tool.c/qemu-user.c
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
janitor: move iovector functions out of cutils.c
This removes the dependency of cutils.c on iov.c, and lets us removeiov.o from several builds.
rtc: fix overflow in mktimegm
When setting a date in 1980, Linux is actually disregarding the centurybyte and setting the year to 2080. This causes a year-2038 overflowin mktimegm. Fix this by doing the days-to-seconds computation in64-bit math.
Reported-by: Lucas Meneghel Rodrigues <lookkas@gmail.com>...
block: Enable qemu_open/close to work with fd sets
When qemu_open is passed a filename of the "/dev/fdset/nnn" format (where nnn is the fdset ID), an fd with matching accessmode flags will be searched for within the specified monitorfd set. If the fd is found, a dup of the fd will be returned...
Add cache handling functions
Add MRU page cache mechanism.The page are accessed by their address.
Signed-off-by: Benoit Hudzia <benoit.hudzia@sap.com>Signed-off-by: Petter Svard <petters@cs.umu.se>Signed-off-by: Aidan Shribman <aidan.shribman@sap.com>...
Add uleb encoding/decoding functions
Implement Unsigned Little Endian Base 128.
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>
cutils: add strpadcpy()
Signed-off-by: Yan Vugenfirer <yan@ravellosystems.com>Signed-off-by: Dmitry Fleytman <dmitry.fleytman@ravellosystems.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
allow qemu_iovec_from_buffer() to specify offset from which to start copying
Similar to qemu_iovec_memset(QEMUIOVector *qiov, size_t offset, int c, size_t bytes);the new prototype is: qemu_iovec_from_buf(QEMUIOVector *qiov, size_t offset,...
consolidate qemu_iovec_copy() and qemu_iovec_concat() and make them consistent
qemu_iovec_concat() is currently a wrapper forqemu_iovec_copy(), use the former (with extra"0" arg) in a few places where it is used.
Change skip argument of qemu_iovec_copy() from...
change qemu_iovec_to_buf() to match other to,from_buf functions
It now allows specifying offset within qiov to start from andamount of bytes to copy. Actual implementation is just a callto iov_to_buf().
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
rename qemu_sendv to iov_send, change proto and move declarations to iov.h
Rename arguments and use size_t for sizes instead of int,from int qemu_sendv(int sockfd, struct iovec *iov, int len, int iov_offset)to ssize_t iov_send(int sockfd, struct iovec *iov,...
export iov_send_recv() and use it in iov_send() and iov_recv()
Rename do_sendv_recvv() to iov_send_recv(), change its last arg(do_send) from int to bool, export it in iov.h, and made the twocallers of it (iov_send() and iov_recv()) to be trivial #defines...
rewrite iov_send_recv() and move it to iov.c
Make it much more understandable, add a missingiov_cnt argument (number of iovs in the iov), andadd comments to it.
The new implementation has been extensively testedby splitting a large buffer into many small...
consolidate qemu_iovec_memset{,_skip}() into single function and use existing iov_memset()
This patch combines two functions into one, and replacesthe implementation with already existing iov_memset() fromiov.c.
The new prototype of qemu_iovec_memset():...
cutils: extract buffer_is_zero() from qemu-img.c
The qemu-img.c:is_not_zero() function checks if a buffer contains allzeroes. This function will come in handy for zero-detection in theblock layer, so clean it up and move it to cutils.c.
Note that the function now returns true if the buffer is all zeroes....
sheepdog: move coroutine send/recv function to generic code
Outside coroutines, avoid busy waiting on EAGAIN by temporarilymaking the socket blocking.
The API of qemu_recvv/qemu_sendv is slightly different fromdo_readv/do_writev because they do not handle coroutines. It...
qiov: prevent double free or use-after-free
qemu_iovec_destroy does not clear the QEMUIOVector fully, and the datacould thus be used after free or freed again. While I do not know anyexample in the tree, I observed this using virtio-scsi (and SCSIscatter/gather) when canceling DMA requests....
cutils: Drop broken support for zero strtosz default_suffix
Commit 9f9b17a4's strtosz() defaults a missing suffix to 'M', exceptit rejects fractions then (switch case 0).
When commit d8427002 introduced strtosz_suffix(), that changed:fractions are no longer rejected, because we go to switch case 'M' on...
cutils: Make strtosz & friends leave follow set to callers
strtosz() & friends require the size to be at the end of the string,or be followed by whitespace or ','. I find this surprising, becausethe name suggests it works like strtol().
The check simplifies callers that accept exactly that follow set...
Move filedescriptor parsing code from net.c into qemu_parse_fd()
Move the parsing of a filedescriptor into a common functionqemu_parse_fd() so others can use it as well. Have net.c call thisfunction.
v2: - moving qemu_parse_fd into cutils.c
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>...
Fix up some style nits of last uq/master merge
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu: Add strtosz_suffix_unit function
This function does the same as the strtosz_suffix functionexcept that it allows to specify the unit to which thek/M/B/T suffixes apply. This function will be used later toparse the tsc-frequency from the command-line....
QCOW2: bug fix - read base image beyond its size
This patch fixes the following bug in QCOW2. For a QCOW2 image that is largerthan its base image, when handling a read request straddling over the end of thebase image, the QCOW2 driver attempts to read beyond the end of the base image...
strtosz() use qemu_toupper() to simplify switch statement
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
strtosz(): Fix name confusion in use of modf()
strtosz(): Use suffix macros in switch() statement
strtosz(): use unsigned char and switch to qemu_isspace()
isspace() behavior is undefined for signed char.
Bug pointed out by Eric Blake, thanks!
Make strtosz() return int64_t instead of ssize_t
strtosz() needs to return a 64 bit type even on 32 bitarchitectures. Otherwise qemu-img will fail to create diskimages >= 2GB
Introduce strtosz_suffix()
This introduces strtosz_suffix() which allows the caller to specify adefault suffix in case the non default of MB is wanted.
strtosz() is kept as a wrapper for strtosz_suffix() which keeps it'scurrent default of MB.
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>...
Introduce strtosz() library function to convert a string to a byte count.
strtosz() returns -1 on error. It now supports human unit formats ineg. 1.0G, with better error handling.
The following suffixes are supported:B/b = bytesK/k = KBM/m = MBG/g = GB...
cutils: qemu_iovec_copy and qemu_iovec_memset
This adds two functions that work on QEMUIOVectors and will be used by the nextqcow2 patches.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
split out qemu-timer.c
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Probe for fdatasync()
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
block: use fdatasync instead of fsync if possible
If we are flushing the caches for our image files we only care about thedata (including the metadata required for accessing it) but not thingslike timestamp updates. So try to use fdatasync instead of fsync to...
Add bdrv_aio_multiwrite
One performance problem of qcow2 during the initial image growth aresequential writes that are not cluster aligned. In this case, when a firstrequests requires to allocate a new cluster but writes only to the firstcouple of sectors in that cluster, the rest of the cluster is zeroed - just...
Revert "support colon in filenames"
This reverts commit 707c0dbc97cddfe8d2441b8259c6c526d99f2dd8.
Fix missing strnlen problems
Fix missing strnlen (a GNU extension) problems by using qemu_strnlenused for user emulators also for system emulators.
support colon in filenames
Problem: It is impossible to feed filenames with the character colon becauseqemu interprets such names as a protocol. For example filename scsi:0, isinterpreted as a protocol by name "scsi".
This patch allows user to espace colon characters. For example the above...
Include assert.h from qemu-common.h
Include assert.h from qemu-common.h and remove other direct uses.cpu-all.h still need to include it because of the dyngen-exec.h hacks
Signed-off-by: Paul Brook <paul@codesourcery.com>
add qemu_iovec_init_external (Christoph Hellwig)
Allow to initialize a QEMUIOVector from an externally allocated iovec.qiov->nalloc is initialized to 1 to indicate external storage for qiov>iovand all functions dealing with memory management assert on the iovec beeing...
Add qemu_iovec_reset() (Avi Kivity)
Add a helper to zero out an existing iovec. Removes the need to deallocateand reallocate it.
Signed-off-by: Avi Kivity <avi@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6523 c046a42c-6fe2-441c-8c8c-71466251a162
qemu iovec: keep track of total size, allow partial copies (Gerd Hoffman)
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6448 c046a42c-6fe2-441c-8c8c-71466251a162
I/O vector helpers (Avi Kivity)
In general, it is not possible to predict the size of of an I/O vector sincea contiguous guest region may map to a disconiguous host region. Add somehelpers to manage I/O vector growth.
Signed-off-by: Avi Kivity <avi@redhat.com>...
Rename fls to qemu_fls
Fix compiler warning on OSX, reported by Andreas Faerber.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5982 c046a42c-6fe2-441c-8c8c-71466251a162
Define fls() in terms of clz32().
As suggested by Laurent Desnogues.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5872 c046a42c-6fe2-441c-8c8c-71466251a162
Introduce fls() helper
This is needed for virtio. The implementation is originally fromMarcelo Tosatti.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5868 c046a42c-6fe2-441c-8c8c-71466251a162
Attached patch fixes a series of this warningwhen compiling on NetBSD:
warning: array subscript has type 'char'
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5727 c046a42c-6fe2-441c-8c8c-71466251a162
Revert r5532, r5536 and a piece of r5531.
The use of strncat and strndup was correct, pstrcpy and pstrdup wasn't.I'll try to restore building on non-gnu OSes in a later commit.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5651 c046a42c-6fe2-441c-8c8c-71466251a162
Replace uses of strndup (a GNU extension) with Qemu pstrdup
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5532 c046a42c-6fe2-441c-8c8c-71466251a162
Prevent guest reusing host memory allocations.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4710 c046a42c-6fe2-441c-8c8c-71466251a162
Remove osdep.c/qemu-img code duplication
(Kevin Wolf)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4191 c046a42c-6fe2-441c-8c8c-71466251a162
Split block API from vl.h.Remove QEMU_TOOL. Replace with QEMU_IMG and NEED_CPU_H.Avoid linking qemu-img against whole system emulatior.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3578 c046a42c-6fe2-441c-8c8c-71466251a162
always use mktimegm
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3570 c046a42c-6fe2-441c-8c8c-71466251a162
find -type f | xargs sed -i 's/[\t ]$//g' # on most files
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3173 c046a42c-6fe2-441c-8c8c-71466251a162
added cutils.c
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2310 c046a42c-6fe2-441c-8c8c-71466251a162