All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Lindig <christian.lindig@citrix.com>
To: Ian Jackson <Ian.Jackson@citrix.com>
Cc: Xen-devel <xen-devel@lists.xenproject.org>,
	Jonathan Ludlam <Jonathan.Ludlam@citrix.com>,
	Roger Pau Monne <roger.pau@citrix.com>,
	Wei Liu <wei.liu2@citrix.com>,
	"dave@recoil.org" <dave@recoil.org>
Subject: Re: [PATCH for-4.9 2/2] oxenstored: make it work on FreeBSD
Date: Tue, 18 Apr 2017 10:22:45 +0000	[thread overview]
Message-ID: <CFB8AD83-E9AB-441B-8E7F-A73B3F13BE5B@citrix.com> (raw)
In-Reply-To: <22773.59283.370168.112825@mariner.uk.xensource.com>


> On 18. Apr 2017, at 11:16, Ian Jackson <ian.jackson@eu.citrix.com> wrote:
> 
> Wei Liu writes ("[PATCH for-4.9 2/2] oxenstored: make it work on FreeBSD"):
>> Call the uname syscall to determine sysname and return device names
>> accordingly.
> ...
>> -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"
> 
> This isn't very good.  If this code wants to fail, it returns a string
> "nonexistent" which would then be used to construct pathnames, and
> actually accessed.
> 
> In Haskell one could simply leave the default case off, which would
> generate a runtime failure.  Is that possible in ocaml ?

In Ocaml you would either use “assert false” or raise a dedicated exception for the catch-all case. You would get a run-time Match_failure exception without but this is nasty. The current solution has the problem you describe.

— C 

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

  reply	other threads:[~2017-04-18 10:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-14 10:20 [PATCH for-4.9 0/2] oxenstored: make it work on FreeBSD Wei Liu
2017-04-14 10:20 ` [PATCH for-4.9 1/2] oxenstored: add an Unix syscall C extension Wei Liu
2017-04-18 10:14   ` Ian Jackson
2017-04-14 10:20 ` [PATCH for-4.9 2/2] oxenstored: make it work on FreeBSD Wei Liu
2017-04-14 10:32   ` [PATCH for-4.9] oxenstored: remove "_proc" in names Wei Liu
2017-04-18 10:15     ` Ian Jackson
2017-04-18 10:16   ` [PATCH for-4.9 2/2] oxenstored: make it work on FreeBSD Ian Jackson
2017-04-18 10:22     ` Christian Lindig [this message]
2017-04-18  9:46 ` [PATCH for-4.9 0/2] " Christian Lindig
2017-04-18  9:59   ` Wei Liu
2017-04-18 10:11     ` Christian Lindig
2017-04-18 10:11     ` Christian Lindig
2017-04-18 13:07       ` Wei Liu

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=CFB8AD83-E9AB-441B-8E7F-A73B3F13BE5B@citrix.com \
    --to=christian.lindig@citrix.com \
    --cc=Ian.Jackson@citrix.com \
    --cc=Jonathan.Ludlam@citrix.com \
    --cc=dave@recoil.org \
    --cc=roger.pau@citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /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.