All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
To: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: [PATCH 18/24] [xen-unstable.hg] flag in minios kernel to say whether xenbus is initialised - it might not be if this is a xenstore stubdom
Date: Mon, 23 Mar 2009 15:21:24 +0000	[thread overview]
Message-ID: <49C7A8F4.1080900@eu.citrix.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2 bytes --]




[-- Attachment #2: minios_xenbus_ready_flag --]
[-- Type: text/plain, Size: 2105 bytes --]

Aborts minios xenbus initialization if there is no xenstored mfn or port
available. Adds a is_xenbus_ready function for other modules to query
whether xenbus is available.

TODO: Do we just want a global integer instead of a function?

TODO: Should fini_xenbus take it back to not ready?

TODO: Should the other non-static functions fail if !ready?

Signed-off-by: Diego Ongaro <diego.ongaro@citrix.com>
Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
---

diff -r e53f83b91052 extras/mini-os/include/xenbus.h
--- a/extras/mini-os/include/xenbus.h	Fri Aug 01 16:50:48 2008 +0100
+++ b/extras/mini-os/include/xenbus.h	Fri Aug 01 16:50:49 2008 +0100
@@ -6,6 +6,8 @@
 
 /* Initialize the XenBus system. */
 void init_xenbus(void);
+
+int is_xenbus_ready(void);
 
 /* Read the value associated with a path.  Returns a malloc'd error
    string on failure and sets *value to NULL.  On success, *value is
diff -r e53f83b91052 extras/mini-os/xenbus/xenbus.c
--- a/extras/mini-os/xenbus/xenbus.c	Fri Aug 01 16:50:48 2008 +0100
+++ b/extras/mini-os/xenbus/xenbus.c	Fri Aug 01 16:50:49 2008 +0100
@@ -41,6 +41,7 @@
 #define DEBUG(_f, _a...)    ((void)0)
 #endif
 
+static int xenbus_ready;
 static struct xenstore_domain_interface *xenstore_buf;
 static DECLARE_WAIT_QUEUE_HEAD(xb_waitq);
 DECLARE_WAIT_QUEUE_HEAD(xenbus_watch_queue);
@@ -254,12 +255,23 @@
     return o_probe;
 }
 
+int is_xenbus_ready(void)
+{
+    return xenbus_ready;
+}
+
 /* Initialise xenbus. */
 void init_xenbus(void)
 {
     int err;
     printk("Initialising xenbus\n");
     DEBUG("init_xenbus called.\n");
+
+    if (start_info.store_mfn == -1 || start_info.store_evtchn == -1) {
+        printk("No start_info store_mfn/store_evtchn, aborting init_xenbus\n");
+        return;
+    }
+
     xenstore_buf = mfn_to_virt(start_info.store_mfn);
     create_thread("xenstore", xenbus_thread_func, NULL);
     DEBUG("buf at %p.\n", xenstore_buf);
@@ -268,6 +280,8 @@
               NULL);
     unmask_evtchn(start_info.store_evtchn);
     DEBUG("xenbus on irq %d\n", err);
+
+    xenbus_ready = 1;
 }
 
 void fini_xenbus(void)



[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

                 reply	other threads:[~2009-03-23 15:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49C7A8F4.1080900@eu.citrix.com \
    --to=alex.zeffertt@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.