xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Castro <evil.dani@gmail.com>
To: xen-devel@lists.xensource.com
Cc: Daniel Castro <evil.dani@gmail.com>
Subject: [PATCH 10/10] Xen: Xenstore example
Date: Fri, 19 Aug 2011 01:03:28 +0900	[thread overview]
Message-ID: <1313683408-32306-12-git-send-email-evil.dani@gmail.com> (raw)
In-Reply-To: <1313683408-32306-1-git-send-email-evil.dani@gmail.com>

After the xenbus ring initialization we issue a directory query
for the list of virtual block devices attached to the current
guest. The answer is displayed in the console.

Signed-off-by: Daniel Castro <evil.dani@gmail.com>
---
 src/xen-xs.c |   10 +++++++++-
 src/xen-xs.h |    1 +
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/xen-xs.c b/src/xen-xs.c
index d4b6b26..1173ce2 100644
--- a/src/xen-xs.c
+++ b/src/xen-xs.c
@@ -36,7 +36,7 @@ static struct xenstore_domain_interface *rings; /* Shared ring with dom0 */
 static evtchn_port_t event;                     /* Event-channel to dom0 */
 static char payload[XENSTORE_PAYLOAD_MAX + 1];  /* Unmarshalling area */
 
-
+void test_xenstore(void);
 /*
  * Connect our xenbus client to the backend.
  * Call once, before any other xenbus actions.
@@ -62,6 +62,7 @@ void xenbus_setup(void)
 	event = param.value;
 	dprintf(1,"Xenbus rings @0x%lx, event channel %lu\n",
 			(unsigned long) rings, (unsigned long) event);
+	test_xenstore();
 }
 
 /*
@@ -241,3 +242,10 @@ char * xenstore_directory(char *path, u32 *ans_len){
 	/* We know xenbus_send() nul-terminates its answer, so just pass it on. */
 	return answer;
 }
+
+void test_xenstore(void){
+	char path[11] = {'d','e','v','i','c','e','/','v','b','d','\0'};
+	u32 ans_len;
+	char * res = xenstore_directory(path,&ans_len);
+	dprintf(1,"length: %d strlen: %d vdb-id: %s .\n",ans_len,strlen(res),res);
+}
diff --git a/src/xen-xs.h b/src/xen-xs.h
index 91e8da0..6957031 100644
--- a/src/xen-xs.h
+++ b/src/xen-xs.h
@@ -4,5 +4,6 @@
 void xenbus_setup(void);
 char * xenstore_read(char *path);
 char * xenstore_directory(char *path, u32 *ans_len);
+void test_xenstore(void);
 
 #endif
-- 
1.7.4.1

  parent reply	other threads:[~2011-08-18 16:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-18 16:03 [PATCH 00/10] Xenstore communication support for Seabios Daniel Castro
2011-08-18 16:03 ` [PATCH 01/10] Xen: Guest Handlers and Copyrights Daniel Castro
2011-08-18 16:03 ` [PATCH 02/10] Move PAGE_SHIFT to memmap.h Daniel Castro
2011-08-24 17:51   ` Konrad Rzeszutek Wilk
2011-08-24 21:08     ` Ian Campbell
2011-08-18 16:03 ` [PATCH 03/10] Xen: Use PAGE_SHIFT as a constant Daniel Castro
2011-08-18 16:03 ` [PATCH 04/10] Xen: Support for interdomain event channel Daniel Castro
2011-08-18 16:03 ` [PATCH 05/10] Xen: Support for HVM_op Hypercall Daniel Castro
2011-08-18 16:03 ` [PATCH 06/10] Xen: Support for memory_op Hypercall Daniel Castro
2011-08-18 16:03 ` [PATCH 07/10] Xen: Support for sched_op hypercall Daniel Castro
2011-08-18 16:03 ` [PATCH 08/10] Xen: Shared info for CPU yield support and xenbus protocol Daniel Castro
2011-08-18 16:03 ` [PATCH 09/10] Xen: Xenstore communication via xenbus Daniel Castro
2011-08-18 16:03 ` [PATCH 10/10] Xen: Xenstore example -do not apply Daniel Castro
2011-08-18 16:03 ` Daniel Castro [this message]
2011-08-24 17:56 ` [PATCH 00/10] Xenstore communication support for Seabios Konrad Rzeszutek Wilk

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=1313683408-32306-12-git-send-email-evil.dani@gmail.com \
    --to=evil.dani@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).