|   | 
      | 
  
  
      | 
      | 
  
 
     | 
    | 
  
  
     | 
    | 
  
  
    |   | 
      | 
  
  
    | 
         
xen-devel
Re: [Xen-devel] [PATCH] Convert balloon driver to xenstore
 
On 8/2/05, Dan Smith <danms@xxxxxxxxxx> wrote:
> The attached patch converts the balloon driver and xend to use
> xenstore instead of control messages.
> 
<snip>
> +static void watch_target(struct xenbus_watch *watch, const char *node)
> +{
> +    unsigned long new_target;
> +    int err;
> +
> +    if(watch == &root_watch)
> +    {
> +        /* FIXME: This is part of a dom0 sequencing workaround */
> +        if(register_xenbus_watch(&xb_watch) == 0)
> +        {
> +            /*
> +               We successfully set a watch on memory/target:
> +               now we can stop watching root
> +            */
> +            unregister_xenbus_watch(&root_watch);
> +            balloon_xenbus_init=1;
> +        }
> +        else
> +        {
> +            return;
> +        }
> +    }
> +
> +    err = xenbus_scanf("memory", "target", "%lu", &new_target);
> +
> +    if(err != 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 != target_pages)
    set_new_target(new_target >> PAGE_SHIFT);
regards,
aq
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
 |   
 
 | 
    | 
  
  
    |   | 
    |