[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] xen/decompress: make helper symbols static



commit eaecd329a56ccbc8158a20a75dcb486d07a412d6
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue Mar 30 14:33:48 2021 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Mar 30 14:33:48 2021 +0200

    xen/decompress: make helper symbols static
    
    The individual decompression CUs need to only surface their top level
    functions to other code. Arrange for everything else to be static, to
    make sure no undue uses of that code exist or will appear without
    explicitly noticing. (In some cases this also results in code size
    reduction, but since this is all init-only code this probably doesn't
    matter very much.)
    
    In the LZO case also take the opportunity and convert u8 where lines
    get touched anyway.
    
    The downside is that the top level functions will now be non-static
    in stubdom builds of libxenguest, but I think that's acceptable. This
    does require declaring them first, though, as the compiler warns about
    the lack of declarations.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: Wei Liu <wl@xxxxxxx>
---
 tools/libs/guest/xg_dom_decompress_unsafe.h |  4 ++++
 xen/common/bunzip2.c                        | 11 +++++------
 xen/common/decompress.h                     |  2 +-
 xen/common/unlz4.c                          | 11 +++++------
 xen/common/unlzma.c                         | 12 +++++-------
 xen/common/unlzo.c                          | 10 +++++-----
 xen/common/unxz.c                           | 10 +++++-----
 xen/common/unzstd.c                         | 11 +++++------
 8 files changed, 35 insertions(+), 36 deletions(-)

diff --git a/tools/libs/guest/xg_dom_decompress_unsafe.h 
b/tools/libs/guest/xg_dom_decompress_unsafe.h
index 969846cb32..4e0bf23aa5 100644
--- a/tools/libs/guest/xg_dom_decompress_unsafe.h
+++ b/tools/libs/guest/xg_dom_decompress_unsafe.h
@@ -1,8 +1,12 @@
+#ifdef __MINIOS__
+# include "../../xen/include/xen/decompress.h"
+#else
 typedef int decompress_fn(unsigned char *inbuf, unsigned int len,
                           int (*fill)(void*, unsigned int),
                           int (*flush)(void*, unsigned int),
                           unsigned char *outbuf, unsigned int *posp,
                           void (*error)(const char *x));
+#endif
 
 int xc_dom_decompress_unsafe(
     decompress_fn fn, struct xc_dom_image *dom, void **blob, size_t *size)
diff --git a/xen/common/bunzip2.c b/xen/common/bunzip2.c
index 6d6e8b19fd..6aeac79f1a 100644
--- a/xen/common/bunzip2.c
+++ b/xen/common/bunzip2.c
@@ -665,12 +665,11 @@ static int INIT start_bunzip(struct bunzip_data **bdp, 
void *inbuf, int len,
 
 /* Example usage: decompress src_fd to dst_fd.  (Stops at end of bzip2 data,
    not end of file.) */
-STATIC 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 --git a/xen/common/decompress.h b/xen/common/decompress.h
index 647b7b1e83..d740a80eeb 100644
--- a/xen/common/decompress.h
+++ b/xen/common/decompress.h
@@ -7,7 +7,7 @@
 #include <xen/types.h>
 #include <xen/xmalloc.h>
 
-#define STATIC
+#define STATIC static
 #define INIT __init
 #define INITDATA __initdata
 
diff --git a/xen/common/unlz4.c b/xen/common/unlz4.c
index 9dcaec7e84..4a8fc55ccb 100644
--- a/xen/common/unlz4.c
+++ b/xen/common/unlz4.c
@@ -22,12 +22,11 @@
 #define LZ4_DEFAULT_UNCOMPRESSED_CHUNK_SIZE (8 << 20)
 #define ARCHIVE_MAGICNUMBER 0x184C2102
 
-STATIC int INIT unlz4(unsigned char *input, 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 unlz4(unsigned char *input, 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 ret = -1;
        size_t chunksize = 0;
diff --git a/xen/common/unlzma.c b/xen/common/unlzma.c
index 9134277bba..ea5ab41738 100644
--- a/xen/common/unlzma.c
+++ b/xen/common/unlzma.c
@@ -528,13 +528,11 @@ static inline int INIT process_bit1(struct writer *wr, 
struct rc *rc,
 
 
 
-STATIC 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;
diff --git a/xen/common/unlzo.c b/xen/common/unlzo.c
index 11f64fcf3b..df7e53db14 100644
--- a/xen/common/unlzo.c
+++ b/xen/common/unlzo.c
@@ -114,11 +114,11 @@ static int INIT parse_header(u8 *input, int *skip, int 
in_len)
        return 1;
 }
 
-STATIC int INIT unlzo(u8 *input, unsigned int in_len,
-                     int (*fill) (void *, unsigned int),
-                     int (*flush) (void *, unsigned int),
-                     u8 *output, unsigned int *posp,
-                     void (*error) (const char *x))
+int INIT unlzo(unsigned char *input, 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))
 {
        u8 r = 0;
        int skip = 0;
diff --git a/xen/common/unxz.c b/xen/common/unxz.c
index cf25c9fc8e..15806f4469 100644
--- a/xen/common/unxz.c
+++ b/xen/common/unxz.c
@@ -157,11 +157,11 @@
  * both input and output buffers are available as a single chunk, i.e. when
  * fill() and flush() won't be used.
  */
-STATIC int INIT unxz(unsigned char *in, unsigned int in_size,
-                    int (*fill)(void *dest, unsigned int size),
-                    int (*flush)(void *src, unsigned int size),
-                    unsigned char *out, unsigned int *in_used,
-                    void (*error)(const char *x))
+int INIT unxz(unsigned char *in, unsigned int in_size,
+             int (*fill)(void *dest, unsigned int size),
+             int (*flush)(void *src, unsigned int size),
+             unsigned char *out, unsigned int *in_used,
+             void (*error)(const char *x))
 {
        struct xz_buf b;
        struct xz_dec *s;
diff --git a/xen/common/unzstd.c b/xen/common/unzstd.c
index a107616427..915a07c21b 100644
--- a/xen/common/unzstd.c
+++ b/xen/common/unzstd.c
@@ -142,12 +142,11 @@ out:
        return err;
 }
 
-STATIC int INIT unzstd(unsigned char *in_buf, unsigned int in_len,
-                      int (*fill)(void*, unsigned int),
-                      int (*flush)(void*, unsigned int),
-                      unsigned char *out_buf,
-                      unsigned int *in_pos,
-                      void (*error)(const char *x))
+int INIT unzstd(unsigned char *in_buf, unsigned int in_len,
+               int (*fill)(void*, unsigned int),
+               int (*flush)(void*, unsigned int),
+               unsigned char *out_buf, unsigned int *in_pos,
+               void (*error)(const char *x))
 {
        ZSTD_inBuffer in;
        ZSTD_outBuffer out;
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.