From nobody Mon Feb 9 16:45:10 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1610638722; cv=none; d=zohomail.com; s=zohoarc; b=WMkaimhzUEMgl4CTps7KHnhm1JxcRUxhqeTjSzI/ElGFWjL5qYWgHfyhsXj/j8m7NgLCYTYRZNrfdDNciV7f3Jr7LweTjznmWnipxXmHxijtFvguufr6SpORfZXyKU6b96SUgjQp8jSlOAGz+rktswCjj5aGa1ytU11FQh5I+cI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610638722; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SXeWCVLCNKqb1BhBiMbLtSi4Q/AfWDsC5gfu3rKZsDc=; b=hCKR48LzT2OonebtB2I8DQ63uDJlPoSOViY/RmsUsr2Hu9656RDUL4GQvSCHN9pMlRlxjhm1J9gS7VFkiWJiWR5DFCUPwPHf3zQU8qdtgYoioPm6nv+9r/DTJyUtPJGAtBAkeMhM7d8vh7dPIo/bmc4BUE1k/URXZEFIW1wRF0A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1610638722508692.8948897183316; Thu, 14 Jan 2021 07:38:42 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.67206.119789 (Exim 4.92) (envelope-from ) id 1l04he-0002qe-ES; Thu, 14 Jan 2021 15:38:26 +0000 Received: by outflank-mailman (output) from mailman id 67206.119789; Thu, 14 Jan 2021 15:38:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l04he-0002qN-5v; Thu, 14 Jan 2021 15:38:26 +0000 Received: by outflank-mailman (input) for mailman id 67206; Thu, 14 Jan 2021 15:38:24 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l04hc-0002Sh-Ij for xen-devel@lists.xenproject.org; Thu, 14 Jan 2021 15:38:24 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id e2c593fc-66b5-45df-aa7b-b094302478c0; Thu, 14 Jan 2021 15:38:07 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id F3043AE39; Thu, 14 Jan 2021 15:38:06 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: e2c593fc-66b5-45df-aa7b-b094302478c0 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1610638687; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SXeWCVLCNKqb1BhBiMbLtSi4Q/AfWDsC5gfu3rKZsDc=; b=bu39cAjn9t4Xv+wen9mSUS2t5b5MYNJTbscgiBqCCULeRnGoGCeqFjmspXml/IKPsXc3sL yCHl1Ni0ikqUtD2gUfnxEOZ/W9Vl45as1oBlfX9hnXefmf+gRT9pgyTuWrFGjYR0GxGhVg qxlR8spRUsbvN04CcjF9aCvMZ/5DOZg= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Ian Jackson , Wei Liu Subject: [PATCH v11 01/27] tools/libxenevtchn: switch to standard xen coding style Date: Thu, 14 Jan 2021 16:37:37 +0100 Message-Id: <20210114153803.2591-2-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210114153803.2591-1-jgross@suse.com> References: <20210114153803.2591-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" There is a mixture of different styles in libxenevtchn. Use the standard xen style only. No functional change. Signed-off-by: Juergen Gross Acked-by: Andrew Cooper , although if whoever --- V11: - new patch --- tools/libs/evtchn/core.c | 24 +++++---- tools/libs/evtchn/freebsd.c | 25 +++++++--- tools/libs/evtchn/linux.c | 4 ++ tools/libs/evtchn/minios.c | 98 +++++++++++++++++++++++++++---------- tools/libs/evtchn/netbsd.c | 22 ++++++--- tools/libs/evtchn/solaris.c | 12 +++-- 6 files changed, 131 insertions(+), 54 deletions(-) diff --git a/tools/libs/evtchn/core.c b/tools/libs/evtchn/core.c index aff6ecfaa0..5008810f4f 100644 --- a/tools/libs/evtchn/core.c +++ b/tools/libs/evtchn/core.c @@ -18,10 +18,11 @@ =20 #include "private.h" =20 -static int all_restrict_cb(Xentoolcore__Active_Handle *ah, domid_t domid) { +static int all_restrict_cb(Xentoolcore__Active_Handle *ah, domid_t domid) +{ xenevtchn_handle *xce =3D CONTAINER_OF(ah, *xce, tc_ah); =20 - if (xce->fd < 0) + if ( xce->fd < 0 ) /* just in case */ return 0; =20 @@ -33,7 +34,8 @@ xenevtchn_handle *xenevtchn_open(xentoollog_logger *logge= r, unsigned open_flags) xenevtchn_handle *xce =3D malloc(sizeof(*xce)); int rc; =20 - if (!xce) return NULL; + if ( !xce ) + return NULL; =20 xce->fd =3D -1; xce->logger =3D logger; @@ -42,23 +44,26 @@ xenevtchn_handle *xenevtchn_open(xentoollog_logger *log= ger, unsigned open_flags) xce->tc_ah.restrict_callback =3D all_restrict_cb; xentoolcore__register_active_handle(&xce->tc_ah); =20 - if (!xce->logger) { - xce->logger =3D xce->logger_tofree =3D - (xentoollog_logger*) + if ( !xce->logger ) + { + xce->logger =3D xce->logger_tofree =3D (xentoollog_logger *) xtl_createlogger_stdiostream(stderr, XTL_PROGRESS, 0); - if (!xce->logger) goto err; + if ( !xce->logger ) + goto err; } =20 rc =3D osdep_evtchn_open(xce); - if ( rc < 0 ) goto err; + if ( rc < 0 ) + goto err; =20 return xce; =20 -err: + err: xentoolcore__deregister_active_handle(&xce->tc_ah); osdep_evtchn_close(xce); xtl_logger_destroy(xce->logger_tofree); free(xce); + return NULL; } =20 @@ -73,6 +78,7 @@ int xenevtchn_close(xenevtchn_handle *xce) rc =3D osdep_evtchn_close(xce); xtl_logger_destroy(xce->logger_tofree); free(xce); + return rc; } =20 diff --git a/tools/libs/evtchn/freebsd.c b/tools/libs/evtchn/freebsd.c index 6564ed4c44..554af122c8 100644 --- a/tools/libs/evtchn/freebsd.c +++ b/tools/libs/evtchn/freebsd.c @@ -34,9 +34,12 @@ int osdep_evtchn_open(xenevtchn_handle *xce) { int fd =3D open(EVTCHN_DEV, O_RDWR|O_CLOEXEC); + if ( fd =3D=3D -1 ) return -1; + xce->fd =3D fd; + return 0; } =20 @@ -51,6 +54,7 @@ int osdep_evtchn_close(xenevtchn_handle *xce) int osdep_evtchn_restrict(xenevtchn_handle *xce, domid_t domid) { errno =3D -EOPNOTSUPP; + return -1; } =20 @@ -69,7 +73,8 @@ int xenevtchn_notify(xenevtchn_handle *xce, evtchn_port_t= port) return ioctl(fd, IOCTL_EVTCHN_NOTIFY, ¬ify); } =20 -xenevtchn_port_or_error_t xenevtchn_bind_unbound_port(xenevtchn_handle *xc= e, uint32_t domid) +xenevtchn_port_or_error_t xenevtchn_bind_unbound_port(xenevtchn_handle *xc= e, + uint32_t domid) { int ret, fd =3D xce->fd; struct ioctl_evtchn_bind_unbound_port bind; @@ -77,11 +82,13 @@ xenevtchn_port_or_error_t xenevtchn_bind_unbound_port(x= enevtchn_handle *xce, uin bind.remote_domain =3D domid; =20 ret =3D ioctl(fd, IOCTL_EVTCHN_BIND_UNBOUND_PORT, &bind); - return ( ret =3D=3D 0 ) ? bind.port : ret; + + return ret ?: bind.port; } =20 -xenevtchn_port_or_error_t -xenevtchn_bind_interdomain(xenevtchn_handle *xce, uint32_t domid, evtchn_p= ort_t remote_port) +xenevtchn_port_or_error_t xenevtchn_bind_interdomain(xenevtchn_handle *xce, + uint32_t domid, + evtchn_port_t remote_= port) { int ret, fd =3D xce->fd; struct ioctl_evtchn_bind_interdomain bind; @@ -90,10 +97,12 @@ xenevtchn_bind_interdomain(xenevtchn_handle *xce, uint3= 2_t domid, evtchn_port_t bind.remote_port =3D remote_port; =20 ret =3D ioctl(fd, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind); - return ( ret =3D=3D 0 ) ? bind.port : ret; + + return ret ?: bind.port; } =20 -xenevtchn_port_or_error_t xenevtchn_bind_virq(xenevtchn_handle *xce, unsig= ned int virq) +xenevtchn_port_or_error_t xenevtchn_bind_virq(xenevtchn_handle *xce, + unsigned int virq) { int ret, fd =3D xce->fd; struct ioctl_evtchn_bind_virq bind; @@ -101,7 +110,8 @@ xenevtchn_port_or_error_t xenevtchn_bind_virq(xenevtchn= _handle *xce, unsigned in bind.virq =3D virq; =20 ret =3D ioctl(fd, IOCTL_EVTCHN_BIND_VIRQ, &bind); - return ( ret =3D=3D 0 ) ? bind.port : ret; + + return ret ?: bind.port; } =20 int xenevtchn_unbind(xenevtchn_handle *xce, evtchn_port_t port) @@ -131,6 +141,7 @@ int xenevtchn_unmask(xenevtchn_handle *xce, evtchn_port= _t port) =20 if ( write(fd, &port, sizeof(port)) !=3D sizeof(port) ) return -1; + return 0; } =20 diff --git a/tools/libs/evtchn/linux.c b/tools/libs/evtchn/linux.c index 17e64aea32..4582a58ec4 100644 --- a/tools/libs/evtchn/linux.c +++ b/tools/libs/evtchn/linux.c @@ -37,9 +37,12 @@ int osdep_evtchn_open(xenevtchn_handle *xce) { int fd =3D open("/dev/xen/evtchn", O_RDWR|O_CLOEXEC); + if ( fd =3D=3D -1 ) return -1; + xce->fd =3D fd; + return 0; } =20 @@ -135,6 +138,7 @@ int xenevtchn_unmask(xenevtchn_handle *xce, evtchn_port= _t port) =20 if ( write(fd, &port, sizeof(port)) !=3D sizeof(port) ) return -1; + return 0; } =20 diff --git a/tools/libs/evtchn/minios.c b/tools/libs/evtchn/minios.c index 9cd7636fc5..8e9f77bb6b 100644 --- a/tools/libs/evtchn/minios.c +++ b/tools/libs/evtchn/minios.c @@ -43,22 +43,28 @@ extern void minios_evtchn_close_fd(int fd); extern struct wait_queue_head event_queue; =20 /* XXX Note: This is not threadsafe */ -static struct evtchn_port_info* port_alloc(int fd) { +static struct evtchn_port_info* port_alloc(int fd) +{ struct evtchn_port_info *port_info; + port_info =3D malloc(sizeof(struct evtchn_port_info)); - if (port_info =3D=3D NULL) + if ( port_info =3D=3D NULL ) return NULL; + port_info->pending =3D 0; port_info->port =3D -1; port_info->bound =3D 0; =20 LIST_INSERT_HEAD(&files[fd].evtchn.ports, port_info, list); + return port_info; } =20 -static void port_dealloc(struct evtchn_port_info *port_info) { - if (port_info->bound) +static void port_dealloc(struct evtchn_port_info *port_info) +{ + if ( port_info->bound ) unbind_evtchn(port_info->port); + LIST_REMOVE(port_info, list); free(port_info); } @@ -66,11 +72,14 @@ static void port_dealloc(struct evtchn_port_info *port_= info) { int osdep_evtchn_open(xenevtchn_handle *xce) { int fd =3D alloc_fd(FTYPE_EVTCHN); + if ( fd =3D=3D -1 ) return -1; + LIST_INIT(&files[fd].evtchn.ports); xce->fd =3D fd; printf("evtchn_open() -> %d\n", fd); + return 0; } =20 @@ -85,12 +94,14 @@ int osdep_evtchn_close(xenevtchn_handle *xce) int osdep_evtchn_restrict(xenevtchn_handle *xce, domid_t domid) { errno =3D -EOPNOTSUPP; + return -1; } =20 void minios_evtchn_close_fd(int fd) { struct evtchn_port_info *port_info, *tmp; + LIST_FOREACH_SAFE(port_info, &files[fd].evtchn.ports, list, tmp) port_dealloc(port_info); =20 @@ -108,10 +119,12 @@ int xenevtchn_notify(xenevtchn_handle *xce, evtchn_po= rt_t port) =20 ret =3D notify_remote_via_evtchn(port); =20 - if (ret < 0) { + if (ret < 0) + { errno =3D -ret; ret =3D -1; } + return ret; } =20 @@ -119,12 +132,15 @@ static void evtchn_handler(evtchn_port_t port, struct= pt_regs *regs, void *data) { int fd =3D (int)(intptr_t)data; struct evtchn_port_info *port_info; + assert(files[fd].type =3D=3D FTYPE_EVTCHN); mask_evtchn(port); - LIST_FOREACH(port_info, &files[fd].evtchn.ports, list) { - if (port_info->port =3D=3D port) + LIST_FOREACH(port_info, &files[fd].evtchn.ports, list) + { + if ( port_info->port =3D=3D port ) goto found; } + printk("Unknown port for handle %d\n", fd); return; =20 @@ -134,7 +150,8 @@ static void evtchn_handler(evtchn_port_t port, struct p= t_regs *regs, void *data) wake_up(&event_queue); } =20 -xenevtchn_port_or_error_t xenevtchn_bind_unbound_port(xenevtchn_handle *xc= e, uint32_t domid) +xenevtchn_port_or_error_t xenevtchn_bind_unbound_port(xenevtchn_handle *xc= e, + uint32_t domid) { int fd =3D xce->fd; struct evtchn_port_info *port_info; @@ -143,26 +160,31 @@ xenevtchn_port_or_error_t xenevtchn_bind_unbound_port= (xenevtchn_handle *xce, uin =20 assert(get_current() =3D=3D main_thread); port_info =3D port_alloc(fd); - if (port_info =3D=3D NULL) + if ( port_info =3D=3D NULL ) return -1; =20 printf("xenevtchn_bind_unbound_port(%d)", domid); - ret =3D evtchn_alloc_unbound(domid, evtchn_handler, (void*)(intptr_t)f= d, &port); + ret =3D evtchn_alloc_unbound(domid, evtchn_handler, + (void *)(intptr_t)fd, &port); printf(" =3D %d\n", ret); =20 - if (ret < 0) { + if ( ret < 0 ) + { port_dealloc(port_info); errno =3D -ret; return -1; } + port_info->bound =3D 1; port_info->port =3D port; unmask_evtchn(port); + return port; } =20 -xenevtchn_port_or_error_t xenevtchn_bind_interdomain(xenevtchn_handle *xce= , uint32_t domid, - evtchn_port_t remote_por= t) +xenevtchn_port_or_error_t xenevtchn_bind_interdomain(xenevtchn_handle *xce, + uint32_t domid, + evtchn_port_t remote_= port) { int fd =3D xce->fd; struct evtchn_port_info *port_info; @@ -171,21 +193,25 @@ xenevtchn_port_or_error_t xenevtchn_bind_interdomain(= xenevtchn_handle *xce, uint =20 assert(get_current() =3D=3D main_thread); port_info =3D port_alloc(fd); - if (port_info =3D=3D NULL) + if ( port_info =3D=3D NULL ) return -1; =20 printf("xenevtchn_bind_interdomain(%d, %"PRId32")", domid, remote_port= ); - ret =3D evtchn_bind_interdomain(domid, remote_port, evtchn_handler, (v= oid*)(intptr_t)fd, &local_port); + ret =3D evtchn_bind_interdomain(domid, remote_port, evtchn_handler, + (void *)(intptr_t)fd, &local_port); printf(" =3D %d\n", ret); =20 - if (ret < 0) { + if ( ret < 0 ) + { port_dealloc(port_info); errno =3D -ret; return -1; } + port_info->bound =3D 1; port_info->port =3D local_port; unmask_evtchn(local_port); + return local_port; } =20 @@ -194,18 +220,24 @@ int xenevtchn_unbind(xenevtchn_handle *xce, evtchn_po= rt_t port) int fd =3D xce->fd; struct evtchn_port_info *port_info; =20 - LIST_FOREACH(port_info, &files[fd].evtchn.ports, list) { - if (port_info->port =3D=3D port) { + LIST_FOREACH(port_info, &files[fd].evtchn.ports, list) + { + if ( port_info->port =3D=3D port ) + { port_dealloc(port_info); return 0; } } - printf("Warning: couldn't find port %"PRId32" for xc handle %x\n", por= t, fd); + + printf("Warning: couldn't find port %"PRId32" for xc handle %x\n", + port, fd); errno =3D EINVAL; + return -1; } =20 -xenevtchn_port_or_error_t xenevtchn_bind_virq(xenevtchn_handle *xce, unsig= ned int virq) +xenevtchn_port_or_error_t xenevtchn_bind_virq(xenevtchn_handle *xce, + unsigned int virq) { int fd =3D xce->fd; struct evtchn_port_info *port_info; @@ -213,21 +245,24 @@ xenevtchn_port_or_error_t xenevtchn_bind_virq(xenevtc= hn_handle *xce, unsigned in =20 assert(get_current() =3D=3D main_thread); port_info =3D port_alloc(fd); - if (port_info =3D=3D NULL) + if ( port_info =3D=3D NULL ) return -1; =20 printf("xenevtchn_bind_virq(%d)", virq); - port =3D bind_virq(virq, evtchn_handler, (void*)(intptr_t)fd); + port =3D bind_virq(virq, evtchn_handler, (void *)(intptr_t)fd); printf(" =3D %d\n", port); =20 - if (port < 0) { + if ( port < 0 ) + { port_dealloc(port_info); errno =3D -port; return -1; } + port_info->bound =3D 1; port_info->port =3D port; unmask_evtchn(port); + return port; } =20 @@ -239,26 +274,35 @@ xenevtchn_port_or_error_t xenevtchn_pending(xenevtchn= _handle *xce) evtchn_port_t ret =3D -1; =20 local_irq_save(flags); + files[fd].read =3D 0; =20 - LIST_FOREACH(port_info, &files[fd].evtchn.ports, list) { - if (port_info->port !=3D -1 && port_info->pending) { - if (ret =3D=3D -1) { + LIST_FOREACH(port_info, &files[fd].evtchn.ports, list) + { + if ( port_info->port !=3D -1 && port_info->pending ) + { + if ( ret =3D=3D -1 ) + { ret =3D port_info->port; port_info->pending =3D 0; - } else { + } + else + { files[fd].read =3D 1; break; } } } + local_irq_restore(flags); + return ret; } =20 int xenevtchn_unmask(xenevtchn_handle *xce, evtchn_port_t port) { unmask_evtchn(port); + return 0; } =20 diff --git a/tools/libs/evtchn/netbsd.c b/tools/libs/evtchn/netbsd.c index 8b8545d2f9..53f9299ebb 100644 --- a/tools/libs/evtchn/netbsd.c +++ b/tools/libs/evtchn/netbsd.c @@ -34,9 +34,12 @@ int osdep_evtchn_open(xenevtchn_handle *xce) { int fd =3D open(EVTCHN_DEV_NAME, O_NONBLOCK|O_RDWR); + if ( fd =3D=3D -1 ) return -1; + xce->fd =3D fd; + return 0; } =20 @@ -51,6 +54,7 @@ int osdep_evtchn_close(xenevtchn_handle *xce) int osdep_evtchn_restrict(xenevtchn_handle *xce, domid_t domid) { errno =3D -EOPNOTSUPP; + return -1; } =20 @@ -69,7 +73,8 @@ int xenevtchn_notify(xenevtchn_handle *xce, evtchn_port_t= port) return ioctl(fd, IOCTL_EVTCHN_NOTIFY, ¬ify); } =20 -xenevtchn_port_or_error_t xenevtchn_bind_unbound_port(xenevtchn_handle * x= ce, uint32_t domid) +xenevtchn_port_or_error_t xenevtchn_bind_unbound_port(xenevtchn_handle *xc= e, + uint32_t domid) { int fd =3D xce->fd; struct ioctl_evtchn_bind_unbound_port bind; @@ -78,14 +83,15 @@ xenevtchn_port_or_error_t xenevtchn_bind_unbound_port(x= enevtchn_handle * xce, ui bind.remote_domain =3D domid; =20 ret =3D ioctl(fd, IOCTL_EVTCHN_BIND_UNBOUND_PORT, &bind); - if (ret =3D=3D 0) + if ( ret =3D=3D 0 ) return bind.port; else return -1; } =20 -xenevtchn_port_or_error_t xenevtchn_bind_interdomain(xenevtchn_handle *xce= , uint32_t domid, - evtchn_port_t remote_por= t) +xenevtchn_port_or_error_t xenevtchn_bind_interdomain(xenevtchn_handle *xce, + uint32_t domid, + evtchn_port_t remote_= port) { int fd =3D xce->fd; struct ioctl_evtchn_bind_interdomain bind; @@ -95,7 +101,7 @@ xenevtchn_port_or_error_t xenevtchn_bind_interdomain(xen= evtchn_handle *xce, uint bind.remote_port =3D remote_port; =20 ret =3D ioctl(fd, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind); - if (ret =3D=3D 0) + if ( ret =3D=3D 0 ) return bind.port; else return -1; @@ -111,7 +117,8 @@ int xenevtchn_unbind(xenevtchn_handle *xce, evtchn_port= _t port) return ioctl(fd, IOCTL_EVTCHN_UNBIND, &unbind); } =20 -xenevtchn_port_or_error_t xenevtchn_bind_virq(xenevtchn_handle *xce, unsig= ned int virq) +xenevtchn_port_or_error_t xenevtchn_bind_virq(xenevtchn_handle *xce, + unsigned int virq) { int fd =3D xce->fd; struct ioctl_evtchn_bind_virq bind; @@ -120,7 +127,7 @@ xenevtchn_port_or_error_t xenevtchn_bind_virq(xenevtchn= _handle *xce, unsigned in bind.virq =3D virq; =20 err =3D ioctl(fd, IOCTL_EVTCHN_BIND_VIRQ, &bind); - if (err) + if ( err ) return -1; else return bind.port; @@ -140,6 +147,7 @@ xenevtchn_port_or_error_t xenevtchn_pending(xenevtchn_h= andle *xce) int xenevtchn_unmask(xenevtchn_handle *xce, evtchn_port_t port) { int fd =3D xce->fd; + return write_exact(fd, (char *)&port, sizeof(port)); } =20 diff --git a/tools/libs/evtchn/solaris.c b/tools/libs/evtchn/solaris.c index dd41f62a24..d87abc553c 100644 --- a/tools/libs/evtchn/solaris.c +++ b/tools/libs/evtchn/solaris.c @@ -72,7 +72,8 @@ int xenevtchn_notify(xenevtchn_handle *xce, evtchn_port_t= port) return ioctl(fd, IOCTL_EVTCHN_NOTIFY, ¬ify); } =20 -xenevtchn_port_or_error_t xenevtchn_bind_unbound_port(xenevtchn_handle *xc= e, uint32_t domid) +xenevtchn_port_or_error_t xenevtchn_bind_unbound_port(xenevtchn_handle *xc= e, + uint32_t domid) { int fd =3D xce->fd; struct ioctl_evtchn_bind_unbound_port bind; @@ -82,8 +83,9 @@ xenevtchn_port_or_error_t xenevtchn_bind_unbound_port(xen= evtchn_handle *xce, uin return ioctl(fd, IOCTL_EVTCHN_BIND_UNBOUND_PORT, &bind); } =20 -xenevtchn_port_or_error_t xenevtchn_bind_interdomain(xenevtchn_handle *xce= , uint32_t domid, - evtchn_port_t remote_por= t) +xenevtchn_port_or_error_t xenevtchn_bind_interdomain(xenevtchn_handle *xce, + uint32_t domid, + evtchn_port_t remote_= port) { int fd =3D xce->fd; struct ioctl_evtchn_bind_interdomain bind; @@ -94,7 +96,8 @@ xenevtchn_port_or_error_t xenevtchn_bind_interdomain(xene= vtchn_handle *xce, uint return ioctl(fd, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind); } =20 -xenevtchn_port_or_error_t xenevtchn_bind_virq(xenevtchn_handle *xce, unsig= ned int virq) +xenevtchn_port_or_error_t xenevtchn_bind_virq(xenevtchn_handle *xce, + unsigned int virq) { int fd =3D xce->fd; struct ioctl_evtchn_bind_virq bind; @@ -128,6 +131,7 @@ xenevtchn_port_or_error_t xenevtchn_pending(xenevtchn_h= andle *xce) int xenevtchn_unmask(xenevtchn_handle *xce, evtchn_port_t port) { int fd =3D xce->fd; + return write_exact(fd, (char *)&port, sizeof(port)); } =20 --=20 2.26.2