[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH for-4.9 0/2] oxenstored: make it work on FreeBSD



On Tue, Apr 18, 2017 at 10:46:15AM +0100, Christian Lindig wrote:
> 
> > On 14. Apr 2017, at 11:20, Wei Liu <wei.liu2@xxxxxxxxxx> wrote:
> > 
> > Unfortunately there is an easy way to determine system name in the standard
> > library so I wrote a wrapper for uname syscall.
> 
> I think there are two solutions to using the correct path:
> 
> (1) Determine the path at compile time and use the mechanism in config.ml to 
> read the path at startup.
> 
> https://github.com/mirage/xen/blob/master/tools/ocaml/xenstored/oxenstored.conf.in
> https://github.com/mirage/xen/blob/master/tools/ocaml/xenstored/xenstored.ml#L90
> 

Forgive my ignorance for the Ocaml ecosystem, but I can't seem to find a
way to conditionally compile ocaml source code easily.

Presumably you mean "Determine the path at *configure* time"?  Even if
we make those configurable, there should still be two default values in
define.ml -- what should they be?

All in all I don't think it is nice to require extra configurations when
all relevant information is already available during build phase and run
time.

> (2) Determine the path at runtime and this is what the patch does by using 
> uname:
> 
> -let xenstored_proc_kva = "/proc/xen/xsd_kva"
> -let xenstored_proc_port = "/proc/xen/xsd_port"
> +let xenstored_proc_kva =
> +  let info = Unix_syscalls.uname () in
> +  match info.sysname with
> +  | "Linux" -> "/proc/xen/xsd_kva"
> +  | "FreeBSD" -> "/dev/xen/xenstored"
> +  | _ -> "nonexistent"
> +let xenstored_proc_port =
> +  let info = Unix_syscalls.uname () in
> +  match info.sysname with
> +  | "Linux" -> "/proc/xen/xsd_port"
> +  | "FreeBSD" -> "/dev/xen/xenstored"
> +  | _ -> "nonexistent"
> 
> I wonder whether this could be simplified without binding a system
> call in C by simply checking the presence of the two paths (using
> Sys.is_directory) and picking the one that does exist. In general I’m
> in favour of (1) but would also consider a simple run-time check.

I am fine with checking the paths using Sys.is_directory.

Wei.

> 
> - Christian
> 
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.