From nobody Sat Feb 7 07:09:38 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 header.i=dpsmith@apertussolutions.com; 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; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) ARC-Seal: i=2; a=rsa-sha256; t=1713976559; cv=pass; d=zohomail.com; s=zohoarc; b=ZWqWljAAy2DnajQvDJ1/CMZDeprv1rD33ip7OvIcfZH4HKf0cCt+NWzrf0hGH40aoxgj0lZ1HABRlHK5JKJgahWxEXjfx6nUYEL+DhG+vQND8/3sTdgoCPpzmOcOi2xb5Mwx/DraVvQ+GpuDaGFMByde7DaX4xg++PcQK9nHhLk= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1713976559; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=0AUXswEKZ492CVNKbtY21+GmWSjq8y8qXSbtGsUVrVA=; b=eKOVZnj2PsfqNiPNVy44LbI43nNlIJJPHF+HfyAtcGULqaIRY91H4GUEhIQWgO9x9peo0TD+2f8slVNksEHczKyvcBRDlWI3QIE0rNXcMW3nQx90OLTHnpcjC3DRp/z7aMt53Yk5wt21HPYdfcN6+rSqAmkRFvYk02uAgkTQoyE= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=dpsmith@apertussolutions.com; 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; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 17139765592841019.7636348251654; Wed, 24 Apr 2024 09:35:59 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.711549.1111594 (Exim 4.92) (envelope-from ) id 1rzfb0-0005Q3-3S; Wed, 24 Apr 2024 16:35:46 +0000 Received: by outflank-mailman (output) from mailman id 711549.1111594; Wed, 24 Apr 2024 16:35:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzfb0-0005Pw-0e; Wed, 24 Apr 2024 16:35:46 +0000 Received: by outflank-mailman (input) for mailman id 711549; Wed, 24 Apr 2024 16:35:45 +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 1rzfaz-0003bR-6Q for xen-devel@lists.xenproject.org; Wed, 24 Apr 2024 16:35:45 +0000 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id b0bea6e8-0258-11ef-b4bb-af5377834399; Wed, 24 Apr 2024 18:35:43 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1713976477505550.3663677305303; Wed, 24 Apr 2024 09:34:37 -0700 (PDT) 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: b0bea6e8-0258-11ef-b4bb-af5377834399 ARC-Seal: i=1; a=rsa-sha256; t=1713976479; cv=none; d=zohomail.com; s=zohoarc; b=cHvAo8SAjcDCHl0ltCjxca0dA/eTWmBjdjxSPD782ELuo64HhzzPcKWAV2lQA7thAyPb0jHfAUF4ciDwNXddoqYmVCdDEQYrU2Ppt87kQBxWc552JtuIiLrVfhs/dlZC66kHrjXnuNTk1oi7PEwo2VxzYkwqoWhudV8RL6g5qYk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1713976479; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=0AUXswEKZ492CVNKbtY21+GmWSjq8y8qXSbtGsUVrVA=; b=cyNg+LmUrJ5ai4A4DR9u9gTt05BshUwz4xVq5bnxrPO+ngXmOnCoWAvHeIpDHt03plfeeyns33m5uC9FJrLwDMgF4mbK64CjCFLTBfX+4wHEDE+kzkpKIc6cq1SEov0dp0eUj4RSwlOaSTgEer2xHAYXxmGoRJDVWSajoLLTPeU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=apertussolutions.com; spf=pass smtp.mailfrom=dpsmith@apertussolutions.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1713976479; s=zoho; d=apertussolutions.com; i=dpsmith@apertussolutions.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=0AUXswEKZ492CVNKbtY21+GmWSjq8y8qXSbtGsUVrVA=; b=dJD1oQuD0DVvj8pWQ1NzJRfSgnj0MFgYlLLudFxqfgrwVFcoFfUYm8TSe6AnIB7R KgvPonLs/k3//eRJJb3ltz42zsHw0gEp6knu1tjwcdjSYQlsOya+JPnYRC4ox/Pn69O h25hla0xTL4Qqs8xY4/ehMWLkP4ZhOHTXR96nHSE= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: Jason Andryuk , "Daniel P. Smith" , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini Subject: [PATCH v3 4/8] gzip: move window pointer into gunzip state Date: Wed, 24 Apr 2024 12:34:18 -0400 Message-Id: <20240424163422.23276-5-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240424163422.23276-1-dpsmith@apertussolutions.com> References: <20240424163422.23276-1-dpsmith@apertussolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External X-ZohoMail-DKIM: pass (identity dpsmith@apertussolutions.com) X-ZM-MESSAGEID: 1713976560932100001 Content-Type: text/plain; charset="utf-8" Move the window pointer, outcnt/wp, into struct gunzip_data. It was erroneo= usly labeled as outcnt and then define aliased to wp, this eliminates the aliasi= ng and only refers to as wp, the window pointer. Signed-off-by: Daniel P. Smith Acked-by: Jan Beulich --- xen/common/gzip/gunzip.c | 11 +++++------ xen/common/gzip/inflate.c | 17 ++++++++--------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/xen/common/gzip/gunzip.c b/xen/common/gzip/gunzip.c index e47f10ae19ad..11bfe45d8222 100644 --- a/xen/common/gzip/gunzip.c +++ b/xen/common/gzip/gunzip.c @@ -8,6 +8,8 @@ =20 struct gunzip_state { unsigned char *window; + /* window pointer: */ + unsigned int wp; }; =20 static unsigned char *__initdata inbuf; @@ -16,9 +18,6 @@ static unsigned int __initdata insize; /* Index of next byte to be processed in inbuf: */ static unsigned int __initdata inptr; =20 -/* Bytes in output buffer: */ -static unsigned int __initdata outcnt; - #define malloc(a) xmalloc_bytes(a) #define free(a) xfree(a) #define memzero(s, n) memset((s), 0, (n)) @@ -75,15 +74,15 @@ static __init void flush_window(struct gunzip_state *s) unsigned char *in, ch; =20 in =3D s->window; - for ( n =3D 0; n < outcnt; n++ ) + for ( n =3D 0; n < s->wp; n++ ) { ch =3D *in++; c =3D crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8); } crc =3D c; =20 - bytes_out +=3D (unsigned long)outcnt; - outcnt =3D 0; + bytes_out +=3D (unsigned long)s->wp; + s->wp =3D 0; } =20 __init int gzip_check(char *image, unsigned long image_len) diff --git a/xen/common/gzip/inflate.c b/xen/common/gzip/inflate.c index 5fa5c039c6d1..78b2f20a97ba 100644 --- a/xen/common/gzip/inflate.c +++ b/xen/common/gzip/inflate.c @@ -130,7 +130,6 @@ static char rcsid[] =3D "#Id: inflate.c,v 0.14 1993/06/= 10 13:27:04 jloup Exp #"; * "uch *window;" and then malloc'ed in the latter case. The definition * must be in unzip.h, included above. */ -#define wp outcnt =20 /* * Huffman code lookup table entry--this entry is four bytes for machines @@ -556,7 +555,7 @@ static int __init inflate_codes( /* make local copies of globals */ b =3D bb; /* initialize bit buffer */ k =3D bk; - w =3D wp; /* initialize window position */ + w =3D s->wp; /* initialize window position */ =20 /* inflate the coded data */ ml =3D mask_bits[bl]; /* precompute masks for speed */ @@ -579,7 +578,7 @@ static int __init inflate_codes( Tracevv((stderr, "%c", s->window[w-1])); if (w =3D=3D WSIZE) { - wp =3D w; + s->wp =3D w; flush_window(s); w =3D 0; } @@ -627,7 +626,7 @@ static int __init inflate_codes( } while (--e); if (w =3D=3D WSIZE) { - wp =3D w; + s->wp =3D w; flush_window(s); w =3D 0; } @@ -636,7 +635,7 @@ static int __init inflate_codes( } =20 /* restore the globals from the locals */ - wp =3D w; /* restore global window pointer */ + s->wp =3D w; /* restore global window pointer */ bb =3D b; /* restore global bit buffer */ bk =3D k; =20 @@ -657,7 +656,7 @@ static int __init inflate_stored(struct gunzip_state *s) /* make local copies of globals */ b =3D bb; /* initialize bit buffer */ k =3D bk; - w =3D wp; /* initialize window position */ + w =3D s->wp; /* initialize window position */ =20 =20 /* go to byte boundary */ @@ -681,7 +680,7 @@ static int __init inflate_stored(struct gunzip_state *s) s->window[w++] =3D (uch)b; if (w =3D=3D WSIZE) { - wp =3D w; + s->wp =3D w; flush_window(s); w =3D 0; } @@ -689,7 +688,7 @@ static int __init inflate_stored(struct gunzip_state *s) } =20 /* restore the globals from the locals */ - wp =3D w; /* restore global window pointer */ + s->wp =3D w; /* restore global window pointer */ bb =3D b; /* restore global bit buffer */ bk =3D k; =20 @@ -1004,7 +1003,7 @@ static int __init inflate(struct gunzip_state *s) int r; /* result code */ =20 /* initialize window, bit buffer */ - wp =3D 0; + s->wp =3D 0; bk =3D 0; bb =3D 0; =20 --=20 2.30.2