Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40409C433DB for ; Tue, 26 Jan 2021 09:55:06 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C89C120780 for ; Tue, 26 Jan 2021 09:55:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C89C120780 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.74778.134431 (Exim 4.92) (envelope-from ) id 1l4L3o-0002CB-9w; Tue, 26 Jan 2021 09:54:56 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 74778.134431; Tue, 26 Jan 2021 09:54:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l4L3o-0002C4-6s; Tue, 26 Jan 2021 09:54:56 +0000 Received: by outflank-mailman (input) for mailman id 74778; Tue, 26 Jan 2021 09:54:54 +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 1l4L3m-0002Bd-Kv for xen-devel@lists.xenproject.org; Tue, 26 Jan 2021 09:54:54 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 860b7770-873e-4eb3-92e1-68a2c2efd728; Tue, 26 Jan 2021 09:54:53 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 4FD83ACF4; Tue, 26 Jan 2021 09:54:52 +0000 (UTC) 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: 860b7770-873e-4eb3-92e1-68a2c2efd728 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=1611654892; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CmACXmwxaudtkfIf6PNkfCRd4qdwwfStoKQQsJAzqz0=; b=PPjleKzCOV/yF/Djfy+0Gmyaww2DSpHUa6MkFlHO2Betcxxk35tMv5nE50yvxEBf0Rsbj9 lYUFcbvsjPt12I9LXgBQxjfplV6pmIXUgZSreeLxXMFOrPfvKCy1Snb8GTwholtmkXXNZ1 6MgXlwCOBEc0lgITMbLY87kUvnaiyS0= Subject: Re: [PATCH v3 01/15] gunzip: drop INIT{,DATA} and STATIC From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: <2db91183-a7de-0c43-2fef-feb3523ed19b@suse.com> Message-ID: Date: Tue, 26 Jan 2021 10:54:52 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 26.01.2021 10:50, Jan Beulich wrote: > There's no need for the extra abstraction. > > Requested-by: Andrew Cooper > Signed-off-by: Jan Beulich This, of course, is 07/15. Sorry. Jan > --- > v3: New. > > --- a/xen/common/gunzip.c > +++ b/xen/common/gunzip.c > @@ -22,7 +22,6 @@ static unsigned __initdata inptr; > static unsigned __initdata outcnt; > > #define OF(args) args > -#define STATIC static > > #define memzero(s, n) memset((s), 0, (n)) > > @@ -30,9 +29,6 @@ typedef unsigned char uch; > typedef unsigned short ush; > typedef unsigned long ulg; > > -#define INIT __init > -#define INITDATA __initdata > - > #define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf()) > > /* Diagnostic functions */ > --- a/xen/common/inflate.c > +++ b/xen/common/inflate.c > @@ -107,7 +107,7 @@ > static char rcsid[] = "#Id: inflate.c,v 0.14 1993/06/10 13:27:04 jloup Exp #"; > #endif > > -#ifndef STATIC > +#ifndef __XEN__ > > #if defined(STDC_HEADERS) || defined(HAVE_STDLIB_H) > # include > @@ -115,14 +115,9 @@ static char rcsid[] = "#Id: inflate.c,v > #endif > > #include "gzip.h" > -#define STATIC > -#endif /* !STATIC */ > > -#ifndef INIT > -#define INIT > -#define INITDATA > -#endif > - > +#endif /* !__XEN__ */ > + > #define slide window > > /* Huffman code lookup table entry--this entry is four bytes for machines > @@ -143,15 +138,15 @@ struct huft { > > > /* Function prototypes */ > -STATIC int INIT huft_build OF((unsigned *, unsigned, unsigned, > - const ush *, const ush *, struct huft **, int *)); > -STATIC int INIT huft_free OF((struct huft *)); > -STATIC int INIT inflate_codes OF((struct huft *, struct huft *, int, int)); > -STATIC int INIT inflate_stored OF((void)); > -STATIC int INIT inflate_fixed OF((void)); > -STATIC int INIT inflate_dynamic OF((void)); > -STATIC int INIT inflate_block OF((int *)); > -STATIC int INIT inflate OF((void)); > +static int huft_build OF((unsigned *, unsigned, unsigned, > + const ush *, const ush *, struct huft **, int *)); > +static int huft_free OF((struct huft *)); > +static int inflate_codes OF((struct huft *, struct huft *, int, int)); > +static int inflate_stored OF((void)); > +static int inflate_fixed OF((void)); > +static int inflate_dynamic OF((void)); > +static int inflate_block OF((int *)); > +static int inflate OF((void)); > > > /* The inflate algorithm uses a sliding 32 K byte window on the uncompressed > @@ -217,10 +212,10 @@ static const ush cpdext[] = { /* > the stream. > */ > > -STATIC ulg INITDATA bb; /* bit buffer */ > -STATIC unsigned INITDATA bk; /* bits in bit buffer */ > +static ulg __initdata bb; /* bit buffer */ > +static unsigned __initdata bk; /* bits in bit buffer */ > > -STATIC const ush mask_bits[] = { > +static const ush mask_bits[] = { > 0x0000, > 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, > 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff > @@ -235,10 +230,10 @@ STATIC const ush mask_bits[] = { > * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 > */ > > -static unsigned long INITDATA malloc_ptr; > -static int INITDATA malloc_count; > +static unsigned long __initdata malloc_ptr; > +static int __initdata malloc_count; > > -static void *INIT malloc(int size) > +static void *__init malloc(int size) > { > void *p; > > @@ -259,7 +254,7 @@ static void *INIT malloc(int size) > return p; > } > > -static void INIT free(void *where) > +static void __init free(void *where) > { > malloc_count--; > if (!malloc_count) > @@ -303,8 +298,8 @@ static void INIT free(void *where) > */ > > > -STATIC const int lbits = 9; /* bits in base literal/length lookup table */ > -STATIC const int dbits = 6; /* bits in base distance lookup table */ > +static const int lbits = 9; /* bits in base literal/length lookup table */ > +static const int dbits = 6; /* bits in base distance lookup table */ > > > /* If BMAX needs to be larger than 16, then h and x[] should be ulg. */ > @@ -312,10 +307,10 @@ STATIC const int dbits = 6; /* > #define N_MAX 288 /* maximum number of codes in any set */ > > > -STATIC unsigned INITDATA hufts; /* track memory usage */ > +static unsigned __initdata hufts; /* track memory usage */ > > > -STATIC int INIT huft_build( > +static int __init huft_build( > unsigned *b, /* code lengths in bits (all assumed <= BMAX) */ > unsigned n, /* number of codes (assumed <= N_MAX) */ > unsigned s, /* number of simple-valued codes (0..s-1) */ > @@ -560,7 +555,7 @@ STATIC int INIT huft_build( > > > > -STATIC int INIT huft_free( > +static int __init huft_free( > struct huft *t /* table to free */ > ) > /* Free the malloc'ed tables built by huft_build(), which makes a linked > @@ -582,7 +577,7 @@ STATIC int INIT huft_free( > } > > > -STATIC int INIT inflate_codes( > +static int __init inflate_codes( > struct huft *tl, /* literal/length decoder tables */ > struct huft *td, /* distance decoder tables */ > int bl, /* number of bits decoded by tl[] */ > @@ -697,7 +692,7 @@ STATIC int INIT inflate_codes( > > > > -STATIC int INIT inflate_stored(void) > +static int __init inflate_stored(void) > /* "decompress" an inflated type 0 (stored) block. */ > { > unsigned n; /* number of bytes in block */ > @@ -758,7 +753,7 @@ STATIC int INIT inflate_stored(void) > /* > * We use `noinline' here to prevent gcc-3.5 from using too much stack space > */ > -STATIC int noinline INIT inflate_fixed(void) > +static int noinline __init inflate_fixed(void) > /* decompress an inflated type 1 (fixed Huffman codes) block. We should > either replace this with a custom decoder, or at least precompute the > Huffman tables. */ > @@ -822,7 +817,7 @@ STATIC int noinline INIT inflate_fixed(v > /* > * We use `noinline' here to prevent gcc-3.5 from using too much stack space > */ > -STATIC int noinline INIT inflate_dynamic(void) > +static int noinline __init inflate_dynamic(void) > /* decompress an inflated type 2 (dynamic Huffman codes) block. */ > { > int i; /* temporary variables */ > @@ -1027,7 +1022,7 @@ goto out; > > > > -STATIC int INIT inflate_block( > +static int __init inflate_block( > int *e /* last block flag */ > ) > /* decompress an inflated block */ > @@ -1078,7 +1073,7 @@ NEEDBITS(1) > > > > -STATIC int INIT inflate(void) > +static int __init inflate(void) > /* decompress an inflated entry */ > { > int e; /* last block flag */ > @@ -1130,8 +1125,8 @@ STATIC int INIT inflate(void) > * > **********************************************************************/ > > -static ulg INITDATA crc_32_tab[256]; > -static ulg INITDATA crc; /* initialized in makecrc() so it'll reside in bss */ > +static ulg __initdata crc_32_tab[256]; > +static ulg __initdata crc; /* initialized in makecrc() so it'll reside in bss */ > #define CRC_VALUE (crc ^ 0xffffffffUL) > > /* > @@ -1139,7 +1134,7 @@ static ulg INITDATA crc; /* initialized > * gzip-1.0.3/makecrc.c. > */ > > -static void INIT > +static void __init > makecrc(void) > { > /* Not copyrighted 1990 Mark Adler */ > @@ -1187,7 +1182,7 @@ makecrc(void) > /* > * Do the uncompression! > */ > -static int INIT gunzip(void) > +static int __init gunzip(void) > { > uch flags; > unsigned char magic[2]; /* magic header */ > >