Author: kevans
Date: Wed Feb 20 19:32:02 2019
New Revision: 344379
URL: https://svnweb.freebsd.org/changeset/base/344379

Log:
  MFC r306681, r336249-r336250, r336261: remove inflate conflict
  
  r306681:
  ANSIfy inflate.c
  
  Reviewed by:  kib
  Sponsored by: The FreeBSD Foundation
  Differential Revision:        https://reviews.freebsd.org/D8143
  
  r336249:
  Fix sparc64 builds
  
  gcc is complaining about struct infate being defined in a parameter
  list. It's inclear how long this has been broken, but the fix is
  simple enough.
  
  r336250:
  There's two files in the sys tree named inflate.c, in addition
  to it being a common name elsewhere. Rename the old kzip one
  to subr_inflate.c.
  
  This actually fixes the build issues on sparc64 that my inclusion of
  .PATH ${SYSDIR}/kern created in r336244, so also revert the broken
  workaround I committed in r336249.
  
  This slipped passed me because apparently, I never did a clean build.
  
  r336261:
  Catch up to the inflate renaming.

Added:
  stable/11/sys/kern/subr_inflate.c   (contents, props changed)
     - copied, changed from r344378, stable/11/sys/kern/inflate.c
Deleted:
  stable/11/sys/kern/inflate.c
Modified:
  stable/11/stand/i386/kgzldr/Makefile
  stable/11/sys/conf/Makefile.arm
  stable/11/sys/conf/files
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/i386/kgzldr/Makefile
==============================================================================
--- stable/11/stand/i386/kgzldr/Makefile        Wed Feb 20 19:19:24 2019        
(r344378)
+++ stable/11/stand/i386/kgzldr/Makefile        Wed Feb 20 19:32:02 2019        
(r344379)
@@ -7,7 +7,7 @@ STRIP=
 BINMODE=${LIBMODE}
 BINDIR=        ${LIBDIR}
 
-SRCS=  start.s boot.c inflate.c lib.c crt.s sio.s
+SRCS=  start.s boot.c subr_inflate.c lib.c crt.s sio.s
 CFLAGS=        -Os
 CFLAGS+=-DKZIP
 NO_SHARED=

Modified: stable/11/sys/conf/Makefile.arm
==============================================================================
--- stable/11/sys/conf/Makefile.arm     Wed Feb 20 19:19:24 2019        
(r344378)
+++ stable/11/sys/conf/Makefile.arm     Wed Feb 20 19:32:02 2019        
(r344379)
@@ -111,7 +111,7 @@ ${KERNEL_KO}.tramp: ${KERNEL_KO} $S/$M/$M/inckern.S $S
        gzip -f9 ${KERNEL_KO}.tmp
        eval $$(stat -s ${KERNEL_KO}.tmp.gz) && \
            echo "#define KERNCOMPSIZE $$st_size" >>opt_kernname.h
-       ${CC} -O2 -ffreestanding -DKZIP -I. -I$S -c $S/kern/inflate.c -o \
+       ${CC} -O2 -ffreestanding -DKZIP -I. -I$S -c $S/kern/subr_inflate.c -o \
            inflate-tramp.o
        ${CC} -O -nostdlib -I. -I$S -Xlinker -T -Xlinker ldscript.$M.tramp \
            -DKZIP tmphack.S $S/$M/$M/elf_trampoline.c inflate-tramp.o \

Modified: stable/11/sys/conf/files
==============================================================================
--- stable/11/sys/conf/files    Wed Feb 20 19:19:24 2019        (r344378)
+++ stable/11/sys/conf/files    Wed Feb 20 19:32:02 2019        (r344379)
@@ -3581,7 +3581,6 @@ kern/imgact_binmisc.c             optional        
imagact_binmisc
 kern/imgact_elf.c              standard
 kern/imgact_elf32.c            optional compat_freebsd32
 kern/imgact_shell.c            standard
-kern/inflate.c                 optional gzip
 kern/init_main.c               standard
 kern/init_sysent.c             standard
 kern/ksched.c                  optional _kposix_priority_scheduling
@@ -3690,6 +3689,7 @@ kern/subr_firmware.c              optional firmware
 kern/subr_gtaskqueue.c         standard
 kern/subr_hash.c               standard
 kern/subr_hints.c              standard
+kern/subr_inflate.c            optional gzip
 kern/subr_kdb.c                        standard
 kern/subr_kobj.c               standard
 kern/subr_lock.c               standard

Copied and modified: stable/11/sys/kern/subr_inflate.c (from r344378, 
stable/11/sys/kern/inflate.c)
==============================================================================
--- stable/11/sys/kern/inflate.c        Wed Feb 20 19:19:24 2019        
(r344378, copy source)
+++ stable/11/sys/kern/subr_inflate.c   Wed Feb 20 19:32:02 2019        
(r344379)
@@ -411,16 +411,19 @@ static const int dbits = 6;       /* bits in base 
distance l
    The code with value 256 is special, and the tables are constructed
    so that no bits beyond that code are fetched when that code is
    decoded. */
+/*
+ * Arguments:
+ * b   code lengths in bits (all assumed <= BMAX)
+ * n   number of codes (assumed <= N_MAX)
+ * s   number of simple-valued codes (0..s-1)
+ * d   list of base values for non-simple codes
+ * e   list of extra bits for non-simple codes
+ * t   result: starting table
+ * m   maximum lookup bits, returns actual
+ */
 static int
-huft_build(glbl, b, n, s, d, e, t, m)
-       struct inflate *glbl;
-       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) */
-       const ush      *d;      /* list of base values for non-simple codes */
-       const ush      *e;      /* list of extra bits for non-simple codes */
-       struct huft   **t;      /* result: starting table */
-       int            *m;      /* maximum lookup bits, returns actual */
+huft_build(struct inflate *glbl, unsigned *b, unsigned n, unsigned s,
+    const ush *d, const ush *e, struct huft **t, int *m)
 {
        unsigned        a;      /* counter for codes of length k */
        unsigned        c[BMAX + 1];    /* bit length count table */
@@ -614,10 +617,12 @@ huft_build(glbl, b, n, s, d, e, t, m)
        return y != 0 && g != 1;
 }
 
+/*
+ * Arguments:
+ * t   table to free
+ */
 static int
-huft_free(glbl, t)
-       struct inflate *glbl;
-       struct huft    *t;      /* table to free */
+huft_free(struct inflate *glbl, struct huft *t)
 /* Free the malloc'ed tables built by huft_build(), which makes a linked
    list of the tables it made, with the links in a dummy first entry of
    each table. */
@@ -636,11 +641,14 @@ huft_free(glbl, t)
 
 /* inflate (decompress) the codes in a deflated (compressed) block.
    Return an error code or zero if it all goes ok. */
+/*
+ * Arguments:
+ * tl, td      literal/length and distance decoder tables
+ * bl, bd      number of bits decoded by tl[] and td[]
+ */
 static int
-inflate_codes(glbl, tl, td, bl, bd)
-       struct inflate *glbl;
-       struct huft    *tl, *td;/* literal/length and distance decoder tables */
-       int             bl, bd; /* number of bits decoded by tl[] and td[] */
+inflate_codes(struct inflate *glbl, struct huft *tl, struct huft*td, int bl,
+    int bd)
 {
        unsigned e;             /* table entry flag/number of extra bits */
        unsigned        n, d;   /* length and index for copy */
@@ -733,8 +741,7 @@ inflate_codes(glbl, tl, td, bl, bd)
 
 /* "decompress" an inflated type 0 (stored) block. */
 static int
-inflate_stored(glbl)
-       struct inflate *glbl;
+inflate_stored(struct inflate *glbl)
 {
        unsigned        n;      /* number of bytes in block */
        unsigned        w;      /* current window position */
@@ -780,8 +787,7 @@ inflate_stored(glbl)
    either replace this with a custom decoder, or at least precompute the
    Huffman tables. */
 static int
-inflate_fixed(glbl)
-       struct inflate *glbl;
+inflate_fixed(struct inflate *glbl)
 {
        /* if first time, set up tables for fixed blocks */
        if (glbl->gz_fixed_tl == (struct huft *) NULL) {
@@ -822,8 +828,7 @@ inflate_fixed(glbl)
 
 /* decompress an inflated type 2 (dynamic Huffman codes) block. */
 static int
-inflate_dynamic(glbl)
-       struct inflate *glbl;
+inflate_dynamic(struct inflate *glbl)
 {
        int             i;      /* temporary variables */
        unsigned        j;
@@ -967,10 +972,12 @@ inflate_dynamic(glbl)
 }
 
 /* decompress an inflated block */
+/*
+ * Arguments:
+ * e   last block flag
+ */
 static int
-inflate_block(glbl, e)
-       struct inflate *glbl;
-       int            *e;      /* last block flag */
+inflate_block(struct inflate *glbl, int *e)
 {
        unsigned        t;      /* block type */
        ulg    b;               /* bit buffer */
@@ -1007,8 +1014,7 @@ inflate_block(glbl, e)
 
 /* decompress an inflated entry */
 static int
-xinflate(glbl)
-       struct inflate *glbl;
+xinflate(struct inflate *glbl)
 {
        int             e;      /* last block flag */
        int             r;      /* result code */
@@ -1040,8 +1046,7 @@ xinflate(glbl)
 
 /* Nobody uses this - why not? */
 int
-inflate(glbl)
-       struct inflate *glbl;
+inflate(struct inflate *glbl)
 {
        int             i;
 #ifdef _KERNEL
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to