From mboxrd@z Thu Jan 1 00:00:00 1970 From: aq Subject: Re: [PATCH] Convert balloon driver to xenstore Date: Wed, 3 Aug 2005 17:02:09 +0900 Message-ID: <9cde8bff05080301022cf0d33@mail.gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Dan Smith Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On 8/2/05, Dan Smith wrote: > The attached patch converts the balloon driver and xend to use > xenstore instead of control messages. >=20 > +static void watch_target(struct xenbus_watch *watch, const char *node) > +{ > + unsigned long new_target; > + int err; > + > + if(watch =3D=3D &root_watch) > + { > + /* FIXME: This is part of a dom0 sequencing workaround */ > + if(register_xenbus_watch(&xb_watch) =3D=3D 0) > + { > + /* > + We successfully set a watch on memory/target: > + now we can stop watching root > + */ > + unregister_xenbus_watch(&root_watch); > + balloon_xenbus_init=3D1; > + } > + else > + { > + return; > + } > + } > + > + err =3D xenbus_scanf("memory", "target", "%lu", &new_target); > + > + if(err !=3D 1) > + { > + IPRINTK("Unable to read memory/target\n"); > + return; > + } > + > + set_new_target(new_target >> PAGE_SHIFT); as under "memory"node, there probably are several nodes besides "target" (that means what triggered this watch may be not balloon request), i guess it is better to do some checking before calling set_new_target, like this: if (new_target !=3D target_pages) set_new_target(new_target >> PAGE_SHIFT); regards, aq