]> xenbits.xensource.com Git - people/sstabellini/xen-unstable.git/.git/commitdiff
xen/decompress: make helper symbols static
authorJan Beulich <jbeulich@suse.com>
Tue, 30 Mar 2021 12:33:48 +0000 (14:33 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 30 Mar 2021 12:33:48 +0000 (14:33 +0200)
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@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Wei Liu <wl@xen.org>
tools/libs/guest/xg_dom_decompress_unsafe.h
xen/common/bunzip2.c
xen/common/decompress.h
xen/common/unlz4.c
xen/common/unlzma.c
xen/common/unlzo.c
xen/common/unxz.c
xen/common/unzstd.c

index 969846cb322c24b188769f00f7c105f07f0d22dd..4e0bf23aa58797db100208a2f57de0b98829cfee 100644 (file)
@@ -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)
index 6d6e8b19fdd7b1f09f841c59a1b63b2e2356d10b..6aeac79f1a4534b307f4a97fd477da82ca565993 100644 (file)
@@ -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;
index 647b7b1e83db94232082b3161b388bd8b1825149..d740a80eeb5ccb3a22cb560aa9566203212d3a87 100644 (file)
@@ -7,7 +7,7 @@
 #include <xen/types.h>
 #include <xen/xmalloc.h>
 
-#define STATIC
+#define STATIC static
 #define INIT __init
 #define INITDATA __initdata
 
index 9dcaec7e84cca734c9f842c6294c4b744a324d02..4a8fc55ccb27089705b005b692bdfdc2bcba955e 100644 (file)
 #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;
index 9134277bba0368061ad99cf4145f68dfcca693f5..ea5ab41738ee235d06500babd510c433050125db 100644 (file)
@@ -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;
index 11f64fcf3b26c4f0796e07b28b65263a1be95abb..df7e53db14a9babed3ca82aa705f7c285a94d109 100644 (file)
@@ -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;
index cf25c9fc8ed00d1000653ec22a873653996aa7da..15806f4469f266e7d969bd93785db30302c95aa0 100644 (file)
  * 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;
index a10761642764573f5d856e81999b72116d160b77..915a07c21b19dff9a5f1f675c2f7d94fec584a4b 100644 (file)
@@ -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;