From: Keir Fraser Subject: Re: [1/2] [XEN] gnttab: Add new op unmap_and_replace Date: Wed, 09 May 2007 13:55:08 +0100 Message-ID: References: <20070509113117.GB12586@gondor.apana.org.au> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20070509113117.GB12586@gondor.apana.org.au> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Herbert Xu , Xen Development Mailing List List-Id: xen-devel@lists.xenproject.org On 9/5/07 12:31, "Herbert Xu" wrote: > [XEN] gnttab: Add new op unmap_and_replace There's considerable code duplication in common/grant_table.c. Could we please somehow merge __gnttab_unmap() and __gnttab_unmap_and_replace(), because they only differ right now in the struct type they take, and in the function they call to do the actual unmap or unmap-and-replace work. Perhaps their wrappers could stuff a 'union structure' of some sort, with enough discrimination to ensure the correct underlying arch-specific function is called? We could even only supply unmap-and-replace functionality at the arch-specific interface and have new_addr==NULL/zero-pte mean we want the the old-style unmap semantics. Then the wrapper for unmap_op can stuff that field in the 'union structure' with zero to do the right thing. -- Keir