From nobody Thu Apr 25 07:05:36 2024 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=1641551787; cv=none; d=zohomail.com; s=zohoarc; b=FZerGq9DNKGEw3eAD+C1sgQrs7DZk0nPBKIOhPywCeKdn3psN+DU98ZHAjN4oYxLPMW2FFmJ0wJxTDsZnPyY+AcCUK9nG3Rc7x8Nv8chDDnIFJjyIrApPAs7JVJB1yS2WaXxTsKjNt++/l8bDyisxTnvFOu3FqIHEadlJg8xEgY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641551787; 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=ExUV76bDon3vF2lqMKSHAUkh14TbcK4d/8FVqDba5Ig=; b=OITbFuIuHUsQZ59clLGTZlz5oE9aN9Be8qZMYYZJ5AxTYb5KXm8R6N8x11HqkOj47Jgl6r1efMGxrI3SPkhbElWa2mu0pCBsiACm/j6xzrYXBqKUjuGcg4QV3O6NBfiUJfLTjTyrmpR2Q4OimELfvvxDVsGive+MS7Cp/RO+tuo= 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) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1641551787628909.1545428389712; Fri, 7 Jan 2022 02:36:27 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.254338.436089 (Exim 4.92) (envelope-from ) id 1n5mbA-0001dk-I4; Fri, 07 Jan 2022 10:35:52 +0000 Received: by outflank-mailman (output) from mailman id 254338.436089; Fri, 07 Jan 2022 10:35:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1n5mbA-0001dd-E1; Fri, 07 Jan 2022 10:35:52 +0000 Received: by outflank-mailman (input) for mailman id 254338; Fri, 07 Jan 2022 10:35:50 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1n5mb8-0001Nm-CP for xen-devel@lists.xenproject.org; Fri, 07 Jan 2022 10:35:50 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 9303a079-6fa5-11ec-81c0-a30af7de8005; Fri, 07 Jan 2022 11:35:48 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 9BE7D212BE; Fri, 7 Jan 2022 10:35:46 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 75F8913CCC; Fri, 7 Jan 2022 10:35:46 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id WLmRG4IX2GHvCwAAMHmgww (envelope-from ); Fri, 07 Jan 2022 10:35:46 +0000 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: 9303a079-6fa5-11ec-81c0-a30af7de8005 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1641551746; 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=ExUV76bDon3vF2lqMKSHAUkh14TbcK4d/8FVqDba5Ig=; b=M3jeiL0CMrEcA3+HQepc8xZ3F50RdCcNW+HzdyaL/v6JKr9/XVHPXlbnrGedRNlIDZa2Mz qyxcZVbzcfdqXoGkHgznpsjBfSXcR0rsauxGazPCqqOuef7lYnzPQb7t3W+k06BGrnU3up a+onKW/qNa8X5ke77fW17yxHb6kvsdc= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Wei Liu , Anthony PERARD Subject: [PATCH 1/2] tools/libs/evtchn: decouple more from mini-os Date: Fri, 7 Jan 2022 11:35:43 +0100 Message-Id: <20220107103544.9271-2-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20220107103544.9271-1-jgross@suse.com> References: <20220107103544.9271-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1641551789886100003 Content-Type: text/plain; charset="utf-8" Mini-OS and libevtchn are using implementation details of each other. Change that by letting libevtchn use the new get_file_from_fd() function and the generic dev pointer of struct file from Mini-OS. By using private struct declarations Mini-OS will be able to drop the libevtchn specific definitions of struct evtchn_port_info and evtchn_port_list in future. Signed-off-by: Juergen Gross --- tools/libs/evtchn/minios.c | 82 +++++++++++++++++++++++++++----------- 1 file changed, 58 insertions(+), 24 deletions(-) diff --git a/tools/libs/evtchn/minios.c b/tools/libs/evtchn/minios.c index e5dfdc5ef5..3305102f22 100644 --- a/tools/libs/evtchn/minios.c +++ b/tools/libs/evtchn/minios.c @@ -38,16 +38,27 @@ =20 #include "private.h" =20 +LIST_HEAD(port_list, port_info); + +struct port_info { + LIST_ENTRY(port_info) list; + evtchn_port_t port; + unsigned long pending; + int bound; +}; + extern void minios_evtchn_close_fd(int fd); =20 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 port_info *port_alloc(int fd) { - struct evtchn_port_info *port_info; + struct port_info *port_info; + struct file *file =3D get_file_from_fd(fd); + struct port_list *port_list =3D file->dev; =20 - port_info =3D malloc(sizeof(struct evtchn_port_info)); + port_info =3D malloc(sizeof(struct port_info)); if ( port_info =3D=3D NULL ) return NULL; =20 @@ -55,12 +66,12 @@ static struct evtchn_port_info *port_alloc(int fd) port_info->port =3D -1; port_info->bound =3D 0; =20 - LIST_INSERT_HEAD(&files[fd].evtchn.ports, port_info, list); + LIST_INSERT_HEAD(port_list, port_info, list); =20 return port_info; } =20 -static void port_dealloc(struct evtchn_port_info *port_info) +static void port_dealloc(struct port_info *port_info) { if ( port_info->bound ) unbind_evtchn(port_info->port); @@ -75,12 +86,25 @@ static void port_dealloc(struct evtchn_port_info *port_= info) */ int osdep_evtchn_open(xenevtchn_handle *xce, unsigned int flags) { - int fd =3D alloc_fd(FTYPE_EVTCHN); + int fd; + struct file *file; + struct port_list *list; + + list =3D malloc(sizeof(*list)); + if ( !list ) + return -1; + + fd =3D alloc_fd(FTYPE_EVTCHN); + file =3D get_file_from_fd(fd); =20 - if ( fd =3D=3D -1 ) + if ( !file ) + { + free(list); return -1; + } =20 - LIST_INIT(&files[fd].evtchn.ports); + file->dev =3D list; + LIST_INIT(list); xce->fd =3D fd; printf("evtchn_open() -> %d\n", fd); =20 @@ -104,12 +128,15 @@ int osdep_evtchn_restrict(xenevtchn_handle *xce, domi= d_t domid) =20 void minios_evtchn_close_fd(int fd) { - struct evtchn_port_info *port_info, *tmp; + struct port_info *port_info, *tmp; + struct file *file =3D get_file_from_fd(fd); + struct port_list *port_list =3D file->dev; =20 - LIST_FOREACH_SAFE(port_info, &files[fd].evtchn.ports, list, tmp) + LIST_FOREACH_SAFE(port_info, port_list, list, tmp) port_dealloc(port_info); + free(port_list); =20 - files[fd].type =3D FTYPE_NONE; + file->type =3D FTYPE_NONE; } =20 int xenevtchn_fd(xenevtchn_handle *xce) @@ -135,11 +162,14 @@ int xenevtchn_notify(xenevtchn_handle *xce, evtchn_po= rt_t port) 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; + struct file *file =3D get_file_from_fd(fd); + struct port_info *port_info; + struct port_list *port_list; =20 - assert(files[fd].type =3D=3D FTYPE_EVTCHN); + assert(file && file->type =3D=3D FTYPE_EVTCHN); + port_list =3D file->dev; mask_evtchn(port); - LIST_FOREACH(port_info, &files[fd].evtchn.ports, list) + LIST_FOREACH(port_info, port_list, list) { if ( port_info->port =3D=3D port ) goto found; @@ -150,7 +180,7 @@ static void evtchn_handler(evtchn_port_t port, struct p= t_regs *regs, void *data) =20 found: port_info->pending =3D 1; - files[fd].read =3D 1; + file->read =3D 1; wake_up(&event_queue); } =20 @@ -158,7 +188,7 @@ xenevtchn_port_or_error_t xenevtchn_bind_unbound_port(x= enevtchn_handle *xce, uint32_t domid) { int fd =3D xce->fd; - struct evtchn_port_info *port_info; + struct port_info *port_info; int ret; evtchn_port_t port; =20 @@ -191,7 +221,7 @@ xenevtchn_port_or_error_t xenevtchn_bind_interdomain(xe= nevtchn_handle *xce, evtchn_port_t remote_= port) { int fd =3D xce->fd; - struct evtchn_port_info *port_info; + struct port_info *port_info; evtchn_port_t local_port; int ret; =20 @@ -222,9 +252,11 @@ xenevtchn_port_or_error_t xenevtchn_bind_interdomain(x= enevtchn_handle *xce, int xenevtchn_unbind(xenevtchn_handle *xce, evtchn_port_t port) { int fd =3D xce->fd; - struct evtchn_port_info *port_info; + struct file *file =3D get_file_from_fd(fd); + struct port_info *port_info; + struct port_list *port_list =3D file->dev; =20 - LIST_FOREACH(port_info, &files[fd].evtchn.ports, list) + LIST_FOREACH(port_info, port_list, list) { if ( port_info->port =3D=3D port ) { @@ -244,7 +276,7 @@ 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; + struct port_info *port_info; evtchn_port_t port; =20 assert(get_current() =3D=3D main_thread); @@ -273,15 +305,17 @@ xenevtchn_port_or_error_t xenevtchn_bind_virq(xenevtc= hn_handle *xce, xenevtchn_port_or_error_t xenevtchn_pending(xenevtchn_handle *xce) { int fd =3D xce->fd; - struct evtchn_port_info *port_info; + struct file *file =3D get_file_from_fd(fd); + struct port_info *port_info; + struct port_list *port_list =3D file->dev; unsigned long flags; evtchn_port_t ret =3D -1; =20 local_irq_save(flags); =20 - files[fd].read =3D 0; + file->read =3D 0; =20 - LIST_FOREACH(port_info, &files[fd].evtchn.ports, list) + LIST_FOREACH(port_info, port_list, list) { if ( port_info->port !=3D -1 && port_info->pending ) { @@ -292,7 +326,7 @@ xenevtchn_port_or_error_t xenevtchn_pending(xenevtchn_h= andle *xce) } else { - files[fd].read =3D 1; + file->read =3D 1; break; } } --=20 2.26.2 From nobody Thu Apr 25 07:05:36 2024 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=1641551788; cv=none; d=zohomail.com; s=zohoarc; b=UoLVKdZ3qvWDgXPd1WmZpewbGGreyPWG6NSqf3qxVtsGE5Fzf2fBahjwmDNU0NrJTJ/U0b4cFlgxTchiiXzMJWq3hAhnrvH0mBe7DYRK2N7RyOw3e31JzIFRs8oqMBoI2HlynYyPjF4x9Sl+07Y4XG+axAZ4wY4unE+tBW2qweM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641551788; 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=lHlV4wb/lgozNAQh5gy+WKHFMhvi6Np0GE6SfuW92Mo=; b=DtRTprEJGWCQngNceK7f6RoK7lYcL2ZorX1zVQq9knuazt5vCZ7QQXMMBIVxjXdMI9VpMbWqw0pk6CCllNSFYCY9DH03JokJ9xHiw+KM43UffAMOoj3gE/vEjbJ16oFsxB1OMy4u0fpugQFUK8SmOJvCaQZSU8NJF93L8WX2KRI= 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) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 164155178804777.44180955286731; Fri, 7 Jan 2022 02:36:28 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.254339.436094 (Exim 4.92) (envelope-from ) id 1n5mbA-0001hL-T9; Fri, 07 Jan 2022 10:35:52 +0000 Received: by outflank-mailman (output) from mailman id 254339.436094; Fri, 07 Jan 2022 10:35:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1n5mbA-0001gw-NV; Fri, 07 Jan 2022 10:35:52 +0000 Received: by outflank-mailman (input) for mailman id 254339; Fri, 07 Jan 2022 10:35:50 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1n5mb8-0001Nl-LL for xen-devel@lists.xenproject.org; Fri, 07 Jan 2022 10:35:50 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 930e4eac-6fa5-11ec-9ce5-af14b9085ebd; Fri, 07 Jan 2022 11:35:49 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id C7BFF212BF; Fri, 7 Jan 2022 10:35:46 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A30D713CCC; Fri, 7 Jan 2022 10:35:46 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id oJN9JoIX2GHvCwAAMHmgww (envelope-from ); Fri, 07 Jan 2022 10:35:46 +0000 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: 930e4eac-6fa5-11ec-9ce5-af14b9085ebd DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1641551746; 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=lHlV4wb/lgozNAQh5gy+WKHFMhvi6Np0GE6SfuW92Mo=; b=ajHF2Ze6X00ejXJSWelo5qwfDu63E8ECKVY4fGFe8RlhMnlkXxAIm5TJ3ShMUDQ6qamXaE vsHNlD2QWvbEoAKj2+MBjpQA5Qz0QMPbDMw8/SyTggyqDwmflpTYI33QAsJ0WRaW41DBb6 V8EmhZBt/i5JkXAw1x9G+PKadvAi8EE= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Wei Liu , Anthony PERARD Subject: [PATCH 2/2] tools/libs/gnttab: decouple more from mini-os Date: Fri, 7 Jan 2022 11:35:44 +0100 Message-Id: <20220107103544.9271-3-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20220107103544.9271-1-jgross@suse.com> References: <20220107103544.9271-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1641551789875100002 Content-Type: text/plain; charset="utf-8" libgnttab is using implementation details of Mini-OS. Change that by letting libgnttab use the new get_file_from_fd() function and the generic dev pointer of struct file from Mini-OS. Signed-off-by: Juergen Gross --- tools/libs/gnttab/minios.c | 48 ++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/tools/libs/gnttab/minios.c b/tools/libs/gnttab/minios.c index f78caadd30..64601db085 100644 --- a/tools/libs/gnttab/minios.c +++ b/tools/libs/gnttab/minios.c @@ -28,6 +28,7 @@ #include =20 #include +#include #include =20 #include "private.h" @@ -36,10 +37,25 @@ void minios_gnttab_close_fd(int fd); =20 int osdep_gnttab_open(xengnttab_handle *xgt) { - int fd =3D alloc_fd(FTYPE_GNTMAP); - if ( fd =3D=3D -1 ) + int fd; + struct file *file; + struct gntmap *gntmap; + + gntmap =3D malloc(sizeof(*gntmap)); + if ( !gntmap ) return -1; - gntmap_init(&files[fd].gntmap); + + fd =3D alloc_fd(FTYPE_GNTMAP); + file =3D get_file_from_fd(fd); + + if ( !file ) + { + free(gntmap); + return -1; + } + + file->dev =3D gntmap; + gntmap_init(gntmap); xgt->fd =3D fd; return 0; } @@ -54,8 +70,11 @@ int osdep_gnttab_close(xengnttab_handle *xgt) =20 void minios_gnttab_close_fd(int fd) { - gntmap_fini(&files[fd].gntmap); - files[fd].type =3D FTYPE_NONE; + struct file *file =3D get_file_from_fd(fd); + + gntmap_fini(file->dev); + free(file->dev); + file->type =3D FTYPE_NONE; } =20 void *osdep_gnttab_grant_map(xengnttab_handle *xgt, @@ -64,16 +83,16 @@ void *osdep_gnttab_grant_map(xengnttab_handle *xgt, uint32_t notify_offset, evtchn_port_t notify_port) { - int fd =3D xgt->fd; + struct file *file =3D get_file_from_fd(xgt->fd); int stride =3D 1; + if (flags & XENGNTTAB_GRANT_MAP_SINGLE_DOMAIN) stride =3D 0; if (notify_offset !=3D -1 || notify_port !=3D -1) { errno =3D ENOSYS; return NULL; } - return gntmap_map_grant_refs(&files[fd].gntmap, - count, domids, stride, + return gntmap_map_grant_refs(file->dev, count, domids, stride, refs, prot & PROT_WRITE); } =20 @@ -81,11 +100,10 @@ int osdep_gnttab_unmap(xengnttab_handle *xgt, void *start_address, uint32_t count) { - int fd =3D xgt->fd; + struct file *file =3D get_file_from_fd(xgt->fd); int ret; - ret =3D gntmap_munmap(&files[fd].gntmap, - (unsigned long) start_address, - count); + + ret =3D gntmap_munmap(file->dev, (unsigned long) start_address, count); if (ret < 0) { errno =3D -ret; return -1; @@ -95,10 +113,10 @@ int osdep_gnttab_unmap(xengnttab_handle *xgt, =20 int osdep_gnttab_set_max_grants(xengnttab_handle *xgt, uint32_t count) { - int fd =3D xgt->fd; + struct file *file =3D get_file_from_fd(xgt->fd); int ret; - ret =3D gntmap_set_max_grants(&files[fd].gntmap, - count); + + ret =3D gntmap_set_max_grants(file->dev, count); if (ret < 0) { errno =3D -ret; return -1; --=20 2.26.2