The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/zutil.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /* zutil.h -- internal interface and configuration of the compression library
    2  * Copyright (C) 1995-1996 Jean-loup Gailly.
    3  * For conditions of distribution and use, see copyright notice in zlib.h
    4  */
    5 
    6 /* WARNING: this file should *not* be used by applications. It is
    7    part of the implementation of the compression library and is
    8    subject to change. Applications should only use zlib.h.
    9  */
   10 
   11 /* From: zutil.h,v 1.16 1996/07/24 13:41:13 me Exp $ */
   12 /* $FreeBSD: stable/11/sys/sys/zutil.h 281855 2015-04-22 14:38:58Z rodrigc $ */
   13 
   14 #ifndef _Z_UTIL_H
   15 #define _Z_UTIL_H
   16 
   17 #define ZEXPORT
   18 
   19 #ifdef _KERNEL
   20 #include <sys/zlib.h>
   21 #else
   22 #include "zlib.h"
   23 #endif
   24 
   25 #ifdef _KERNEL
   26 /* Assume this is a *BSD or SVR4 kernel */
   27 #include <sys/types.h>
   28 #include <sys/time.h>
   29 #include <sys/systm.h>
   30 #include <sys/module.h>
   31 #include <sys/errno.h>
   32 #include <sys/param.h>
   33 #include <sys/kernel.h>
   34 #  define HAVE_MEMCPY
   35 #  define memcpy(d, s, n)       bcopy((s), (d), (n))
   36 #  define memset(d, v, n)       bzero((d), (n))
   37 #  define memcmp                bcmp
   38 
   39 #else
   40 #if defined(__KERNEL__)
   41 /* Assume this is a Linux kernel */
   42 #include <linux/string.h>
   43 #define HAVE_MEMCPY
   44 
   45 #else /* not kernel */
   46 
   47 #if defined(MSDOS)||defined(VMS)||defined(CRAY)||defined(WIN32)||defined(RISCOS)
   48 #   include <stddef.h>
   49 #   include <errno.h>
   50 #else
   51     extern int errno;
   52 #endif
   53 #ifdef STDC
   54 #  include <string.h>
   55 #  include <stdlib.h>
   56 #endif
   57 #endif /* __KERNEL__ */
   58 #endif /* _KERNEL */
   59 
   60 #ifndef local
   61 #  define local static
   62 #endif
   63 /* compile with -Dlocal if your debugger can't find static symbols */
   64 
   65 typedef unsigned char  uch;
   66 typedef uch FAR uchf;
   67 typedef unsigned short ush;
   68 typedef ush FAR ushf;
   69 typedef unsigned long  ulg;
   70 
   71 #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
   72 
   73 #define ERR_RETURN(strm,err) \
   74   return (strm->msg = (const char*)ERR_MSG(err), (err))
   75 /* To be used only when the state is known to be valid */
   76 
   77         /* common constants */
   78 
   79 #ifndef DEF_WBITS
   80 #  define DEF_WBITS MAX_WBITS
   81 #endif
   82 /* default windowBits for decompression. MAX_WBITS is for compression only */
   83 
   84 #if MAX_MEM_LEVEL >= 8
   85 #  define DEF_MEM_LEVEL 8
   86 #else
   87 #  define DEF_MEM_LEVEL  MAX_MEM_LEVEL
   88 #endif
   89 /* default memLevel */
   90 
   91 #define STORED_BLOCK 0
   92 #define STATIC_TREES 1
   93 #define DYN_TREES    2
   94 /* The three kinds of block type */
   95 
   96 #define MIN_MATCH  3
   97 #define MAX_MATCH  258
   98 /* The minimum and maximum match lengths */
   99 
  100 #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
  101 
  102         /* target dependencies */
  103 
  104 #ifdef MSDOS
  105 #  define OS_CODE  0x00
  106 #  ifdef __TURBOC__
  107 #    include <alloc.h>
  108 #  else /* MSC or DJGPP */
  109 #    include <malloc.h>
  110 #  endif
  111 #endif
  112 
  113 #ifdef OS2
  114 #  define OS_CODE  0x06
  115 #endif
  116 
  117 #ifdef WIN32 /* Window 95 & Windows NT */
  118 #  define OS_CODE  0x0b
  119 #endif
  120 
  121 #if defined(VAXC) || defined(VMS)
  122 #  define OS_CODE  0x02
  123 #  define FOPEN(name, mode) \
  124      fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
  125 #endif
  126 
  127 #ifdef AMIGA
  128 #  define OS_CODE  0x01
  129 #endif
  130 
  131 #if defined(ATARI) || defined(atarist)
  132 #  define OS_CODE  0x05
  133 #endif
  134 
  135 #ifdef MACOS
  136 #  define OS_CODE  0x07
  137 #endif
  138 
  139 #ifdef __50SERIES /* Prime/PRIMOS */
  140 #  define OS_CODE  0x0F
  141 #endif
  142 
  143 #ifdef TOPS20
  144 #  define OS_CODE  0x0a
  145 #endif
  146 
  147 #if defined(_BEOS_) || defined(RISCOS)
  148 #  define fdopen(fd,mode) NULL /* No fdopen() */
  149 #endif
  150 
  151         /* Common defaults */
  152 
  153 #ifndef OS_CODE
  154 #  define OS_CODE  0x03  /* assume Unix */
  155 #endif
  156 
  157 #ifndef FOPEN
  158 #  define FOPEN(name, mode) fopen((name), (mode))
  159 #endif
  160 
  161          /* functions */
  162 
  163 #ifdef HAVE_STRERROR
  164    extern char *strerror OF((int));
  165 #  define zstrerror(errnum) strerror(errnum)
  166 #else
  167 #  define zstrerror(errnum) ""
  168 #endif
  169 
  170 #if defined(pyr)
  171 #  define NO_MEMCPY
  172 #endif
  173 #if (defined(M_I86SM) || defined(M_I86MM)) && !defined(_MSC_VER)
  174  /* Use our own functions for small and medium model with MSC <= 5.0.
  175   * You may have to use the same strategy for Borland C (untested).
  176   */
  177 #  define NO_MEMCPY
  178 #endif
  179 #if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
  180 #  define HAVE_MEMCPY
  181 #endif
  182 #ifdef HAVE_MEMCPY
  183 #  ifdef SMALL_MEDIUM /* MSDOS small or medium model */
  184 #    define zmemcpy _fmemcpy
  185 #    define zmemcmp _fmemcmp
  186 #    define zmemzero(dest, len) _fmemset(dest, 0, len)
  187 #  else
  188 #    define zmemcpy memcpy
  189 #    define zmemcmp memcmp
  190 #    define zmemzero(dest, len) memset(dest, 0, len)
  191 #  endif
  192 #else
  193    extern void zmemcpy  OF((Bytef* dest, Bytef* source, uInt len));
  194    extern int  zmemcmp  OF((Bytef* s1,   Bytef* s2, uInt len));
  195    extern void zmemzero OF((Bytef* dest, uInt len));
  196 #endif
  197 
  198 /* Diagnostic functions */
  199 #ifdef DEBUG_ZLIB
  200 #  include <stdio.h>
  201 #  ifndef verbose
  202 #    define verbose 0
  203 #  endif
  204    extern void z_error    OF((char *m));
  205 #  define Assert(cond,msg) {if(!(cond)) z_error(msg);}
  206 #  define Trace(x) fprintf x
  207 #  define Tracev(x) {if (verbose) fprintf x ;}
  208 #  define Tracevv(x) {if (verbose>1) fprintf x ;}
  209 #  define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
  210 #  define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
  211 #else
  212 #  define Assert(cond,msg)
  213 #  define Trace(x)
  214 #  define Tracev(x)
  215 #  define Tracevv(x)
  216 #  define Tracec(c,x)
  217 #  define Tracecv(c,x)
  218 #endif
  219 
  220 
  221 typedef uLong (*check_func) OF((uLong check, const Bytef *buf, uInt len));
  222 
  223 voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
  224 void   zcfree  OF((voidpf opaque, voidpf ptr));
  225 
  226 #define ZALLOC(strm, items, size) \
  227            (*((strm)->zalloc))((strm)->opaque, (items), (size))
  228 #define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  229 #define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
  230 
  231 #endif /* _Z_UTIL_H */

Cache object: 7160b19bc88a51ba546a62cdf91dc774


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.