Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F110070447
D21156.id60490.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
11 KB
Referenced Files
None
Subscribers
None
D21156.id60490.diff
View Options
Index: sys/conf/files
===================================================================
--- sys/conf/files
+++ sys/conf/files
@@ -273,7 +273,7 @@
cddl/contrib/opensolaris/uts/common/os/fm.c optional zfs compile-with "${ZFS_C}"
cddl/contrib/opensolaris/uts/common/os/list.c optional zfs compile-with "${ZFS_C}"
cddl/contrib/opensolaris/uts/common/os/nvpair_alloc_system.c optional zfs compile-with "${ZFS_C}"
-cddl/contrib/opensolaris/uts/common/zmod/zmod.c optional zfs compile-with "${ZFS_C} ${ZLIB_CFLAGS}"
+cddl/contrib/opensolaris/uts/common/zmod/zmod.c optional zfs compile-with "${ZFS_C}"
# zfs lua support
cddl/contrib/opensolaris/uts/common/fs/zfs/lua/lapi.c optional zfs compile-with "${ZFS_C}"
cddl/contrib/opensolaris/uts/common/fs/zfs/lua/lauxlib.c optional zfs compile-with "${ZFS_C}"
@@ -2443,8 +2443,7 @@
compile-with "${NORMAL_FW}" \
no-obj no-implicit-rule \
clean "mwlboot.fw"
-dev/mxge/if_mxge.c optional mxge pci \
- compile-with "${ZLIB_C}"
+dev/mxge/if_mxge.c optional mxge pci
dev/mxge/mxge_eth_z8e.c optional mxge pci
dev/mxge/mxge_ethp_z8e.c optional mxge pci
dev/mxge/mxge_rss_eth_z8e.c optional mxge pci
@@ -3999,35 +3998,33 @@
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
+contrib/zlib/compress.c optional crypto | geom_uzip | ipsec | \
ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \
- compile-with "${ZLIB_C}"
+ compile-with "${NORMAL_C} -Wno-cast-qual"
contrib/zlib/crc32.c optional crypto | geom_uzip | ipsec | \
ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \
- compile-with "${ZLIB_C} -Wno-cast-qual"
+ compile-with "${NORMAL_C} -Wno-cast-qual"
contrib/zlib/deflate.c optional crypto | geom_uzip | ipsec | \
ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \
- compile-with "${ZLIB_C} -Wno-cast-qual"
+ compile-with "${NORMAL_C} -Wno-cast-qual"
contrib/zlib/inffast.c optional crypto | geom_uzip | ipsec | \
- ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \
- compile-with "${ZLIB_C}"
+ ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib
contrib/zlib/inflate.c optional crypto | geom_uzip | ipsec | \
- ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \
- compile-with "${ZLIB_C}"
+ ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib
contrib/zlib/inftrees.c optional crypto | geom_uzip | ipsec | \
- ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \
- compile-with "${ZLIB_C}"
+ ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib
contrib/zlib/trees.c optional crypto | geom_uzip | ipsec | \
+ ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib
+contrib/zlib/uncompr.c optional crypto | geom_uzip | ipsec | \
ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \
- compile-with "${ZLIB_C}"
+ compile-with "${NORMAL_C} -Wno-cast-qual"
contrib/zlib/zutil.c optional crypto | geom_uzip | ipsec | \
- ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \
- compile-with "${ZLIB_C}"
+ ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib
dev/zlib/zlib_mod.c optional crypto | geom_uzip | ipsec | \
- ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \
- compile-with "${ZLIB_C}"
+ ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib
dev/zlib/zcalloc.c optional crypto | geom_uzip | ipsec | \
- ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \
- compile-with "${ZLIB_C}"
+ ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib
net/altq/altq_cbq.c optional altq
net/altq/altq_codel.c optional altq
net/altq/altq_hfsc.c optional altq
@@ -4780,8 +4777,7 @@
opencrypto/cryptodev.c optional cryptodev
opencrypto/cryptodev_if.m optional crypto | ipsec | ipsec_support
opencrypto/cryptosoft.c optional crypto | ipsec | ipsec_support
-opencrypto/cryptodeflate.c optional crypto | ipsec | ipsec_support \
- compile-with "${ZLIB_C}"
+opencrypto/cryptodeflate.c optional crypto | ipsec | ipsec_support
opencrypto/gmac.c optional crypto | ipsec | ipsec_support
opencrypto/gfmult.c optional crypto | ipsec | ipsec_support
opencrypto/rmd160.c optional crypto | ipsec | ipsec_support
Index: sys/conf/kern.pre.mk
===================================================================
--- sys/conf/kern.pre.mk
+++ sys/conf/kern.pre.mk
@@ -173,10 +173,6 @@
NORMAL_FWO= ${LD} -b binary --no-warn-mismatch -d -warn-common -r \
-m ${LD_EMULATION} -o ${.TARGET} ${.ALLSRC:M*.fw}
-# for zlib in the kernel
-ZLIB_CFLAGS+= -DZ_SOLO
-ZLIB_C= ${CC} -c ${ZLIB_CFLAGS} ${CFLAGS} ${.IMPSRC}
-
# for ZSTD in the kernel (include zstd/lib/freebsd before other CFLAGS)
ZSTD_C= ${CC} -c -DZSTD_HEAPMODE=1 -I$S/contrib/zstd/lib/freebsd ${CFLAGS} -I$S/contrib/zstd/lib -I$S/contrib/zstd/lib/common ${WERROR} -Wno-inline -Wno-missing-prototypes ${PROF} -U__BMI__ ${.IMPSRC}
Index: sys/conf/kmod.mk
===================================================================
--- sys/conf/kmod.mk
+++ sys/conf/kmod.mk
@@ -104,8 +104,6 @@
__KLD_SHARED=no
.endif
-ZLIB_CFLAGS+= -DZ_SOLO
-
.if !empty(CFLAGS:M-O[23s]) && empty(CFLAGS:M-fno-strict-aliasing)
CFLAGS+= -fno-strict-aliasing
.endif
Index: sys/contrib/zlib/deflate.c
===================================================================
--- sys/contrib/zlib/deflate.c
+++ sys/contrib/zlib/deflate.c
@@ -266,7 +266,7 @@
strm->msg = Z_NULL;
if (strm->zalloc == (alloc_func)0) {
-#ifdef Z_SOLO
+#if defined(Z_SOLO) && !defined(_KERNEL)
return Z_STREAM_ERROR;
#else
strm->zalloc = zcalloc;
@@ -274,7 +274,7 @@
#endif
}
if (strm->zfree == (free_func)0)
-#ifdef Z_SOLO
+#if defined(Z_SOLO) && !defined(_KERNEL)
return Z_STREAM_ERROR;
#else
strm->zfree = zcfree;
Index: sys/contrib/zlib/infback.c
===================================================================
--- sys/contrib/zlib/infback.c
+++ sys/contrib/zlib/infback.c
@@ -42,7 +42,7 @@
return Z_STREAM_ERROR;
strm->msg = Z_NULL; /* in case we return an error */
if (strm->zalloc == (alloc_func)0) {
-#ifdef Z_SOLO
+#if defined(Z_SOLO) && !defined(_KERNEL)
return Z_STREAM_ERROR;
#else
strm->zalloc = zcalloc;
@@ -50,7 +50,7 @@
#endif
}
if (strm->zfree == (free_func)0)
-#ifdef Z_SOLO
+#if defined(Z_SOLO) && !defined(_KERNEL)
return Z_STREAM_ERROR;
#else
strm->zfree = zcfree;
Index: sys/contrib/zlib/inflate.c
===================================================================
--- sys/contrib/zlib/inflate.c
+++ sys/contrib/zlib/inflate.c
@@ -207,7 +207,7 @@
if (strm == Z_NULL) return Z_STREAM_ERROR;
strm->msg = Z_NULL; /* in case we return an error */
if (strm->zalloc == (alloc_func)0) {
-#ifdef Z_SOLO
+#if defined(Z_SOLO) && !defined(_KERNEL)
return Z_STREAM_ERROR;
#else
strm->zalloc = zcalloc;
@@ -215,7 +215,7 @@
#endif
}
if (strm->zfree == (free_func)0)
-#ifdef Z_SOLO
+#if defined(Z_SOLO) && !defined(_KERNEL)
return Z_STREAM_ERROR;
#else
strm->zfree = zcfree;
Index: sys/contrib/zlib/zconf.h
===================================================================
--- sys/contrib/zlib/zconf.h
+++ sys/contrib/zlib/zconf.h
@@ -8,6 +8,12 @@
#ifndef ZCONF_H
#define ZCONF_H
+#ifdef __FreeBSD__
+#ifdef _KERNEL
+#define Z_SOLO
+#endif
+#endif
+
/*
* If you *really* need a unique prefix for all types and library functions,
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
@@ -30,7 +36,7 @@
# define adler32_combine z_adler32_combine
# define adler32_combine64 z_adler32_combine64
# define adler32_z z_adler32_z
-# ifndef Z_SOLO
+# if !defined(Z_SOLO) && !defined(_KERNEL)
# define compress z_compress
# define compress2 z_compress2
# define compressBound z_compressBound
@@ -125,12 +131,12 @@
# define inflate_copyright z_inflate_copyright
# define inflate_fast z_inflate_fast
# define inflate_table z_inflate_table
-# ifndef Z_SOLO
+# if !defined(Z_SOLO) && !defined(_KERNEL)
# define uncompress z_uncompress
# define uncompress2 z_uncompress2
# endif
# define zError z_zError
-# ifndef Z_SOLO
+# if !defined(Z_SOLO) && !defined(_KERNEL)
# define zcalloc z_zcalloc
# define zcfree z_zcfree
# endif
Index: sys/contrib/zlib/zlib.h
===================================================================
--- sys/contrib/zlib/zlib.h
+++ sys/contrib/zlib/zlib.h
@@ -1213,7 +1213,7 @@
27-31: 0 (reserved)
*/
-#ifndef Z_SOLO
+#if !defined(Z_SOLO) || defined(_KERNEL)
/* utility functions */
@@ -1288,6 +1288,9 @@
length of the source is *sourceLen. On return, *sourceLen is the number of
source bytes consumed.
*/
+#endif /* !Z_SOLO || _KERNEL */
+
+#ifndef Z_SOLO
/* gzip file access functions */
Index: sys/contrib/zlib/zutil.h
===================================================================
--- sys/contrib/zlib/zutil.h
+++ sys/contrib/zlib/zutil.h
@@ -256,7 +256,7 @@
# define Tracecv(c,x)
#endif
-#ifndef Z_SOLO
+#if !defined(Z_SOLO) || defined(_KERNEL)
voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items,
unsigned size));
void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr));
Index: sys/dev/zlib/zcalloc.h
===================================================================
--- sys/dev/zlib/zcalloc.h
+++ sys/dev/zlib/zcalloc.h
@@ -6,8 +6,9 @@
#ifndef _DEV_ZLIB_ZCALLOC_
#define _DEV_ZLIB_ZCALLOC_
-void * zcalloc_waitok(void *nil, u_int items, u_int size);
-void * zcalloc_nowait(void *nil, u_int items, u_int size);
-void zcfree(void *nil, void *ptr);
+#include <contrib/zlib/zutil.h>
+#undef local
+void *zcalloc_waitok(void *, u_int, u_int);
+void *zcalloc_nowait(void *, u_int, u_int);
#endif
Index: sys/dev/zlib/zcalloc.c
===================================================================
--- sys/dev/zlib/zcalloc.c
+++ sys/dev/zlib/zcalloc.c
@@ -24,6 +24,13 @@
return mallocarray(items, size, M_ZLIB, M_NOWAIT);
}
+void *
+zcalloc(void *nil, u_int items, u_int size)
+{
+
+ return zcalloc_nowait(nil, items, size);
+}
+
void
zcfree(void *nil, void *ptr)
{
Index: sys/modules/crypto/Makefile
===================================================================
--- sys/modules/crypto/Makefile
+++ sys/modules/crypto/Makefile
@@ -23,7 +23,6 @@
SRCS = crypto.c cryptodev_if.c
SRCS += criov.c cryptosoft.c xform.c
SRCS += cast.c cryptodeflate.c rmd160.c rijndael-alg-fst.c rijndael-api.c rijndael-api-fst.c
-CFLAGS.cryptodeflate.c += ${ZLIB_CFLAGS}
SRCS += skipjack.c bf_enc.c bf_ecb.c bf_skey.c
SRCS += camellia.c camellia-api.c
SRCS += des_ecb.c des_enc.c des_setkey.c
Index: sys/modules/mxge/mxge/Makefile
===================================================================
--- sys/modules/mxge/mxge/Makefile
+++ sys/modules/mxge/mxge/Makefile
@@ -5,6 +5,4 @@
KMOD= if_mxge
SRCS= if_mxge.c device_if.h bus_if.h pci_if.h opt_inet.h opt_inet6.h
-CFLAGS.if_mxge.c+= ${ZLIB_CFLAGS}
-
.include <bsd.kmod.mk>
Index: sys/modules/zfs/Makefile
===================================================================
--- sys/modules/zfs/Makefile
+++ sys/modules/zfs/Makefile
@@ -56,7 +56,6 @@
.PATH: ${SUNW}/uts/common/zmod
SRCS+= zmod.c
-CFLAGS.zmod.c+= ${ZLIB_CFLAGS}
.PATH: ${SYSDIR}/crypto/sha2
SRCS+= sha256c.c sha512c.c
Index: sys/modules/zlib/Makefile
===================================================================
--- sys/modules/zlib/Makefile
+++ sys/modules/zlib/Makefile
@@ -11,16 +11,16 @@
SRCS+= zcalloc.c
SRCS+= zlib_mod.c
SRCS+= adler32.c
+SRCS+= compress.c
SRCS+= crc32.c
SRCS+= deflate.c
SRCS+= inffast.c
SRCS+= inflate.c
SRCS+= inftrees.c
SRCS+= trees.c
+SRCS+= uncompr.c
SRCS+= zutil.c
-CFLAGS+=${ZLIB_CFLAGS}
-
CWARNFLAGS.compress.c+=-Wno-cast-qual # compress:49
CWARNFLAGS.deflate.c+=-Wno-cast-qual # deflate.c:415
CWARNFLAGS.uncompr.c+=-Wno-cast-qual # uncompr:49
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Feb 14, 6:19 AM (10 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16638431
Default Alt Text
D21156.id60490.diff (11 KB)
Attached To
Mode
D21156: Expose zlib's utility functions in Z_SOLO library when building kernel. This allows kernel code to reuse zlib's implementation.
Attached
Detach File
Event Timeline
Log In to Comment