diff mbox series

[v3,08/15] bunzip: replace INIT

Message ID 9069acc9-7e86-a0c7-5ec9-e12d674bb834@suse.com (mailing list archive)
State New, archived
Headers show
Series zstd decompression for DomU-s + fallout / consolidation | expand

Commit Message

Jan Beulich Jan. 26, 2021, 9:51 a.m. UTC
While tools/libs/guest/xg_private.h has its own (non-conflicting for our
purposes) __init, which hence needs to be #undef-ed, there's no other
need for this abstraction.

Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
v3: New.

Comments

Julien Grall April 15, 2021, 11:50 a.m. UTC | #1
Hi Jan,

On 26/01/2021 09:51, Jan Beulich wrote:
> While tools/libs/guest/xg_private.h has its own (non-conflicting for our
> purposes) __init, which hence needs to be #undef-ed, there's no other
> need for this abstraction.
> 
> Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Julien Grall <jgrall@amazon.com>

Cheers,

> ---
> v3: New.
> 
> --- a/xen/common/decompress.h
> +++ b/xen/common/decompress.h
> @@ -23,6 +23,10 @@
>   #define INIT
>   #define INITDATA
>   
> +#undef __init /* tools/libs/guest/xg_private.h has its own one */
> +#define __init
> +#define __initdata
> +
>   #define large_malloc malloc
>   #define large_free free
>   
> --- a/xen/common/bunzip2.c
> +++ b/xen/common/bunzip2.c
> @@ -104,7 +104,7 @@ struct bunzip_data {
>   
>   /* Return the next nnn bits of input.  All reads from the compressed input
>      are done through this function.  All reads are big endian */
> -static unsigned int INIT get_bits(struct bunzip_data *bd, char bits_wanted)
> +static unsigned int __init get_bits(struct bunzip_data *bd, char bits_wanted)
>   {
>   	unsigned int bits = 0;
>   
> @@ -144,7 +144,7 @@ static unsigned int INIT get_bits(struct
>   
>   /* Unpacks the next block and sets up for the inverse burrows-wheeler step. */
>   
> -static int INIT get_next_block(struct bunzip_data *bd)
> +static int __init get_next_block(struct bunzip_data *bd)
>   {
>   	struct group_data *hufGroup = NULL;
>   	int *base = NULL;
> @@ -509,7 +509,7 @@ got_huff_bits:
>      are ignored, data is written to out_fd and return is RETVAL_OK or error.
>   */
>   
> -static int INIT read_bunzip(struct bunzip_data *bd, unsigned char *outbuf, int len)
> +static int __init read_bunzip(struct bunzip_data *bd, unsigned char *outbuf, int len)
>   {
>   	const unsigned int *dbuf;
>   	int pos, xcurrent, previous, gotcount;
> @@ -607,7 +607,7 @@ decode_next_byte:
>   	goto decode_next_byte;
>   }
>   
> -static int INIT nofill(void *buf, unsigned int len)
> +static int __init nofill(void *buf, unsigned int len)
>   {
>   	return -1;
>   }
> @@ -615,8 +615,8 @@ static int INIT nofill(void *buf, unsign
>   /* Allocate the structure, read file header.  If in_fd ==-1, inbuf must contain
>      a complete bunzip file (len bytes long).  If in_fd!=-1, inbuf and len are
>      ignored, and data is read from file handle into temporary buffer. */
> -static int INIT start_bunzip(struct bunzip_data **bdp, void *inbuf, int len,
> -			     int (*fill)(void*, unsigned int))
> +static int __init start_bunzip(struct bunzip_data **bdp, void *inbuf, int len,
> +			       int (*fill)(void*, unsigned int))
>   {
>   	struct bunzip_data *bd;
>   	unsigned int i, j, c;
> @@ -665,11 +665,11 @@ static int INIT start_bunzip(struct bunz
>   
>   /* Example usage: decompress src_fd to dst_fd.  (Stops at end of bzip2 data,
>      not end of file.) */
> -int INIT bunzip2(unsigned char *buf, unsigned int len,
> -		 int(*fill)(void*, unsigned int),
> -		 int(*flush)(void*, unsigned int),
> -		 unsigned char *outbuf, unsigned int *pos,
> -		 void(*error)(const char *x))
> +int __init bunzip2(unsigned char *buf, unsigned int len,
> +		   int(*fill)(void*, unsigned int),
> +		   int(*flush)(void*, unsigned int),
> +		   unsigned char *outbuf, unsigned int *pos,
> +		   void(*error)(const char *x))
>   {
>   	struct bunzip_data *bd;
>   	int i = -1;
> 
>
diff mbox series

Patch

--- a/xen/common/decompress.h
+++ b/xen/common/decompress.h
@@ -23,6 +23,10 @@ 
 #define INIT
 #define INITDATA
 
+#undef __init /* tools/libs/guest/xg_private.h has its own one */
+#define __init
+#define __initdata
+
 #define large_malloc malloc
 #define large_free free
 
--- a/xen/common/bunzip2.c
+++ b/xen/common/bunzip2.c
@@ -104,7 +104,7 @@  struct bunzip_data {
 
 /* Return the next nnn bits of input.  All reads from the compressed input
    are done through this function.  All reads are big endian */
-static unsigned int INIT get_bits(struct bunzip_data *bd, char bits_wanted)
+static unsigned int __init get_bits(struct bunzip_data *bd, char bits_wanted)
 {
 	unsigned int bits = 0;
 
@@ -144,7 +144,7 @@  static unsigned int INIT get_bits(struct
 
 /* Unpacks the next block and sets up for the inverse burrows-wheeler step. */
 
-static int INIT get_next_block(struct bunzip_data *bd)
+static int __init get_next_block(struct bunzip_data *bd)
 {
 	struct group_data *hufGroup = NULL;
 	int *base = NULL;
@@ -509,7 +509,7 @@  got_huff_bits:
    are ignored, data is written to out_fd and return is RETVAL_OK or error.
 */
 
-static int INIT read_bunzip(struct bunzip_data *bd, unsigned char *outbuf, int len)
+static int __init read_bunzip(struct bunzip_data *bd, unsigned char *outbuf, int len)
 {
 	const unsigned int *dbuf;
 	int pos, xcurrent, previous, gotcount;
@@ -607,7 +607,7 @@  decode_next_byte:
 	goto decode_next_byte;
 }
 
-static int INIT nofill(void *buf, unsigned int len)
+static int __init nofill(void *buf, unsigned int len)
 {
 	return -1;
 }
@@ -615,8 +615,8 @@  static int INIT nofill(void *buf, unsign
 /* Allocate the structure, read file header.  If in_fd ==-1, inbuf must contain
    a complete bunzip file (len bytes long).  If in_fd!=-1, inbuf and len are
    ignored, and data is read from file handle into temporary buffer. */
-static int INIT start_bunzip(struct bunzip_data **bdp, void *inbuf, int len,
-			     int (*fill)(void*, unsigned int))
+static int __init start_bunzip(struct bunzip_data **bdp, void *inbuf, int len,
+			       int (*fill)(void*, unsigned int))
 {
 	struct bunzip_data *bd;
 	unsigned int i, j, c;
@@ -665,11 +665,11 @@  static int INIT start_bunzip(struct bunz
 
 /* Example usage: decompress src_fd to dst_fd.  (Stops at end of bzip2 data,
    not end of file.) */
-int INIT bunzip2(unsigned char *buf, unsigned int len,
-		 int(*fill)(void*, unsigned int),
-		 int(*flush)(void*, unsigned int),
-		 unsigned char *outbuf, unsigned int *pos,
-		 void(*error)(const char *x))
+int __init bunzip2(unsigned char *buf, unsigned int len,
+		   int(*fill)(void*, unsigned int),
+		   int(*flush)(void*, unsigned int),
+		   unsigned char *outbuf, unsigned int *pos,
+		   void(*error)(const char *x))
 {
 	struct bunzip_data *bd;
 	int i = -1;