aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Turner <digit@android.com>2010-09-10 10:42:32 +0200
committerDavid 'Digit' Turner <digit@android.com>2010-09-13 00:30:34 -0700
commitd06599430ac907d1a89bbfda4bf3621f909aac8e (patch)
tree196c05a749a555b4b42b29622a7fa23913fa72d0
parenta25351325187eb8eff8b9b090acd8f2d7684c6ff (diff)
downloadexternal_qemu-d06599430ac907d1a89bbfda4bf3621f909aac8e.zip
external_qemu-d06599430ac907d1a89bbfda4bf3621f909aac8e.tar.gz
external_qemu-d06599430ac907d1a89bbfda4bf3621f909aac8e.tar.bz2
upstream: qemu-common.h updates.
-rw-r--r--block/raw-posix-aio.h43
-rw-r--r--net.h1
-rw-r--r--qemu-common.h70
-rw-r--r--sysemu.h9
-rw-r--r--vl-android.c2
-rw-r--r--vl.c2
6 files changed, 112 insertions, 15 deletions
diff --git a/block/raw-posix-aio.h b/block/raw-posix-aio.h
new file mode 100644
index 0000000..dfc63b8
--- /dev/null
+++ b/block/raw-posix-aio.h
@@ -0,0 +1,43 @@
+/*
+ * QEMU Posix block I/O backend AIO support
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ *
+ */
+#ifndef QEMU_RAW_POSIX_AIO_H
+#define QEMU_RAW_POSIX_AIO_H
+
+/* AIO request types */
+#define QEMU_AIO_READ 0x0001
+#define QEMU_AIO_WRITE 0x0002
+#define QEMU_AIO_IOCTL 0x0004
+#define QEMU_AIO_FLUSH 0x0008
+#define QEMU_AIO_TYPE_MASK \
+ (QEMU_AIO_READ|QEMU_AIO_WRITE|QEMU_AIO_IOCTL|QEMU_AIO_FLUSH)
+
+/* AIO flags */
+#define QEMU_AIO_MISALIGNED 0x1000
+
+
+/* posix-aio-compat.c - thread pool based implementation */
+int paio_init(void);
+BlockDriverAIOCB *paio_submit(BlockDriverState *bs, int fd,
+ int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
+ BlockDriverCompletionFunc *cb, void *opaque, int type);
+BlockDriverAIOCB *paio_ioctl(BlockDriverState *bs, int fd,
+ unsigned long int req, void *buf,
+ BlockDriverCompletionFunc *cb, void *opaque);
+
+/* linux-aio.c - Linux native implementation */
+void *laio_init(void);
+BlockDriverAIOCB *laio_submit(BlockDriverState *bs, void *aio_ctx, int fd,
+ int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
+ BlockDriverCompletionFunc *cb, void *opaque, int type);
+
+#endif /* QEMU_RAW_POSIX_AIO_H */
diff --git a/net.h b/net.h
index 89e7706..ad17fdf 100644
--- a/net.h
+++ b/net.h
@@ -5,7 +5,6 @@
/* VLANs support */
-typedef struct VLANClientState VLANClientState;
typedef int (NetCanReceive)(VLANClientState *);
typedef ssize_t (NetReceive)(VLANClientState *, const uint8_t *, size_t);
diff --git a/qemu-common.h b/qemu-common.h
index 7b511ff..366c002 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -46,10 +46,15 @@ typedef struct DeviceState DeviceState;
#ifndef O_BINARY
#define O_BINARY 0
#endif
-
+#ifndef MAP_ANONYMOUS
+#define MAP_ANONYMOUS MAP_ANON
+#endif
#ifndef ENOMEDIUM
#define ENOMEDIUM ENODEV
#endif
+#if !defined(ENOTSUP)
+#define ENOTSUP 4096
+#endif
#ifndef CONFIG_IOVEC
#define CONFIG_IOVEC
@@ -57,20 +62,20 @@ struct iovec {
void *iov_base;
size_t iov_len;
};
+/*
+ * Use the same value as Linux for now.
+ */
+#define IOV_MAX 1024
#else
#include <sys/uio.h>
#endif
#ifdef _WIN32
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
#define fsync _commit
#define lseek _lseeki64
-#define ENOTSUP 4096
extern int qemu_ftruncate64(int, int64_t);
#define ftruncate qemu_ftruncate64
-
static inline char *realpath(const char *path, char *resolved_path)
{
_fullpath(resolved_path, path, _MAX_PATH);
@@ -99,6 +104,10 @@ static inline char *realpath(const char *path, char *resolved_path)
/* bottom halves */
typedef void QEMUBHFunc(void *opaque);
+void async_context_push(void);
+void async_context_pop(void);
+int get_async_context_id(void);
+
QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque);
void qemu_bh_schedule(QEMUBH *bh);
/* Bottom halfs that are scheduled from a bottom half handler are instantly
@@ -111,6 +120,7 @@ void qemu_bh_schedule_idle(QEMUBH *bh);
void qemu_bh_cancel(QEMUBH *bh);
void qemu_bh_delete(QEMUBH *bh);
int qemu_bh_poll(void);
+void qemu_bh_update_timeout(int *timeout);
uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c);
@@ -151,6 +161,19 @@ void qemu_free(void *ptr);
char *qemu_strdup(const char *str);
char *qemu_strndup(const char *str, size_t size);
+void qemu_mutex_lock_iothread(void);
+void qemu_mutex_unlock_iothread(void);
+
+int qemu_open(const char *name, int flags, ...);
+ssize_t qemu_write_full(int fd, const void *buf, size_t count)
+ QEMU_WARN_UNUSED_RESULT;
+void qemu_set_cloexec(int fd);
+
+#ifndef _WIN32
+int qemu_eventfd(int pipefd[2]);
+int qemu_pipe(int pipefd[2]);
+#endif
+
void *get_mmap_addr(unsigned long size);
@@ -177,6 +200,7 @@ typedef struct NICInfo NICInfo;
typedef struct HCIInfo HCIInfo;
typedef struct AudioState AudioState;
typedef struct BlockDriverState BlockDriverState;
+typedef struct DriveInfo DriveInfo;
typedef struct DisplayState DisplayState;
typedef struct DisplayChangeListener DisplayChangeListener;
typedef struct DisplaySurface DisplaySurface;
@@ -185,10 +209,14 @@ typedef struct PixelFormat PixelFormat;
typedef struct TextConsole TextConsole;
typedef TextConsole QEMUConsole;
typedef struct CharDriverState CharDriverState;
+typedef struct MACAddr MACAddr;
typedef struct VLANState VLANState;
+typedef struct VLANClientState VLANClientState;
typedef struct i2c_bus i2c_bus;
typedef struct i2c_slave i2c_slave;
typedef struct SMBusDevice SMBusDevice;
+typedef struct PCIHostState PCIHostState;
+typedef struct PCIExpressHost PCIExpressHost;
typedef struct PCIBus PCIBus;
typedef struct PCIDevice PCIDevice;
typedef struct SerialState SerialState;
@@ -198,6 +226,18 @@ typedef struct MouseTransformInfo MouseTransformInfo;
typedef struct uWireSlave uWireSlave;
typedef struct I2SCodec I2SCodec;
typedef struct SSIBus SSIBus;
+typedef struct EventNotifier EventNotifier;
+typedef struct VirtIODevice VirtIODevice;
+
+typedef uint64_t pcibus_t;
+
+typedef enum {
+ IF_NONE,
+ IF_IDE, IF_SCSI, IF_FLOPPY, IF_PFLASH, IF_MTD, IF_SD, IF_VIRTIO, IF_XEN,
+ IF_COUNT
+} BlockInterfaceType;
+
+void cpu_exec_init_all(unsigned long tb_size);
/* CPU save/load. */
void cpu_save(QEMUFile *f, void *opaque);
@@ -213,6 +253,14 @@ void qemu_notify_event(void);
void qemu_cpu_kick(void *env);
int qemu_cpu_self(void *env);
+/* work queue */
+struct qemu_work_item {
+ struct qemu_work_item *next;
+ void (*func)(void *data);
+ void *data;
+ int done;
+};
+
#ifdef CONFIG_USER_ONLY
#define qemu_init_vcpu(env) do { } while (0)
#else
@@ -229,6 +277,7 @@ typedef struct QEMUIOVector {
void qemu_iovec_init(QEMUIOVector *qiov, int alloc_hint);
void qemu_iovec_init_external(QEMUIOVector *qiov, struct iovec *iov, int niov);
void qemu_iovec_add(QEMUIOVector *qiov, void *base, size_t len);
+void qemu_iovec_concat(QEMUIOVector *dst, QEMUIOVector *src, size_t size);
void qemu_iovec_destroy(QEMUIOVector *qiov);
void qemu_iovec_reset(QEMUIOVector *qiov);
void qemu_iovec_to_buffer(QEMUIOVector *qiov, void *buf);
@@ -237,6 +286,17 @@ void qemu_iovec_from_buffer(QEMUIOVector *qiov, const void *buf, size_t count);
struct Monitor;
typedef struct Monitor Monitor;
+/* Convert a byte between binary and BCD. */
+static inline uint8_t to_bcd(uint8_t val)
+{
+ return ((val / 10) << 4) | (val % 10);
+}
+
+static inline uint8_t from_bcd(uint8_t val)
+{
+ return ((val >> 4) * 10) + (val & 0x0f);
+}
+
#include "module.h"
#endif /* dyngen-exec.h hack */
diff --git a/sysemu.h b/sysemu.h
index adccb93..0d332c1 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -162,16 +162,11 @@ extern unsigned int nb_prom_envs;
#endif
typedef enum {
- IF_IDE, IF_SCSI, IF_FLOPPY, IF_PFLASH, IF_MTD, IF_SD, IF_VIRTIO, IF_XEN,
- IF_COUNT
-} BlockInterfaceType;
-
-typedef enum {
BLOCK_ERR_REPORT, BLOCK_ERR_IGNORE, BLOCK_ERR_STOP_ENOSPC,
BLOCK_ERR_STOP_ANY
} BlockInterfaceErrorAction;
-typedef struct DriveInfo {
+struct DriveInfo {
BlockDriverState *bdrv;
BlockInterfaceType type;
int bus;
@@ -180,7 +175,7 @@ typedef struct DriveInfo {
int drive_opt_idx;
BlockInterfaceErrorAction onerror;
char serial[21];
-} DriveInfo;
+};
#define MAX_IDE_DEVS 2
#define MAX_SCSI_DEVS 7
diff --git a/vl-android.c b/vl-android.c
index 4c81d55..291591b 100644
--- a/vl-android.c
+++ b/vl-android.c
@@ -2454,7 +2454,7 @@ void qemu_bh_delete(QEMUBH *bh)
bh->deleted = 1;
}
-static void qemu_bh_update_timeout(int *timeout)
+void qemu_bh_update_timeout(int *timeout)
{
QEMUBH *bh;
diff --git a/vl.c b/vl.c
index 3ad20e0..f86bf3c 100644
--- a/vl.c
+++ b/vl.c
@@ -2439,7 +2439,7 @@ void qemu_bh_delete(QEMUBH *bh)
bh->deleted = 1;
}
-static void qemu_bh_update_timeout(int *timeout)
+void qemu_bh_update_timeout(int *timeout)
{
QEMUBH *bh;