WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 04 of 10] Add XS_RESUME command

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 04 of 10] Add XS_RESUME command
From: Brendan Cully <brendan@xxxxxxxxx>
Date: Thu, 14 Dec 2006 23:38:40 -0700
Delivery-date: Thu, 14 Dec 2006 23:41:48 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1166168316@xxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Brendan Cully <brendan@xxxxxxxxx>
# Date 1166166342 28800
# Node ID 9c35e3a499a7a3eb95eaab616ded1e77d4676722
# Parent  76574bc1ca50ece678c606887558e9f910361ac5
Add XS_RESUME command.

This clears the shutdown flag for a domain in xenstore, allowing
subsequent shutdowns of the same domain to fire the appropriate
watches.

Signed-off-by: Brendan Cully <brendan@xxxxxxxxx>

diff -r 76574bc1ca50 -r 9c35e3a499a7 tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c   Thu Dec 14 23:05:42 2006 -0800
+++ b/tools/xenstore/xenstored_core.c   Thu Dec 14 23:05:42 2006 -0800
@@ -164,6 +164,7 @@ static char *sockmsg_string(enum xsd_soc
        case XS_WATCH_EVENT: return "WATCH_EVENT";
        case XS_ERROR: return "ERROR";
        case XS_IS_DOMAIN_INTRODUCED: return "XS_IS_DOMAIN_INTRODUCED";
+       case XS_RESUME: return "RESUME";
        default:
                return "**UNKNOWN**";
        }
@@ -1265,6 +1266,10 @@ static void process_message(struct conne
 
        case XS_GET_DOMAIN_PATH:
                do_get_domain_path(conn, onearg(in));
+               break;
+
+       case XS_RESUME:
+               do_resume(conn, onearg(in));
                break;
 
        default:
diff -r 76574bc1ca50 -r 9c35e3a499a7 tools/xenstore/xenstored_domain.c
--- a/tools/xenstore/xenstored_domain.c Thu Dec 14 23:05:42 2006 -0800
+++ b/tools/xenstore/xenstored_domain.c Thu Dec 14 23:05:42 2006 -0800
@@ -395,6 +395,43 @@ void do_release(struct connection *conn,
        send_ack(conn, XS_RELEASE);
 }
 
+void do_resume(struct connection *conn, const char *domid_str)
+{
+       struct domain *domain;
+       unsigned int domid;
+
+       if (!domid_str) {
+               send_error(conn, EINVAL);
+               return;
+       }
+
+       domid = atoi(domid_str);
+       if (!domid) {
+               send_error(conn, EINVAL);
+               return;
+       }
+
+       if (conn->id != 0) {
+               send_error(conn, EACCES);
+               return;
+       }
+
+       domain = find_domain_by_domid(domid);
+       if (!domain) {
+               send_error(conn, ENOENT);
+               return;
+       }
+
+       if (!domain->conn) {
+               send_error(conn, EINVAL);
+               return;
+       }
+
+       domain->shutdown = 0;
+       
+       send_ack(conn, XS_RESUME);
+}
+
 void do_get_domain_path(struct connection *conn, const char *domid_str)
 {
        char *path;
diff -r 76574bc1ca50 -r 9c35e3a499a7 tools/xenstore/xenstored_domain.h
--- a/tools/xenstore/xenstored_domain.h Thu Dec 14 23:05:42 2006 -0800
+++ b/tools/xenstore/xenstored_domain.h Thu Dec 14 23:05:42 2006 -0800
@@ -32,6 +32,9 @@ void do_release(struct connection *conn,
 void do_release(struct connection *conn, const char *domid_str);
 
 /* domid */
+void do_resume(struct connection *conn, const char *domid_str);
+
+/* domid */
 void do_get_domain_path(struct connection *conn, const char *domid_str);
 
 /* Returns the event channel handle */
diff -r 76574bc1ca50 -r 9c35e3a499a7 tools/xenstore/xs.c
--- a/tools/xenstore/xs.c       Thu Dec 14 23:05:42 2006 -0800
+++ b/tools/xenstore/xs.c       Thu Dec 14 23:05:42 2006 -0800
@@ -719,6 +719,12 @@ bool xs_release_domain(struct xs_handle 
        return xs_bool(single_with_domid(h, XS_RELEASE, domid));
 }
 
+/* clear the shutdown bit for the given domain */
+bool xs_resume_domain(struct xs_handle *h, unsigned int domid)
+{
+       return xs_bool(single_with_domid(h, XS_RESUME, domid));
+}
+
 char *xs_get_domain_path(struct xs_handle *h, unsigned int domid)
 {
        char domid_str[MAX_STRLEN(domid)];
diff -r 76574bc1ca50 -r 9c35e3a499a7 tools/xenstore/xs.h
--- a/tools/xenstore/xs.h       Thu Dec 14 23:05:42 2006 -0800
+++ b/tools/xenstore/xs.h       Thu Dec 14 23:05:42 2006 -0800
@@ -133,6 +133,11 @@ bool xs_introduce_domain(struct xs_handl
                         unsigned int domid,
                         unsigned long mfn,
                          unsigned int eventchn); 
+/* Resume a domain.
+ * Clear the shutdown flag for this domain in the store.
+ */
+bool xs_resume_domain(struct xs_handle *h, unsigned int domid);
+
 /* Release a domain.
  * Tells the store domain to release the memory page to the domain.
  */
diff -r 76574bc1ca50 -r 9c35e3a499a7 xen/include/public/io/xs_wire.h
--- a/xen/include/public/io/xs_wire.h   Thu Dec 14 23:05:42 2006 -0800
+++ b/xen/include/public/io/xs_wire.h   Thu Dec 14 23:05:42 2006 -0800
@@ -45,7 +45,8 @@ enum xsd_sockmsg_type
     XS_SET_PERMS,
     XS_WATCH_EVENT,
     XS_ERROR,
-    XS_IS_DOMAIN_INTRODUCED
+    XS_IS_DOMAIN_INTRODUCED,
+    XS_RESUME
 };
 
 #define XS_WRITE_NONE "NONE"

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