| Branch: | Revision:

root / cutils.c @ a74cdab4

History | View | Annotate | Download (9.8 kB)

# Date Author Comment
e0d9c6f9 02/10/2011 02:23 pm Chunqiang Tang

QCOW2: bug fix - read base image beyond its size

This patch fixes the following bug in QCOW2. For a QCOW2 image that is larger
than its base image, when handling a read request straddling over the end of the
base image, the QCOW2 driver attempts to read beyond the end of the base image...

a2afc2c1 01/31/2011 11:03 am Jes Sorensen

strtosz() use qemu_toupper() to simplify switch statement

Signed-off-by: Jes Sorensen <>
Signed-off-by: Kevin Wolf <>

7eb05349 01/31/2011 11:03 am Jes Sorensen

strtosz(): Fix name confusion in use of modf()

Signed-off-by: Jes Sorensen <>
Signed-off-by: Kevin Wolf <>

2be22ca5 01/31/2011 11:03 am Jes Sorensen

strtosz(): Use suffix macros in switch() statement

Signed-off-by: Jes Sorensen <>
Signed-off-by: Kevin Wolf <>

f3bd362a 01/31/2011 11:02 am Jes Sorensen

strtosz(): use unsigned char and switch to qemu_isspace()

isspace() behavior is undefined for signed char.

Bug pointed out by Eric Blake, thanks!

Signed-off-by: Jes Sorensen <>
Signed-off-by: Kevin Wolf <>

70b4f4bb 01/24/2011 12:08 pm Jes Sorensen

Make strtosz() return int64_t instead of ssize_t

strtosz() needs to return a 64 bit type even on 32 bit
architectures. Otherwise qemu-img will fail to create disk
images >= 2GB

Signed-off-by: Jes Sorensen <>
Signed-off-by: Kevin Wolf <>

d8427002 12/17/2010 05:10 pm Jes Sorensen

Introduce strtosz_suffix()

This introduces strtosz_suffix() which allows the caller to specify a
default suffix in case the non default of MB is wanted.

strtosz() is kept as a wrapper for strtosz_suffix() which keeps it's
current default of MB.

Signed-off-by: Jes Sorensen <>...

9f9b17a4 11/03/2010 07:48 pm Jes Sorensen

Introduce strtosz() library function to convert a string to a byte count.

strtosz() returns -1 on error. It now supports human unit formats in
eg. 1.0G, with better error handling.

The following suffixes are supported:
B/b = bytes
K/k = KB
M/m = MB
G/g = GB...

b8a83a4f 09/21/2010 04:39 pm Kevin Wolf

cutils: qemu_iovec_copy and qemu_iovec_memset

This adds two functions that work on QEMUIOVectors and will be used by the next
qcow2 patches.

Signed-off-by: Kevin Wolf <>

db1a4972 03/17/2010 06:16 pm Paolo Bonzini

split out qemu-timer.c

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Anthony Liguori <>

5f6b9e8f 09/20/2009 09:56 am Blue Swirl

Probe for fdatasync()

Signed-off-by: Blue Swirl <>

6f1953c4 09/11/2009 06:19 pm Christoph Hellwig

block: use fdatasync instead of fsync if possible

If we are flushing the caches for our image files we only care about the
data (including the metadata required for accessing it) but not things
like timestamp updates. So try to use fdatasync instead of fsync to...

40b4f539 09/11/2009 06:18 pm Kevin Wolf

Add bdrv_aio_multiwrite

One performance problem of qcow2 during the initial image growth are
sequential writes that are not cluster aligned. In this case, when a first
requests requires to allocate a new cluster but writes only to the first
couple of sectors in that cluster, the rest of the cluster is zeroed - just...

1cec71e3 07/10/2009 12:06 am Anthony Liguori

Revert "support colon in filenames"

This reverts commit 707c0dbc97cddfe8d2441b8259c6c526d99f2dd8.

Signed-off-by: Anthony Liguori <>

d43277c5 07/01/2009 09:24 pm Blue Swirl

Fix missing strnlen problems

Fix missing strnlen (a GNU extension) problems by using qemu_strnlen
used for user emulators also for system emulators.

Signed-off-by: Blue Swirl <>

707c0dbc 06/29/2009 09:50 pm Ram Pai

support colon in filenames

Problem: It is impossible to feed filenames with the character colon because
qemu interprets such names as a protocol. For example filename scsi:0, is
interpreted as a protocol by name "scsi".

This patch allows user to espace colon characters. For example the above...

55616505 05/13/2009 10:54 pm Paul Brook

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 <>

522584a5 03/28/2009 07:46 pm aliguori

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>iov
and all functions dealing with memory management assert on the iovec beeing...

be959463 02/05/2009 11:23 pm aliguori

Add qemu_iovec_reset() (Avi Kivity)

Add a helper to zero out an existing iovec. Removes the need to deallocate
and reallocate it.

Signed-off-by: Avi Kivity <>
Signed-off-by: Anthony Liguori <>

git-svn-id: svn:// c046a42c-6fe2-441c-8c8c-71466251a162

249aa745 01/26/2009 07:17 pm aliguori

qemu iovec: keep track of total size, allow partial copies (Gerd Hoffman)

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

git-svn-id: svn:// c046a42c-6fe2-441c-8c8c-71466251a162

44e3ee8a 01/22/2009 06:59 pm aliguori

I/O vector helpers (Avi Kivity)

In general, it is not possible to predict the size of of an I/O vector since
a contiguous guest region may map to a disconiguous host region. Add some
helpers to manage I/O vector growth.

Signed-off-by: Avi Kivity <>...

ad46db9a 12/11/2008 09:37 pm blueswir1

Rename fls to qemu_fls

Fix compiler warning on OSX, reported by Andreas Faerber.

git-svn-id: svn:// c046a42c-6fe2-441c-8c8c-71466251a162

8d371d4b 12/04/2008 10:08 pm aliguori

Define fls() in terms of clz32().

As suggested by Laurent Desnogues.

Signed-off-by: Anthony Liguori <>

git-svn-id: svn:// c046a42c-6fe2-441c-8c8c-71466251a162

b39ade83 12/04/2008 09:19 pm aliguori

Introduce fls() helper

This is needed for virtio. The implementation is originally from
Marcelo Tosatti.

Signed-off-by: Anthony Liguori <>

git-svn-id: svn:// c046a42c-6fe2-441c-8c8c-71466251a162

cd390083 11/16/2008 03:53 pm blueswir1

Attached patch fixes a series of this warning
when compiling on NetBSD:

warning: array subscript has type 'char'

Signed-off-by: Christoph Egger <>

git-svn-id: svn:// c046a42c-6fe2-441c-8c8c-71466251a162

793a10a2 11/09/2008 01:57 am balrog

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:// c046a42c-6fe2-441c-8c8c-71466251a162

2bd7318c 10/25/2008 02:23 pm blueswir1

Replace uses of strndup (a GNU extension) with Qemu pstrdup

git-svn-id: svn:// c046a42c-6fe2-441c-8c8c-71466251a162

17e2377a 06/09/2008 04:47 pm pbrook

Prevent guest reusing host memory allocations.

git-svn-id: svn:// c046a42c-6fe2-441c-8c8c-71466251a162

ca10f867 04/12/2008 12:35 am aurel32

Remove osdep.c/qemu-img code duplication

(Kevin Wolf)

git-svn-id: svn:// c046a42c-6fe2-441c-8c8c-71466251a162

faf07963 11/11/2007 04:51 am pbrook

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:// c046a42c-6fe2-441c-8c8c-71466251a162

3c6b2088 11/10/2007 09:36 pm bellard

always use mktimegm

git-svn-id: svn:// c046a42c-6fe2-441c-8c8c-71466251a162

5fafdf24 09/17/2007 12:08 am ths

find -type f | xargs sed -i 's/[\t ]$//g' # on most files

git-svn-id: svn:// c046a42c-6fe2-441c-8c8c-71466251a162

18607dcb 01/08/2007 12:04 am bellard

added cutils.c

git-svn-id: svn:// c046a42c-6fe2-441c-8c8c-71466251a162