FreeBSD ZFS
The Zettabyte File System

sys/zio_checksum.h

Go to the documentation of this file.
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  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
00023  */
00024 
00025 #ifndef _SYS_ZIO_CHECKSUM_H
00026 #define _SYS_ZIO_CHECKSUM_H
00027 
00028 #include <sys/zio.h>
00029 
00030 #ifdef  __cplusplus
00031 extern "C" {
00032 #endif
00033 
00037 typedef void zio_checksum_t(const void *data, uint64_t size, zio_cksum_t *zcp);
00038 
00042 typedef struct zio_checksum_info {
00043         zio_checksum_t  *ci_func[2]; 
00044         int             ci_correctable; 
00045         int             ci_eck;         
00046         int             ci_dedup;       
00047         char            *ci_name;       
00048 } zio_checksum_info_t;
00049 
00050 typedef struct zio_bad_cksum {
00051         zio_cksum_t             zbc_expected;
00052         zio_cksum_t             zbc_actual;
00053         const char              *zbc_checksum_name;
00054         uint8_t                 zbc_byteswapped;
00055         uint8_t                 zbc_injected;
00056         uint8_t                 zbc_has_cksum;  
00057 } zio_bad_cksum_t;
00058 
00059 extern zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS];
00060 
00061 /*
00062  * Checksum routines.
00063  */
00064 extern zio_checksum_t zio_checksum_SHA256;
00065 
00066 extern void zio_checksum_compute(zio_t *zio, enum zio_checksum checksum,
00067     void *data, uint64_t size);
00068 extern int zio_checksum_error(zio_t *zio, zio_bad_cksum_t *out);
00069 extern enum zio_checksum spa_dedup_checksum(spa_t *spa);
00070 
00071 #ifdef  __cplusplus
00072 }
00073 #endif
00074 
00075 #endif  /* _SYS_ZIO_CHECKSUM_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines