1 /*
2  *  Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
3  *  Copyright (C) 2007 The Regents of the University of California.
4  *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
5  *  Written by Brian Behlendorf <behlendorf1@llnl.gov>.
6  *  UCRL-CODE-235197
7  *
8  *  This file is part of the SPL, Solaris Porting Layer.
9  *  For details, see <http://zfsonlinux.org/>.
10  *
11  *  The SPL is free software; you can redistribute it and/or modify it
12  *  under the terms of the GNU General Public License as published by the
13  *  Free Software Foundation; either version 2 of the License, or (at your
14  *  option) any later version.
15  *
16  *  The SPL is distributed in the hope that it will be useful, but WITHOUT
17  *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19  *  for more details.
20  *
21  *  You should have received a copy of the GNU General Public License along
22  *  with the SPL.  If not, see <http://www.gnu.org/licenses/>.
23  *
24  *
25  *  z_compress_level/z_uncompress are nearly identical copies of the
26  *  compress2/uncompress functions provided by the official zlib package
27  *  available at http://zlib.net/.  The only changes made we to slightly
28  *  adapt the functions called to match the linux kernel implementation
29  *  of zlib.  The full zlib license follows:
30  *
31  *  zlib.h -- interface of the 'zlib' general purpose compression library
32  *  version 1.2.5, April 19th, 2010
33  *
34  *  Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler
35  *
36  *  This software is provided 'as-is', without any express or implied
37  *  warranty.  In no event will the authors be held liable for any damages
38  *  arising from the use of this software.
39  *
40  *  Permission is granted to anyone to use this software for any purpose,
41  *  including commercial applications, and to alter it and redistribute it
42  *  freely, subject to the following restrictions:
43  *
44  *  1. The origin of this software must not be misrepresented; you must not
45  *     claim that you wrote the original software. If you use this software
46  *     in a product, an acknowledgment in the product documentation would be
47  *     appreciated but is not required.
48  *  2. Altered source versions must be plainly marked as such, and must not be
49  *     misrepresented as being the original software.
50  *  3. This notice may not be removed or altered from any source distribution.
51  *
52  *  Jean-loup Gailly
53  *  Mark Adler
54  */
55 
56 #ifndef _SPL_ZMOD_H
57 #define	_SPL_ZMOD_H
58 
59 #include <sys/types.h>
60 #include <linux/zlib.h>
61 
62 extern int z_compress_level(void *dest, size_t *destLen, const void *source,
63     size_t sourceLen, int level);
64 extern int z_uncompress(void *dest, size_t *destLen, const void *source,
65     size_t sourceLen);
66 
67 int spl_zlib_init(void);
68 void spl_zlib_fini(void);
69 
70 #endif /* SPL_ZMOD_H */
71