[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] libs/foreignmem: Fix/simplify errno handling for map_resource
commit d203dbd69f1a02577dd6fe571d72beb980c548a6 Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Wed Feb 3 15:43:35 2021 +0000 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Wed Feb 3 19:25:35 2021 +0000 libs/foreignmem: Fix/simplify errno handling for map_resource Simplify the FreeBSD and Linux logic, left in this state by the previous change. No functional change. Duplicate the FreeBSD logic for NetBSD, to maintain the uniform ABI for callers that EOPNOTSUPP covers all Xen/Kernel support. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Ian Jackson <iwj@xxxxxxxxxxxxxx> Release-Acked-by: Ian Jackson <iwj@xxxxxxxxxxxxxx> --- 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; -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |