FreeBSD ZFS
The Zettabyte File System
|
00001 /* 00002 * CDDL HEADER START 00003 * 00004 * The contents of this file are subject to the terms of the 00005 * Common Development and Distribution License (the "License"). 00006 * You may not use this file except in compliance with the License. 00007 * 00008 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 00009 * or http://www.opensolaris.org/os/licensing. 00010 * See the License for the specific language governing permissions 00011 * and limitations under the License. 00012 * 00013 * When distributing Covered Code, include this CDDL HEADER in each 00014 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 00015 * If applicable, add the following below this CDDL HEADER, with the 00016 * fields enclosed by brackets "[]" replaced with your own identifying 00017 * information: Portions Copyright [yyyy] [name of copyright owner] 00018 * 00019 * CDDL HEADER END 00020 */ 00021 00022 /* 00023 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 00024 * Use is subject to license terms. 00025 */ 00026 00027 #ifndef _SYS_ZIO_COMPRESS_H 00028 #define _SYS_ZIO_COMPRESS_H 00029 00030 #include <sys/zio.h> 00031 00032 #ifdef __cplusplus 00033 extern "C" { 00034 #endif 00035 00039 typedef size_t zio_compress_func_t(void *src, void *dst, 00040 size_t s_len, size_t d_len, int); 00044 typedef int zio_decompress_func_t(void *src, void *dst, 00045 size_t s_len, size_t d_len, int); 00046 00050 typedef struct zio_compress_info { 00051 zio_compress_func_t *ci_compress; 00052 zio_decompress_func_t *ci_decompress; 00053 int ci_level; 00054 char *ci_name; 00055 } zio_compress_info_t; 00056 00057 extern zio_compress_info_t zio_compress_table[ZIO_COMPRESS_FUNCTIONS]; 00058 00059 /* 00060 * Compression routines. 00061 */ 00062 extern size_t lzjb_compress(void *src, void *dst, size_t s_len, size_t d_len, 00063 int level); 00064 extern int lzjb_decompress(void *src, void *dst, size_t s_len, size_t d_len, 00065 int level); 00066 extern size_t gzip_compress(void *src, void *dst, size_t s_len, size_t d_len, 00067 int level); 00068 extern int gzip_decompress(void *src, void *dst, size_t s_len, size_t d_len, 00069 int level); 00070 extern size_t zle_compress(void *src, void *dst, size_t s_len, size_t d_len, 00071 int level); 00072 extern int zle_decompress(void *src, void *dst, size_t s_len, size_t d_len, 00073 int level); 00074 00075 /* 00076 * Compress and decompress data if necessary. 00077 */ 00078 extern size_t zio_compress_data(enum zio_compress c, void *src, void *dst, 00079 size_t s_len); 00080 extern int zio_decompress_data(enum zio_compress c, void *src, void *dst, 00081 size_t s_len, size_t d_len); 00082 00083 #ifdef __cplusplus 00084 } 00085 #endif 00086 00087 #endif /* _SYS_ZIO_COMPRESS_H */