Below summary is added to new sys/sys/zlib.h and copied to here
#1 - sys/crc32.h is split out of sys/libkern.h to avoid conflicts
between zlib's crc32 and system crc32.
#2 - Use contrib/zstd/lib/freebsd's stdlib compatible includes.
#3 - ZLIB_C is created con/kern.pre.mk to share compile paths.
-I contrib/zlib
-I sys/contrib/zstd/lib/freebsd
#4 - sys/zlib.h defines these. -DZ_PREIFX
Z_PREIFX#4 - opencryptodeflate.c
NO_GZIP
Z_SOLO - this is for libkern/zlib.c and not needed for clients of zlib
#5 - opencryptodeflate.c
zfs.state->dummy is an address and doesn't seem to be useful.
Its DTRACE probe is removed.
#5 - zfs has its own copy of zlib, too.
- sys/cddl/contrib/opensolaris/uts/common/zmod has zlib
version 1.2.3 in 2005
- However, it looks this code is not used and removed.
#6 - netgraph/deflate.c needs and uses FreeBSD enhancements to zlib.
Moved sys/zlib.h to netgraph/ng_zlib.h, sys/libkern/zlib.c to
netgraph/ng_zlib.c, and netgraph/deflate.c includes netgraph/ng_zlib.c
to compile as a part of deflate.c.
We may consider dropping functions with the same implementationPrefixed with ng_ for inflate() and deflate() to emphasize that
as contrib/zlib from netgraph/zlib.c. However, this effortsthese are the FreeBSD specific implementations.
require exposing static functions to general publicAll of ng_zlib.h functions are marked static.
TODOs
1 - Should we move contrib/zlib to sys/contrib/zlib?
2 - GZIP APIs are redefined in multiple places as static functions.