diff options
author | Veronia Bahaa <veroniabahaa@gmail.com> | 2016-03-20 19:16:19 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2016-03-22 22:20:17 +0100 |
commit | f348b6d1a53e5271cf1c9f9acc4646b4b98c1771 (patch) | |
tree | 2eb2da02e51400b1b1ecae295e32a81c7a889ab1 /util | |
parent | 73bcb24d932912f8e75e1d88da0fc0ac6d4bce78 (diff) |
util: move declarations out of qemu-common.h
Move declarations out of qemu-common.h for functions declared in
utils/ files: e.g. include/qemu/path.h for utils/path.c.
Move inline functions out of qemu-common.h and into new files (e.g.
include/qemu/bcd.h)
Signed-off-by: Veronia Bahaa <veroniabahaa@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'util')
-rw-r--r-- | util/cutils.c | 33 | ||||
-rw-r--r-- | util/event_notifier-posix.c | 1 | ||||
-rw-r--r-- | util/id.c | 1 | ||||
-rw-r--r-- | util/iov.c | 1 | ||||
-rw-r--r-- | util/osdep.c | 1 | ||||
-rw-r--r-- | util/oslib-posix.c | 1 | ||||
-rw-r--r-- | util/oslib-win32.c | 1 | ||||
-rw-r--r-- | util/path.c | 2 | ||||
-rw-r--r-- | util/qemu-option.c | 3 | ||||
-rw-r--r-- | util/qemu-sockets.c | 1 | ||||
-rw-r--r-- | util/readline.c | 1 | ||||
-rw-r--r-- | util/unicode.c | 2 |
12 files changed, 47 insertions, 1 deletions
diff --git a/util/cutils.c b/util/cutils.c index c3dd53453a..43d1afbbec 100644 --- a/util/cutils.c +++ b/util/cutils.c @@ -29,6 +29,7 @@ #include "qemu/sockets.h" #include "qemu/iov.h" #include "net/net.h" +#include "qemu/cutils.h" void strpadcpy(char *buf, int buf_size, const char *str, char pad) { @@ -160,6 +161,38 @@ int qemu_fdatasync(int fd) #endif } +/* vector definitions */ +#ifdef __ALTIVEC__ +#include <altivec.h> +/* The altivec.h header says we're allowed to undef these for + * C++ compatibility. Here we don't care about C++, but we + * undef them anyway to avoid namespace pollution. + */ +#undef vector +#undef pixel +#undef bool +#define VECTYPE __vector unsigned char +#define SPLAT(p) vec_splat(vec_ld(0, p), 0) +#define ALL_EQ(v1, v2) vec_all_eq(v1, v2) +#define VEC_OR(v1, v2) ((v1) | (v2)) +/* altivec.h may redefine the bool macro as vector type. + * Reset it to POSIX semantics. */ +#define bool _Bool +#elif defined __SSE2__ +#include <emmintrin.h> +#define VECTYPE __m128i +#define SPLAT(p) _mm_set1_epi8(*(p)) +#define ALL_EQ(v1, v2) (_mm_movemask_epi8(_mm_cmpeq_epi8(v1, v2)) == 0xFFFF) +#define VEC_OR(v1, v2) (_mm_or_si128(v1, v2)) +#else +#define VECTYPE unsigned long +#define SPLAT(p) (*(p) * (~0UL / 255)) +#define ALL_EQ(v1, v2) ((v1) == (v2)) +#define VEC_OR(v1, v2) ((v1) | (v2)) +#endif + +#define BUFFER_FIND_NONZERO_OFFSET_UNROLL_FACTOR 8 + static bool can_use_buffer_find_nonzero_offset_inner(const void *buf, size_t len) { diff --git a/util/event_notifier-posix.c b/util/event_notifier-posix.c index 2e30e74bd6..b00189a754 100644 --- a/util/event_notifier-posix.c +++ b/util/event_notifier-posix.c @@ -12,6 +12,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" +#include "qemu/cutils.h" #include "qemu/event_notifier.h" #include "sysemu/char.h" #include "qemu/main-loop.h" @@ -12,6 +12,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" +#include "qemu/id.h" bool id_wellformed(const char *id) { diff --git a/util/iov.c b/util/iov.c index b69e4b7534..003fcce66f 100644 --- a/util/iov.c +++ b/util/iov.c @@ -20,6 +20,7 @@ #include "qemu-common.h" #include "qemu/iov.h" #include "qemu/sockets.h" +#include "qemu/cutils.h" size_t iov_from_buf_full(const struct iovec *iov, unsigned int iov_cnt, size_t offset, const void *buf, size_t bytes) diff --git a/util/osdep.c b/util/osdep.c index 8356bdd3d8..d56d071111 100644 --- a/util/osdep.c +++ b/util/osdep.c @@ -37,6 +37,7 @@ extern int madvise(caddr_t, size_t, int); #endif #include "qemu-common.h" +#include "qemu/cutils.h" #include "qemu/sockets.h" #include "qemu/error-report.h" #include "monitor/monitor.h" diff --git a/util/oslib-posix.c b/util/oslib-posix.c index dcc3c7ea01..09082564c4 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -52,6 +52,7 @@ #include <libgen.h> #include <setjmp.h> #include <sys/signal.h> +#include "qemu/cutils.h" #ifdef CONFIG_LINUX #include <sys/syscall.h> diff --git a/util/oslib-win32.c b/util/oslib-win32.c index 4ef4a9a13b..c926db4a5c 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -37,6 +37,7 @@ #include "qemu/main-loop.h" #include "trace.h" #include "qemu/sockets.h" +#include "qemu/cutils.h" /* this must come after including "trace.h" */ #include <shlobj.h> diff --git a/util/path.c b/util/path.c index d09e8c5e14..5479f76c6d 100644 --- a/util/path.c +++ b/util/path.c @@ -7,6 +7,8 @@ #include <sys/param.h> #include <dirent.h> #include "qemu-common.h" +#include "qemu/cutils.h" +#include "qemu/path.h" struct pathelem { diff --git a/util/qemu-option.c b/util/qemu-option.c index 98967ffde9..dd9e73df54 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -31,6 +31,9 @@ #include "qapi/qmp/types.h" #include "qapi/qmp/qerror.h" #include "qemu/option_int.h" +#include "qemu/cutils.h" +#include "qemu/id.h" +#include "qemu/help_option.h" /* * Extracts the name of an option from the parameter string (p points at the diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index 6f344d4405..b87e17fa56 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -24,6 +24,7 @@ #include "qapi/qmp-input-visitor.h" #include "qapi/qmp-output-visitor.h" #include "qapi-visit.h" +#include "qemu/cutils.h" #ifndef AI_ADDRCONFIG # define AI_ADDRCONFIG 0 diff --git a/util/readline.c b/util/readline.c index e94c97521b..bbdee790b0 100644 --- a/util/readline.c +++ b/util/readline.c @@ -25,6 +25,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qemu/readline.h" +#include "qemu/cutils.h" #define IS_NORM 0 #define IS_ESC 1 diff --git a/util/unicode.c b/util/unicode.c index 524dca8c7c..a812a35171 100644 --- a/util/unicode.c +++ b/util/unicode.c @@ -11,7 +11,7 @@ */ #include "qemu/osdep.h" -#include "qemu-common.h" +#include "qemu/unicode.h" /** * mod_utf8_codepoint: |