From: Ian Jackson Subject: Re: [PATCH v2 3/5] hotplug/NetBSD: check type of file to attach from params Date: Fri, 27 Jul 2012 15:28:22 +0100 Message-ID: <20498.42374.427510.784028@mariner.uk.xensource.com> References: <1343332476-33765-1-git-send-email-roger.pau@citrix.com> <1343332476-33765-4-git-send-email-roger.pau@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1343332476-33765-4-git-send-email-roger.pau@citrix.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: Roger Pau Monne Cc: Christoph Egger , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org Roger Pau Monne writes ("[PATCH v2 3/5] hotplug/NetBSD: check type of file to attach from params"): > xend used to set the xenbus backend entry "type" to either "phy" or > "file", but now libxl sets it to "phy" for both file and block device. > We have to manually check for the type of the "param" filed in order > to detect if we are trying to attach a file or a block device. ... > diff --git a/tools/hotplug/NetBSD/block b/tools/hotplug/NetBSD/block > index cf5ff3a..31d9998 100644 > --- a/tools/hotplug/NetBSD/block > +++ b/tools/hotplug/NetBSD/block > @@ -19,8 +19,14 @@ error() { > > xpath=$1 > xstatus=$2 > -xtype=$(xenstore-read "$xpath/type") > xparams=$(xenstore-read "$xpath/params") > +if [ -b $xparams ]; then > + xtype="phy" > +elif [ -f $xparams ]; then > + xtype="file" > +else > + error "invalid file type" > +fi This seems to be likely to print strange messages as well as the intended message if xparams=''. And you should print the type you are complaining about in the error message. Ian.