[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] mini-os: make frontends and xenbus optional



# HG changeset patch
# User Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
# Date 1328812412 0
# Node ID 585caf50a9260d3fc6a4ece0450d10d34e73489f
# Parent  86dca025cc2dbc74a7a0e71f3dd2aef747752dda
mini-os: make frontends and xenbus optional

This adds compile-time logic to disable certain frontends in mini-os:
 - pcifront is disabled by default, enabled for ioemu
 - blkfront, netfront, fbfront, kbdfront, consfront are enabled by default
 - xenbus is required for any frontend, and is enabled by default

If all frontends and xenbus are disabled, mini-os will run without
needing to communicate with xenstore, making it suitable to run the
xenstore daemon. The console frontend is not required for the initial
console, only consoles opened via openpt or ptmx.

Signed-off-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Cc: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---


diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/Makefile
--- a/extras/mini-os/Makefile   Thu Feb 09 18:33:31 2012 +0000
+++ b/extras/mini-os/Makefile   Thu Feb 09 18:33:32 2012 +0000
@@ -20,11 +20,25 @@
 CONFIG_SPARSE_BSS ?= y
 CONFIG_QEMU_XS_ARGS ?= n
 CONFIG_TEST ?= n
+CONFIG_PCIFRONT ?= n
+CONFIG_BLKFRONT ?= y
+CONFIG_NETFRONT ?= y
+CONFIG_FBFRONT ?= y
+CONFIG_KBDFRONT ?= y
+CONFIG_CONSFRONT ?= y
+CONFIG_XENBUS ?= y
 
 # Export config items as compiler directives
 flags-$(CONFIG_START_NETWORK) += -DCONFIG_START_NETWORK
 flags-$(CONFIG_SPARSE_BSS) += -DCONFIG_SPARSE_BSS
 flags-$(CONFIG_QEMU_XS_ARGS) += -DCONFIG_QEMU_XS_ARGS
+flags-$(CONFIG_PCIFRONT) += -DCONFIG_PCIFRONT
+flags-$(CONFIG_BLKFRONT) += -DCONFIG_BLKFRONT
+flags-$(CONFIG_NETFRONT) += -DCONFIG_NETFRONT
+flags-$(CONFIG_KBDFRONT) += -DCONFIG_KBDFRONT
+flags-$(CONFIG_FBFRONT) += -DCONFIG_FBFRONT
+flags-$(CONFIG_CONSFRONT) += -DCONFIG_CONSFRONT
+flags-$(CONFIG_XENBUS) += -DCONFIG_XENBUS
 
 DEF_CFLAGS += $(flags-y)
 
@@ -50,10 +64,10 @@
 # Subdirectories common to mini-os
 SUBDIRS := lib xenbus console
 
-src-y += blkfront.c
+src-$(CONFIG_BLKFRONT) += blkfront.c
 src-y += daytime.c
 src-y += events.c
-src-y += fbfront.c
+src-$(CONFIG_FBFRONT) += fbfront.c
 src-y += gntmap.c
 src-y += gnttab.c
 src-y += hypervisor.c
@@ -61,8 +75,8 @@
 src-y += lock.c
 src-y += main.c
 src-y += mm.c
-src-y += netfront.c
-src-y += pcifront.c
+src-$(CONFIG_NETFRONT) += netfront.c
+src-$(CONFIG_PCIFRONT) += pcifront.c
 src-y += sched.c
 src-$(CONFIG_TEST) += test.c
 
@@ -73,12 +87,13 @@
 src-y += lib/string.c
 src-y += lib/sys.c
 src-y += lib/xmalloc.c
-src-y += lib/xs.c
+src-$(CONFIG_XENBUS) += lib/xs.c
 
-src-y += xenbus/xenbus.c
+src-$(CONFIG_XENBUS) += xenbus/xenbus.c
 
 src-y += console/console.c
 src-y += console/xencons_ring.c
+src-$(CONFIG_CONSFRONT) += console/xenbus.c
 
 # The common mini-os objects to build.
 APP_OBJS :=
@@ -113,7 +128,10 @@
 LWC    := $(shell find $(LWIPDIR)/ -type f -name '*.c')
 LWC    := $(filter-out %6.c %ip6_addr.c %ethernetif.c, $(LWC))
 LWO    := $(patsubst %.c,%.o,$(LWC))
-LWO    += $(addprefix $(OBJ_DIR)/,lwip-arch.o lwip-net.o)
+LWO    += $(OBJ_DIR)/lwip-arch.o
+ifeq ($(CONFIG_NETFRONT),y)
+LWO += $(OBJ_DIR)/lwip-net.o
+endif
 
 $(OBJ_DIR)/lwip.a: $(LWO)
        $(RM) $@
diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/console/console.c
--- a/extras/mini-os/console/console.c  Thu Feb 09 18:33:31 2012 +0000
+++ b/extras/mini-os/console/console.c  Thu Feb 09 18:33:32 2012 +0000
@@ -158,8 +158,3 @@
     /* This is also required to notify the daemon */
     printk("done.\n");
 }
-
-void fini_console(struct consfront_dev *dev)
-{
-    if (dev) free_consfront(dev);
-}
diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/console/console.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/extras/mini-os/console/console.h  Thu Feb 09 18:33:32 2012 +0000
@@ -0,0 +1,2 @@
+
+void console_handle_input(evtchn_port_t port, struct pt_regs *regs, void 
*data);
diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/console/xenbus.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/extras/mini-os/console/xenbus.c   Thu Feb 09 18:33:32 2012 +0000
@@ -0,0 +1,198 @@
+#include <mini-os/types.h>
+#include <mini-os/wait.h>
+#include <mini-os/mm.h>
+#include <mini-os/hypervisor.h>
+#include <mini-os/events.h>
+#include <mini-os/os.h>
+#include <mini-os/lib.h>
+#include <mini-os/xenbus.h>
+#include <xen/io/console.h>
+#include <xen/io/protocols.h>
+#include <xen/io/ring.h>
+#include <mini-os/xmalloc.h>
+#include <mini-os/gnttab.h>
+#include "console.h"
+
+void free_consfront(struct consfront_dev *dev)
+{
+    char* err = NULL;
+    XenbusState state;
+
+    char path[strlen(dev->backend) + 1 + 5 + 1];
+    char nodename[strlen(dev->nodename) + 1 + 5 + 1];
+
+    snprintf(path, sizeof(path), "%s/state", dev->backend);
+    snprintf(nodename, sizeof(nodename), "%s/state", dev->nodename);
+
+    if ((err = xenbus_switch_state(XBT_NIL, nodename, XenbusStateClosing)) != 
NULL) {
+        printk("free_consfront: error changing state to %d: %s\n",
+                XenbusStateClosing, err);
+        goto close;
+    }
+    state = xenbus_read_integer(path);
+    while (err == NULL && state < XenbusStateClosing)
+        err = xenbus_wait_for_state_change(path, &state, &dev->events);
+    if (err) free(err);
+
+    if ((err = xenbus_switch_state(XBT_NIL, nodename, XenbusStateClosed)) != 
NULL) {
+        printk("free_consfront: error changing state to %d: %s\n",
+                XenbusStateClosed, err);
+        goto close;
+    }
+
+close:
+    if (err) free(err);
+    xenbus_unwatch_path_token(XBT_NIL, path, path);
+
+    mask_evtchn(dev->evtchn);
+    unbind_evtchn(dev->evtchn);
+    free(dev->backend);
+    free(dev->nodename);
+
+    gnttab_end_access(dev->ring_ref);
+
+    free_page(dev->ring);
+    free(dev);
+}
+
+struct consfront_dev *init_consfront(char *_nodename)
+{
+    xenbus_transaction_t xbt;
+    char* err;
+    char* message=NULL;
+    int retry=0;
+    char* msg = NULL;
+    char nodename[256];
+    char path[256];
+    static int consfrontends = 3;
+    struct consfront_dev *dev;
+    int res;
+
+    if (!_nodename)
+        snprintf(nodename, sizeof(nodename), "device/console/%d", 
consfrontends);
+    else
+        strncpy(nodename, _nodename, sizeof(nodename));
+
+    printk("******************* CONSFRONT for %s **********\n\n\n", nodename);
+
+    consfrontends++;
+    dev = malloc(sizeof(*dev));
+    memset(dev, 0, sizeof(*dev));
+    dev->nodename = strdup(nodename);
+#ifdef HAVE_LIBC
+    dev->fd = -1;
+#endif
+
+    snprintf(path, sizeof(path), "%s/backend-id", nodename);
+    if ((res = xenbus_read_integer(path)) < 0) 
+        return NULL;
+    else
+        dev->dom = res;
+    evtchn_alloc_unbound(dev->dom, console_handle_input, dev, &dev->evtchn);
+
+    dev->ring = (struct xencons_interface *) alloc_page();
+    memset(dev->ring, 0, PAGE_SIZE);
+    dev->ring_ref = gnttab_grant_access(dev->dom, virt_to_mfn(dev->ring), 0);
+
+    dev->events = NULL;
+
+again:
+    err = xenbus_transaction_start(&xbt);
+    if (err) {
+        printk("starting transaction\n");
+        free(err);
+    }
+
+    err = xenbus_printf(xbt, nodename, "ring-ref","%u",
+                dev->ring_ref);
+    if (err) {
+        message = "writing ring-ref";
+        goto abort_transaction;
+    }
+    err = xenbus_printf(xbt, nodename,
+                "port", "%u", dev->evtchn);
+    if (err) {
+        message = "writing event-channel";
+        goto abort_transaction;
+    }
+    err = xenbus_printf(xbt, nodename,
+                "protocol", "%s", XEN_IO_PROTO_ABI_NATIVE);
+    if (err) {
+        message = "writing protocol";
+        goto abort_transaction;
+    }
+
+    err = xenbus_printf(xbt, nodename, "type", "%s", "ioemu");
+    if (err) {
+        message = "writing type";
+        goto abort_transaction;
+    }
+
+    snprintf(path, sizeof(path), "%s/state", nodename);
+    err = xenbus_switch_state(xbt, path, XenbusStateConnected);
+    if (err) {
+        message = "switching state";
+        goto abort_transaction;
+    }
+
+
+    err = xenbus_transaction_end(xbt, 0, &retry);
+    if (err) free(err);
+    if (retry) {
+            goto again;
+        printk("completing transaction\n");
+    }
+
+    goto done;
+
+abort_transaction:
+    free(err);
+    err = xenbus_transaction_end(xbt, 1, &retry);
+    printk("Abort transaction %s\n", message);
+    goto error;
+
+done:
+
+    snprintf(path, sizeof(path), "%s/backend", nodename);
+    msg = xenbus_read(XBT_NIL, path, &dev->backend);
+    if (msg) {
+        printk("Error %s when reading the backend path %s\n", msg, path);
+        goto error;
+    }
+
+    printk("backend at %s\n", dev->backend);
+
+    {
+        XenbusState state;
+        char path[strlen(dev->backend) + 1 + 19 + 1];
+        snprintf(path, sizeof(path), "%s/state", dev->backend);
+        
+       xenbus_watch_path_token(XBT_NIL, path, path, &dev->events);
+        msg = NULL;
+        state = xenbus_read_integer(path);
+        while (msg == NULL && state < XenbusStateConnected)
+            msg = xenbus_wait_for_state_change(path, &state, &dev->events);
+        if (msg != NULL || state != XenbusStateConnected) {
+            printk("backend not available, state=%d\n", state);
+            xenbus_unwatch_path_token(XBT_NIL, path, path);
+            goto error;
+        }
+    }
+    unmask_evtchn(dev->evtchn);
+
+    printk("**************************\n");
+
+    return dev;
+
+error:
+    free(msg);
+    free(err);
+    free_consfront(dev);
+    return NULL;
+}
+
+void fini_console(struct consfront_dev *dev)
+{
+    if (dev) free_consfront(dev);
+}
+
diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/console/xencons_ring.c
--- a/extras/mini-os/console/xencons_ring.c     Thu Feb 09 18:33:31 2012 +0000
+++ b/extras/mini-os/console/xencons_ring.c     Thu Feb 09 18:33:32 2012 +0000
@@ -11,6 +11,7 @@
 #include <xen/io/ring.h>
 #include <mini-os/xmalloc.h>
 #include <mini-os/gnttab.h>
+#include "console.h"
 
 DECLARE_WAIT_QUEUE_HEAD(console_queue);
 
@@ -70,7 +71,7 @@
 
 
 
-static void handle_input(evtchn_port_t port, struct pt_regs *regs, void *data)
+void console_handle_input(evtchn_port_t port, struct pt_regs *regs, void *data)
 {
        struct consfront_dev *dev = (struct consfront_dev *) data;
 #ifdef HAVE_LIBC
@@ -173,7 +174,7 @@
        dev->evtchn = start_info.console.domU.evtchn;
        dev->ring = (struct xencons_interface *) 
mfn_to_virt(start_info.console.domU.mfn);
 
-       err = bind_evtchn(dev->evtchn, handle_input, dev);
+       err = bind_evtchn(dev->evtchn, console_handle_input, dev);
        if (err <= 0) {
                printk("XEN console request chn bind failed %i\n", err);
                 free(dev);
@@ -187,184 +188,6 @@
        return dev;
 }
 
-void free_consfront(struct consfront_dev *dev)
-{
-    char* err = NULL;
-    XenbusState state;
-
-    char path[strlen(dev->backend) + 1 + 5 + 1];
-    char nodename[strlen(dev->nodename) + 1 + 5 + 1];
-
-    snprintf(path, sizeof(path), "%s/state", dev->backend);
-    snprintf(nodename, sizeof(nodename), "%s/state", dev->nodename);
-
-    if ((err = xenbus_switch_state(XBT_NIL, nodename, XenbusStateClosing)) != 
NULL) {
-        printk("free_consfront: error changing state to %d: %s\n",
-                XenbusStateClosing, err);
-        goto close;
-    }
-    state = xenbus_read_integer(path);
-    while (err == NULL && state < XenbusStateClosing)
-        err = xenbus_wait_for_state_change(path, &state, &dev->events);
-    if (err) free(err);
-
-    if ((err = xenbus_switch_state(XBT_NIL, nodename, XenbusStateClosed)) != 
NULL) {
-        printk("free_consfront: error changing state to %d: %s\n",
-                XenbusStateClosed, err);
-        goto close;
-    }
-
-close:
-    if (err) free(err);
-    xenbus_unwatch_path_token(XBT_NIL, path, path);
-
-    mask_evtchn(dev->evtchn);
-    unbind_evtchn(dev->evtchn);
-    free(dev->backend);
-    free(dev->nodename);
-
-    gnttab_end_access(dev->ring_ref);
-
-    free_page(dev->ring);
-    free(dev);
-}
-
-struct consfront_dev *init_consfront(char *_nodename)
-{
-    xenbus_transaction_t xbt;
-    char* err;
-    char* message=NULL;
-    int retry=0;
-    char* msg = NULL;
-    char nodename[256];
-    char path[256];
-    static int consfrontends = 3;
-    struct consfront_dev *dev;
-    int res;
-
-    if (!_nodename)
-        snprintf(nodename, sizeof(nodename), "device/console/%d", 
consfrontends);
-    else
-        strncpy(nodename, _nodename, sizeof(nodename));
-
-    printk("******************* CONSFRONT for %s **********\n\n\n", nodename);
-
-    consfrontends++;
-    dev = malloc(sizeof(*dev));
-    memset(dev, 0, sizeof(*dev));
-    dev->nodename = strdup(nodename);
-#ifdef HAVE_LIBC
-    dev->fd = -1;
-#endif
-
-    snprintf(path, sizeof(path), "%s/backend-id", nodename);
-    if ((res = xenbus_read_integer(path)) < 0) 
-        return NULL;
-    else
-        dev->dom = res;
-    evtchn_alloc_unbound(dev->dom, handle_input, dev, &dev->evtchn);
-
-    dev->ring = (struct xencons_interface *) alloc_page();
-    memset(dev->ring, 0, PAGE_SIZE);
-    dev->ring_ref = gnttab_grant_access(dev->dom, virt_to_mfn(dev->ring), 0);
-
-    dev->events = NULL;
-
-again:
-    err = xenbus_transaction_start(&xbt);
-    if (err) {
-        printk("starting transaction\n");
-        free(err);
-    }
-
-    err = xenbus_printf(xbt, nodename, "ring-ref","%u",
-                dev->ring_ref);
-    if (err) {
-        message = "writing ring-ref";
-        goto abort_transaction;
-    }
-    err = xenbus_printf(xbt, nodename,
-                "port", "%u", dev->evtchn);
-    if (err) {
-        message = "writing event-channel";
-        goto abort_transaction;
-    }
-    err = xenbus_printf(xbt, nodename,
-                "protocol", "%s", XEN_IO_PROTO_ABI_NATIVE);
-    if (err) {
-        message = "writing protocol";
-        goto abort_transaction;
-    }
-
-    err = xenbus_printf(xbt, nodename, "type", "%s", "ioemu");
-    if (err) {
-        message = "writing type";
-        goto abort_transaction;
-    }
-
-    snprintf(path, sizeof(path), "%s/state", nodename);
-    err = xenbus_switch_state(xbt, path, XenbusStateConnected);
-    if (err) {
-        message = "switching state";
-        goto abort_transaction;
-    }
-
-
-    err = xenbus_transaction_end(xbt, 0, &retry);
-    if (err) free(err);
-    if (retry) {
-            goto again;
-        printk("completing transaction\n");
-    }
-
-    goto done;
-
-abort_transaction:
-    free(err);
-    err = xenbus_transaction_end(xbt, 1, &retry);
-    printk("Abort transaction %s\n", message);
-    goto error;
-
-done:
-
-    snprintf(path, sizeof(path), "%s/backend", nodename);
-    msg = xenbus_read(XBT_NIL, path, &dev->backend);
-    if (msg) {
-        printk("Error %s when reading the backend path %s\n", msg, path);
-        goto error;
-    }
-
-    printk("backend at %s\n", dev->backend);
-
-    {
-        XenbusState state;
-        char path[strlen(dev->backend) + 1 + 19 + 1];
-        snprintf(path, sizeof(path), "%s/state", dev->backend);
-        
-       xenbus_watch_path_token(XBT_NIL, path, path, &dev->events);
-        msg = NULL;
-        state = xenbus_read_integer(path);
-        while (msg == NULL && state < XenbusStateConnected)
-            msg = xenbus_wait_for_state_change(path, &state, &dev->events);
-        if (msg != NULL || state != XenbusStateConnected) {
-            printk("backend not available, state=%d\n", state);
-            xenbus_unwatch_path_token(XBT_NIL, path, path);
-            goto error;
-        }
-    }
-    unmask_evtchn(dev->evtchn);
-
-    printk("**************************\n");
-
-    return dev;
-
-error:
-    free(msg);
-    free(err);
-    free_consfront(dev);
-    return NULL;
-}
-
 void xencons_resume(void)
 {
        (void)xencons_ring_init();
diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/include/lib.h
--- a/extras/mini-os/include/lib.h      Thu Feb 09 18:33:31 2012 +0000
+++ b/extras/mini-os/include/lib.h      Thu Feb 09 18:33:32 2012 +0000
@@ -184,11 +184,13 @@
        struct {
            struct consfront_dev *dev;
        } cons;
+#ifdef CONFIG_XENBUS
         struct {
             /* To each xenbus FD is associated a queue of watch events for this
              * FD.  */
             xenbus_event_queue events;
         } xenbus;
+#endif
     };
     int read;  /* maybe available for read */
 } files[];
diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/include/xenbus.h
--- a/extras/mini-os/include/xenbus.h   Thu Feb 09 18:33:31 2012 +0000
+++ b/extras/mini-os/include/xenbus.h   Thu Feb 09 18:33:32 2012 +0000
@@ -6,8 +6,14 @@
 typedef unsigned long xenbus_transaction_t;
 #define XBT_NIL ((xenbus_transaction_t)0)
 
+#ifdef CONFIG_XENBUS
 /* Initialize the XenBus system. */
 void init_xenbus(void);
+#else
+static inline void init_xenbus(void)
+{
+}
+#endif
 
 /* Read the value associated with a path.  Returns a malloc'd error
    string on failure and sets *value to NULL.  On success, *value is
@@ -98,7 +104,13 @@
 /* Utility function to figure out our domain id */
 domid_t xenbus_get_self_id(void);
 
+#ifdef CONFIG_XENBUS
 /* Reset the XenBus system. */
 void fini_xenbus(void);
+#else
+static inline void fini_xenbus(void)
+{
+}
+#endif
 
 #endif /* XENBUS_H__ */
diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/kernel.c
--- a/extras/mini-os/kernel.c   Thu Feb 09 18:33:31 2012 +0000
+++ b/extras/mini-os/kernel.c   Thu Feb 09 18:33:32 2012 +0000
@@ -142,10 +142,6 @@
     /* Reset grant tables */
     fini_gnttab();
 
-    /* Reset the console driver. */
-    fini_console(NULL);
-    /* TODO: record new ring mfn & event in start_info */
-
     /* Reset XenBus */
     fini_xenbus();
 
diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/lib/sys.c
--- a/extras/mini-os/lib/sys.c  Thu Feb 09 18:33:31 2012 +0000
+++ b/extras/mini-os/lib/sys.c  Thu Feb 09 18:33:32 2012 +0000
@@ -164,6 +164,7 @@
     return -1;
 }
 
+#ifdef CONFIG_CONSFRONT
 int posix_openpt(int flags)
 {
     struct consfront_dev *dev;
@@ -192,6 +193,18 @@
     printk("fd(%d) = open_savefile\n", dev->fd);
     return(dev->fd);
 }
+#else
+int posix_openpt(int flags)
+{
+       errno = EIO;
+       return -1;
+}
+int open_savefile(const char *path, int save)
+{
+       errno = EIO;
+       return -1;
+}
+#endif
 
 int open(const char *pathname, int flags, ...)
 {
@@ -241,6 +254,7 @@
        case FTYPE_SOCKET:
            return lwip_read(files[fd].socket.fd, buf, nbytes);
 #endif
+#ifdef CONFIG_NETFRONT
        case FTYPE_TAP: {
            ssize_t ret;
            ret = netfront_receive(files[fd].tap.dev, buf, nbytes);
@@ -250,6 +264,8 @@
            }
            return ret;
        }
+#endif
+#ifdef CONFIG_KBDFRONT
         case FTYPE_KBD: {
             int ret, n;
             n = nbytes / sizeof(union xenkbd_in_event);
@@ -260,6 +276,8 @@
            }
            return ret * sizeof(union xenkbd_in_event);
         }
+#endif
+#ifdef CONFIG_FBFRONT
         case FTYPE_FB: {
             int ret, n;
             n = nbytes / sizeof(union xenfb_in_event);
@@ -270,6 +288,7 @@
            }
            return ret * sizeof(union xenfb_in_event);
         }
+#endif
        default:
            break;
     }
@@ -297,9 +316,11 @@
        case FTYPE_SOCKET:
            return lwip_write(files[fd].socket.fd, (void*) buf, nbytes);
 #endif
+#ifdef CONFIG_NETFRONT
        case FTYPE_TAP:
            netfront_xmit(files[fd].tap.dev, (void*) buf, nbytes);
            return nbytes;
+#endif
        default:
            break;
     }
@@ -326,9 +347,11 @@
         default:
            files[fd].type = FTYPE_NONE;
            return 0;
+#ifdef CONFIG_XENBUS
        case FTYPE_XENBUS:
             xs_daemon_close((void*)(intptr_t) fd);
             return 0;
+#endif
 #ifdef HAVE_LWIP
        case FTYPE_SOCKET: {
            int res = lwip_close(files[fd].socket.fd);
@@ -345,27 +368,37 @@
        case FTYPE_GNTMAP:
            minios_gnttab_close_fd(fd);
            return 0;
+#ifdef CONFIG_NETFRONT
        case FTYPE_TAP:
            shutdown_netfront(files[fd].tap.dev);
            files[fd].type = FTYPE_NONE;
            return 0;
+#endif
+#ifdef CONFIG_BLKFRONT
        case FTYPE_BLK:
             shutdown_blkfront(files[fd].blk.dev);
            files[fd].type = FTYPE_NONE;
            return 0;
+#endif
+#ifdef CONFIG_KBDFRONT
        case FTYPE_KBD:
             shutdown_kbdfront(files[fd].kbd.dev);
             files[fd].type = FTYPE_NONE;
             return 0;
+#endif
+#ifdef CONFIG_FBFRONT
        case FTYPE_FB:
             shutdown_fbfront(files[fd].fb.dev);
             files[fd].type = FTYPE_NONE;
             return 0;
+#endif
+#ifdef CONFIG_CONSFRONT
         case FTYPE_SAVEFILE:
         case FTYPE_CONSOLE:
             fini_console(files[fd].cons.dev);
             files[fd].type = FTYPE_NONE;
             return 0;
+#endif
        case FTYPE_NONE:
            break;
     }
@@ -611,6 +644,7 @@
                 n++;
            FD_CLR(i, exceptfds);
            break;
+#ifdef CONFIG_XENBUS
        case FTYPE_XENBUS:
            if (FD_ISSET(i, readfds)) {
                 if (files[i].xenbus.events)
@@ -621,6 +655,7 @@
            FD_CLR(i, writefds);
            FD_CLR(i, exceptfds);
            break;
+#endif
        case FTYPE_EVTCHN:
        case FTYPE_TAP:
        case FTYPE_BLK:
@@ -705,11 +740,19 @@
     fd_set myread, mywrite, myexcept;
     struct thread *thread = get_current();
     s_time_t start = NOW(), stop;
+#ifdef CONFIG_NETFRONT
     DEFINE_WAIT(netfront_w);
+#endif
     DEFINE_WAIT(event_w);
+#ifdef CONFIG_BLKFRONT
     DEFINE_WAIT(blkfront_w);
+#endif
+#ifdef CONFIG_XENBUS
     DEFINE_WAIT(xenbus_watch_w);
+#endif
+#ifdef CONFIG_KBDFRONT
     DEFINE_WAIT(kbdfront_w);
+#endif
     DEFINE_WAIT(console_w);
 
     assert(thread == main_thread);
@@ -727,11 +770,19 @@
     /* Tell people we're going to sleep before looking at what they are
      * saying, hence letting them wake us if events happen between here and
      * schedule() */
+#ifdef CONFIG_NETFRONT
     add_waiter(netfront_w, netfront_queue);
+#endif
     add_waiter(event_w, event_queue);
+#ifdef CONFIG_BLKFRONT
     add_waiter(blkfront_w, blkfront_queue);
+#endif
+#ifdef CONFIG_XENBUS
     add_waiter(xenbus_watch_w, xenbus_watch_queue);
+#endif
+#ifdef CONFIG_KBDFRONT
     add_waiter(kbdfront_w, kbdfront_queue);
+#endif
     add_waiter(console_w, console_queue);
 
     if (readfds)
@@ -814,11 +865,19 @@
     ret = -1;
 
 out:
+#ifdef CONFIG_NETFRONT
     remove_waiter(netfront_w, netfront_queue);
+#endif
     remove_waiter(event_w, event_queue);
+#ifdef CONFIG_BLKFRONT
     remove_waiter(blkfront_w, blkfront_queue);
+#endif
+#ifdef CONFIG_XENBUS
     remove_waiter(xenbus_watch_w, xenbus_watch_queue);
+#endif
+#ifdef CONFIG_KBDFRONT
     remove_waiter(kbdfront_w, kbdfront_queue);
+#endif
     remove_waiter(console_w, console_queue);
     return ret;
 }
diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/main.c
--- a/extras/mini-os/main.c     Thu Feb 09 18:33:31 2012 +0000
+++ b/extras/mini-os/main.c     Thu Feb 09 18:33:32 2012 +0000
@@ -63,10 +63,12 @@
 #ifdef CONFIG_SPARSE_BSS
     sparse((unsigned long) &__app_bss_start, &__app_bss_end - 
&__app_bss_start);
 #endif
-#if defined(HAVE_LWIP) && defined(CONFIG_START_NETWORK)
+#if defined(HAVE_LWIP) && defined(CONFIG_START_NETWORK) && 
defined(CONFIG_NETFRONT)
     start_networking();
 #endif
+#ifdef CONFIG_PCIFRONT
     create_thread("pcifront", pcifront_watches, NULL);
+#endif
 
 #ifdef CONFIG_QEMU_XS_ARGS
     /* Fetch argc, argv from XenStore */
@@ -169,7 +171,7 @@
     close_all_files();
     __libc_fini_array();
     printk("main returned %d\n", ret);
-#ifdef HAVE_LWIP
+#if defined(HAVE_LWIP) && defined(CONFIG_NETFRONT)
     stop_networking();
 #endif
     stop_kernel();
diff -r 86dca025cc2d -r 585caf50a926 stubdom/ioemu-minios.cfg
--- a/stubdom/ioemu-minios.cfg  Thu Feb 09 18:33:31 2012 +0000
+++ b/stubdom/ioemu-minios.cfg  Thu Feb 09 18:33:32 2012 +0000
@@ -1,2 +1,3 @@
 CONFIG_START_NETWORK=n
 CONFIG_QEMU_XS_ARGS=y
+CONFIG_PCIFRONT=y

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.