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

Cache object: ea5335e2da391d1fdd52cb26c85ffdf8


[ 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.