zfs-builds-mm/zfs-0.8.1/include/spl/sys/zmod.h
2019-07-06 23:40:11 +02:00

78 lines
3 KiB
C

/*
* Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
* Copyright (C) 2007 The Regents of the University of California.
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
* Written by Brian Behlendorf <behlendorf1@llnl.gov>.
* UCRL-CODE-235197
*
* This file is part of the SPL, Solaris Porting Layer.
* For details, see <http://zfsonlinux.org/>.
*
* The SPL is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* The SPL is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with the SPL. If not, see <http://www.gnu.org/licenses/>.
*
*
* z_compress_level/z_uncompress are nearly identical copies of the
* compress2/uncompress functions provided by the official zlib package
* available at http://zlib.net/. The only changes made we to slightly
* adapt the functions called to match the linux kernel implementation
* of zlib. The full zlib license follows:
*
* zlib.h -- interface of the 'zlib' general purpose compression library
* version 1.2.5, April 19th, 2010
*
* Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*
* Jean-loup Gailly
* Mark Adler
*/
#ifndef _SPL_ZMOD_H
#define _SPL_ZMOD_H
#include <sys/types.h>
#include <linux/zlib.h>
#ifdef HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE
#define spl_zlib_deflate_workspacesize(wb, ml) \
zlib_deflate_workspacesize(wb, ml)
#else
#define spl_zlib_deflate_workspacesize(wb, ml) \
zlib_deflate_workspacesize()
#endif /* HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE */
extern int z_compress_level(void *dest, size_t *destLen, const void *source,
size_t sourceLen, int level);
extern int z_uncompress(void *dest, size_t *destLen, const void *source,
size_t sourceLen);
int spl_zlib_init(void);
void spl_zlib_fini(void);
#endif /* SPL_ZMOD_H */