summaryrefslogtreecommitdiffstats
path: root/include/qemu-common.h
Commit message (Collapse)AuthorAgeFilesLines
* glib: Add compat wrapper for g_poll on old glibAlexander Graf2013-02-261-0/+12
| | | | | | | | | | | | | Older glib doesn't implement g_poll(). Most notably the glib version in use on SLE11 is on 2.18 which is hit by this. We do want to use g_poll() in the source however. So on older systems, just wrap it with functions that do exist on older versions. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de> Message-id: 1361835970-2889-1-git-send-email-agraf@suse.de Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* cutils: unsigned int parsing functionsEduardo Habkost2013-02-041-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are lots of duplicate parsing code using strto*() in QEMU, and most of that code is broken in one way or another. Even the visitors code have duplicate integer parsing code[1]. This introduces functions to help parsing unsigned int values: parse_uint() and parse_uint_full(). Parsing functions for signed ints and floats will be submitted later. parse_uint_full() has all the checks made by opts_type_uint64() at opts-visitor.c: - Check for NULL (returns -EINVAL) - Check for negative numbers (returns -EINVAL) - Check for empty string (returns -EINVAL) - Check for overflow or other errno values set by strtoll() (returns -errno) - Check for end of string (reject invalid characters after number) (returns -EINVAL) parse_uint() does everything above except checking for the end of the string, so callers can continue parsing the remainder of string after the number. Unit tests included. [1] string-input-visitor.c:parse_int() could use the same parsing code used by opts-visitor.c:opts_type_int(), instead of duplicating that logic. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* block: Add special error code for wrong formatStefan Weil2013-01-251-0/+3
| | | | | | | | | | | The block drivers need a special error code for "wrong format". From the available error codes EMEDIUMTYPE fits best. It is not available on all platforms, so a definition in qemu-common.h and a specific error report are needed. Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* qemu-common.h: Make qemu_init_vcpu() stub static inlineAndreas Färber2013-01-081-1/+3
| | | | | | | | | | | | | Turn the *-user macro into a no-op inline function to avoid unused-variable warnings and band-aiding #ifdef'ery. This allows to drop an #ifdef for alpha and avoids more for unicore32 and other upcoming trivial realizefn implementations. Suggested-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
* iov: add qemu_iovec_concat_iov()Stefan Hajnoczi2013-01-021-0/+3
| | | | | | | | | | | | | The qemu_iovec_concat() function copies a subset of a QEMUIOVector. The new qemu_iovec_concat_iov() function does the same for a iov/cnt pair. It is easy to define qemu_iovec_concat() in terms of qemu_iovec_concat_iov(). The existing code is mostly unchanged, except for the assertion src->size >= soffset, which cannot be efficiently checked upfront on a iov/cnt pair. Instead we assert upon hitting the end of src with an unsatisfied soffset. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* janitor: move remaining public headers to include/Paolo Bonzini2012-12-191-0/+421
Headers in the root directory are now used only from within that directory. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
OpenPOWER on IntegriCloud