Page MenuHomeFreeBSD

D20271.id60380.diff
No OneTemporary

D20271.id60380.diff

Index: share/man/man4/geom_uzip.4
===================================================================
--- share/man/man4/geom_uzip.4
+++ share/man/man4/geom_uzip.4
@@ -36,6 +36,7 @@
place the following line in your
kernel configuration file:
.Bd -ragged -offset indent
+.Cd "device zlib"
.Cd "device xz"
.Cd "options GEOM_UZIP"
.Ed
Index: sys/conf/files
===================================================================
--- sys/conf/files
+++ sys/conf/files
@@ -3626,7 +3626,8 @@
geom/uzip/g_uzip.c optional geom_uzip
geom/uzip/g_uzip_lzma.c optional geom_uzip
geom/uzip/g_uzip_wrkthr.c optional geom_uzip
-geom/uzip/g_uzip_zlib.c optional geom_uzip
+geom/uzip/g_uzip_zlib.c optional geom_uzip \
+ compile-with "${ZLIB_C}"
geom/vinum/geom_vinum.c optional geom_vinum
geom/vinum/geom_vinum_create.c optional geom_vinum
geom/vinum/geom_vinum_drive.c optional geom_vinum
@@ -3997,6 +3998,9 @@
libkern/zlib.c optional crypto | geom_uzip | ipsec | \
ipsec_support | mxge | netgraph_deflate | ddb_ctf | gzio
contrib/zlib/adler32.c optional crypto | geom_uzip | ipsec | \
+ ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \
+ compile-with "${ZLIB_C}"
+contrib/zlib/compress.c optional crypto | geom_uzip | ipsec | \
ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \
compile-with "${ZLIB_C}"
contrib/zlib/crc32.c optional crypto | geom_uzip | ipsec | \
Index: sys/contrib/zlib/compress.c
===================================================================
--- sys/contrib/zlib/compress.c
+++ sys/contrib/zlib/compress.c
@@ -8,6 +8,8 @@
#define ZLIB_INTERNAL
#include "zlib.h"
+#ifndef Z_SOLO
+
/* ===========================================================================
Compresses the source buffer into the destination buffer. The level
parameter has the same meaning as in deflateInit. sourceLen is the byte
@@ -73,6 +75,8 @@
{
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
}
+
+#endif
/* ===========================================================================
If the default memLevel or windowBits for deflateInit() is changed, then
Index: sys/contrib/zlib/zconf.h
===================================================================
--- sys/contrib/zlib/zconf.h
+++ sys/contrib/zlib/zconf.h
@@ -33,8 +33,8 @@
# ifndef Z_SOLO
# define compress z_compress
# define compress2 z_compress2
-# define compressBound z_compressBound
# endif
+# define compressBound z_compressBound
# define crc32 z_crc32
# define crc32_combine z_crc32_combine
# define crc32_combine64 z_crc32_combine64
Index: sys/contrib/zlib/zlib.h
===================================================================
--- sys/contrib/zlib/zlib.h
+++ sys/contrib/zlib/zlib.h
@@ -1256,12 +1256,16 @@
Z_STREAM_ERROR if the level parameter is invalid.
*/
+#endif /* !Z_SOLO */
+
ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
/*
compressBound() returns an upper bound on the compressed size after
compress() or compress2() on sourceLen bytes. It would be used before a
compress() or compress2() call to allocate the destination buffer.
*/
+
+#ifndef Z_SOLO
ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
const Bytef *source, uLong sourceLen));
Index: sys/geom/uzip/g_uzip_zlib.c
===================================================================
--- sys/geom/uzip/g_uzip_zlib.c
+++ sys/geom/uzip/g_uzip_zlib.c
@@ -33,7 +33,8 @@
#include <sys/systm.h>
#include <sys/malloc.h>
-#include <sys/zlib.h>
+#include <contrib/zlib/zlib.h>
+#include <dev/zlib/zcalloc.h>
#include <geom/uzip/g_uzip.h>
#include <geom/uzip/g_uzip_dapi.h>
@@ -46,8 +47,6 @@
z_stream zs;
};
-static void *z_alloc(void *, u_int, u_int);
-static void z_free(void *, void *);
static int g_uzip_zlib_rewind(struct g_uzip_dapi *, const char *);
static void
@@ -97,26 +96,19 @@
return (err);
}
-static int
-z_compressBound(int len)
-{
-
- return (len + (len >> 12) + (len >> 14) + 11);
-}
-
struct g_uzip_dapi *
g_uzip_zlib_ctor(uint32_t blksz)
{
struct g_uzip_zlib *zp;
zp = malloc(sizeof(struct g_uzip_zlib), M_GEOM_UZIP, M_WAITOK);
- zp->zs.zalloc = z_alloc;
- zp->zs.zfree = z_free;
+ zp->zs.zalloc = zcalloc_nowait;
+ zp->zs.zfree = zcfree;
if (inflateInit(&zp->zs) != Z_OK) {
goto e1;
}
zp->blksz = blksz;
- zp->pub.max_blen = z_compressBound(blksz);
+ zp->pub.max_blen = compressBound(blksz);
zp->pub.decompress = &g_uzip_zlib_decompress;
zp->pub.free = &g_uzip_zlib_free;
zp->pub.rewind = &g_uzip_zlib_rewind;
@@ -125,21 +117,4 @@
e1:
free(zp, M_GEOM_UZIP);
return (NULL);
-}
-
-static void *
-z_alloc(void *nil, u_int type, u_int size)
-{
- void *ptr;
-
- ptr = malloc(type * size, M_GEOM_UZIP, M_NOWAIT);
-
- return (ptr);
-}
-
-static void
-z_free(void *nil, void *ptr)
-{
-
- free(ptr, M_GEOM_UZIP);
}
Index: sys/modules/geom/geom_uzip/Makefile
===================================================================
--- sys/modules/geom/geom_uzip/Makefile
+++ sys/modules/geom/geom_uzip/Makefile
@@ -10,7 +10,8 @@
.PATH: ${SRCTOP}/sys/net
-CFLAGS+= -I${SRCTOP}/sys/contrib/xz-embedded/freebsd \
+CFLAGS.g_uzip_zlib.c+= ${ZLIB_CFLAGS}
+CFLAGS.g_uzip_lzma.c+= -I${SRCTOP}/sys/contrib/xz-embedded/freebsd \
-I${SRCTOP}/sys/contrib/xz-embedded/linux/lib/xz/
SRCS+= opt_geom.h
Index: sys/modules/zlib/Makefile
===================================================================
--- sys/modules/zlib/Makefile
+++ sys/modules/zlib/Makefile
@@ -11,6 +11,7 @@
SRCS+= zcalloc.c
SRCS+= zlib_mod.c
SRCS+= adler32.c
+SRCS+= compress.c
SRCS+= crc32.c
SRCS+= deflate.c
SRCS+= inffast.c

File Metadata

Mime Type
text/plain
Expires
Sat, Jun 13, 12:58 AM (10 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33917944
Default Alt Text
D20271.id60380.diff (5 KB)

Event Timeline