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

Re: [Xen-devel] xenbus and the message of doom



On Tue, Jan 03, Ian Campbell wrote:

> As I said in the bit you trimmed the precedent seems to be to
> write /local/domain/<N>/control/platform-feature-<X> for each guest that
> you want to expose the feature to. I think a per-guest key makes sense
> since even if something seems obviously global you never know when you
> might need to hide it from a guest (e.g. to workaround an in-guest bug).
> 
> I'm afraid I don't have time to work on this myself but it seems pretty
> simple?

After looking at this, the (compile tested) patch below should be enough:


diff -r 3a22ed3ec534 tools/xenstore/xs.c
--- a/tools/xenstore/xs.c
+++ b/tools/xenstore/xs.c
@@ -884,6 +884,10 @@ bool xs_introduce_domain(struct xs_handl
        char mfn_str[MAX_STRLEN(mfn)];
        char eventchn_str[MAX_STRLEN(eventchn)];
        struct iovec iov[3];
+       static const char feat[] = "control/platform-feature-xs_reset_watches";
+       int len;
+       char *dom_path, *feat_path;
+       bool ret;
 
        snprintf(domid_str, sizeof(domid_str), "%u", domid);
        snprintf(mfn_str, sizeof(mfn_str), "%lu", mfn);
@@ -896,8 +900,21 @@ bool xs_introduce_domain(struct xs_handl
        iov[2].iov_base = eventchn_str;
        iov[2].iov_len = strlen(eventchn_str) + 1;
 
-       return xs_bool(xs_talkv(h, XBT_NULL, XS_INTRODUCE, iov,
+       ret = xs_bool(xs_talkv(h, XBT_NULL, XS_INTRODUCE, iov,
                                ARRAY_SIZE(iov), NULL));
+
+       dom_path = xs_get_domain_path(h, domid);
+       if (dom_path) {
+               len = strlen(dom_path) + 1 + strlen(feat);
+               feat_path = malloc(len + 1);
+               if (feat_path) {
+                       snprintf(feat_path, len + 1, "%s/%s", dom_path, feat);
+                       xs_write(h, XBT_NULL, feat_path, "1", 1);
+                       free(feat_path);
+               }
+               free(dom_path);
+       }
+       return ret;
 }
 
 bool xs_set_target(struct xs_handle *h,

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


 


Rackspace

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