From: Wei Liu Subject: Re: [PATCH] ocaml/xs: prefer using character device Date: Wed, 2 Sep 2015 11:15:11 +0100 Message-ID: <20150902101511.GA18474@zion.uk.xensource.com> References: <1441132442-30166-1-git-send-email-cardoe@cardoe.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1441132442-30166-1-git-send-email-cardoe@cardoe.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Doug Goldstein Cc: wei.liu2@citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Tue, Sep 01, 2015 at 01:34:02PM -0500, Doug Goldstein wrote: > Since 9c89dc95201ffed5fead17b35754bf9440fdbdc0 libxenstore prefers using > /dev/xen/xenbus over /proc/xen/xenbus. This makes the OCaml xenstore > library contain the same preference. > > Signed-off-by: Doug Goldstein Release-acked-by: Wei Liu > --- > tools/ocaml/libs/xs/xs.ml | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/tools/ocaml/libs/xs/xs.ml b/tools/ocaml/libs/xs/xs.ml > index 5757571..7e14487 100644 > --- a/tools/ocaml/libs/xs/xs.ml > +++ b/tools/ocaml/libs/xs/xs.ml > @@ -162,7 +162,13 @@ let daemon_open () = > with _ -> raise Failed_to_connect > > let domain_open () = > - let path = "/proc/xen/xenbus" in > + let path = try > + let devpath = "/dev/xen/xenbus" in > + Unix.access devpath [ Unix.F_OK ]; > + devpath > + with Unix.Unix_error(_, _, _) -> > + "/proc/xen/xenbus" in > + > let fd = Unix.openfile path [ Unix.O_RDWR ] 0o550 in > Unix.set_close_on_exec fd; > make fd > -- > 2.1.4 > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel