From: Ian Jackson Date: Thu, 11 Sep 2008 15:51:06 +0000 (+0100) Subject: Fixes to source files to compile as a stubdomain X-Git-Tag: t.master-before-merge~92 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=9567131d4b36d951129d8d3604d2de25ddd83db3;p=qemu-xen-4.3-testing.git Fixes to source files to compile as a stubdomain Various fixes to some source files to compile as a stubdomain. (Most of these changes were originally written by Samuel for an older version of qemu-remote. Patch to exec-all.h dropped in this checkin by iwj.) Signed-off-by: Stefano Stabellini --- diff --git a/block-vbd.c b/block-vbd.c index 10f7a21f5..9c74952d1 100644 --- a/block-vbd.c +++ b/block-vbd.c @@ -22,7 +22,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -#include "vl.h" +#include "qemu-common.h" +#include "audio/sys-queue.h" #include "block_int.h" #include #include diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index 3f7816663..e3d8069be 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -36,7 +36,7 @@ do { fprintf(stderr, "scsi-disk: " fmt , ##args); } while (0) #ifdef CONFIG_STUBDOM #include -#define SCSI_DMA_BUF_SIZE (BLKIF_MAX_SEGMENTS_PER_REQUEST * TARGET_PAGE_SIZE) +#define SCSI_DMA_BUF_SIZE ((BLKIF_MAX_SEGMENTS_PER_REQUEST - 1) * PAGE_SIZE) #else #define SCSI_DMA_BUF_SIZE 131072 #endif diff --git a/hw/vga.c b/hw/vga.c index 9e0dea821..65c710a15 100644 --- a/hw/vga.c +++ b/hw/vga.c @@ -27,6 +27,9 @@ #include "pci.h" #include "vga_int.h" #include +#include "sysemu.h" +#include "qemu-xen.h" +#include "exec-all.h" //#define DEBUG_VGA //#define DEBUG_VGA_MEM diff --git a/i386-dm/exec-dm.c b/i386-dm/exec-dm.c index d511021c4..dec4aa8b2 100644 --- a/i386-dm/exec-dm.c +++ b/i386-dm/exec-dm.c @@ -574,8 +574,8 @@ void cpu_physical_memory_rw(target_phys_addr_t _addr, uint8_t *buf, #ifdef CONFIG_STUBDOM if (logdirty_bitmap != NULL) xc_hvm_modified_memory(xc_handle, domid, _addr >> TARGET_PAGE_BITS, - (_addr + _len + TARGET_PAGE_SIZE - 1) >> TARGET_PAGE_BITS - - _addr >> TARGET_PAGE_BITS); + ((_addr + _len + TARGET_PAGE_SIZE - 1) >> TARGET_PAGE_BITS) + - (_addr >> TARGET_PAGE_BITS)); #endif mapcache_unlock(); diff --git a/vl.c b/vl.c index 3f14553ba..e215af709 100644 --- a/vl.c +++ b/vl.c @@ -38,6 +38,7 @@ #include "qemu-char.h" #include "block.h" #include "audio/audio.h" +#include "qemu-xen.h" #include #include @@ -114,6 +115,7 @@ int inet_aton(const char *cp, struct in_addr *ia); #include #define getopt_long_only getopt_long #define memalign(align, size) malloc(size) +#define NO_UNIX_SOCKETS 1 #endif #include "qemu_socket.h" @@ -3104,7 +3106,7 @@ static void udp_chr_update_read_handler(CharDriverState *chr) } int parse_host_port(struct sockaddr_in *saddr, const char *str); -#ifndef _WIN32 +#ifndef NO_UNIX_SOCKETS static int parse_unix_path(struct sockaddr_un *uaddr, const char *str); #endif int parse_host_src_port(struct sockaddr_in *haddr, @@ -3312,7 +3314,7 @@ static void tcp_chr_accept(void *opaque) CharDriverState *chr = opaque; TCPCharDriver *s = chr->opaque; struct sockaddr_in saddr; -#ifndef _WIN32 +#ifndef NO_UNIX_SOCKETS struct sockaddr_un uaddr; #endif struct sockaddr *addr; @@ -3320,7 +3322,7 @@ static void tcp_chr_accept(void *opaque) int fd; for(;;) { -#ifndef _WIN32 +#ifndef NO_UNIX_SOCKETS if (s->is_unix) { len = sizeof(uaddr); addr = (struct sockaddr *)&uaddr; @@ -3369,13 +3371,13 @@ static CharDriverState *qemu_chr_open_tcp(const char *host_str, int do_nodelay = 0; const char *ptr; struct sockaddr_in saddr; -#ifndef _WIN32 +#ifndef NO_UNIX_SOCKETS struct sockaddr_un uaddr; #endif struct sockaddr *addr; socklen_t addrlen; -#ifndef _WIN32 +#ifndef NO_UNIX_SOCKETS if (is_unix) { addr = (struct sockaddr *)&uaddr; addrlen = sizeof(uaddr); @@ -3414,7 +3416,7 @@ static CharDriverState *qemu_chr_open_tcp(const char *host_str, if (!s) goto fail; -#ifndef _WIN32 +#ifndef NO_UNIX_SOCKETS if (is_unix) fd = socket(PF_UNIX, SOCK_STREAM, 0); else @@ -3439,7 +3441,7 @@ static CharDriverState *qemu_chr_open_tcp(const char *host_str, if (is_listen) { /* allow fast reuse */ -#ifndef _WIN32 +#ifndef NO_UNIX_SOCKETS if (is_unix) { char path[109]; strncpy(path, uaddr.sun_path, 108); @@ -4270,7 +4272,7 @@ static int tap_open(char *ifname, int ifname_size) fcntl(fd, F_SETFL, O_NONBLOCK); return fd; } -#else +#elif defined(__linux__) static int tap_open(char *ifname, int ifname_size) { struct ifreq ifr; @@ -8699,7 +8701,17 @@ int main(int argc, char **argv) bdrv_init(); xc_handle = xc_interface_open(); +#ifdef CONFIG_STUBDOM + { + char *domid_s, *msg; + if ((msg = xenbus_read(XBT_NIL, "domid", &domid_s))) + fprintf(stderr,"Can not read our own domid: %s\n", msg); + else + xenstore_parse_domain_config(atoi(domid_s)); + } +#else xenstore_parse_domain_config(domid); +#endif /* CONFIG_STUBDOM */ /* we always create the cdrom drive, even if no disk is there */ @@ -8729,6 +8741,10 @@ int main(int argc, char **argv) /* terminal init */ memset(&display_state, 0, sizeof(display_state)); +#ifdef CONFIG_STUBDOM + if (xenfb_pv_display_init(ds) == 0) { + } else +#endif if (nographic) { if (curses) { fprintf(stderr, "fatal: -nographic can't be used with -curses\n"); diff --git a/xen-vl-extra.c b/xen-vl-extra.c index 4baada2b3..8c3dc6b31 100644 --- a/xen-vl-extra.c +++ b/xen-vl-extra.c @@ -88,3 +88,20 @@ void do_loadvm(const char *name) struct qemu_alarm_timer; static int unix_start_timer(struct qemu_alarm_timer *t) { return 0; } static void unix_stop_timer(struct qemu_alarm_timer *t) { } + +#ifdef CONFIG_STUBDOM +#include +static int tap_open(char *ifname, int ifname_size) +{ + char nodename[64]; + static int num = 1; // 0 is for our own TCP/IP networking + snprintf(nodename, sizeof(nodename), "device/vif/%d", num++); + return netfront_tap_open(nodename); +} + +#undef DEFAULT_NETWORK_SCRIPT +#define DEFAULT_NETWORK_SCRIPT "" +#undef DEFAULT_NETWORK_DOWN_SCRIPT +#define DEFAULT_NETWORK_DOWN_SCRIPT "" +#endif + diff --git a/xenfbfront.c b/xenfbfront.c index 16691fdde..3a67ada9a 100644 --- a/xenfbfront.c +++ b/xenfbfront.c @@ -4,11 +4,12 @@ #include #include #include +#include +#include +#include #include -#include "vl.h" - typedef struct XenFBState { struct semaphore kbd_sem; struct kbdfront_dev *kbd_dev; @@ -70,6 +71,7 @@ static void xenfb_pv_resize_shared(DisplayState *ds, int w, int h, int depth, in if (ds->shared_buf) { offset = pixels - xs->vga_vram; ds->data = pixels; + fbfront_resize(fb_dev, ds->width, ds->height, ds->linesize, ds->depth, offset); } else { ds->data = xs->nonshared_vram; fbfront_resize(fb_dev, w, h, linesize, ds->depth, VGA_RAM_SIZE); diff --git a/xenstore.c b/xenstore.c index c0fe95a50..99792c421 100644 --- a/xenstore.c +++ b/xenstore.c @@ -305,8 +305,7 @@ void xenstore_parse_domain_config(int hvm_domid) continue; if (bdrv_open2(bs, buf, 0 /* snapshot */, &bdrv_vbd) == 0) { pstrcpy(bs->filename, sizeof(bs->filename), params); - continue; - } + } else #endif if (params[0]) {