7712 mandoc -Tlint does always exit with error code 0
[unleashed.git] / usr / src / uts / common / sys / lvm / md_crc.h
blob082ddd289c32ce4ac7da0cf4f050f714460a4e47
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _SYS_MD_CRC_H
28 #define _SYS_MD_CRC_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #include <sys/types.h>
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
38 /* md_crc.c */
40 * Structure to hold fields to be skipped when calculating the checksum
42 typedef struct crc_skip {
43 struct crc_skip *skip_next;
44 int skip_offset;
45 int skip_size;
46 } crc_skip_t;
48 extern uint_t crcfunc(uint_t check,
49 uchar_t *record,
50 uint_t *result,
51 size_t size,
52 crc_skip_t *skip);
53 extern void crcfreetab(void);
56 * The following crc defines allow for a number of areas to be skipped
57 * (not be included in the data being crc'd) in the record
58 * block (mddb_rb_32). These areas are the 12 byte area covering
59 * rb_checksum_fiddle, rb_private and rb_userdata
61 * In addition the skipped areas include the timestamps in the crc for
62 * MN disksets.
64 #ifndef DEBUG
65 #define crcgen(record, result, size, skip) \
66 (void) crcfunc(0, (uchar_t *)(record), (uint_t *)(result), \
67 (size_t)(size), (crc_skip_t *)(skip))
69 #else /* DEBUG */
71 #ifdef _KERNEL
72 #define crcgen(record, result, size, skip) {\
73 uint_t b = crcfunc(0, (uchar_t *)(record), (uint_t *)(result), \
74 (size_t)(size), (crc_skip_t *)(skip)); \
75 (void) crcfunc(0, (uchar_t *)(record), (uint_t *)(result), \
76 (size_t)(size), (crc_skip_t *)(skip)); \
77 ASSERT (*((uint_t *)(result)) == b); \
79 #else /* !_KERNEL */
80 #define crcgen(record, result, size, skip) {\
81 uint_t b = crcfunc(0, (uchar_t *)(record), (uint_t *)(result), \
82 (size_t)(size), (crc_skip_t *)(skip)); \
83 (void) crcfunc(0, (uchar_t *)(record), (uint_t *)(result), \
84 (size_t)(size), (crc_skip_t *)(skip)); \
85 assert (*((uint_t *)(result)) == b); \
87 #endif /* _KERNEL */
88 #endif /* DEBUG */
90 #define crcchk(record, result, size, skip) crcfunc(1, (uchar_t *)(record), \
91 (uint_t *)(result), (size_t)(size), (crc_skip_t *)(skip))
93 #ifdef __cplusplus
95 #endif
97 #endif /* _SYS_MD_CRC_H */