From mboxrd@z Thu Jan 1 00:00:00 1970 From: NAHieu Subject: Re: problem using xenbus interface Date: Tue, 9 Aug 2005 12:14:21 +0900 Message-ID: <5d7aca9505080820141bfa2415@mail.gmail.com> References: <5d7aca9505080805267dce691b@mail.gmail.com> <1123554115.13481.15.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <1123554115.13481.15.camel@localhost.localdomain> 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: Rusty Russell Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On 8/9/05, Rusty Russell 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 =3D xenbus_scanf("/", "restart_mode", "%s", mode); >=20 > OK, if you start the xenstored with "--trace-file=3D/tmp/trace" you can > see what's happening in that file. >=20 > 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... >=20 > I would recommend the following: >=20 > 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. >=20 > 2) Use "restart-mode" not "restart_mode": we've chosen - over _ so far. >=20 > 3) Use the two args "restart-mode", "": that will be restart-mode inside > your domain's home directory, rather than at the top level. >=20 > > Another code like below also failed (I try to make a new node > > "/domain//test" with xenbus_mkdir): > > > > err =3D xenbus_mkdir("/", "test"); >=20 > 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