All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	George Dunlap <george.dunlap@citrix.com>,
	Ian Jackson <iwj@xenproject.org>, Julien Grall <julien@xen.org>,
	Stefano Stabellini <sstabellini@kernel.org>, Wei Liu <wl@xen.org>
Subject: [PATCH v3 10/15] unlzma: replace INIT
Date: Tue, 26 Jan 2021 10:51:48 +0100	[thread overview]
Message-ID: <b955d146-d9dd-daa2-984b-c50d38c714d7@suse.com> (raw)
In-Reply-To: <2db91183-a7de-0c43-2fef-feb3523ed19b@suse.com>

There's no need for this abstraction.

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

--- a/xen/common/unlzma.c
+++ b/xen/common/unlzma.c
@@ -30,7 +30,7 @@
 
 #include "decompress.h"
 
-static long long INIT read_int(unsigned char *ptr, int size)
+static long long __init read_int(unsigned char *ptr, int size)
 {
 	int i;
 	long long ret = 0;
@@ -76,13 +76,13 @@ struct rc {
 #define RC_MODEL_TOTAL_BITS 11
 
 
-static int INIT nofill(void *buffer, unsigned int len)
+static int __init nofill(void *buffer, unsigned int len)
 {
 	return -1;
 }
 
 /* Called twice: once at startup and once in rc_normalize() */
-static void INIT rc_read(struct rc *rc)
+static void __init rc_read(struct rc *rc)
 {
 	rc->buffer_size = rc->fill((char *)rc->buffer, LZMA_IOBUF_SIZE);
 	if (rc->buffer_size <= 0)
@@ -92,9 +92,9 @@ static void INIT rc_read(struct rc *rc)
 }
 
 /* Called once */
-static inline void INIT rc_init(struct rc *rc,
-				       int (*fill)(void*, unsigned int),
-				       unsigned char *buffer, int buffer_size)
+static inline void __init rc_init(struct rc *rc,
+				  int (*fill)(void*, unsigned int),
+				  unsigned char *buffer, int buffer_size)
 {
 	if (fill)
 		rc->fill = fill;
@@ -109,7 +109,7 @@ static inline void INIT rc_init(struct r
 	rc->range = 0xFFFFFFFF;
 }
 
-static inline void INIT rc_init_code(struct rc *rc)
+static inline void __init rc_init_code(struct rc *rc)
 {
 	int i;
 
@@ -122,14 +122,14 @@ static inline void INIT rc_init_code(str
 
 
 /* Called twice, but one callsite is in inline'd rc_is_bit_0_helper() */
-static void INIT rc_do_normalize(struct rc *rc)
+static void __init rc_do_normalize(struct rc *rc)
 {
 	if (rc->ptr >= rc->buffer_end)
 		rc_read(rc);
 	rc->range <<= 8;
 	rc->code = (rc->code << 8) | *rc->ptr++;
 }
-static inline void INIT rc_normalize(struct rc *rc)
+static inline void __init rc_normalize(struct rc *rc)
 {
 	if (rc->range < (1 << RC_TOP_BITS))
 		rc_do_normalize(rc);
@@ -139,20 +139,20 @@ static inline void INIT rc_normalize(str
 /* Why rc_is_bit_0_helper exists?
  *Because we want to always expose (rc->code < rc->bound) to optimizer
  */
-static inline uint32_t INIT rc_is_bit_0_helper(struct rc *rc, uint16_t *p)
+static inline uint32_t __init rc_is_bit_0_helper(struct rc *rc, uint16_t *p)
 {
 	rc_normalize(rc);
 	rc->bound = *p * (rc->range >> RC_MODEL_TOTAL_BITS);
 	return rc->bound;
 }
-static inline int INIT rc_is_bit_0(struct rc *rc, uint16_t *p)
+static inline int __init rc_is_bit_0(struct rc *rc, uint16_t *p)
 {
 	uint32_t t = rc_is_bit_0_helper(rc, p);
 	return rc->code < t;
 }
 
 /* Called ~10 times, but very small, thus inlined */
-static inline void INIT rc_update_bit_0(struct rc *rc, uint16_t *p)
+static inline void __init rc_update_bit_0(struct rc *rc, uint16_t *p)
 {
 	rc->range = rc->bound;
 	*p += ((1 << RC_MODEL_TOTAL_BITS) - *p) >> RC_MOVE_BITS;
@@ -165,7 +165,7 @@ static inline void rc_update_bit_1(struc
 }
 
 /* Called 4 times in unlzma loop */
-static int INIT rc_get_bit(struct rc *rc, uint16_t *p, int *symbol)
+static int __init rc_get_bit(struct rc *rc, uint16_t *p, int *symbol)
 {
 	if (rc_is_bit_0(rc, p)) {
 		rc_update_bit_0(rc, p);
@@ -179,7 +179,7 @@ static int INIT rc_get_bit(struct rc *rc
 }
 
 /* Called once */
-static inline int INIT rc_direct_bit(struct rc *rc)
+static inline int __init rc_direct_bit(struct rc *rc)
 {
 	rc_normalize(rc);
 	rc->range >>= 1;
@@ -191,7 +191,7 @@ static inline int INIT rc_direct_bit(str
 }
 
 /* Called twice */
-static inline void INIT
+static inline void __init
 rc_bit_tree_decode(struct rc *rc, uint16_t *p, int num_levels, int *symbol)
 {
 	int i = num_levels;
@@ -283,14 +283,14 @@ struct cstate {
 	uint32_t rep0, rep1, rep2, rep3;
 };
 
-static inline size_t INIT get_pos(struct writer *wr)
+static inline size_t __init get_pos(struct writer *wr)
 {
 	return
 		wr->global_pos + wr->buffer_pos;
 }
 
-static inline uint8_t INIT peek_old_byte(struct writer *wr,
-						uint32_t offs)
+static inline uint8_t __init peek_old_byte(struct writer *wr,
+					   uint32_t offs)
 {
 	if (!wr->flush) {
 		int32_t pos;
@@ -307,7 +307,7 @@ static inline uint8_t INIT peek_old_byte
 
 }
 
-static inline int INIT write_byte(struct writer *wr, uint8_t byte)
+static inline int __init write_byte(struct writer *wr, uint8_t byte)
 {
 	wr->buffer[wr->buffer_pos++] = wr->previous_byte = byte;
 	if (wr->flush && wr->buffer_pos == wr->header->dict_size) {
@@ -321,13 +321,13 @@ static inline int INIT write_byte(struct
 }
 
 
-static inline int INIT copy_byte(struct writer *wr, uint32_t offs)
+static inline int __init copy_byte(struct writer *wr, uint32_t offs)
 {
 	return write_byte(wr, peek_old_byte(wr, offs));
 }
 
-static inline int INIT copy_bytes(struct writer *wr,
-					 uint32_t rep0, int len)
+static inline int __init copy_bytes(struct writer *wr,
+				    uint32_t rep0, int len)
 {
 	do {
 		if (copy_byte(wr, rep0))
@@ -338,10 +338,10 @@ static inline int INIT copy_bytes(struct
 	return len;
 }
 
-static inline int INIT process_bit0(struct writer *wr, struct rc *rc,
-				     struct cstate *cst, uint16_t *p,
-				     int pos_state, uint16_t *prob,
-				     int lc, uint32_t literal_pos_mask) {
+static inline int __init process_bit0(struct writer *wr, struct rc *rc,
+				      struct cstate *cst, uint16_t *p,
+				      int pos_state, uint16_t *prob,
+				      int lc, uint32_t literal_pos_mask) {
 	int mi = 1;
 	rc_update_bit_0(rc, prob);
 	prob = (p + LZMA_LITERAL +
@@ -382,9 +382,9 @@ static inline int INIT process_bit0(stru
 	return write_byte(wr, mi);
 }
 
-static inline int INIT process_bit1(struct writer *wr, struct rc *rc,
-					    struct cstate *cst, uint16_t *p,
-					    int pos_state, uint16_t *prob) {
+static inline int __init process_bit1(struct writer *wr, struct rc *rc,
+				      struct cstate *cst, uint16_t *p,
+				      int pos_state, uint16_t *prob) {
   int offset;
 	uint16_t *prob_len;
 	int num_bits;
@@ -528,11 +528,11 @@ static inline int INIT process_bit1(stru
 
 
 
-int INIT unlzma(unsigned char *buf, unsigned int in_len,
-	        int(*fill)(void*, unsigned int),
-	        int(*flush)(void*, unsigned int),
-	        unsigned char *output, unsigned int *posp,
-	        void(*error)(const char *x))
+int __init unlzma(unsigned char *buf, unsigned int in_len,
+		  int(*fill)(void*, unsigned int),
+		  int(*flush)(void*, unsigned int),
+		  unsigned char *output, unsigned int *posp,
+		  void(*error)(const char *x))
 {
 	struct lzma_header header;
 	int lc, pb, lp;



  parent reply	other threads:[~2021-01-26  9:51 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-26  9:46 [PATCH v3 00/15] zstd decompression for DomU-s + fallout / consolidation Jan Beulich
2021-01-26  9:48 ` [PATCH v3 01/15] libxenguest: add get_unaligned_le32() Jan Beulich
2021-01-26 11:51   ` Ian Jackson
2021-01-26  9:49 ` [PATCH v3 02/15] libxenguest: support zstd compressed kernels Jan Beulich
2021-01-26 11:53   ` Ian Jackson
2021-01-26  9:49 ` [PATCH v3 03/15] xen/decompress: make helper symbols static Jan Beulich
2021-01-26  9:49 ` [PATCH v3 04/15] libxenguest: "standardize" LZO kernel decompression code Jan Beulich
2021-01-26  9:50 ` [PATCH v3 05/15] libxenguest: drop redundant decompression declarations Jan Beulich
2021-01-26  9:50 ` [PATCH v3 06/15] libxenguest: simplify kernel decompression Jan Beulich
2021-01-26  9:50 ` [PATCH v3 01/15] gunzip: drop INIT{,DATA} and STATIC Jan Beulich
2021-01-26  9:54   ` Jan Beulich
2021-01-26 11:56   ` Ian Jackson
2021-01-26 12:49     ` Jan Beulich
2021-01-26  9:51 ` [PATCH v3 08/15] bunzip: replace INIT Jan Beulich
2021-04-15 11:50   ` Julien Grall
2021-01-26  9:51 ` [PATCH v3 09/15] unlzo: " Jan Beulich
2021-04-15 11:51   ` Julien Grall
2021-01-26  9:51 ` Jan Beulich [this message]
2021-04-15 11:52   ` [PATCH v3 10/15] unlzma: " Julien Grall
2021-01-26  9:52 ` [PATCH v3 11/15] unlz4: " Jan Beulich
2021-04-15 11:56   ` Julien Grall
2021-01-26  9:52 ` [PATCH v3 12/15] unxz: replace INIT{,DATA} and STATIC Jan Beulich
2021-04-15 11:58   ` Julien Grall
2021-04-15 14:16     ` Jan Beulich
2021-04-15 14:18       ` Julien Grall
2021-04-15 14:22         ` Jan Beulich
2021-04-15 14:24           ` Julien Grall
2021-04-15 14:28             ` Jan Beulich
2021-04-15 14:55               ` Julien Grall
2021-01-26  9:52 ` [PATCH v3 13/15] unzstd: " Jan Beulich
2021-04-15 11:59   ` Julien Grall
2021-04-15 14:21     ` Jan Beulich
2021-04-15 14:22       ` Julien Grall
2021-04-15 14:25         ` Jan Beulich
2021-04-15 14:30           ` Julien Grall
2021-04-15 14:34             ` Jan Beulich
2021-04-15 14:47               ` Julien Grall
2021-01-26  9:53 ` [PATCH v3 14/15] xen/decompress: drop STATIC and INIT Jan Beulich
2021-04-15 14:21   ` Julien Grall
2021-04-15 14:32     ` Jan Beulich
2021-04-15 14:45       ` Julien Grall
2021-01-26  9:53 ` [PATCH v3 15/15] unzstd: make helper symbols static Jan Beulich
2021-04-15 12:09   ` Julien Grall
2021-04-15 14:37     ` Jan Beulich
2021-01-26 12:05 ` [PATCH v3 00/15] zstd decompression for DomU-s + fallout / consolidation Ian Jackson
2021-01-26 13:04   ` Jan Beulich
2021-01-26 13:25     ` Ian Jackson
2021-01-26 13:50       ` Jan Beulich
2021-04-15  9:20 ` Ping: " Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b955d146-d9dd-daa2-984b-c50d38c714d7@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=iwj@xenproject.org \
    --cc=julien@xen.org \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.