Message ID | 20170831093605.2757-5-paul.durrant@citrix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Aug 31, 2017 at 10:35:57AM +0100, Paul Durrant wrote: > By using a static inline stub in private.h for OS where this functionality > is not implemented, the various duplicate stubs in the OS-specific source > modules can be avoided. Ouch, forget my comment in the previous patch, haven't seen that one. > > Signed-off-by: Paul Durrant <paul.durrant@citrix.com> > --- > Cc: Ian Jackson <ian.jackson@eu.citrix.com> > Cc: Wei Liu <wei.liu2@citrix.com> > > v3: > - Patch added in response to review comments. > --- > tools/libs/foreignmemory/minios.c | 7 ------- > tools/libs/foreignmemory/netbsd.c | 7 ------- > tools/libs/foreignmemory/private.h | 12 +++++++++--- > tools/libs/foreignmemory/solaris.c | 7 ------- You forgot the one in freebsd.c. With that added (or rather removed): Reviewed-by: Roger Pau Monné <roger.pau@citrix.com> Roger.
> -----Original Message----- > From: Roger Pau Monne > Sent: 04 September 2017 11:48 > To: Paul Durrant <Paul.Durrant@citrix.com> > Cc: xen-devel@lists.xenproject.org; Wei Liu <wei.liu2@citrix.com>; Ian > Jackson <Ian.Jackson@citrix.com> > Subject: Re: [Xen-devel] [PATCH v3 04/12] tools/libxenforeignmemory: > reduce xenforeignmemory_restrict code footprint > > On Thu, Aug 31, 2017 at 10:35:57AM +0100, Paul Durrant wrote: > > By using a static inline stub in private.h for OS where this functionality > > is not implemented, the various duplicate stubs in the OS-specific source > > modules can be avoided. > > Ouch, forget my comment in the previous patch, haven't seen that one. > > > > > Signed-off-by: Paul Durrant <paul.durrant@citrix.com> > > --- > > Cc: Ian Jackson <ian.jackson@eu.citrix.com> > > Cc: Wei Liu <wei.liu2@citrix.com> > > > > v3: > > - Patch added in response to review comments. > > --- > > tools/libs/foreignmemory/minios.c | 7 ------- > > tools/libs/foreignmemory/netbsd.c | 7 ------- > > tools/libs/foreignmemory/private.h | 12 +++++++++--- > > tools/libs/foreignmemory/solaris.c | 7 ------- > > You forgot the one in freebsd.c. With that added (or rather removed): > So I did. > Reviewed-by: Roger Pau Monné <roger.pau@citrix.com> > Thanks, Paul > Roger.
diff --git a/tools/libs/foreignmemory/minios.c b/tools/libs/foreignmemory/minios.c index 75f340122e..43341ca301 100644 --- a/tools/libs/foreignmemory/minios.c +++ b/tools/libs/foreignmemory/minios.c @@ -58,13 +58,6 @@ int osdep_xenforeignmemory_unmap(xenforeignmemory_handle *fmem, return munmap(addr, num << PAGE_SHIFT); } -int osdep_xenforeignmemory_restrict(xenforeignmemory_handle *fmem, - domid_t domid) -{ - errno = -EOPNOTSUPP; - return -1; -} - /* * Local variables: * mode: C diff --git a/tools/libs/foreignmemory/netbsd.c b/tools/libs/foreignmemory/netbsd.c index 9bf95ef4f0..54a418ebd6 100644 --- a/tools/libs/foreignmemory/netbsd.c +++ b/tools/libs/foreignmemory/netbsd.c @@ -100,13 +100,6 @@ int osdep_xenforeignmemory_unmap(xenforeignmemory_handle *fmem, return munmap(addr, num*XC_PAGE_SIZE); } -int osdep_xenforeignmemory_restrict(xenforeignmemory_handle *fmem, - domid_t domid) -{ - errno = -EOPNOTSUPP; - return -1; -} - /* * Local variables: * mode: C diff --git a/tools/libs/foreignmemory/private.h b/tools/libs/foreignmemory/private.h index 9ff94b724d..8a8d48d2da 100644 --- a/tools/libs/foreignmemory/private.h +++ b/tools/libs/foreignmemory/private.h @@ -32,9 +32,6 @@ void *osdep_xenforeignmemory_map(xenforeignmemory_handle *fmem, int osdep_xenforeignmemory_unmap(xenforeignmemory_handle *fmem, void *addr, size_t num); -int osdep_xenforeignmemory_restrict(xenforeignmemory_handle *fmem, - domid_t domid); - #if defined(__NetBSD__) || defined(__sun__) /* Strictly compat for those two only only */ void *compat_mapforeign_batch(xenforeignmem_handle *fmem, uint32_t dom, @@ -54,6 +51,13 @@ struct xenforeignmemory_resource_handle { }; #ifndef __linux__ +static inline int osdep_xenforeignmemory_restrict(xenforeignmemory_handle *fmem, + domid_t domid) +{ + errno = EOPNOTSUPP; + return -1; +} + static inline int osdep_xenforeignmemory_map_resource( xenforeignmemory_handle *fmem, xenforeignmemory_resource_handle *fres) { @@ -66,6 +70,8 @@ static inline void osdep_xenforeignmemory_unmap_resource( { } #else +int osdep_xenforeignmemory_restrict(xenforeignmemory_handle *fmem, + domid_t domid); int osdep_xenforeignmemory_map_resource( xenforeignmemory_handle *fmem, xenforeignmemory_resource_handle *fres); void osdep_xenforeignmemory_unmap_resource( diff --git a/tools/libs/foreignmemory/solaris.c b/tools/libs/foreignmemory/solaris.c index a33decb4ae..ee8aae4fbd 100644 --- a/tools/libs/foreignmemory/solaris.c +++ b/tools/libs/foreignmemory/solaris.c @@ -97,13 +97,6 @@ int osdep_xenforeignmemory_unmap(xenforeignmemory_handle *fmem, return munmap(addr, num*XC_PAGE_SIZE); } -int osdep_xenforeignmemory_restrict(xenforeignmemory_handle *fmem, - domid_t domid) -{ - errno = -EOPNOTSUPP; - return -1; -} - /* * Local variables: * mode: C
By using a static inline stub in private.h for OS where this functionality is not implemented, the various duplicate stubs in the OS-specific source modules can be avoided. Signed-off-by: Paul Durrant <paul.durrant@citrix.com> --- Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Wei Liu <wei.liu2@citrix.com> v3: - Patch added in response to review comments. --- tools/libs/foreignmemory/minios.c | 7 ------- tools/libs/foreignmemory/netbsd.c | 7 ------- tools/libs/foreignmemory/private.h | 12 +++++++++--- tools/libs/foreignmemory/solaris.c | 7 ------- 4 files changed, 9 insertions(+), 24 deletions(-)