]> git.proxmox.com Git - mirror_spl.git/blame - include/spl/sys/zmod.h
Prepare SPL repo to merge with ZFS repo
[mirror_spl.git] / include / spl / sys / zmod.h
CommitLineData
4b393c50 1/*
716154c5
BB
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>.
715f6251 6 * UCRL-CODE-235197
7 *
716154c5 8 * This file is part of the SPL, Solaris Porting Layer.
3d6af2dd 9 * For details, see <http://zfsonlinux.org/>.
715f6251 10 *
716154c5
BB
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
715f6251 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
716154c5 22 * with the SPL. If not, see <http://www.gnu.org/licenses/>.
5461eefe
BB
23 *
24 *
716154c5
BB
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
4b393c50 54 */
715f6251 55
3b3ba48f 56#ifndef _SPL_ZMOD_H
5461eefe 57#define _SPL_ZMOD_H
3b3ba48f 58
5c1967eb 59#include <sys/types.h>
3b3ba48f 60#include <linux/zlib.h>
61
5712fade
BB
62#ifdef HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE
63#define spl_zlib_deflate_workspacesize(wb, ml) \
64 zlib_deflate_workspacesize(wb, ml)
65#else
66#define spl_zlib_deflate_workspacesize(wb, ml) \
67 zlib_deflate_workspacesize()
68#endif /* HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE */
69
5c1967eb
BB
70extern int z_compress_level(void *dest, size_t *destLen, const void *source,
71 size_t sourceLen, int level);
72extern int z_uncompress(void *dest, size_t *destLen, const void *source,
73 size_t sourceLen);
3b3ba48f 74
1114ae6a
BB
75int spl_zlib_init(void);
76void spl_zlib_fini(void);
3b3ba48f 77
78#endif /* SPL_ZMOD_H */