All of lore.kernel.org
 help / color / mirror / Atom feed
From: NAHieu <nahieu@gmail.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: xen-devel@lists.xensource.com
Subject: Re: problem using xenbus interface
Date: Tue, 9 Aug 2005 12:14:21 +0900	[thread overview]
Message-ID: <5d7aca9505080820141bfa2415@mail.gmail.com> (raw)
In-Reply-To: <1123554115.13481.15.camel@localhost.localdomain>

On 8/9/05, Rusty Russell <rusty@rustcorp.com.au> 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

  parent reply	other threads:[~2005-08-09  3:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-08 12:26 problem using xenbus interface NAHieu
2005-08-08 13:39 ` Dan Smith
2005-08-09  6:47   ` aq
2005-08-09  2:21 ` Rusty Russell
2005-08-09  2:53   ` NAHieu
2005-08-09  3:14   ` NAHieu [this message]
2005-08-09  3:34   ` NAHieu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5d7aca9505080820141bfa2415@mail.gmail.com \
    --to=nahieu@gmail.com \
    --cc=rusty@rustcorp.com.au \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.