From: Ian Jackson Subject: Re: [v5][PATCH 11/16] tools/libxl: detect and avoid conflicts with RDM Date: Tue, 7 Jul 2015 15:57:07 +0100 Message-ID: <21915.59587.186926.310968@mariner.uk.xensource.com> References: <1436249837-14747-1-git-send-email-tiejun.chen@intel.com> <1436249837-14747-12-git-send-email-tiejun.chen@intel.com> <21915.48835.512123.695897@mariner.uk.xensource.com> <559BE7A8.3020007@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <559BE7A8.3020007@intel.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: "Chen, Tiejun" Cc: Stefano Stabellini , Wei Liu , Ian Campbell , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org Chen, Tiejun writes ("Re: [v5][PATCH 11/16] tools/libxl: detect and avoid conflicts with RDM"): > On 2015/7/7 19:57, Ian Jackson wrote: > > I think the error handling here is wrong. Certainly `rc' should not > > be used for a libxc return. > > Nope, we don't return rc directly. In any case of error, rc is reset as > "ERROR_FAIL" finally. Did you see > > See tools/libxl/CODING_STYLE. I know that much of the existing code > > uses rc for libxc returns but this is deprecated, and please don't > > make more of it. this ? > >> + if (errno == ENOBUFS) { > >> + *xrdm = libxl__malloc(gc, > >> + *nr_entries * > >> + sizeof(xen_reserved_device_memory_t)); > >> + rc = xc_reserved_device_memory_map(CTX->xch, flag, seg, bus, devfn, > >> + *xrdm, nr_entries); > > > > This might be less code, and a bit clearer, if it were a loop rather > > than two calls with the second in an if. > > Sorry I can't understand completely what you want to do. I meant that you could have a loop containing one call to xc_reserved_device_memory_map. The loop would normally execute twice. But it was just a suggestion. If you don't want to do it that way, the existing arrangement is tolerable. > if (errno != ENOBUFS) { > rc = ERROR_FAIL; > goto out; > } That would be clearer, yes. Ian.