From: Ian Campbell Subject: Re: [PATCH v6 5/5] xen: introduce XENMEM_pin Date: Mon, 30 Sep 2013 14:02:50 +0100 Message-ID: <1380546170.1302.43.camel@kazak.uk.xensource.com> References: <1380298560-29352-5-git-send-email-stefano.stabellini@eu.citrix.com> <5249475C02000078000F7E43@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VQdHg-0005N0-SH for xen-devel@lists.xenproject.org; Mon, 30 Sep 2013 13:13:09 +0000 In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini Cc: xen-devel , tim@xen.org, Jan Beulich List-Id: xen-devel@lists.xenproject.org On Mon, 2013-09-30 at 13:56 +0100, Stefano Stabellini wrote: > On Mon, 30 Sep 2013, Jan Beulich wrote: > > > + > > > + if ( !is_hardware_domain(d) ) > > > + { > > > + rc = -EPERM; > > > + goto fail; > > > + } > > > + > > > + memflags |= MEMF_bits(domain_clamp_alloc_bitsize( > > > + d, > > > + XENMEMF_get_address_bits(pin.in.mem_flags) ? : > > > + (BITS_PER_LONG+PAGE_SHIFT))); > > > + > > > + for ( ; i < pin.in.nr_extents; i++ ) > > > + { > > > + if ( unlikely(__copy_from_guest_offset( > > > + &gpfn, pin.in.extent_start, i, 1)) ) > > > + { > > > + rc = -EFAULT; > > > + goto fail; > > > + } > > > + > > > + if ( generic_fls64(gpfn << PAGE_SHIFT) > memflags ) > > > > Didn't you mean MEMF_bits(memflags) here? > > memflags is set to MEMF_bits(XXX) in the assignment above memflags is quite a confusing name for such a variable and/or implicitly relying on this internal knowledge of the flags layout later is overly subtle. If you don't want to use the accessor as Jan suggested perhaps membits or just bits would be a better variable name, omitting the MEMF_bits "wrapper" until the actual callsite which needs it or keep memflags separately. Ian.