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

Re: [Xen-devel] problem using xenbus interface

To: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] problem using xenbus interface
From: NAHieu <nahieu@xxxxxxxxx>
Date: Tue, 9 Aug 2005 12:14:21 +0900
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 09 Aug 2005 03:12:42 +0000
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=H3jTyU7qnBx4QFOYQw9szccUN8kOxj+KP2wS6srwXhzD8NM3oRPDIy9IhBIxtR/L/jITBMBZMTBW1XINmiw8SV136jsGiuPCwiL+pDPSnhYn/RhG485KAxVR7p8YuYdvQXeEyWx9AbcneEiX/S8Ty2UvMAvNDKA5SFYK0nfavL0=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1123554115.13481.15.camel@xxxxxxxxxxxxxxxxxxxxx>
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>
References: <5d7aca9505080805267dce691b@xxxxxxxxxxxxxx> <1123554115.13481.15.camel@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On 8/9/05, Rusty Russell <rusty@xxxxxxxxxxxxxxx> wrote:
> On Mon, 2005-08-08 at 21:26 +0900, NAHieu wrote:
> > Hello,
> >
> > I a writing a small kernel module for domU, in which I use xenbus and
> > have some problems:
> >
> > I use xenbus_scanf to read value of "/restart_mode", but the below
> > code always failed (got non-zero err)
> >
> > err = xenbus_scanf("/", "restart_mode", "%s", mode);
> 
> OK, if you start the xenstored with "--trace-file=/tmp/trace" you can
> see what's happening in that file.
> 
> In this case, it's actually a bug in xenbus_scanf: it will ask to read
> "//restart_mode" which is an invalid path since it has two "/" in a row.
> But it's not a big problem because you shouldn't be writing in the top
> level directory anyway...
> 
> I would recommend the following:
> 
> 1) Use xenbus_read here, not xenbus_scanf, since you are just reading a
> single string and xenbus_read won't overflow on long strings.
> 
> 2) Use "restart-mode" not "restart_mode": we've chosen - over _ so far.
> 
> 3) Use the two args "restart-mode", "": that will be restart-mode inside
> your domain's home directory, rather than at the top level.
> 
> > Another code like below also failed (I try to make a new node
> > "/domain/<DOM>/test" with xenbus_mkdir):
> >
> > err = xenbus_mkdir("/", "test");
> 
> Same problem: it would be "xenbus_mkdir("/test", "")" and you probably
> don't want to do that at the top level anyway (when we turn permission
> checking back on, that will not work).

Sorry, I have another question here: suppose that it is fine (ok, I
know I should not do that), what are the difference between:

xenbus_mkdir("/", "test");

and:

xenbus_mkdir("/test", "");


Dont they do the same thing??

I am confused here: why xenbus_mkdir() needs 2 args? Why we dont use
just one arg, like:

xenbus_mkdir("/test")


Is that not more intuitive?

Many thanks,
NAH

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