Move zlib out of net/ and into kern/. It would probably be better to use

the reachover Makefiles and libz, but this is already here and it works.
This commit is contained in:
ad 2008-05-04 23:07:09 +00:00
parent d2c9207a91
commit b407147f14
10 changed files with 1302 additions and 39 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: files,v 1.902 2008/04/29 14:35:20 rmind Exp $ # $NetBSD: files,v 1.903 2008/05/04 23:07:09 ad Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93 # @(#)files.newconf 7.5 (Berkeley) 5/10/93
@ -1396,6 +1396,7 @@ file kern/kern_turnstile.c
file kern/kern_todr.c file kern/kern_todr.c
file kern/kern_uuid.c file kern/kern_uuid.c
file kern/kern_xxx.c file kern/kern_xxx.c
file kern/kern_zlib.c
file kern/kgdb_stub.c kgdb file kern/kgdb_stub.c kgdb
file kern/sched_4bsd.c sched_4bsd file kern/sched_4bsd.c sched_4bsd
file kern/sched_m2.c sched_m2 file kern/sched_m2.c sched_m2
@ -1530,7 +1531,6 @@ file net/raw_usrreq.c
file net/route.c file net/route.c
file net/rtsock.c file net/rtsock.c
file net/slcompress.c sl | ppp | strip | (irip & irip_vj) file net/slcompress.c sl | ppp | strip | (irip & irip_vj)
file net/zlib.c (ppp & ppp_deflate) | ipsec | opencrypto | vnd_compression
file netinet/cpu_in_cksum.c (inet | inet6) & !cpu_in_cksum file netinet/cpu_in_cksum.c (inet | inet6) & !cpu_in_cksum
file netinet/if_arp.c arp | netatalk needs-flag file netinet/if_arp.c arp | netatalk needs-flag
file netinet/if_atm.c atm file netinet/if_atm.c atm

View File

@ -1,4 +1,4 @@
/* $NetBSD: vnd.c,v 1.179 2008/04/28 20:23:47 martin Exp $ */ /* $NetBSD: vnd.c,v 1.180 2008/05/04 23:07:09 ad Exp $ */
/*- /*-
* Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc. * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@ -130,7 +130,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.179 2008/04/28 20:23:47 martin Exp $"); __KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.180 2008/05/04 23:07:09 ad Exp $");
#if defined(_KERNEL_OPT) #if defined(_KERNEL_OPT)
#include "fs_nfs.h" #include "fs_nfs.h"
@ -157,8 +157,7 @@ __KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.179 2008/04/28 20:23:47 martin Exp $");
#include <sys/uio.h> #include <sys/uio.h>
#include <sys/conf.h> #include <sys/conf.h>
#include <sys/kauth.h> #include <sys/kauth.h>
#include <sys/zlib.h>
#include <net/zlib.h>
#include <miscfs/genfs/genfs.h> #include <miscfs/genfs/genfs.h>
#include <miscfs/specfs/specdev.h> #include <miscfs/specfs/specdev.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: zlib.c,v 1.28 2006/11/16 01:33:40 christos Exp $ */ /* $NetBSD: kern_zlib.c,v 1.1 2008/05/04 23:07:09 ad Exp $ */
/* /*
* This file is derived from various .h and .c files from the zlib-1.0.4 * This file is derived from various .h and .c files from the zlib-1.0.4
* distribution by Jean-loup Gailly and Mark Adler, with some additions * distribution by Jean-loup Gailly and Mark Adler, with some additions
@ -11,7 +11,7 @@
* - added inflateIncomp and deflateOutputPending * - added inflateIncomp and deflateOutputPending
* - allow strm->next_out to be NULL, meaning discard the output * - allow strm->next_out to be NULL, meaning discard the output
* *
* $Id: zlib.c,v 1.28 2006/11/16 01:33:40 christos Exp $ * $Id: kern_zlib.c,v 1.1 2008/05/04 23:07:09 ad Exp $
*/ */
/* /*
@ -22,7 +22,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: zlib.c,v 1.28 2006/11/16 01:33:40 christos Exp $"); __KERNEL_RCSID(0, "$NetBSD: kern_zlib.c,v 1.1 2008/05/04 23:07:09 ad Exp $");
#define NO_DUMMY_DECL #define NO_DUMMY_DECL
#define NO_ZCFUNCS #define NO_ZCFUNCS
@ -36,7 +36,7 @@ __KERNEL_RCSID(0, "$NetBSD: zlib.c,v 1.28 2006/11/16 01:33:40 christos Exp $");
/* +++ zutil.h */ /* +++ zutil.h */
/* zutil.h -- internal interface and configuration of the compression library /* zutil.h -- internal interface and configuration of the compression library
* Copyright (C) 1995-2002 Jean-loup Gailly. * Copyright (C) 1995-2003 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@ -45,12 +45,12 @@ __KERNEL_RCSID(0, "$NetBSD: zlib.c,v 1.28 2006/11/16 01:33:40 christos Exp $");
subject to change. Applications should only use zlib.h. subject to change. Applications should only use zlib.h.
*/ */
/* @(#) $Id: zlib.c,v 1.28 2006/11/16 01:33:40 christos Exp $ */ /* @(#) $Id: kern_zlib.c,v 1.1 2008/05/04 23:07:09 ad Exp $ */
#ifndef _Z_UTIL_H #ifndef _Z_UTIL_H
#define _Z_UTIL_H #define _Z_UTIL_H
#include "zlib.h" #include <sys/zlib.h>
#if defined(KERNEL) || defined(_KERNEL) #if defined(KERNEL) || defined(_KERNEL)
/* Assume this is a *BSD or SVR4 kernel */ /* Assume this is a *BSD or SVR4 kernel */
@ -294,7 +294,7 @@ void zcfree __P((voidpf opaque, voidpf ptr));
subject to change. Applications should only use zlib.h. subject to change. Applications should only use zlib.h.
*/ */
/* @(#) $Id: zlib.c,v 1.28 2006/11/16 01:33:40 christos Exp $ */ /* @(#) $Id: kern_zlib.c,v 1.1 2008/05/04 23:07:09 ad Exp $ */
#ifndef _DEFLATE_H #ifndef _DEFLATE_H
#define _DEFLATE_H #define _DEFLATE_H
@ -656,7 +656,7 @@ void _tr_stored_type_only __P((deflate_state *));
* *
*/ */
/* @(#) $Id: zlib.c,v 1.28 2006/11/16 01:33:40 christos Exp $ */ /* @(#) $Id: kern_zlib.c,v 1.1 2008/05/04 23:07:09 ad Exp $ */
/* #include "deflate.h" */ /* #include "deflate.h" */
@ -2030,7 +2030,7 @@ local block_state deflate_slow(s, flush)
* Addison-Wesley, 1983. ISBN 0-201-06672-6. * Addison-Wesley, 1983. ISBN 0-201-06672-6.
*/ */
/* @(#) $Id: zlib.c,v 1.28 2006/11/16 01:33:40 christos Exp $ */ /* @(#) $Id: kern_zlib.c,v 1.1 2008/05/04 23:07:09 ad Exp $ */
/* #define GEN_TREES_H */ /* #define GEN_TREES_H */
@ -3548,7 +3548,6 @@ int stream_size;
} }
#if 0
int ZEXPORT inflateInit_(z, vers, stream_size) int ZEXPORT inflateInit_(z, vers, stream_size)
z_streamp z; z_streamp z;
const char *vers; const char *vers;
@ -3556,7 +3555,6 @@ int stream_size;
{ {
return inflateInit2_(z, DEF_WBITS, vers, stream_size); return inflateInit2_(z, DEF_WBITS, vers, stream_size);
} }
#endif
#define NEEDBYTE {if(z->avail_in==0)goto empty;r=Z_OK;} #define NEEDBYTE {if(z->avail_in==0)goto empty;r=Z_OK;}
@ -5909,7 +5907,7 @@ void zcfree (opaque, ptr)
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
/* @(#) $Id: zlib.c,v 1.28 2006/11/16 01:33:40 christos Exp $ */ /* @(#) $Id: kern_zlib.c,v 1.1 2008/05/04 23:07:09 ad Exp $ */
/* #include "zlib.h" */ /* #include "zlib.h" */
@ -5954,3 +5952,66 @@ uLong ZEXPORT adler32(adler, buf, len)
} }
/* --- adler32.c */ /* --- adler32.c */
/* +++ uncompr.c */
/* uncompr.c -- decompress a memory buffer
* Copyright (C) 1995-2003 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) Id */
#define ZLIB_INTERNAL
#include <sys/zlib.h>
/* ===========================================================================
Decompresses the source buffer into the destination buffer. sourceLen is
the byte length of the source buffer. Upon entry, destLen is the total
size of the destination buffer, which must be large enough to hold the
entire uncompressed data. (The size of the uncompressed data must have
been saved previously by the compressor and transmitted to the decompressor
by some mechanism outside the scope of this compression library.)
Upon exit, destLen is the actual size of the compressed buffer.
This function can be used to decompress a whole file at once if the
input file is mmap'ed.
uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
enough memory, Z_BUF_ERROR if there was not enough room in the output
buffer, or Z_DATA_ERROR if the input data was corrupted.
*/
int ZEXPORT uncompress (dest, destLen, source, sourceLen)
Bytef *dest;
uLongf *destLen;
const Bytef *source;
uLong sourceLen;
{
z_stream stream;
int err;
stream.next_in = (Bytef*)__UNCONST(source);
stream.avail_in = (uInt)sourceLen;
/* Check for source > 64K on 16-bit machine: */
if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
stream.next_out = dest;
stream.avail_out = (uInt)*destLen;
if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
stream.zalloc = (alloc_func)0;
stream.zfree = (free_func)0;
err = inflateInit(&stream);
if (err != Z_OK) return err;
err = inflate(&stream, Z_FINISH);
if (err != Z_STREAM_END) {
inflateEnd(&stream);
if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0))
return Z_DATA_ERROR;
return err;
}
*destLen = stream.total_out;
err = inflateEnd(&stream);
return err;
}
/* --- uncompr.c */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ppp-deflate.c,v 1.15 2006/11/16 01:33:40 christos Exp $ */ /* $NetBSD: ppp-deflate.c,v 1.16 2008/05/04 23:07:09 ad Exp $ */
/* Id: ppp-deflate.c,v 1.5 1997/03/04 03:33:28 paulus Exp */ /* Id: ppp-deflate.c,v 1.5 1997/03/04 03:33:28 paulus Exp */
/* /*
@ -39,13 +39,14 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ppp-deflate.c,v 1.15 2006/11/16 01:33:40 christos Exp $"); __KERNEL_RCSID(0, "$NetBSD: ppp-deflate.c,v 1.16 2008/05/04 23:07:09 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/mbuf.h> #include <sys/mbuf.h>
#include <sys/zlib.h>
#include <net/ppp_defs.h> #include <net/ppp_defs.h>
#include <net/zlib.h>
#define PACKETPTR struct mbuf * #define PACKETPTR struct mbuf *
#include <net/ppp-comp.h> #include <net/ppp-comp.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: ipcomp_core.c,v 1.26 2007/11/01 20:33:58 dyoung Exp $ */ /* $NetBSD: ipcomp_core.c,v 1.27 2008/05/04 23:07:09 ad Exp $ */
/* $KAME: ipcomp_core.c,v 1.25 2001/07/26 06:53:17 jinmei Exp $ */ /* $KAME: ipcomp_core.c,v 1.25 2001/07/26 06:53:17 jinmei Exp $ */
/* /*
@ -35,7 +35,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ipcomp_core.c,v 1.26 2007/11/01 20:33:58 dyoung Exp $"); __KERNEL_RCSID(0, "$NetBSD: ipcomp_core.c,v 1.27 2008/05/04 23:07:09 ad Exp $");
#include "opt_inet.h" #include "opt_inet.h"
@ -51,12 +51,12 @@ __KERNEL_RCSID(0, "$NetBSD: ipcomp_core.c,v 1.26 2007/11/01 20:33:58 dyoung Exp
#include <sys/kernel.h> #include <sys/kernel.h>
#include <sys/syslog.h> #include <sys/syslog.h>
#include <sys/queue.h> #include <sys/queue.h>
#include <sys/zlib.h>
#include <sys/cpu.h>
#include <net/if.h> #include <net/if.h>
#include <net/route.h> #include <net/route.h>
#include <net/netisr.h> #include <net/netisr.h>
#include <net/zlib.h>
#include <sys/cpu.h>
#include <netinet6/ipcomp.h> #include <netinet6/ipcomp.h>
#include <netinet6/ipsec.h> #include <netinet6/ipsec.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: ipcomp_input.c,v 1.34 2008/04/23 06:09:05 thorpej Exp $ */ /* $NetBSD: ipcomp_input.c,v 1.35 2008/05/04 23:07:09 ad Exp $ */
/* $KAME: ipcomp_input.c,v 1.29 2001/09/04 08:43:19 itojun Exp $ */ /* $KAME: ipcomp_input.c,v 1.29 2001/09/04 08:43:19 itojun Exp $ */
/* /*
@ -35,7 +35,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ipcomp_input.c,v 1.34 2008/04/23 06:09:05 thorpej Exp $"); __KERNEL_RCSID(0, "$NetBSD: ipcomp_input.c,v 1.35 2008/05/04 23:07:09 ad Exp $");
#include "opt_inet.h" #include "opt_inet.h"
#include "opt_ipsec.h" #include "opt_ipsec.h"
@ -51,12 +51,12 @@ __KERNEL_RCSID(0, "$NetBSD: ipcomp_input.c,v 1.34 2008/04/23 06:09:05 thorpej Ex
#include <sys/time.h> #include <sys/time.h>
#include <sys/kernel.h> #include <sys/kernel.h>
#include <sys/syslog.h> #include <sys/syslog.h>
#include <sys/zlib.h>
#include <sys/cpu.h>
#include <net/if.h> #include <net/if.h>
#include <net/route.h> #include <net/route.h>
#include <net/netisr.h> #include <net/netisr.h>
#include <net/zlib.h>
#include <sys/cpu.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netinet/in_systm.h> #include <netinet/in_systm.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: ipcomp_output.c,v 1.26 2008/04/23 06:09:05 thorpej Exp $ */ /* $NetBSD: ipcomp_output.c,v 1.27 2008/05/04 23:07:09 ad Exp $ */
/* $KAME: ipcomp_output.c,v 1.24 2001/07/26 06:53:18 jinmei Exp $ */ /* $KAME: ipcomp_output.c,v 1.24 2001/07/26 06:53:18 jinmei Exp $ */
/* /*
@ -35,7 +35,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ipcomp_output.c,v 1.26 2008/04/23 06:09:05 thorpej Exp $"); __KERNEL_RCSID(0, "$NetBSD: ipcomp_output.c,v 1.27 2008/05/04 23:07:09 ad Exp $");
#include "opt_inet.h" #include "opt_inet.h"
@ -50,12 +50,12 @@ __KERNEL_RCSID(0, "$NetBSD: ipcomp_output.c,v 1.26 2008/04/23 06:09:05 thorpej E
#include <sys/time.h> #include <sys/time.h>
#include <sys/kernel.h> #include <sys/kernel.h>
#include <sys/syslog.h> #include <sys/syslog.h>
#include <sys/zlib.h>
#include <sys/cpu.h>
#include <net/if.h> #include <net/if.h>
#include <net/route.h> #include <net/route.h>
#include <net/netisr.h> #include <net/netisr.h>
#include <net/zlib.h>
#include <sys/cpu.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netinet/in_systm.h> #include <netinet/in_systm.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: deflate.c,v 1.9 2007/09/22 23:38:17 degroote Exp $ */ /* $NetBSD: deflate.c,v 1.10 2008/05/04 23:07:09 ad Exp $ */
/* $FreeBSD: src/sys/opencrypto/deflate.c,v 1.1.2.1 2002/11/21 23:34:23 sam Exp $ */ /* $FreeBSD: src/sys/opencrypto/deflate.c,v 1.1.2.1 2002/11/21 23:34:23 sam Exp $ */
/* $OpenBSD: deflate.c,v 1.3 2001/08/20 02:45:22 hugh Exp $ */ /* $OpenBSD: deflate.c,v 1.3 2001/08/20 02:45:22 hugh Exp $ */
@ -31,17 +31,17 @@
/* /*
* This file contains a wrapper around the deflate algo compression * This file contains a wrapper around the deflate algo compression
* functions using the zlib library (see net/zlib.{c,h}) * functions using the zlib library (see sys/zlib.{c,h})
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: deflate.c,v 1.9 2007/09/22 23:38:17 degroote Exp $"); __KERNEL_RCSID(0, "$NetBSD: deflate.c,v 1.10 2008/05/04 23:07:09 ad Exp $");
#include <sys/types.h> #include <sys/types.h>
#include <sys/malloc.h> #include <sys/malloc.h>
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <net/zlib.h> #include <sys/zlib.h>
#include <opencrypto/cryptodev.h> #include <opencrypto/cryptodev.h>
#include <opencrypto/deflate.h> #include <opencrypto/deflate.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: deflate.h,v 1.3 2005/12/11 12:25:20 christos Exp $ */ /* $NetBSD: deflate.h,v 1.4 2008/05/04 23:07:09 ad Exp $ */
/* $FreeBSD: src/sys/opencrypto/deflate.h,v 1.1.2.1 2002/11/21 23:34:23 sam Exp $ */ /* $FreeBSD: src/sys/opencrypto/deflate.h,v 1.1.2.1 2002/11/21 23:34:23 sam Exp $ */
/* $OpenBSD: deflate.h,v 1.3 2002/03/14 01:26:51 millert Exp $ */ /* $OpenBSD: deflate.h,v 1.3 2002/03/14 01:26:51 millert Exp $ */
@ -37,7 +37,7 @@
#ifndef _CRYPTO_DEFLATE_H_ #ifndef _CRYPTO_DEFLATE_H_
#define _CRYPTO_DEFLATE_H_ #define _CRYPTO_DEFLATE_H_
#include <net/zlib.h> #include <sys/zlib.h>
#define Z_METHOD 8 #define Z_METHOD 8
#define Z_MEMLEVEL 8 #define Z_MEMLEVEL 8

1202
sys/sys/zlib.h Normal file

File diff suppressed because it is too large Load Diff