[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH for-4.15 2/2] libs/foreignmem: Fix/simplify errno handling for map_resource
Simplify the FreeBSD logic, and duplicate it for NetBSD as the userpace ABI appears to be to consistently provide EOPNOTSUPP for missing Xen/Kernel support. The Linux logic was contorted in what appears to be a deliberate attempt to skip the now-deleted logic for the EOPNOTSUPP case. Simplify it. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- CC: Ian Jackson <iwj@xxxxxxxxxxxxxx> CC: Wei Liu <wl@xxxxxxx> CC: Roger Pau Monné <roger.pau@xxxxxxxxxx> CC: Manuel Bouyer <bouyer@xxxxxxxxxx> --- tools/libs/foreignmemory/freebsd.c | 4 +--- tools/libs/foreignmemory/linux.c | 4 +--- tools/libs/foreignmemory/netbsd.c | 3 +++ 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/tools/libs/foreignmemory/freebsd.c b/tools/libs/foreignmemory/freebsd.c index 04bfa806b0..d94ea07862 100644 --- a/tools/libs/foreignmemory/freebsd.c +++ b/tools/libs/foreignmemory/freebsd.c @@ -133,9 +133,7 @@ int osdep_xenforeignmemory_map_resource(xenforeignmemory_handle *fmem, { int saved_errno; - if ( errno != ENOSYS ) - ; - else + if ( errno == ENOSYS ) errno = EOPNOTSUPP; if ( fres->addr ) diff --git a/tools/libs/foreignmemory/linux.c b/tools/libs/foreignmemory/linux.c index 050b9ed3a5..c1f35e2db7 100644 --- a/tools/libs/foreignmemory/linux.c +++ b/tools/libs/foreignmemory/linux.c @@ -325,9 +325,7 @@ int osdep_xenforeignmemory_map_resource( { int saved_errno; - if ( errno != fmem->unimpl_errno && errno != EOPNOTSUPP ) - ; - else + if ( errno == fmem->unimpl_errno ) errno = EOPNOTSUPP; if ( fres->addr ) diff --git a/tools/libs/foreignmemory/netbsd.c b/tools/libs/foreignmemory/netbsd.c index 565682e064..c0b1b8f79d 100644 --- a/tools/libs/foreignmemory/netbsd.c +++ b/tools/libs/foreignmemory/netbsd.c @@ -147,6 +147,9 @@ int osdep_xenforeignmemory_map_resource( rc = ioctl(fmem->fd, IOCTL_PRIVCMD_MMAP_RESOURCE, &mr); if ( rc ) { + if ( errno == ENOSYS ) + errno = EOPNOTSUPP; + if ( fres->addr ) { int saved_errno = errno; -- 2.11.0
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |