Date: Sat, 16 May 2009 09:16:23 -0700 From: Kip Macy <kmacy@freebsd.org> To: Doug Rabson <dfr@rabson.org> Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r192168 - in user/kmacy/ZFS_MFC/sys/cddl/boot: . zfs Message-ID: <3c1674c90905160916m71f75ea8tcd7aa8b9057e1c1b@mail.gmail.com> In-Reply-To: <CA2EB2F3-28BF-485D-B198-F719D4E4699D@rabson.org> References: <200905152311.n4FNBYcm037473@svn.freebsd.org> <CA2EB2F3-28BF-485D-B198-F719D4E4699D@rabson.org>
index | next in thread | previous in thread | raw e-mail
Thanks. 'svn revert' doesn't delete files that haven't been added - I applied a patch from another tree multiple times which causes files to have the same content multiple times. Cheers, Kip On Sat, May 16, 2009 at 3:44 AM, Doug Rabson <dfr@rabson.org> wrote: > Somehow sys/cddl/boot/zfs/README has two copies of the text that appears in > current. > > On 16 May 2009, at 00:11, Kip Macy wrote: > >> Author: kmacy >> Date: Fri May 15 23:11:34 2009 >> New Revision: 192168 >> URL: http://svn.freebsd.org/changeset/base/192168 >> >> Log: >> add ZFS boot support >> >> Added: >> user/kmacy/ZFS_MFC/sys/cddl/boot/ >> user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/ >> user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/README >> user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/fletcher.c (contents, props >> changed) >> user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/lzjb.c (contents, props changed) >> user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/sha256.c (contents, props changed) >> user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/zfsimpl.h (contents, props >> changed) >> user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/zfssubr.c (contents, props >> changed) >> >> Added: user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/README >> >> ============================================================================== >> --- /dev/null 00:00:00 1970 (empty, because file is newly added) >> +++ user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/README Fri May 15 23:11:34 2009 >> (r192168) >> @@ -0,0 +1,28 @@ >> +$FreeBSD$ >> + >> +This directory contains various files derived from CDDL sources that >> +are used by the ZFS bootstrap: >> + >> + fletcher.c checksum support >> + sha256.c checksum support >> + lzjb.c compression support >> + zfssubr.c mostly checksum and compression support >> + zfsimpl.h mostly describing the physical layout >> + >> +The files fletcher.c, lzjb.c and sha256.c are largely identical to the >> +ZFS base code (with write support removed) and could be shared but >> +that might complicate future imports from OpenSolaris. >> +$FreeBSD$ >> + >> +This directory contains various files derived from CDDL sources that >> +are used by the ZFS bootstrap: >> + >> + fletcher.c checksum support >> + sha256.c checksum support >> + lzjb.c compression support >> + zfssubr.c mostly checksum and compression support >> + zfsimpl.h mostly describing the physical layout >> + >> +The files fletcher.c, lzjb.c and sha256.c are largely identical to the >> +ZFS base code (with write support removed) and could be shared but >> +that might complicate future imports from OpenSolaris. >> >> Added: user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/fletcher.c >> >> ============================================================================== >> --- /dev/null 00:00:00 1970 (empty, because file is newly added) >> +++ user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/fletcher.c Fri May 15 >> 23:11:34 2009 (r192168) >> @@ -0,0 +1,120 @@ >> +/* >> + * CDDL HEADER START >> + * >> + * The contents of this file are subject to the terms of the >> + * Common Development and Distribution License (the "License"). >> + * You may not use this file except in compliance with the License. >> + * >> + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE >> + * or http://www.opensolaris.org/os/licensing. >> + * See the License for the specific language governing permissions >> + * and limitations under the License. >> + * >> + * When distributing Covered Code, include this CDDL HEADER in each >> + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. >> + * If applicable, add the following below this CDDL HEADER, with the >> + * fields enclosed by brackets "[]" replaced with your own identifying >> + * information: Portions Copyright [yyyy] [name of copyright owner] >> + * >> + * CDDL HEADER END >> + */ >> +/* >> + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. >> + * Use is subject to license terms. >> + */ >> + >> +/*#pragma ident "%Z%%M% %I% %E% SMI"*/ >> + >> +static void >> +fletcher_2_native(const void *buf, uint64_t size, zio_cksum_t *zcp) >> +{ >> + const uint64_t *ip = buf; >> + const uint64_t *ipend = ip + (size / sizeof (uint64_t)); >> + uint64_t a0, b0, a1, b1; >> + >> + for (a0 = b0 = a1 = b1 = 0; ip < ipend; ip += 2) { >> + a0 += ip[0]; >> + a1 += ip[1]; >> + b0 += a0; >> + b1 += a1; >> + } >> + >> + ZIO_SET_CHECKSUM(zcp, a0, a1, b0, b1); >> +} >> + >> +static void >> +fletcher_4_native(const void *buf, uint64_t size, zio_cksum_t *zcp) >> +{ >> + const uint32_t *ip = buf; >> + const uint32_t *ipend = ip + (size / sizeof (uint32_t)); >> + uint64_t a, b, c, d; >> + >> + for (a = b = c = d = 0; ip < ipend; ip++) { >> + a += ip[0]; >> + b += a; >> + c += b; >> + d += c; >> + } >> + >> + ZIO_SET_CHECKSUM(zcp, a, b, c, d); >> +} >> +/* >> + * CDDL HEADER START >> + * >> + * The contents of this file are subject to the terms of the >> + * Common Development and Distribution License (the "License"). >> + * You may not use this file except in compliance with the License. >> + * >> + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE >> + * or http://www.opensolaris.org/os/licensing. >> + * See the License for the specific language governing permissions >> + * and limitations under the License. >> + * >> + * When distributing Covered Code, include this CDDL HEADER in each >> + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. >> + * If applicable, add the following below this CDDL HEADER, with the >> + * fields enclosed by brackets "[]" replaced with your own identifying >> + * information: Portions Copyright [yyyy] [name of copyright owner] >> + * >> + * CDDL HEADER END >> + */ >> +/* >> + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. >> + * Use is subject to license terms. >> + */ >> + >> +/*#pragma ident "%Z%%M% %I% %E% SMI"*/ >> + >> +static void >> +fletcher_2_native(const void *buf, uint64_t size, zio_cksum_t *zcp) >> +{ >> + const uint64_t *ip = buf; >> + const uint64_t *ipend = ip + (size / sizeof (uint64_t)); >> + uint64_t a0, b0, a1, b1; >> + >> + for (a0 = b0 = a1 = b1 = 0; ip < ipend; ip += 2) { >> + a0 += ip[0]; >> + a1 += ip[1]; >> + b0 += a0; >> + b1 += a1; >> + } >> + >> + ZIO_SET_CHECKSUM(zcp, a0, a1, b0, b1); >> +} >> + >> +static void >> +fletcher_4_native(const void *buf, uint64_t size, zio_cksum_t *zcp) >> +{ >> + const uint32_t *ip = buf; >> + const uint32_t *ipend = ip + (size / sizeof (uint32_t)); >> + uint64_t a, b, c, d; >> + >> + for (a = b = c = d = 0; ip < ipend; ip++) { >> + a += ip[0]; >> + b += a; >> + c += b; >> + d += c; >> + } >> + >> + ZIO_SET_CHECKSUM(zcp, a, b, c, d); >> +} >> >> Added: user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/lzjb.c >> >> ============================================================================== >> --- /dev/null 00:00:00 1970 (empty, because file is newly added) >> +++ user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/lzjb.c Fri May 15 23:11:34 2009 >> (r192168) >> @@ -0,0 +1,148 @@ >> +/* >> + * CDDL HEADER START >> + * >> + * The contents of this file are subject to the terms of the >> + * Common Development and Distribution License (the "License"). >> + * You may not use this file except in compliance with the License. >> + * >> + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE >> + * or http://www.opensolaris.org/os/licensing. >> + * See the License for the specific language governing permissions >> + * and limitations under the License. >> + * >> + * When distributing Covered Code, include this CDDL HEADER in each >> + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. >> + * If applicable, add the following below this CDDL HEADER, with the >> + * fields enclosed by brackets "[]" replaced with your own identifying >> + * information: Portions Copyright [yyyy] [name of copyright owner] >> + * >> + * CDDL HEADER END >> + */ >> + >> +/* >> + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. >> + * Use is subject to license terms. >> + */ >> + >> +/*#pragma ident "%Z%%M% %I% %E% SMI"*/ >> + >> +/* >> + * We keep our own copy of this algorithm for 2 main reasons: >> + * 1. If we didn't, anyone modifying common/os/compress.c would >> + * directly break our on disk format >> + * 2. Our version of lzjb does not have a number of checks that the >> + * common/os version needs and uses >> + * In particular, we are adding the "feature" that compress() can >> + * take a destination buffer size and return -1 if the data will not >> + * compress to d_len or less. >> + */ >> + >> +#define MATCH_BITS 6 >> +#define MATCH_MIN 3 >> +#define MATCH_MAX ((1 << MATCH_BITS) + (MATCH_MIN - 1)) >> +#define OFFSET_MASK ((1 << (16 - MATCH_BITS)) - 1) >> +#define LEMPEL_SIZE 256 >> + >> +/*ARGSUSED*/ >> +static int >> +lzjb_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len, >> int n) >> +{ >> + unsigned char *src = s_start; >> + unsigned char *dst = d_start; >> + unsigned char *d_end = (unsigned char *)d_start + d_len; >> + unsigned char *cpy, copymap = 0; >> + int copymask = 1 << (NBBY - 1); >> + >> + while (dst < d_end) { >> + if ((copymask <<= 1) == (1 << NBBY)) { >> + copymask = 1; >> + copymap = *src++; >> + } >> + if (copymap & copymask) { >> + int mlen = (src[0] >> (NBBY - MATCH_BITS)) + >> MATCH_MIN; >> + int offset = ((src[0] << NBBY) | src[1]) & >> OFFSET_MASK; >> + src += 2; >> + if ((cpy = dst - offset) < (unsigned char >> *)d_start) >> + return (-1); >> + while (--mlen >= 0 && dst < d_end) >> + *dst++ = *cpy++; >> + } else { >> + *dst++ = *src++; >> + } >> + } >> + return (0); >> +} >> +/* >> + * CDDL HEADER START >> + * >> + * The contents of this file are subject to the terms of the >> + * Common Development and Distribution License (the "License"). >> + * You may not use this file except in compliance with the License. >> + * >> + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE >> + * or http://www.opensolaris.org/os/licensing. >> + * See the License for the specific language governing permissions >> + * and limitations under the License. >> + * >> + * When distributing Covered Code, include this CDDL HEADER in each >> + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. >> + * If applicable, add the following below this CDDL HEADER, with the >> + * fields enclosed by brackets "[]" replaced with your own identifying >> + * information: Portions Copyright [yyyy] [name of copyright owner] >> + * >> + * CDDL HEADER END >> + */ >> + >> +/* >> + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. >> + * Use is subject to license terms. >> + */ >> + >> +/*#pragma ident "%Z%%M% %I% %E% SMI"*/ >> + >> +/* >> + * We keep our own copy of this algorithm for 2 main reasons: >> + * 1. If we didn't, anyone modifying common/os/compress.c would >> + * directly break our on disk format >> + * 2. Our version of lzjb does not have a number of checks that the >> + * common/os version needs and uses >> + * In particular, we are adding the "feature" that compress() can >> + * take a destination buffer size and return -1 if the data will not >> + * compress to d_len or less. >> + */ >> + >> +#define MATCH_BITS 6 >> +#define MATCH_MIN 3 >> +#define MATCH_MAX ((1 << MATCH_BITS) + (MATCH_MIN - 1)) >> +#define OFFSET_MASK ((1 << (16 - MATCH_BITS)) - 1) >> +#define LEMPEL_SIZE 256 >> + >> +/*ARGSUSED*/ >> +static int >> +lzjb_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len, >> int n) >> +{ >> + unsigned char *src = s_start; >> + unsigned char *dst = d_start; >> + unsigned char *d_end = (unsigned char *)d_start + d_len; >> + unsigned char *cpy, copymap = 0; >> + int copymask = 1 << (NBBY - 1); >> + >> + while (dst < d_end) { >> + if ((copymask <<= 1) == (1 << NBBY)) { >> + copymask = 1; >> + copymap = *src++; >> + } >> + if (copymap & copymask) { >> + int mlen = (src[0] >> (NBBY - MATCH_BITS)) + >> MATCH_MIN; >> + int offset = ((src[0] << NBBY) | src[1]) & >> OFFSET_MASK; >> + src += 2; >> + if ((cpy = dst - offset) < (unsigned char >> *)d_start) >> + return (-1); >> + while (--mlen >= 0 && dst < d_end) >> + *dst++ = *cpy++; >> + } else { >> + *dst++ = *src++; >> + } >> + } >> + return (0); >> +} >> >> Added: user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/sha256.c >> >> ============================================================================== >> --- /dev/null 00:00:00 1970 (empty, because file is newly added) >> +++ user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/sha256.c Fri May 15 >> 23:11:34 2009 (r192168) >> @@ -0,0 +1,254 @@ >> +/* >> + * CDDL HEADER START >> + * >> + * The contents of this file are subject to the terms of the >> + * Common Development and Distribution License, Version 1.0 only >> + * (the "License"). You may not use this file except in compliance >> + * with the License. >> + * >> + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE >> + * or http://www.opensolaris.org/os/licensing. >> + * See the License for the specific language governing permissions >> + * and limitations under the License. >> + * >> + * When distributing Covered Code, include this CDDL HEADER in each >> + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. >> + * If applicable, add the following below this CDDL HEADER, with the >> + * fields enclosed by brackets "[]" replaced with your own identifying >> + * information: Portions Copyright [yyyy] [name of copyright owner] >> + * >> + * CDDL HEADER END >> + */ >> +/* >> + * Copyright 2005 Sun Microsystems, Inc. All rights reserved. >> + * Use is subject to license terms. >> + */ >> + >> +/*#pragma ident "%Z%%M% %I% %E% SMI"*/ >> + >> +/* >> + * SHA-256 checksum, as specified in FIPS 180-2, available at: >> + * http://csrc.nist.gov/cryptval >> + * >> + * This is a very compact implementation of SHA-256. >> + * It is designed to be simple and portable, not to be fast. >> + */ >> + >> +/* >> + * The literal definitions according to FIPS180-2 would be: >> + * >> + * Ch(x, y, z) (((x) & (y)) ^ ((~(x)) & (z))) >> + * Maj(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z))) >> + * >> + * We use logical equivalents which require one less op. >> + */ >> +#define Ch(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) >> +#define Maj(x, y, z) (((x) & (y)) ^ ((z) & ((x) ^ (y)))) >> +#define Rot32(x, s) (((x) >> s) | ((x) << (32 - s))) >> +#define SIGMA0(x) (Rot32(x, 2) ^ Rot32(x, 13) ^ Rot32(x, >> 22)) >> +#define SIGMA1(x) (Rot32(x, 6) ^ Rot32(x, 11) ^ Rot32(x, >> 25)) >> +#define sigma0(x) (Rot32(x, 7) ^ Rot32(x, 18) ^ ((x) >> 3)) >> +#define sigma1(x) (Rot32(x, 17) ^ Rot32(x, 19) ^ ((x) >> >> 10)) >> + >> +static const uint32_t SHA256_K[64] = { >> + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, >> + 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, >> + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, >> + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, >> + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, >> + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, >> + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, >> + 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, >> + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, >> + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, >> + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, >> + 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, >> + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, >> + 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, >> + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, >> + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 >> +}; >> + >> +static void >> +SHA256Transform(uint32_t *H, const uint8_t *cp) >> +{ >> + uint32_t a, b, c, d, e, f, g, h, t, T1, T2, W[64]; >> + >> + for (t = 0; t < 16; t++, cp += 4) >> + W[t] = (cp[0] << 24) | (cp[1] << 16) | (cp[2] << 8) | >> cp[3]; >> + >> + for (t = 16; t < 64; t++) >> + W[t] = sigma1(W[t - 2]) + W[t - 7] + >> + sigma0(W[t - 15]) + W[t - 16]; >> + >> + a = H[0]; b = H[1]; c = H[2]; d = H[3]; >> + e = H[4]; f = H[5]; g = H[6]; h = H[7]; >> + >> + for (t = 0; t < 64; t++) { >> + T1 = h + SIGMA1(e) + Ch(e, f, g) + SHA256_K[t] + W[t]; >> + T2 = SIGMA0(a) + Maj(a, b, c); >> + h = g; g = f; f = e; e = d + T1; >> + d = c; c = b; b = a; a = T1 + T2; >> + } >> + >> + H[0] += a; H[1] += b; H[2] += c; H[3] += d; >> + H[4] += e; H[5] += f; H[6] += g; H[7] += h; >> +} >> + >> +static void >> +zio_checksum_SHA256(const void *buf, uint64_t size, zio_cksum_t *zcp) >> +{ >> + uint32_t H[8] = { 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, >> + 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 }; >> + uint8_t pad[128]; >> + int padsize = size & 63; >> + int i; >> + >> + for (i = 0; i < size - padsize; i += 64) >> + SHA256Transform(H, (uint8_t *)buf + i); >> + >> + for (i = 0; i < padsize; i++) >> + pad[i] = ((uint8_t *)buf)[i]; >> + >> + for (pad[padsize++] = 0x80; (padsize & 63) != 56; padsize++) >> + pad[padsize] = 0; >> + >> + for (i = 0; i < 8; i++) >> + pad[padsize++] = (size << 3) >> (56 - 8 * i); >> + >> + for (i = 0; i < padsize; i += 64) >> + SHA256Transform(H, pad + i); >> + >> + ZIO_SET_CHECKSUM(zcp, >> + (uint64_t)H[0] << 32 | H[1], >> + (uint64_t)H[2] << 32 | H[3], >> + (uint64_t)H[4] << 32 | H[5], >> + (uint64_t)H[6] << 32 | H[7]); >> +} >> +/* >> + * CDDL HEADER START >> + * >> + * The contents of this file are subject to the terms of the >> + * Common Development and Distribution License, Version 1.0 only >> + * (the "License"). You may not use this file except in compliance >> + * with the License. >> + * >> + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE >> + * or http://www.opensolaris.org/os/licensing. >> + * See the License for the specific language governing permissions >> + * and limitations under the License. >> + * >> + * When distributing Covered Code, include this CDDL HEADER in each >> + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. >> + * If applicable, add the following below this CDDL HEADER, with the >> + * fields enclosed by brackets "[]" replaced with your own identifying >> + * information: Portions Copyright [yyyy] [name of copyright owner] >> + * >> + * CDDL HEADER END >> + */ >> +/* >> + * Copyright 2005 Sun Microsystems, Inc. All rights reserved. >> + * Use is subject to license terms. >> + */ >> + >> +/*#pragma ident "%Z%%M% %I% %E% SMI"*/ >> + >> +/* >> + * SHA-256 checksum, as specified in FIPS 180-2, available at: >> + * http://csrc.nist.gov/cryptval >> + * >> + * This is a very compact implementation of SHA-256. >> + * It is designed to be simple and portable, not to be fast. >> + */ >> + >> +/* >> + * The literal definitions according to FIPS180-2 would be: >> + * >> + * Ch(x, y, z) (((x) & (y)) ^ ((~(x)) & (z))) >> + * Maj(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z))) >> + * >> + * We use logical equivalents which require one less op. >> + */ >> +#define Ch(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) >> +#define Maj(x, y, z) (((x) & (y)) ^ ((z) & ((x) ^ (y)))) >> +#define Rot32(x, s) (((x) >> s) | ((x) << (32 - s))) >> +#define SIGMA0(x) (Rot32(x, 2) ^ Rot32(x, 13) ^ Rot32(x, >> 22)) >> +#define SIGMA1(x) (Rot32(x, 6) ^ Rot32(x, 11) ^ Rot32(x, >> 25)) >> +#define sigma0(x) (Rot32(x, 7) ^ Rot32(x, 18) ^ ((x) >> 3)) >> +#define sigma1(x) (Rot32(x, 17) ^ Rot32(x, 19) ^ ((x) >> >> 10)) >> + >> +static const uint32_t SHA256_K[64] = { >> + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, >> + 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, >> + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, >> + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, >> + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, >> + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, >> + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, >> + 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, >> + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, >> + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, >> + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, >> + 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, >> + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, >> + 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, >> + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, >> + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 >> +}; >> + >> +static void >> +SHA256Transform(uint32_t *H, const uint8_t *cp) >> +{ >> + uint32_t a, b, c, d, e, f, g, h, t, T1, T2, W[64]; >> + >> + for (t = 0; t < 16; t++, cp += 4) >> + W[t] = (cp[0] << 24) | (cp[1] << 16) | (cp[2] << 8) | >> cp[3]; >> + >> + for (t = 16; t < 64; t++) >> + W[t] = sigma1(W[t - 2]) + W[t - 7] + >> + sigma0(W[t - 15]) + W[t - 16]; >> + >> + a = H[0]; b = H[1]; c = H[2]; d = H[3]; >> + e = H[4]; f = H[5]; g = H[6]; h = H[7]; >> + >> + for (t = 0; t < 64; t++) { >> + T1 = h + SIGMA1(e) + Ch(e, f, g) + SHA256_K[t] + W[t]; >> + T2 = SIGMA0(a) + Maj(a, b, c); >> + h = g; g = f; f = e; e = d + T1; >> + d = c; c = b; b = a; a = T1 + T2; >> + } >> + >> + H[0] += a; H[1] += b; H[2] += c; H[3] += d; >> + H[4] += e; H[5] += f; H[6] += g; H[7] += h; >> +} >> + >> +static void >> +zio_checksum_SHA256(const void *buf, uint64_t size, zio_cksum_t *zcp) >> +{ >> + uint32_t H[8] = { 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, >> + 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 }; >> + uint8_t pad[128]; >> + int padsize = size & 63; >> + int i; >> + >> + for (i = 0; i < size - padsize; i += 64) >> + SHA256Transform(H, (uint8_t *)buf + i); >> + >> + for (i = 0; i < padsize; i++) >> + pad[i] = ((uint8_t *)buf)[i]; >> + >> + for (pad[padsize++] = 0x80; (padsize & 63) != 56; padsize++) >> + pad[padsize] = 0; >> + >> + for (i = 0; i < 8; i++) >> + pad[padsize++] = (size << 3) >> (56 - 8 * i); >> + >> + for (i = 0; i < padsize; i += 64) >> + SHA256Transform(H, pad + i); >> + >> + ZIO_SET_CHECKSUM(zcp, >> + (uint64_t)H[0] << 32 | H[1], >> + (uint64_t)H[2] << 32 | H[3], >> + (uint64_t)H[4] << 32 | H[5], >> + (uint64_t)H[6] << 32 | H[7]); >> +} >> >> Added: user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/zfsimpl.h >> >> ============================================================================== >> --- /dev/null 00:00:00 1970 (empty, because file is newly added) >> +++ user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/zfsimpl.h Fri May 15 >> 23:11:34 2009 (r192168) >> @@ -0,0 +1,2340 @@ >> +/*- >> + * Copyright (c) 2002 McAfee, Inc. >> + * All rights reserved. >> + * >> + * This software was developed for the FreeBSD Project by Marshall >> + * Kirk McKusick and McAfee Research,, the Security Research Division of >> + * McAfee, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), >> as >> + * part of the DARPA CHATS research program >> + * >> + * Redistribution and use in source and binary forms, with or without >> + * modification, are permitted provided that the following conditions >> + * are met: >> + * 1. Redistributions of source code must retain the above copyright >> + * notice, this list of conditions and the following disclaimer. >> + * 2. Redistributions in binary form must reproduce the above copyright >> + * notice, this list of conditions and the following disclaimer in the >> + * documentation and/or other materials provided with the >> distribution. >> + * >> + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND >> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >> PURPOSE >> + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE >> LIABLE >> + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >> CONSEQUENTIAL >> + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE >> GOODS >> + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) >> + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, >> STRICT >> + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY >> WAY >> + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF >> + * SUCH DAMAGE. >> + */ >> +/* >> + * CDDL HEADER START >> + * >> + * The contents of this file are subject to the terms of the >> + * Common Development and Distribution License (the "License"). >> + * You may not use this file except in compliance with the License. >> + * >> + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE >> + * or http://www.opensolaris.org/os/licensing. >> + * See the License for the specific language governing permissions >> + * and limitations under the License. >> + * >> + * When distributing Covered Code, include this CDDL HEADER in each >> + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. >> + * If applicable, add the following below this CDDL HEADER, with the >> + * fields enclosed by brackets "[]" replaced with your own identifying >> + * information: Portions Copyright [yyyy] [name of copyright owner] >> + * >> + * CDDL HEADER END >> + */ >> +/* >> + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. >> + * Use is subject to license terms. >> + */ >> + >> +/* CRC64 table */ >> +#define ZFS_CRC64_POLY 0xC96C5795D7870F42ULL /* ECMA-182, >> reflected form */ >> + >> +/* >> + * Macros for various sorts of alignment and rounding when the alignment >> + * is known to be a power of 2. >> + */ >> +#define P2ALIGN(x, align) ((x) & -(align)) >> +#define P2PHASE(x, align) ((x) & ((align) - 1)) >> +#define P2NPHASE(x, align) (-(x) & ((align) - 1)) >> +#define P2ROUNDUP(x, align) (-(-(x) & -(align))) >> +#define P2END(x, align) (-(~(x) & -(align))) >> +#define P2PHASEUP(x, align, phase) ((phase) - (((phase) - >> (x)) & -(align))) >> +#define P2CROSS(x, y, align) (((x) ^ (y)) > (align) - >> 1) >> + >> +/* >> + * General-purpose 32-bit and 64-bit bitfield encodings. >> + */ >> +#define BF32_DECODE(x, low, len) P2PHASE((x) >> (low), 1U >> << (len)) >> +#define BF64_DECODE(x, low, len) P2PHASE((x) >> (low), 1ULL >> << (len)) >> +#define BF32_ENCODE(x, low, len) (P2PHASE((x), 1U << (len)) >> << (low)) >> +#define BF64_ENCODE(x, low, len) (P2PHASE((x), 1ULL << >> (len)) << (low)) >> + >> +#define BF32_GET(x, low, len) BF32_DECODE(x, low, len) >> +#define BF64_GET(x, low, len) BF64_DECODE(x, low, len) >> + >> +#define BF32_SET(x, low, len, val) \ >> + ((x) ^= BF32_ENCODE((x >> low) ^ (val), low, len)) >> +#define BF64_SET(x, low, len, val) \ >> + ((x) ^= BF64_ENCODE((x >> low) ^ (val), low, len)) >> + >> +#define BF32_GET_SB(x, low, len, shift, bias) \ >> + ((BF32_GET(x, low, len) + (bias)) << (shift)) >> +#define BF64_GET_SB(x, low, len, shift, bias) \ >> + ((BF64_GET(x, low, len) + (bias)) << (shift)) >> + >> +#define BF32_SET_SB(x, low, len, shift, bias, val) \ >> + BF32_SET(x, low, len, ((val) >> (shift)) - (bias)) >> +#define BF64_SET_SB(x, low, len, shift, bias, val) \ >> + BF64_SET(x, low, len, ((val) >> (shift)) - (bias)) >> + >> +/* >> + * We currently support nine block sizes, from 512 bytes to 128K. >> + * We could go higher, but the benefits are near-zero and the cost >> + * of COWing a giant block to modify one byte would become excessive. >> + */ >> +#define SPA_MINBLOCKSHIFT 9 >> +#define SPA_MAXBLOCKSHIFT 17 >> +#define SPA_MINBLOCKSIZE (1ULL << SPA_MINBLOCKSHIFT) >> +#define SPA_MAXBLOCKSIZE (1ULL << SPA_MAXBLOCKSHIFT) >> + >> +#define SPA_BLOCKSIZES (SPA_MAXBLOCKSHIFT - >> SPA_MINBLOCKSHIFT + 1) >> + >> +/* >> + * The DVA size encodings for LSIZE and PSIZE support blocks up to 32MB. >> + * The ASIZE encoding should be at least 64 times larger (6 more bits) >> + * to support up to 4-way RAID-Z mirror mode with worst-case gang block >> + * overhead, three DVAs per bp, plus one more bit in case we do anything >> + * else that expands the ASIZE. >> + */ >> +#define SPA_LSIZEBITS 16 /* LSIZE up to 32M (2^16 * >> 512) */ >> +#define SPA_PSIZEBITS 16 /* PSIZE up to 32M (2^16 * >> 512) */ >> +#define SPA_ASIZEBITS 24 /* ASIZE up to 64 times >> larger */ >> + >> +/* >> + * All SPA data is represented by 128-bit data virtual addresses (DVAs). >> + * The members of the dva_t should be considered opaque outside the SPA. >> + */ >> +typedef struct dva { >> + uint64_t dva_word[2]; >> +} dva_t; >> + >> +/* >> + * Each block has a 256-bit checksum -- strong enough for cryptographic >> hashes. >> + */ >> +typedef struct zio_cksum { >> + uint64_t zc_word[4]; >> +} zio_cksum_t; >> + >> +/* >> + * Each block is described by its DVAs, time of birth, checksum, etc. >> + * The word-by-word, bit-by-bit layout of the blkptr is as follows: >> + * >> + * 64 56 48 40 32 24 16 8 0 >> + * +-------+-------+-------+-------+-------+-------+-------+-------+ >> + * 0 | vdev1 | GRID | ASIZE | >> + * +-------+-------+-------+-------+-------+-------+-------+-------+ >> + * 1 |G| offset1 | >> + * +-------+-------+-------+-------+-------+-------+-------+-------+ >> + * 2 | vdev2 | GRID | ASIZE | >> + * +-------+-------+-------+-------+-------+-------+-------+-------+ >> + * 3 |G| offset2 | >> + * +-------+-------+-------+-------+-------+-------+-------+-------+ >> + * 4 | vdev3 | GRID | ASIZE | >> + * +-------+-------+-------+-------+-------+-------+-------+-------+ >> + * 5 |G| offset3 | >> + * +-------+-------+-------+-------+-------+-------+-------+-------+ >> + * 6 |E| lvl | type | cksum | comp | PSIZE | LSIZE | >> + * +-------+-------+-------+-------+-------+-------+-------+-------+ >> + * 7 | padding | >> + * +-------+-------+-------+-------+-------+-------+-------+-------+ >> + * 8 | padding | >> + * +-------+-------+-------+-------+-------+-------+-------+-------+ >> + * 9 | padding | >> + * +-------+-------+-------+-------+-------+-------+-------+-------+ >> + * a | birth txg | >> + * +-------+-------+-------+-------+-------+-------+-------+-------+ >> + * b | fill count | >> + * +-------+-------+-------+-------+-------+-------+-------+-------+ >> + * c | checksum[0] | >> + * +-------+-------+-------+-------+-------+-------+-------+-------+ >> + * d | checksum[1] | >> + * +-------+-------+-------+-------+-------+-------+-------+-------+ >> + * e | checksum[2] | >> + * +-------+-------+-------+-------+-------+-------+-------+-------+ >> + * f | checksum[3] | >> + * +-------+-------+-------+-------+-------+-------+-------+-------+ >> + * >> + * Legend: >> + * >> + * vdev virtual device ID >> + * offset offset into virtual device >> + * LSIZE logical size >> + * PSIZE physical size (after compression) >> + * ASIZE allocated size (including RAID-Z parity and gang block >> headers) >> + * GRID RAID-Z layout information (reserved for future >> use) >> + * cksum checksum function >> + * comp compression function >> + * G gang block indicator >> + * E endianness >> + * type DMU object type >> + * lvl level of indirection >> + * birth txg transaction group in which the block was born >> + * fill count number of non-zero blocks under this bp >> + * checksum[4] 256-bit checksum of the data this bp describes >> + */ >> +typedef struct blkptr { >> + dva_t blk_dva[3]; /* 128-bit Data Virtual Address */ >> + uint64_t blk_prop; /* size, compression, type, etc */ >> + uint64_t blk_pad[3]; /* Extra space for the future */ >> + uint64_t blk_birth; /* transaction group at birth */ >> + uint64_t blk_fill; /* fill count */ >> + zio_cksum_t blk_cksum; /* 256-bit checksum */ >> +} blkptr_t; >> + >> +#define SPA_BLKPTRSHIFT 7 /* blkptr_t is 128 bytes >> */ >> +#define SPA_DVAS_PER_BP 3 /* Number of DVAs in a bp >> */ >> + >> +/* >> + * Macros to get and set fields in a bp or DVA. >> + */ >> +#define DVA_GET_ASIZE(dva) \ >> + BF64_GET_SB((dva)->dva_word[0], 0, 24, SPA_MINBLOCKSHIFT, 0) >> +#define DVA_SET_ASIZE(dva, x) \ >> + BF64_SET_SB((dva)->dva_word[0], 0, 24, SPA_MINBLOCKSHIFT, 0, x) >> + >> +#define DVA_GET_GRID(dva) BF64_GET((dva)->dva_word[0], 24, >> 8) >> +#define DVA_SET_GRID(dva, x) BF64_SET((dva)->dva_word[0], 24, >> 8, x) >> + >> +#define DVA_GET_VDEV(dva) BF64_GET((dva)->dva_word[0], 32, >> 32) >> +#define DVA_SET_VDEV(dva, x) BF64_SET((dva)->dva_word[0], 32, >> 32, x) >> + >> +#define DVA_GET_OFFSET(dva) \ >> + BF64_GET_SB((dva)->dva_word[1], 0, 63, SPA_MINBLOCKSHIFT, 0) >> +#define DVA_SET_OFFSET(dva, x) \ >> + BF64_SET_SB((dva)->dva_word[1], 0, 63, SPA_MINBLOCKSHIFT, 0, x) >> + >> +#define DVA_GET_GANG(dva) BF64_GET((dva)->dva_word[1], 63, >> 1) >> +#define DVA_SET_GANG(dva, x) BF64_SET((dva)->dva_word[1], 63, >> 1, x) >> + >> +#define BP_GET_LSIZE(bp) \ >> + (BP_IS_HOLE(bp) ? 0 : \ >> + BF64_GET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1)) >> +#define BP_SET_LSIZE(bp, x) \ >> + BF64_SET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1, x) >> + >> +#define BP_GET_PSIZE(bp) \ >> + BF64_GET_SB((bp)->blk_prop, 16, 16, SPA_MINBLOCKSHIFT, 1) >> +#define BP_SET_PSIZE(bp, x) \ >> + BF64_SET_SB((bp)->blk_prop, 16, 16, SPA_MINBLOCKSHIFT, 1, x) >> + >> +#define BP_GET_COMPRESS(bp) BF64_GET((bp)->blk_prop, 32, 8) >> +#define BP_SET_COMPRESS(bp, x) BF64_SET((bp)->blk_prop, 32, 8, x) >> + >> +#define BP_GET_CHECKSUM(bp) BF64_GET((bp)->blk_prop, 40, 8) >> +#define BP_SET_CHECKSUM(bp, x) BF64_SET((bp)->blk_prop, 40, 8, x) >> + >> +#define BP_GET_TYPE(bp) BF64_GET((bp)->blk_prop, 48, 8) >> +#define BP_SET_TYPE(bp, x) BF64_SET((bp)->blk_prop, 48, 8, x) >> + >> +#define BP_GET_LEVEL(bp) BF64_GET((bp)->blk_prop, 56, 5) >> +#define BP_SET_LEVEL(bp, x) BF64_SET((bp)->blk_prop, 56, 5, x) >> + >> +#define BP_GET_BYTEORDER(bp) (0 - BF64_GET((bp)->blk_prop, 63, >> 1)) >> +#define BP_SET_BYTEORDER(bp, x) BF64_SET((bp)->blk_prop, 63, 1, x) >> + >> +#define BP_GET_ASIZE(bp) \ >> + (DVA_GET_ASIZE(&(bp)->blk_dva[0]) + >> DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \ >> + DVA_GET_ASIZE(&(bp)->blk_dva[2])) >> + >> +#define BP_GET_UCSIZE(bp) \ >> + ((BP_GET_LEVEL(bp) > 0 || dmu_ot[BP_GET_TYPE(bp)].ot_metadata) ? \ >> + BP_GET_PSIZE(bp) : BP_GET_LSIZE(bp)); >> + >> +#define BP_GET_NDVAS(bp) \ >> + (!!DVA_GET_ASIZE(&(bp)->blk_dva[0]) + \ >> + !!DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \ >> + !!DVA_GET_ASIZE(&(bp)->blk_dva[2])) >> + >> +#define BP_COUNT_GANG(bp) \ >> + (DVA_GET_GANG(&(bp)->blk_dva[0]) + \ >> + DVA_GET_GANG(&(bp)->blk_dva[1]) + \ >> + DVA_GET_GANG(&(bp)->blk_dva[2])) >> + >> +#define DVA_EQUAL(dva1, dva2) \ >> + ((dva1)->dva_word[1] == (dva2)->dva_word[1] && \ >> + (dva1)->dva_word[0] == (dva2)->dva_word[0]) >> + >> +#define ZIO_CHECKSUM_EQUAL(zc1, zc2) \ >> + (0 == (((zc1).zc_word[0] - (zc2).zc_word[0]) | \ >> + ((zc1).zc_word[1] - (zc2).zc_word[1]) | \ >> + ((zc1).zc_word[2] - (zc2).zc_word[2]) | \ >> + ((zc1).zc_word[3] - (zc2).zc_word[3]))) >> + >> + >> +#define DVA_IS_VALID(dva) (DVA_GET_ASIZE(dva) != 0) >> + >> +#define ZIO_SET_CHECKSUM(zcp, w0, w1, w2, w3) \ >> +{ \ >> + (zcp)->zc_word[0] = w0; \ >> + (zcp)->zc_word[1] = w1; \ >> + (zcp)->zc_word[2] = w2; \ >> + (zcp)->zc_word[3] = w3; \ >> +} >> + >> +#define BP_IDENTITY(bp) (&(bp)->blk_dva[0]) >> +#define BP_IS_GANG(bp) DVA_GET_GANG(BP_IDENTITY(bp)) >> +#define BP_IS_HOLE(bp) ((bp)->blk_birth == 0) >> +#define BP_IS_OLDER(bp, txg) (!BP_IS_HOLE(bp) && >> (bp)->blk_birth < (txg)) >> + >> +#define BP_ZERO(bp) \ >> +{ \ >> + (bp)->blk_dva[0].dva_word[0] = 0; \ >> + (bp)->blk_dva[0].dva_word[1] = 0; \ >> + (bp)->blk_dva[1].dva_word[0] = 0; \ >> + (bp)->blk_dva[1].dva_word[1] = 0; \ >> + (bp)->blk_dva[2].dva_word[0] = 0; \ >> + (bp)->blk_dva[2].dva_word[1] = 0; \ >> + (bp)->blk_prop = 0; \ >> + (bp)->blk_pad[0] = 0; \ >> + (bp)->blk_pad[1] = 0; \ >> + (bp)->blk_pad[2] = 0; \ >> + (bp)->blk_birth = 0; \ >> + (bp)->blk_fill = 0; \ >> + ZIO_SET_CHECKSUM(&(bp)->blk_cksum, 0, 0, 0, 0); \ >> +} >> + >> +#define ZBT_MAGIC 0x210da7ab10c7a11ULL /* zio data bloc >> tail */ >> + >> +typedef struct zio_block_tail { >> + uint64_t zbt_magic; /* for validation, endianness */ >> + zio_cksum_t zbt_cksum; /* 256-bit checksum */ >> +} zio_block_tail_t; >> + >> +#define VDEV_SKIP_SIZE (8 << 10) >> +#define VDEV_BOOT_HEADER_SIZE (8 << 10) >> +#define VDEV_PHYS_SIZE (112 << 10) >> +#define VDEV_UBERBLOCK_RING (128 << 10) >> + >> +#define VDEV_UBERBLOCK_SHIFT(vd) \ >> + MAX((vd)->vdev_top->vdev_ashift, UBERBLOCK_SHIFT) >> +#define VDEV_UBERBLOCK_COUNT(vd) \ >> + (VDEV_UBERBLOCK_RING >> VDEV_UBERBLOCK_SHIFT(vd)) >> +#define VDEV_UBERBLOCK_OFFSET(vd, n) \ >> + offsetof(vdev_label_t, vl_uberblock[(n) << >> VDEV_UBERBLOCK_SHIFT(vd)]) >> +#define VDEV_UBERBLOCK_SIZE(vd) (1ULL << >> VDEV_UBERBLOCK_SHIFT(vd)) >> + >> +/* ZFS boot block */ >> +#define VDEV_BOOT_MAGIC 0x2f5b007b10cULL >> +#define VDEV_BOOT_VERSION 1 /* version number >> */ >> + >> +typedef struct vdev_boot_header { >> + uint64_t vb_magic; /* VDEV_BOOT_MAGIC */ >> + uint64_t vb_version; /* VDEV_BOOT_VERSION */ >> + uint64_t vb_offset; /* start offset (bytes) */ >> + uint64_t vb_size; /* size (bytes) */ >> + char vb_pad[VDEV_BOOT_HEADER_SIZE - 4 * sizeof >> (uint64_t)]; >> +} vdev_boot_header_t; >> + >> +typedef struct vdev_phys { >> + char vp_nvlist[VDEV_PHYS_SIZE - sizeof >> (zio_block_tail_t)]; >> + zio_block_tail_t vp_zbt; >> +} vdev_phys_t; >> + >> +typedef struct vdev_label { >> + char vl_pad[VDEV_SKIP_SIZE]; /* 8K */ >> + vdev_boot_header_t vl_boot_header; /* 8K */ >> + vdev_phys_t vl_vdev_phys; /* 112K */ >> + char vl_uberblock[VDEV_UBERBLOCK_RING]; /* 128K */ >> +} vdev_label_t; /* >> 256K total */ >> + >> +/* >> + * vdev_dirty() flags >> + */ >> +#define VDD_METASLAB 0x01 >> +#define VDD_DTL 0x02 >> + >> +/* >> + * Size and offset of embedded boot loader region on each label. >> + * The total size of the first two labels plus the boot area is 4MB. >> + */ >> +#define VDEV_BOOT_OFFSET (2 * sizeof (vdev_label_t)) >> +#define VDEV_BOOT_SIZE (7ULL << 19) /* >> 3.5M */ >> + >> +/* >> + * Size of label regions at the start and end of each leaf device. >> + */ >> +#define VDEV_LABEL_START_SIZE (2 * sizeof (vdev_label_t) + >> VDEV_BOOT_SIZE) >> +#define VDEV_LABEL_END_SIZE (2 * sizeof (vdev_label_t)) >> +#define VDEV_LABELS 4 >> + >> +enum zio_checksum { >> + ZIO_CHECKSUM_INHERIT = 0, >> + ZIO_CHECKSUM_ON, >> + ZIO_CHECKSUM_OFF, >> + ZIO_CHECKSUM_LABEL, >> + ZIO_CHECKSUM_GANG_HEADER, >> + ZIO_CHECKSUM_ZILOG, >> + ZIO_CHECKSUM_FLETCHER_2, >> + ZIO_CHECKSUM_FLETCHER_4, >> + ZIO_CHECKSUM_SHA256, >> + ZIO_CHECKSUM_FUNCTIONS >> +}; >> + >> +#define ZIO_CHECKSUM_ON_VALUE ZIO_CHECKSUM_FLETCHER_2 >> +#define ZIO_CHECKSUM_DEFAULT ZIO_CHECKSUM_ON >> + >> +enum zio_compress { >> + ZIO_COMPRESS_INHERIT = 0, >> + ZIO_COMPRESS_ON, >> + ZIO_COMPRESS_OFF, >> + ZIO_COMPRESS_LZJB, >> + ZIO_COMPRESS_EMPTY, >> + ZIO_COMPRESS_GZIP_1, >> + ZIO_COMPRESS_GZIP_2, >> + ZIO_COMPRESS_GZIP_3, >> + ZIO_COMPRESS_GZIP_4, >> + ZIO_COMPRESS_GZIP_5, >> + ZIO_COMPRESS_GZIP_6, >> + ZIO_COMPRESS_GZIP_7, >> + ZIO_COMPRESS_GZIP_8, >> + ZIO_COMPRESS_GZIP_9, >> + ZIO_COMPRESS_FUNCTIONS >> +}; >> + >> +#define ZIO_COMPRESS_ON_VALUE ZIO_COMPRESS_LZJB >> +#define ZIO_COMPRESS_DEFAULT ZIO_COMPRESS_OFF >> + >> +/* nvlist pack encoding */ >> +#define NV_ENCODE_NATIVE 0 >> +#define NV_ENCODE_XDR 1 >> + >> +typedef enum { >> + DATA_TYPE_UNKNOWN = 0, >> + DATA_TYPE_BOOLEAN, >> + DATA_TYPE_BYTE, >> + DATA_TYPE_INT16, >> + DATA_TYPE_UINT16, >> + DATA_TYPE_INT32, >> + DATA_TYPE_UINT32, >> + DATA_TYPE_INT64, >> + DATA_TYPE_UINT64, >> + DATA_TYPE_STRING, >> + DATA_TYPE_BYTE_ARRAY, >> + DATA_TYPE_INT16_ARRAY, >> + DATA_TYPE_UINT16_ARRAY, >> + DATA_TYPE_INT32_ARRAY, >> + DATA_TYPE_UINT32_ARRAY, >> + DATA_TYPE_INT64_ARRAY, >> + DATA_TYPE_UINT64_ARRAY, >> >> *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > > -- When bad men combine, the good must associate; else they will fall one by one, an unpitied sacrifice in a contemptible struggle. Edmund Burkehelp
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3c1674c90905160916m71f75ea8tcd7aa8b9057e1c1b>
