]> xenbits.xensource.com Git - xenclient/ioemu.git/commitdiff
Post-merge compilation fixes for stubdom
authorIan Jackson <ian.jackson@eu.citrix.com>
Wed, 18 Mar 2009 16:32:53 +0000 (16:32 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 18 Mar 2009 16:32:53 +0000 (16:32 +0000)
Much of this is very ugly.  Sadly that's a consequence of the stubdom
and upstream build systems and nothing much can be done about it.

However on the upside with this change we discontinue use of the
upstream `configure' script for stubdom (as it gives wrong answers),
in favour of a new xen-setup-stubdom script.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
16 files changed:
Makefile.target
block-raw-posix.c
block-vbd.c
block.c
i386-dm/exec-dm.c
migration-exec.c
migration-tcp.c
net.c
posix-aio-compat.c
qemu-sockets.c
qemu_socket.h
savevm.c
xen-config-host.h
xen-setup
xen-setup-stubdom [new file with mode: 0755]
xenstore.c

index 3cc3d3412f5e63d6d3caf83700665b0c7f105daf..d2023d515adec1a0f61105166a4fee8ab707e3e6 100644 (file)
@@ -135,8 +135,6 @@ default: all
 kvm.o: CFLAGS+=$(KVM_CFLAGS)
 kvm-all.o: CFLAGS+=$(KVM_CFLAGS)
 
-all: $(PROGS)
-
 #########################################################
 # cpu emulator library
 LIBOBJS=exec.o kqemu.o translate-all.o cpu-exec.o\
index f62b7878bee2cd1b2e4d559ea72c520bb7d08a7f..93bd2723a799ac34955cc1c712f5a33b60903faf 100644 (file)
@@ -26,6 +26,9 @@
 #include "qemu-char.h"
 #include "block_int.h"
 #include <assert.h>
+
+#ifndef CONFIG_STUBDOM
+
 #ifdef CONFIG_AIO
 #include "posix-aio-compat.h"
 #endif
@@ -1228,3 +1231,5 @@ BlockDriver bdrv_host_device = {
     /* generic scsi device */
     .bdrv_ioctl = raw_ioctl,
 };
+
+#endif CONFIG_STUBDOM
index 129a1f55c60f16401f1026b6069dab08f4e32ec1..8c15d65b6171de05fafb004b479561b97f41e190 100644 (file)
@@ -335,7 +335,7 @@ static int vbd_set_locked(BlockDriverState *bs, int locked)
     return -ENOTSUP;
 }
 
-BlockDriver bdrv_vbd = {
+BlockDriver bdrv_raw = {
     "vbd",
     sizeof(BDRVVbdState),
     vbd_probe,
diff --git a/block.c b/block.c
index a1906d0efcc9766adad50572abce30112795bfa3..f59ac6f49c866d670ae69b9021cbcf98ed1862ae 100644 (file)
--- a/block.c
+++ b/block.c
@@ -1568,9 +1568,8 @@ static BlockDriverAIOCB *bdrv_aio_flush_em(BlockDriverState *bs,
 void bdrv_init(void)
 {
     bdrv_register(&bdrv_raw);
+#ifndef CONFIG_STUBDOM
     bdrv_register(&bdrv_host_device);
-#ifdef CONFIG_STUBDOM
-    bdrv_register(&bdrv_vbd);
 #endif
 #ifndef _WIN32
     bdrv_register(&bdrv_cow);
index d035eb5c3b89a45679253757333df0f0fd916c8e..99a32b239bce8d8663365d6a9e0576efa8ea5919 100644 (file)
@@ -712,7 +712,7 @@ void cpu_physical_memory_write_rom(target_phys_addr_t addr,
 void qemu_register_coalesced_mmio(target_phys_addr_t addr, ram_addr_t size) { }
 void qemu_unregister_coalesced_mmio(target_phys_addr_t addr, ram_addr_t size) { }
 
-#if DIRECT_MMAP
+#ifdef DIRECT_MMAP
 void *cpu_physical_memory_map(target_phys_addr_t addr,
                               target_phys_addr_t *plen,
                               int is_write) {
index caeed4bbc0eee01493560206db136cd6b53a1575..220df0b4f0df4b62cfb2bf1d99134231cee7ebc3 100644 (file)
@@ -60,6 +60,11 @@ MigrationState *exec_start_outgoing_migration(const char *command,
     FdMigrationState *s;
     FILE *f;
 
+#ifdef CONFIG_STUBDOM
+    dprintf("stubdom migration? no popen!");
+    return 0;
+#else
+
     s = qemu_mallocz(sizeof(*s));
     if (s == NULL) {
         dprintf("Unable to allocate FdMigrationState\n");
@@ -111,6 +116,7 @@ err_after_alloc:
     qemu_free(s);
 err:
     return NULL;
+#endif /*!CONFIG_STUBDOM*/
 }
 
 int exec_start_incoming_migration(const char *command)
index 6fc1943d8bc2cbf550874a3dc774e8d5112602cf..d043c86b214dbd60aa521f61b44eb150e6edc543 100644 (file)
@@ -40,7 +40,7 @@ static int socket_write(FdMigrationState *s, const void * buf, size_t size)
     return send(s->fd, buf, size, 0);
 }
 
-static int tcp_close(FdMigrationState *s)
+static int tcp_close_qemu(FdMigrationState *s)
 {
     dprintf("tcp_close\n");
     if (s->fd != -1) {
@@ -94,7 +94,7 @@ MigrationState *tcp_start_outgoing_migration(const char *host_port,
 
     s->get_error = socket_errno;
     s->write = socket_write;
-    s->close = tcp_close;
+    s->close = tcp_close_qemu;
     s->mig_state.cancel = migrate_fd_cancel;
     s->mig_state.get_status = migrate_fd_get_status;
     s->mig_state.release = migrate_fd_release;
diff --git a/net.c b/net.c
index d7bf022eab9f31f1814742fcfddffad54ebd6133..78e2e651c2ba38ab2882dd97abf507d74b7717e5 100644 (file)
--- a/net.c
+++ b/net.c
@@ -674,6 +674,7 @@ typedef struct TAPState {
     char script_arg[1024];
 } TAPState;
 
+#ifndef CONFIG_STUBDOM
 #ifdef HAVE_IOVEC
 static ssize_t tap_receive_iov(void *opaque, const struct iovec *iov,
                                int iovcnt)
@@ -688,6 +689,7 @@ static ssize_t tap_receive_iov(void *opaque, const struct iovec *iov,
     return len;
 }
 #endif
+#endif /*!CONFIG_STUBDOM*/
 
 static void tap_receive(void *opaque, const uint8_t *buf, int size)
 {
@@ -738,8 +740,10 @@ static TAPState *net_tap_fd_init(VLANState *vlan,
     s->vc = qemu_new_vlan_client(vlan, model, name, tap_receive, NULL, s);
     s->next = head_net_tap;
     head_net_tap = s;
+#ifndef CONFIG_STUBDOM
 #ifdef HAVE_IOVEC
     s->vc->fd_readv = tap_receive_iov;
+#endif
 #endif
     qemu_set_fd_handler(s->fd, tap_send, NULL, s);
     snprintf(s->vc->info_str, sizeof(s->vc->info_str), "fd=%d", fd);
@@ -991,6 +995,10 @@ static int net_tap_init(VLANState *vlan, const char *model,
                         const char *setup_script, const char *down_script,
                         const char *script_arg)
 {
+#ifdef CONFIG_STUBDOM
+    errno = ENOSYS;
+    return -1;
+#else
     TAPState *s;
     int fd;
     char ifname[128];
@@ -1024,6 +1032,7 @@ static int net_tap_init(VLANState *vlan, const char *model,
     else
         s->script_arg[0] = '\0';
     return 0;
+#endif
 }
 
 #endif /* !_WIN32 */
index 771402dde13f3b6b0cabfb605fcb0118a1b1b2f0..c2310109d2ad20e8428825078cc8b15e7fdebb6c 100644 (file)
 #include <sys/time.h>
 #include "osdep.h"
 
+#include "qemu-common.h"
+
+#ifndef CONFIG_STUBDOM
+
 #include "posix-aio-compat.h"
 
 static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
@@ -201,3 +205,5 @@ int qemu_paio_cancel(int fd, struct qemu_paiocb *aiocb)
 
     return ret;
 }
+
+#endif CONFIG_STUBDOM
index c7db5ace615d7b3f8d85b23bec01569328d1153f..9b9fa772a254da64dc72e548b7e3970a81a53d46 100644 (file)
@@ -22,6 +22,8 @@
 #include "qemu_socket.h"
 #include "qemu-common.h" /* for qemu_isdigit */
 
+#ifndef CONFIG_STUBDOM
+
 #ifndef AI_ADDRCONFIG
 # define AI_ADDRCONFIG 0
 #endif
@@ -312,6 +314,23 @@ int inet_connect(const char *str, int socktype)
     return -1;
 }
 
+#else /*!CONFIG_STUBDOM*/
+
+int inet_listen(const char *str, char *ostr, int olen,
+                int socktype, int port_offset)
+{
+    fprintf(stderr, "ip sockets are not available on stubdom\n");
+    return -1;
+}
+
+int inet_connect(const char *str, int socktype)
+{
+    fprintf(stderr, "ip sockets are not available on stubdom\n");
+    return -1;
+}
+
+#endif /*!CONFIG_STUBDOM*/
+
 #ifndef NO_UNIX_SOCKETS
 
 int unix_listen(const char *str, char *ostr, int olen)
index 03f895b7f3b609d849324f10a6aa09232d9df0a9..7a2dc9cbd9b5dc5d3f4c24802ec53421a6213952 100644 (file)
@@ -2,6 +2,8 @@
 #ifndef QEMU_SOCKET_H
 #define QEMU_SOCKET_H
 
+#include "config-host.h"
+
 #ifdef _WIN32
 #define WIN32_LEAN_AND_MEAN
 #define WINVER 0x0501  /* needed for ipv6 bits */
index 3dc887d2c2dd392a06bce3e8aa05163586c73cad..ae880d336409f8b3792f8b241127372f8eab5466 100644 (file)
--- a/savevm.c
+++ b/savevm.c
@@ -208,6 +208,11 @@ QEMUFile *qemu_popen(FILE *popen_file, const char *mode)
 {
     QEMUFilePopen *s;
 
+#ifdef CONFIG_STUBDOM
+    errno = ENOSYS;
+    return NULL;
+#else
+
     if (popen_file == NULL || mode == NULL || (mode[0] != 'r' && mode[0] != 'w') || mode[1] != 0) {
         fprintf(stderr, "qemu_popen: Argument validity check failed\n");
         return NULL;
@@ -228,18 +233,26 @@ QEMUFile *qemu_popen(FILE *popen_file, const char *mode)
     }
     fprintf(stderr, "qemu_popen: returning result of qemu_fopen_ops\n");
     return s->file;
+
+#endif /*!CONFIG_STUBDOM*/
 }
 
 QEMUFile *qemu_popen_cmd(const char *command, const char *mode)
 {
     FILE *popen_file;
 
+#ifdef CONFIG_STUBDOM
+    errno = ENOSYS;
+    return NULL;
+#else
+
     popen_file = popen(command, mode);
     if(popen_file == NULL) {
         return NULL;
     }
 
     return qemu_popen(popen_file, mode);
+#endif /*!CONFIG_STUBDOM*/
 }
 
 QEMUFile *qemu_fopen_socket(int fd)
index 5fd4577eda39dac990a6d2f6586811c3ea8c9dd2..3a3d7a48b3051eaecf352c9d36e3ef9fa071399e 100644 (file)
@@ -1,8 +1,7 @@
 #ifndef XEN_CONFIG_HOST_H
 #define XEN_CONFIG_HOST_H
 
-#ifdef __MINIOS__
-#define CONFIG_STUBDOM
+#ifdef CONFIG_STUBDOM
 #undef CONFIG_AIO
 #define NO_UNIX_SOCKETS 1
 #define NO_BLUETOOTH_PASSTHROUGH 1
@@ -36,7 +35,7 @@ extern int vcpus;
 #define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/xen/qemu-ifdown"
 
 #ifdef CONFIG_STUBDOM
-extern struct BlockDriver bdrv_vbd;
+#define bdrv_host_device bdrv_raw
 #endif
 struct CharDriverState;
 void xenstore_store_serial_port_info(int i, struct CharDriverState *chr,
@@ -45,4 +44,8 @@ void xenstore_store_serial_port_info(int i, struct CharDriverState *chr,
 extern unsigned long *logdirty_bitmap;
 extern unsigned long logdirty_bitmap_size;
 
+#ifdef CONFIG_STUBDOM
+#undef HAVE_IOVEC
+#endif
+
 #endif /*XEN_CONFIG_HOST_H*/
index ebfad96650ed519816de823e0f567ce87bd6815b..8ca00199c326fe15fd0dc0f4af28c555fa2a687d 100755 (executable)
--- a/xen-setup
+++ b/xen-setup
@@ -11,14 +11,7 @@ if test -f config-host.h; then mv config-host.h config-host.h~; fi
 
 ./configure --disable-gfx-check --disable-curses --disable-slirp "$@" --prefix=/usr
 
-if [ -n "$CONFIG_STUBDOM" ]
-then
-        target=i386-stubdom
-        ln -sf ../i386-dm/hookslib.mak $target/
-        (cd $target ; ln -sf ../i386-dm/*.[ch] .)
-else
-        target=i386-dm
-fi
+target=i386-dm
 
 if [ "x$XEN_ROOT" != x ]; then
        echo "XEN_ROOT=$XEN_ROOT" >>config-host.mak
diff --git a/xen-setup-stubdom b/xen-setup-stubdom
new file mode 100755 (executable)
index 0000000..a3cc5f9
--- /dev/null
@@ -0,0 +1,97 @@
+#!/bin/sh
+set -e
+
+qemu_version=`head VERSION`
+
+ln -sf ../Makefile.target i386-stubdom/Makefile
+
+target=i386-stubdom
+
+#----------
+cat <<END >$target/config.mak.new
+QEMU_ROOT ?= ..
+XEN_ROOT ?= \$(QEMU_ROOT)/../xen-unstable.hg
+
+include ../config-host.mak
+
+TARGET_ARCH=i386
+CONFIG_SOFTMMU=yes
+
+TARGET_CPPFLAGS += $TARGET_CPPFLAGS -DCONFIG_STUBDOM -D__XEN_TOOLS__
+TARGET_CFLAGS= $TARGET_CFLAGS
+TARGET_LDFLAGS= $TARGET_LDFLAGS
+
+bindir = \${prefix}/\${LIBLEAFDIR}/xen/bin
+END
+mv -f $target/config.mak.new $target/config.mak
+#----------
+
+ln -sf ../i386-dm/hookslib.mak $target/
+(cd $target ; ln -sf ../i386-dm/*.[ch] .)
+
+#----------
+cat <<END >config-host.h.new
+#define CONFIG_QEMU_SHAREDIR "/usr/share/xen/qemu"
+#define HOST_I386 1
+#define HOST_LONG_BITS 32
+#define HAVE_BYTESWAP_H 1
+#define AUDIO_DRIVERS /* none */
+#define QEMU_VERSION "$qemu_version"
+#define CONFIG_UNAME_RELEASE ""
+#include "xen-config-host.h"
+END
+mv -f config-host.h.new config-host.h
+#----------
+
+#----------
+cat <<END >config-host.mak.new
+CONFIG_STUBDOM=yes
+prefix=/usr
+bindir=\${prefix}/bin
+mandir=\${prefix}/share/man
+datadir=\${prefix}/share/qemu
+docdir=\${prefix}/share/doc/qemu
+MAKE=make
+INSTALL=install
+CC=gcc
+HOST_CC=gcc
+AR=ar
+STRIP=strip -s -R .comment -R .note
+OS_CFLAGS=
+OS_LDFLAGS=
+ARCH_CFLAGS=-m32
+ARCH_LDFLAGS=-m32
+EXESUF=
+AIOLIBS=
+ARCH=i386
+CONFIG_GDBSTUB=no
+CONFIG_OSS=no
+CONFIG_OSS_LIB=
+VERSION=$qemu_version
+SRC_PATH=`pwd`
+TARGET_DIRS=$target
+BUILD_DOCS=no
+CONFIG_AIO=no
+TOOLS=
+XEN_ROOT=/volatile/iwj/builds/work/2/build/xen-unstable.hg/
+QEMU_ROOT ?= `pwd`
+XEN_ROOT ?= \$(QEMU_ROOT)/../xen-unstable.hg
+include \$(XEN_ROOT)/tools/Rules.mk
+SUBDIR_RULES=subdir-\$(TARGET_DIRS)
+subdir-\$(TARGET_DIRS): libqemu_common.a
+-include \$(QEMU_ROOT)/xen-hooks.mak
+HOST_USB=stub
+
+HOST_LDFLAGS= \$(LDFLAGS) -g -Wl,--warn-common
+HOST_CFLAGS= \$(CFLAGS)
+CPPFLAGS += $TARGET_CPPFLAGS -DCONFIG_STUBDOM
+CFLAGS= $TARGET_CFLAGS
+LDFLAGS= $TARGET_LDFLAGS
+
+SUBDIR_RULES=subdir-$(TARGET_DIRS)
+subdir-\$(TARGET_DIRS): libqemu_common.a
+-include \$(QEMU_ROOT)/xen-hooks.mak
+
+END
+mv -f config-host.mak.new config-host.mak
+#----------
index 4ee6cebb16f1d895c623945a5892284ac5d5c3a7..92ee1e21ff2d644d6f2800f16134b931e46e80e9 100644 (file)
@@ -474,7 +474,7 @@ void xenstore_parse_domain_config(int hvm_domid)
 #ifdef CONFIG_STUBDOM
         if (pasprintf(&danger_buf, "%s/device/vbd/%s", danger_path, e_danger[i]) == -1)
             continue;
-       if (bdrv_open2(bs, danger_buf, BDRV_O_CACHE_WB /* snapshot and write-back */, &bdrv_vbd) == 0) {
+       if (bdrv_open2(bs, danger_buf, BDRV_O_CACHE_WB /* snapshot and write-back */, &bdrv_raw) == 0) {
            pstrcpy(bs->filename, sizeof(bs->filename), params);
        } else
 #endif