xref: /openbmc/u-boot/include/zfs/zio_checksum.h (revision 4d3c95f5)
1*4d3c95f5SJorgen Lundman /*
2*4d3c95f5SJorgen Lundman  *  GRUB  --  GRand Unified Bootloader
3*4d3c95f5SJorgen Lundman  *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
4*4d3c95f5SJorgen Lundman  *
5*4d3c95f5SJorgen Lundman  *  This program is free software; you can redistribute it and/or modify
6*4d3c95f5SJorgen Lundman  *  it under the terms of the GNU General Public License as published by
7*4d3c95f5SJorgen Lundman  *  the Free Software Foundation; either version 2 of the License, or
8*4d3c95f5SJorgen Lundman  *  (at your option) any later version.
9*4d3c95f5SJorgen Lundman  *
10*4d3c95f5SJorgen Lundman  *  This program is distributed in the hope that it will be useful,
11*4d3c95f5SJorgen Lundman  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12*4d3c95f5SJorgen Lundman  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13*4d3c95f5SJorgen Lundman  *  GNU General Public License for more details.
14*4d3c95f5SJorgen Lundman  *
15*4d3c95f5SJorgen Lundman  *  You should have received a copy of the GNU General Public License
16*4d3c95f5SJorgen Lundman  *  along with this program; if not, write to the Free Software
17*4d3c95f5SJorgen Lundman  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18*4d3c95f5SJorgen Lundman  */
19*4d3c95f5SJorgen Lundman /*
20*4d3c95f5SJorgen Lundman  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
21*4d3c95f5SJorgen Lundman  * Use is subject to license terms.
22*4d3c95f5SJorgen Lundman  */
23*4d3c95f5SJorgen Lundman 
24*4d3c95f5SJorgen Lundman #ifndef _SYS_ZIO_CHECKSUM_H
25*4d3c95f5SJorgen Lundman #define	_SYS_ZIO_CHECKSUM_H
26*4d3c95f5SJorgen Lundman 
27*4d3c95f5SJorgen Lundman /*
28*4d3c95f5SJorgen Lundman  * Signature for checksum functions.
29*4d3c95f5SJorgen Lundman  */
30*4d3c95f5SJorgen Lundman typedef void zio_checksum_t(const void *data, uint64_t size,
31*4d3c95f5SJorgen Lundman 			    zfs_endian_t endian, zio_cksum_t *zcp);
32*4d3c95f5SJorgen Lundman 
33*4d3c95f5SJorgen Lundman /*
34*4d3c95f5SJorgen Lundman  * Information about each checksum function.
35*4d3c95f5SJorgen Lundman  */
36*4d3c95f5SJorgen Lundman typedef struct zio_checksum_info {
37*4d3c95f5SJorgen Lundman 	zio_checksum_t	*ci_func; /* checksum function for each byteorder */
38*4d3c95f5SJorgen Lundman 	int		ci_correctable;	/* number of correctable bits	*/
39*4d3c95f5SJorgen Lundman 	int		ci_eck;		/* uses zio embedded checksum? */
40*4d3c95f5SJorgen Lundman 	char		*ci_name;	/* descriptive name */
41*4d3c95f5SJorgen Lundman } zio_checksum_info_t;
42*4d3c95f5SJorgen Lundman 
43*4d3c95f5SJorgen Lundman extern void zio_checksum_SHA256(const void *, uint64_t,
44*4d3c95f5SJorgen Lundman 				 zfs_endian_t endian, zio_cksum_t *);
45*4d3c95f5SJorgen Lundman extern void fletcher_2_endian(const void *, uint64_t, zfs_endian_t endian,
46*4d3c95f5SJorgen Lundman 			zio_cksum_t *);
47*4d3c95f5SJorgen Lundman extern void fletcher_4_endian(const void *, uint64_t, zfs_endian_t endian,
48*4d3c95f5SJorgen Lundman 			zio_cksum_t *);
49*4d3c95f5SJorgen Lundman 
50*4d3c95f5SJorgen Lundman #endif	/* _SYS_ZIO_CHECKSUM_H */
51