Skip site navigation (1)Skip section navigation (2)
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>

next in thread | previous in thread | raw e-mail | index | archive | help
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:
>> =A0add ZFS boot support
>>
>> Added:
>> =A0user/kmacy/ZFS_MFC/sys/cddl/boot/
>> =A0user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/
>> =A0user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/README
>> =A0user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/fletcher.c =A0 (contents, props
>> changed)
>> =A0user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/lzjb.c =A0 (contents, props chan=
ged)
>> =A0user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/sha256.c =A0 (contents, props ch=
anged)
>> =A0user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/zfsimpl.h =A0 (contents, props
>> changed)
>> =A0user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/zfssubr.c =A0 (contents, props
>> changed)
>>
>> Added: user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/README
>>
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
>> --- /dev/null =A0 00:00:00 1970 =A0 (empty, because file is newly added)
>> +++ user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/README Fri May 15 23:11:34 2009
>> =A0(r192168)
>> @@ -0,0 +1,28 @@
>> +$FreeBSD$
>> +
>> +This directory contains various files derived from CDDL sources that
>> +are used by the ZFS bootstrap:
>> +
>> + =A0 =A0fletcher.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 checksum support
>> + =A0 =A0sha256.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 checksum support
>> + =A0 =A0lzjb.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compression supp=
ort
>> + =A0 =A0zfssubr.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0mostly checksum an=
d compression support
>> + =A0 =A0zfsimpl.h =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0mostly 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:
>> +
>> + =A0 =A0fletcher.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 checksum support
>> + =A0 =A0sha256.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 checksum support
>> + =A0 =A0lzjb.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compression supp=
ort
>> + =A0 =A0zfssubr.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0mostly checksum an=
d compression support
>> + =A0 =A0zfsimpl.h =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0mostly 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
>>
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
>> --- /dev/null =A0 00:00:00 1970 =A0 (empty, because file is newly added)
>> +++ user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/fletcher.c =A0 =A0 Fri May 15
>> 23:11:34 2009 =A0 (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. =A0All rights reserved.
>> + * Use is subject to license terms.
>> + */
>> +
>> +/*#pragma ident =A0 =A0 =A0 =A0"%Z%%M% %I% =A0 =A0 %E% SMI"*/
>> +
>> +static void
>> +fletcher_2_native(const void *buf, uint64_t size, zio_cksum_t *zcp)
>> +{
>> + =A0 =A0 =A0 const uint64_t *ip =3D buf;
>> + =A0 =A0 =A0 const uint64_t *ipend =3D ip + (size / sizeof (uint64_t));
>> + =A0 =A0 =A0 uint64_t a0, b0, a1, b1;
>> +
>> + =A0 =A0 =A0 for (a0 =3D b0 =3D a1 =3D b1 =3D 0; ip < ipend; ip +=3D 2)=
 {
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 a0 +=3D ip[0];
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 a1 +=3D ip[1];
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 b0 +=3D a0;
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 b1 +=3D a1;
>> + =A0 =A0 =A0 }
>> +
>> + =A0 =A0 =A0 ZIO_SET_CHECKSUM(zcp, a0, a1, b0, b1);
>> +}
>> +
>> +static void
>> +fletcher_4_native(const void *buf, uint64_t size, zio_cksum_t *zcp)
>> +{
>> + =A0 =A0 =A0 const uint32_t *ip =3D buf;
>> + =A0 =A0 =A0 const uint32_t *ipend =3D ip + (size / sizeof (uint32_t));
>> + =A0 =A0 =A0 uint64_t a, b, c, d;
>> +
>> + =A0 =A0 =A0 for (a =3D b =3D c =3D d =3D 0; ip < ipend; ip++) {
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 a +=3D ip[0];
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 b +=3D a;
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 c +=3D b;
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 d +=3D c;
>> + =A0 =A0 =A0 }
>> +
>> + =A0 =A0 =A0 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. =A0All rights reserved.
>> + * Use is subject to license terms.
>> + */
>> +
>> +/*#pragma ident =A0 =A0 =A0 =A0"%Z%%M% %I% =A0 =A0 %E% SMI"*/
>> +
>> +static void
>> +fletcher_2_native(const void *buf, uint64_t size, zio_cksum_t *zcp)
>> +{
>> + =A0 =A0 =A0 const uint64_t *ip =3D buf;
>> + =A0 =A0 =A0 const uint64_t *ipend =3D ip + (size / sizeof (uint64_t));
>> + =A0 =A0 =A0 uint64_t a0, b0, a1, b1;
>> +
>> + =A0 =A0 =A0 for (a0 =3D b0 =3D a1 =3D b1 =3D 0; ip < ipend; ip +=3D 2)=
 {
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 a0 +=3D ip[0];
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 a1 +=3D ip[1];
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 b0 +=3D a0;
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 b1 +=3D a1;
>> + =A0 =A0 =A0 }
>> +
>> + =A0 =A0 =A0 ZIO_SET_CHECKSUM(zcp, a0, a1, b0, b1);
>> +}
>> +
>> +static void
>> +fletcher_4_native(const void *buf, uint64_t size, zio_cksum_t *zcp)
>> +{
>> + =A0 =A0 =A0 const uint32_t *ip =3D buf;
>> + =A0 =A0 =A0 const uint32_t *ipend =3D ip + (size / sizeof (uint32_t));
>> + =A0 =A0 =A0 uint64_t a, b, c, d;
>> +
>> + =A0 =A0 =A0 for (a =3D b =3D c =3D d =3D 0; ip < ipend; ip++) {
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 a +=3D ip[0];
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 b +=3D a;
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 c +=3D b;
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 d +=3D c;
>> + =A0 =A0 =A0 }
>> +
>> + =A0 =A0 =A0 ZIO_SET_CHECKSUM(zcp, a, b, c, d);
>> +}
>>
>> Added: user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/lzjb.c
>>
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
>> --- /dev/null =A0 00:00:00 1970 =A0 (empty, because file is newly added)
>> +++ user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/lzjb.c Fri May 15 23:11:34 2009
>> =A0(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. =A0All rights reserved.
>> + * Use is subject to license terms.
>> + */
>> +
>> +/*#pragma ident =A0 =A0 =A0 =A0"%Z%%M% %I% =A0 =A0 %E% SMI"*/
>> +
>> +/*
>> + * We keep our own copy of this algorithm for 2 main reasons:
>> + * =A0 =A0 1. If we didn't, anyone modifying common/os/compress.c would
>> + * =A0 =A0 =A0 =A0 directly break our on disk format
>> + * =A0 =A0 2. Our version of lzjb does not have a number of checks that=
 the
>> + * =A0 =A0 =A0 =A0 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 =A0 =A0 =A0 =A0MATCH_BITS =A0 =A0 =A06
>> +#define =A0 =A0 =A0 =A0MATCH_MIN =A0 =A0 =A0 3
>> +#define =A0 =A0 =A0 =A0MATCH_MAX =A0 =A0 =A0 ((1 << MATCH_BITS) + (MATC=
H_MIN - 1))
>> +#define =A0 =A0 =A0 =A0OFFSET_MASK =A0 =A0 ((1 << (16 - MATCH_BITS)) - =
1)
>> +#define =A0 =A0 =A0 =A0LEMPEL_SIZE =A0 =A0 256
>> +
>> +/*ARGSUSED*/
>> +static int
>> +lzjb_decompress(void *s_start, void *d_start, size_t s_len, size_t d_le=
n,
>> int n)
>> +{
>> + =A0 =A0 =A0 unsigned char *src =3D s_start;
>> + =A0 =A0 =A0 unsigned char *dst =3D d_start;
>> + =A0 =A0 =A0 unsigned char *d_end =3D (unsigned char *)d_start + d_len;
>> + =A0 =A0 =A0 unsigned char *cpy, copymap =3D 0;
>> + =A0 =A0 =A0 int copymask =3D 1 << (NBBY - 1);
>> +
>> + =A0 =A0 =A0 while (dst < d_end) {
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((copymask <<=3D 1) =3D=3D (1 << NBBY))=
 {
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 copymask =3D 1;
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 copymap =3D *src++;
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (copymap & copymask) {
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 int mlen =3D (src[0] >> (N=
BBY - MATCH_BITS)) +
>> MATCH_MIN;
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 int offset =3D ((src[0] <<=
 NBBY) | src[1]) &
>> OFFSET_MASK;
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 src +=3D 2;
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((cpy =3D dst - offset)=
 < (unsigned char
>> *)d_start)
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (-1=
);
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 while (--mlen >=3D 0 && ds=
t < d_end)
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 *dst++ =3D=
 *cpy++;
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else {
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 *dst++ =3D *src++;
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
>> + =A0 =A0 =A0 }
>> + =A0 =A0 =A0 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. =A0All rights reserved.
>> + * Use is subject to license terms.
>> + */
>> +
>> +/*#pragma ident =A0 =A0 =A0 =A0"%Z%%M% %I% =A0 =A0 %E% SMI"*/
>> +
>> +/*
>> + * We keep our own copy of this algorithm for 2 main reasons:
>> + * =A0 =A0 1. If we didn't, anyone modifying common/os/compress.c would
>> + * =A0 =A0 =A0 =A0 directly break our on disk format
>> + * =A0 =A0 2. Our version of lzjb does not have a number of checks that=
 the
>> + * =A0 =A0 =A0 =A0 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 =A0 =A0 =A0 =A0MATCH_BITS =A0 =A0 =A06
>> +#define =A0 =A0 =A0 =A0MATCH_MIN =A0 =A0 =A0 3
>> +#define =A0 =A0 =A0 =A0MATCH_MAX =A0 =A0 =A0 ((1 << MATCH_BITS) + (MATC=
H_MIN - 1))
>> +#define =A0 =A0 =A0 =A0OFFSET_MASK =A0 =A0 ((1 << (16 - MATCH_BITS)) - =
1)
>> +#define =A0 =A0 =A0 =A0LEMPEL_SIZE =A0 =A0 256
>> +
>> +/*ARGSUSED*/
>> +static int
>> +lzjb_decompress(void *s_start, void *d_start, size_t s_len, size_t d_le=
n,
>> int n)
>> +{
>> + =A0 =A0 =A0 unsigned char *src =3D s_start;
>> + =A0 =A0 =A0 unsigned char *dst =3D d_start;
>> + =A0 =A0 =A0 unsigned char *d_end =3D (unsigned char *)d_start + d_len;
>> + =A0 =A0 =A0 unsigned char *cpy, copymap =3D 0;
>> + =A0 =A0 =A0 int copymask =3D 1 << (NBBY - 1);
>> +
>> + =A0 =A0 =A0 while (dst < d_end) {
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((copymask <<=3D 1) =3D=3D (1 << NBBY))=
 {
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 copymask =3D 1;
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 copymap =3D *src++;
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (copymap & copymask) {
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 int mlen =3D (src[0] >> (N=
BBY - MATCH_BITS)) +
>> MATCH_MIN;
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 int offset =3D ((src[0] <<=
 NBBY) | src[1]) &
>> OFFSET_MASK;
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 src +=3D 2;
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((cpy =3D dst - offset)=
 < (unsigned char
>> *)d_start)
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (-1=
);
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 while (--mlen >=3D 0 && ds=
t < d_end)
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 *dst++ =3D=
 *cpy++;
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else {
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 *dst++ =3D *src++;
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
>> + =A0 =A0 =A0 }
>> + =A0 =A0 =A0 return (0);
>> +}
>>
>> Added: user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/sha256.c
>>
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
>> --- /dev/null =A0 00:00:00 1970 =A0 (empty, because file is newly added)
>> +++ user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/sha256.c =A0 =A0 =A0 Fri May 15
>> 23:11:34 2009 =A0 (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"). =A0You 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. =A0All rights reserved.
>> + * Use is subject to license terms.
>> + */
>> +
>> +/*#pragma ident =A0 =A0 =A0 =A0"%Z%%M% %I% =A0 =A0 %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:
>> + *
>> + * =A0 =A0 Ch(x, y, z) =A0 =A0 (((x) & (y)) ^ ((~(x)) & (z)))
>> + * =A0 =A0 Maj(x, y, z) =A0 =A0(((x) & (y)) | ((x) & (z)) | ((y) & (z))=
)
>> + *
>> + * We use logical equivalents which require one less op.
>> + */
>> +#define =A0 =A0 =A0 =A0Ch(x, y, z) =A0 =A0 ((z) ^ ((x) & ((y) ^ (z))))
>> +#define =A0 =A0 =A0 =A0Maj(x, y, z) =A0 =A0(((x) & (y)) ^ ((z) & ((x) ^=
 (y))))
>> +#define =A0 =A0 =A0 =A0Rot32(x, s) =A0 =A0 (((x) >> s) | ((x) << (32 - =
s)))
>> +#define =A0 =A0 =A0 =A0SIGMA0(x) =A0 =A0 =A0 (Rot32(x, 2) ^ Rot32(x, 13=
) ^ Rot32(x,
>> 22))
>> +#define =A0 =A0 =A0 =A0SIGMA1(x) =A0 =A0 =A0 (Rot32(x, 6) ^ Rot32(x, 11=
) ^ Rot32(x,
>> 25))
>> +#define =A0 =A0 =A0 =A0sigma0(x) =A0 =A0 =A0 (Rot32(x, 7) ^ Rot32(x, 18=
) ^ ((x) >> 3))
>> +#define =A0 =A0 =A0 =A0sigma1(x) =A0 =A0 =A0 (Rot32(x, 17) ^ Rot32(x, 1=
9) ^ ((x) >>
>> 10))
>> +
>> +static const uint32_t SHA256_K[64] =3D {
>> + =A0 =A0 =A0 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
>> + =A0 =A0 =A0 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
>> + =A0 =A0 =A0 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
>> + =A0 =A0 =A0 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
>> + =A0 =A0 =A0 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
>> + =A0 =A0 =A0 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
>> + =A0 =A0 =A0 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
>> + =A0 =A0 =A0 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
>> + =A0 =A0 =A0 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
>> + =A0 =A0 =A0 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
>> + =A0 =A0 =A0 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
>> + =A0 =A0 =A0 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
>> + =A0 =A0 =A0 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
>> + =A0 =A0 =A0 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
>> + =A0 =A0 =A0 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
>> + =A0 =A0 =A0 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
>> +};
>> +
>> +static void
>> +SHA256Transform(uint32_t *H, const uint8_t *cp)
>> +{
>> + =A0 =A0 =A0 uint32_t a, b, c, d, e, f, g, h, t, T1, T2, W[64];
>> +
>> + =A0 =A0 =A0 for (t =3D 0; t < 16; t++, cp +=3D 4)
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 W[t] =3D (cp[0] << 24) | (cp[1] << 16) | (=
cp[2] << 8) |
>> cp[3];
>> +
>> + =A0 =A0 =A0 for (t =3D 16; t < 64; t++)
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 W[t] =3D sigma1(W[t - 2]) + W[t - 7] +
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 sigma0(W[t - 15]) + W[t - 16];
>> +
>> + =A0 =A0 =A0 a =3D H[0]; b =3D H[1]; c =3D H[2]; d =3D H[3];
>> + =A0 =A0 =A0 e =3D H[4]; f =3D H[5]; g =3D H[6]; h =3D H[7];
>> +
>> + =A0 =A0 =A0 for (t =3D 0; t < 64; t++) {
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 T1 =3D h + SIGMA1(e) + Ch(e, f, g) + SHA25=
6_K[t] + W[t];
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 T2 =3D SIGMA0(a) + Maj(a, b, c);
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 h =3D g; g =3D f; f =3D e; e =3D d + T1;
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 d =3D c; c =3D b; b =3D a; a =3D T1 + T2;
>> + =A0 =A0 =A0 }
>> +
>> + =A0 =A0 =A0 H[0] +=3D a; H[1] +=3D b; H[2] +=3D c; H[3] +=3D d;
>> + =A0 =A0 =A0 H[4] +=3D e; H[5] +=3D f; H[6] +=3D g; H[7] +=3D h;
>> +}
>> +
>> +static void
>> +zio_checksum_SHA256(const void *buf, uint64_t size, zio_cksum_t *zcp)
>> +{
>> + =A0 =A0 =A0 uint32_t H[8] =3D { 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0x=
a54ff53a,
>> + =A0 =A0 =A0 =A0 =A0 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 };
>> + =A0 =A0 =A0 uint8_t pad[128];
>> + =A0 =A0 =A0 int padsize =3D size & 63;
>> + =A0 =A0 =A0 int i;
>> +
>> + =A0 =A0 =A0 for (i =3D 0; i < size - padsize; i +=3D 64)
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 SHA256Transform(H, (uint8_t *)buf + i);
>> +
>> + =A0 =A0 =A0 for (i =3D 0; i < padsize; i++)
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 pad[i] =3D ((uint8_t *)buf)[i];
>> +
>> + =A0 =A0 =A0 for (pad[padsize++] =3D 0x80; (padsize & 63) !=3D 56; pads=
ize++)
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 pad[padsize] =3D 0;
>> +
>> + =A0 =A0 =A0 for (i =3D 0; i < 8; i++)
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 pad[padsize++] =3D (size << 3) >> (56 - 8 =
* i);
>> +
>> + =A0 =A0 =A0 for (i =3D 0; i < padsize; i +=3D 64)
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 SHA256Transform(H, pad + i);
>> +
>> + =A0 =A0 =A0 ZIO_SET_CHECKSUM(zcp,
>> + =A0 =A0 =A0 =A0 =A0 (uint64_t)H[0] << 32 | H[1],
>> + =A0 =A0 =A0 =A0 =A0 (uint64_t)H[2] << 32 | H[3],
>> + =A0 =A0 =A0 =A0 =A0 (uint64_t)H[4] << 32 | H[5],
>> + =A0 =A0 =A0 =A0 =A0 (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"). =A0You 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. =A0All rights reserved.
>> + * Use is subject to license terms.
>> + */
>> +
>> +/*#pragma ident =A0 =A0 =A0 =A0"%Z%%M% %I% =A0 =A0 %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:
>> + *
>> + * =A0 =A0 Ch(x, y, z) =A0 =A0 (((x) & (y)) ^ ((~(x)) & (z)))
>> + * =A0 =A0 Maj(x, y, z) =A0 =A0(((x) & (y)) | ((x) & (z)) | ((y) & (z))=
)
>> + *
>> + * We use logical equivalents which require one less op.
>> + */
>> +#define =A0 =A0 =A0 =A0Ch(x, y, z) =A0 =A0 ((z) ^ ((x) & ((y) ^ (z))))
>> +#define =A0 =A0 =A0 =A0Maj(x, y, z) =A0 =A0(((x) & (y)) ^ ((z) & ((x) ^=
 (y))))
>> +#define =A0 =A0 =A0 =A0Rot32(x, s) =A0 =A0 (((x) >> s) | ((x) << (32 - =
s)))
>> +#define =A0 =A0 =A0 =A0SIGMA0(x) =A0 =A0 =A0 (Rot32(x, 2) ^ Rot32(x, 13=
) ^ Rot32(x,
>> 22))
>> +#define =A0 =A0 =A0 =A0SIGMA1(x) =A0 =A0 =A0 (Rot32(x, 6) ^ Rot32(x, 11=
) ^ Rot32(x,
>> 25))
>> +#define =A0 =A0 =A0 =A0sigma0(x) =A0 =A0 =A0 (Rot32(x, 7) ^ Rot32(x, 18=
) ^ ((x) >> 3))
>> +#define =A0 =A0 =A0 =A0sigma1(x) =A0 =A0 =A0 (Rot32(x, 17) ^ Rot32(x, 1=
9) ^ ((x) >>
>> 10))
>> +
>> +static const uint32_t SHA256_K[64] =3D {
>> + =A0 =A0 =A0 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
>> + =A0 =A0 =A0 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
>> + =A0 =A0 =A0 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
>> + =A0 =A0 =A0 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
>> + =A0 =A0 =A0 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
>> + =A0 =A0 =A0 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
>> + =A0 =A0 =A0 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
>> + =A0 =A0 =A0 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
>> + =A0 =A0 =A0 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
>> + =A0 =A0 =A0 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
>> + =A0 =A0 =A0 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
>> + =A0 =A0 =A0 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
>> + =A0 =A0 =A0 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
>> + =A0 =A0 =A0 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
>> + =A0 =A0 =A0 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
>> + =A0 =A0 =A0 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
>> +};
>> +
>> +static void
>> +SHA256Transform(uint32_t *H, const uint8_t *cp)
>> +{
>> + =A0 =A0 =A0 uint32_t a, b, c, d, e, f, g, h, t, T1, T2, W[64];
>> +
>> + =A0 =A0 =A0 for (t =3D 0; t < 16; t++, cp +=3D 4)
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 W[t] =3D (cp[0] << 24) | (cp[1] << 16) | (=
cp[2] << 8) |
>> cp[3];
>> +
>> + =A0 =A0 =A0 for (t =3D 16; t < 64; t++)
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 W[t] =3D sigma1(W[t - 2]) + W[t - 7] +
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 sigma0(W[t - 15]) + W[t - 16];
>> +
>> + =A0 =A0 =A0 a =3D H[0]; b =3D H[1]; c =3D H[2]; d =3D H[3];
>> + =A0 =A0 =A0 e =3D H[4]; f =3D H[5]; g =3D H[6]; h =3D H[7];
>> +
>> + =A0 =A0 =A0 for (t =3D 0; t < 64; t++) {
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 T1 =3D h + SIGMA1(e) + Ch(e, f, g) + SHA25=
6_K[t] + W[t];
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 T2 =3D SIGMA0(a) + Maj(a, b, c);
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 h =3D g; g =3D f; f =3D e; e =3D d + T1;
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 d =3D c; c =3D b; b =3D a; a =3D T1 + T2;
>> + =A0 =A0 =A0 }
>> +
>> + =A0 =A0 =A0 H[0] +=3D a; H[1] +=3D b; H[2] +=3D c; H[3] +=3D d;
>> + =A0 =A0 =A0 H[4] +=3D e; H[5] +=3D f; H[6] +=3D g; H[7] +=3D h;
>> +}
>> +
>> +static void
>> +zio_checksum_SHA256(const void *buf, uint64_t size, zio_cksum_t *zcp)
>> +{
>> + =A0 =A0 =A0 uint32_t H[8] =3D { 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0x=
a54ff53a,
>> + =A0 =A0 =A0 =A0 =A0 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 };
>> + =A0 =A0 =A0 uint8_t pad[128];
>> + =A0 =A0 =A0 int padsize =3D size & 63;
>> + =A0 =A0 =A0 int i;
>> +
>> + =A0 =A0 =A0 for (i =3D 0; i < size - padsize; i +=3D 64)
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 SHA256Transform(H, (uint8_t *)buf + i);
>> +
>> + =A0 =A0 =A0 for (i =3D 0; i < padsize; i++)
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 pad[i] =3D ((uint8_t *)buf)[i];
>> +
>> + =A0 =A0 =A0 for (pad[padsize++] =3D 0x80; (padsize & 63) !=3D 56; pads=
ize++)
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 pad[padsize] =3D 0;
>> +
>> + =A0 =A0 =A0 for (i =3D 0; i < 8; i++)
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 pad[padsize++] =3D (size << 3) >> (56 - 8 =
* i);
>> +
>> + =A0 =A0 =A0 for (i =3D 0; i < padsize; i +=3D 64)
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 SHA256Transform(H, pad + i);
>> +
>> + =A0 =A0 =A0 ZIO_SET_CHECKSUM(zcp,
>> + =A0 =A0 =A0 =A0 =A0 (uint64_t)H[0] << 32 | H[1],
>> + =A0 =A0 =A0 =A0 =A0 (uint64_t)H[2] << 32 | H[3],
>> + =A0 =A0 =A0 =A0 =A0 (uint64_t)H[4] << 32 | H[5],
>> + =A0 =A0 =A0 =A0 =A0 (uint64_t)H[6] << 32 | H[7]);
>> +}
>>
>> Added: user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/zfsimpl.h
>>
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
>> --- /dev/null =A0 00:00:00 1970 =A0 (empty, because file is newly added)
>> +++ user/kmacy/ZFS_MFC/sys/cddl/boot/zfs/zfsimpl.h =A0 =A0 =A0Fri May 15
>> 23:11:34 2009 =A0 (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 o=
f
>> + * 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
>> + * =A0 =A0notice, this list of conditions and the following disclaimer.
>> + * 2. Redistributions in binary form must reproduce the above copyright
>> + * =A0 =A0notice, this list of conditions and the following disclaimer =
in the
>> + * =A0 =A0documentation and/or other materials provided with the
>> distribution.
>> + *
>> + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' A=
ND
>> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, TH=
E
>> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
>> PURPOSE
>> + * ARE DISCLAIMED. =A0IN 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 AN=
Y
>> 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. =A0All rights reserved.
>> + * Use is subject to license terms.
>> + */
>> +
>> +/* CRC64 table */
>> +#define =A0 =A0 =A0 =A0ZFS_CRC64_POLY =A00xC96C5795D7870F42ULL =A0 /* E=
CMA-182,
>> reflected form */
>> +
>> +/*
>> + * Macros for various sorts of alignment and rounding when the alignmen=
t
>> + * is known to be a power of 2.
>> + */
>> +#define =A0 =A0 =A0 =A0P2ALIGN(x, align) =A0 =A0 =A0 =A0 =A0 =A0 =A0 ((=
x) & -(align))
>> +#define =A0 =A0 =A0 =A0P2PHASE(x, align) =A0 =A0 =A0 =A0 =A0 =A0 =A0 ((=
x) & ((align) - 1))
>> +#define =A0 =A0 =A0 =A0P2NPHASE(x, align) =A0 =A0 =A0 =A0 =A0 =A0 =A0(-=
(x) & ((align) - 1))
>> +#define =A0 =A0 =A0 =A0P2ROUNDUP(x, align) =A0 =A0 =A0 =A0 =A0 =A0 (-(-=
(x) & -(align)))
>> +#define =A0 =A0 =A0 =A0P2END(x, align) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
(-(~(x) & -(align)))
>> +#define =A0 =A0 =A0 =A0P2PHASEUP(x, align, phase) =A0 =A0 =A0((phase) -=
 (((phase) -
>> (x)) & -(align)))
>> +#define =A0 =A0 =A0 =A0P2CROSS(x, y, align) =A0 =A0 =A0 =A0 =A0 =A0(((x=
) ^ (y)) > (align) -
>> 1)
>> +
>> +/*
>> + * General-purpose 32-bit and 64-bit bitfield encodings.
>> + */
>> +#define =A0 =A0 =A0 =A0BF32_DECODE(x, low, len) =A0 =A0 =A0 =A0P2PHASE(=
(x) >> (low), 1U
>> << (len))
>> +#define =A0 =A0 =A0 =A0BF64_DECODE(x, low, len) =A0 =A0 =A0 =A0P2PHASE(=
(x) >> (low), 1ULL
>> << (len))
>> +#define =A0 =A0 =A0 =A0BF32_ENCODE(x, low, len) =A0 =A0 =A0 =A0(P2PHASE=
((x), 1U << (len))
>> << (low))
>> +#define =A0 =A0 =A0 =A0BF64_ENCODE(x, low, len) =A0 =A0 =A0 =A0(P2PHASE=
((x), 1ULL <<
>> (len)) << (low))
>> +
>> +#define =A0 =A0 =A0 =A0BF32_GET(x, low, len) =A0 =A0 =A0 =A0 =A0 BF32_D=
ECODE(x, low, len)
>> +#define =A0 =A0 =A0 =A0BF64_GET(x, low, len) =A0 =A0 =A0 =A0 =A0 BF64_D=
ECODE(x, low, len)
>> +
>> +#define =A0 =A0 =A0 =A0BF32_SET(x, low, len, val) =A0 =A0 =A0\
>> + =A0 =A0 =A0 ((x) ^=3D BF32_ENCODE((x >> low) ^ (val), low, len))
>> +#define =A0 =A0 =A0 =A0BF64_SET(x, low, len, val) =A0 =A0 =A0\
>> + =A0 =A0 =A0 ((x) ^=3D BF64_ENCODE((x >> low) ^ (val), low, len))
>> +
>> +#define =A0 =A0 =A0 =A0BF32_GET_SB(x, low, len, shift, bias) =A0 \
>> + =A0 =A0 =A0 ((BF32_GET(x, low, len) + (bias)) << (shift))
>> +#define =A0 =A0 =A0 =A0BF64_GET_SB(x, low, len, shift, bias) =A0 \
>> + =A0 =A0 =A0 ((BF64_GET(x, low, len) + (bias)) << (shift))
>> +
>> +#define =A0 =A0 =A0 =A0BF32_SET_SB(x, low, len, shift, bias, val) =A0 =
=A0 =A0\
>> + =A0 =A0 =A0 BF32_SET(x, low, len, ((val) >> (shift)) - (bias))
>> +#define =A0 =A0 =A0 =A0BF64_SET_SB(x, low, len, shift, bias, val) =A0 =
=A0 =A0\
>> + =A0 =A0 =A0 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 =A0 =A0 =A0 =A0SPA_MINBLOCKSHIFT =A0 =A0 =A0 9
>> +#define =A0 =A0 =A0 =A0SPA_MAXBLOCKSHIFT =A0 =A0 =A0 17
>> +#define =A0 =A0 =A0 =A0SPA_MINBLOCKSIZE =A0 =A0 =A0 =A0(1ULL << SPA_MIN=
BLOCKSHIFT)
>> +#define =A0 =A0 =A0 =A0SPA_MAXBLOCKSIZE =A0 =A0 =A0 =A0(1ULL << SPA_MAX=
BLOCKSHIFT)
>> +
>> +#define =A0 =A0 =A0 =A0SPA_BLOCKSIZES =A0 =A0 =A0 =A0 =A0(SPA_MAXBLOCKS=
HIFT -
>> 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 anythin=
g
>> + * else that expands the ASIZE.
>> + */
>> +#define =A0 =A0 =A0 =A0SPA_LSIZEBITS =A0 =A0 =A0 =A0 =A0 16 =A0 =A0 =A0=
/* LSIZE up to 32M (2^16 *
>> 512) */
>> +#define =A0 =A0 =A0 =A0SPA_PSIZEBITS =A0 =A0 =A0 =A0 =A0 16 =A0 =A0 =A0=
/* PSIZE up to 32M (2^16 *
>> 512) */
>> +#define =A0 =A0 =A0 =A0SPA_ASIZEBITS =A0 =A0 =A0 =A0 =A0 24 =A0 =A0 =A0=
/* ASIZE up to 64 times
>> larger =A0*/
>> +
>> +/*
>> + * 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 {
>> + =A0 =A0 =A0 uint64_t =A0 =A0 =A0 =A0dva_word[2];
>> +} dva_t;
>> +
>> +/*
>> + * Each block has a 256-bit checksum -- strong enough for cryptographic
>> hashes.
>> + */
>> +typedef struct zio_cksum {
>> + =A0 =A0 =A0 uint64_t =A0 =A0 =A0 =A0zc_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:
>> + *
>> + * =A0 =A0 64 =A0 =A0 =A056 =A0 =A0 =A048 =A0 =A0 =A040 =A0 =A0 =A032 =
=A0 =A0 =A024 =A0 =A0 =A016 =A0 =A0 =A08 =A0 =A0 =A0 0
>> + * =A0 =A0 +-------+-------+-------+-------+-------+-------+-------+---=
----+
>> + * 0 =A0 | =A0 =A0 =A0 =A0 =A0 =A0 =A0 vdev1 =A0 =A0 =A0 =A0 =A0 | GRID=
 =A0| =A0 =A0 =A0 =A0 ASIZE =A0 =A0 =A0 =A0 |
>> + * =A0 =A0 +-------+-------+-------+-------+-------+-------+-------+---=
----+
>> + * 1 =A0 |G| =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0offset1 =A0 =A0=
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0|
>> + * =A0 =A0 +-------+-------+-------+-------+-------+-------+-------+---=
----+
>> + * 2 =A0 | =A0 =A0 =A0 =A0 =A0 =A0 =A0 vdev2 =A0 =A0 =A0 =A0 =A0 | GRID=
 =A0| =A0 =A0 =A0 =A0 ASIZE =A0 =A0 =A0 =A0 |
>> + * =A0 =A0 +-------+-------+-------+-------+-------+-------+-------+---=
----+
>> + * 3 =A0 |G| =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0offset2 =A0 =A0=
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0|
>> + * =A0 =A0 +-------+-------+-------+-------+-------+-------+-------+---=
----+
>> + * 4 =A0 | =A0 =A0 =A0 =A0 =A0 =A0 =A0 vdev3 =A0 =A0 =A0 =A0 =A0 | GRID=
 =A0| =A0 =A0 =A0 =A0 ASIZE =A0 =A0 =A0 =A0 |
>> + * =A0 =A0 +-------+-------+-------+-------+-------+-------+-------+---=
----+
>> + * 5 =A0 |G| =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0offset3 =A0 =A0=
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0|
>> + * =A0 =A0 +-------+-------+-------+-------+-------+-------+-------+---=
----+
>> + * 6 =A0 |E| lvl | type =A0| cksum | comp =A0| =A0 =A0 PSIZE =A0 =A0 | =
=A0 =A0 LSIZE =A0 =A0 |
>> + * =A0 =A0 +-------+-------+-------+-------+-------+-------+-------+---=
----+
>> + * 7 =A0 | =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 padding =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 |
>> + * =A0 =A0 +-------+-------+-------+-------+-------+-------+-------+---=
----+
>> + * 8 =A0 | =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 padding =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 |
>> + * =A0 =A0 +-------+-------+-------+-------+-------+-------+-------+---=
----+
>> + * 9 =A0 | =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 padding =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 |
>> + * =A0 =A0 +-------+-------+-------+-------+-------+-------+-------+---=
----+
>> + * a =A0 | =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 birth txg =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 |
>> + * =A0 =A0 +-------+-------+-------+-------+-------+-------+-------+---=
----+
>> + * b =A0 | =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 fill count =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0|
>> + * =A0 =A0 +-------+-------+-------+-------+-------+-------+-------+---=
----+
>> + * c =A0 | =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 checksum[0] =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 |
>> + * =A0 =A0 +-------+-------+-------+-------+-------+-------+-------+---=
----+
>> + * d =A0 | =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 checksum[1] =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 |
>> + * =A0 =A0 +-------+-------+-------+-------+-------+-------+-------+---=
----+
>> + * e =A0 | =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 checksum[2] =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 |
>> + * =A0 =A0 +-------+-------+-------+-------+-------+-------+-------+---=
----+
>> + * f =A0 | =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 checksum[3] =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 |
>> + * =A0 =A0 +-------+-------+-------+-------+-------+-------+-------+---=
----+
>> + *
>> + * Legend:
>> + *
>> + * vdev =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0virtual device ID
>> + * offset =A0 =A0 =A0offset into virtual device
>> + * LSIZE =A0 =A0 =A0 logical size
>> + * PSIZE =A0 =A0 =A0 physical size (after compression)
>> + * ASIZE =A0 =A0 =A0 allocated size (including RAID-Z parity and gang b=
lock
>> headers)
>> + * GRID =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0RAID-Z layout information (reser=
ved for future
>> use)
>> + * cksum =A0 =A0 =A0 checksum function
>> + * comp =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0compression function
>> + * G =A0 =A0 =A0 =A0 =A0 gang block indicator
>> + * E =A0 =A0 =A0 =A0 =A0 endianness
>> + * type =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0DMU object type
>> + * lvl =A0 =A0 =A0 =A0 level of indirection
>> + * birth txg =A0 transaction group in which the block was born
>> + * fill count =A0number of non-zero blocks under this bp
>> + * checksum[4] 256-bit checksum of the data this bp describes
>> + */
>> +typedef struct blkptr {
>> + =A0 =A0 =A0 dva_t =A0 =A0 =A0 =A0 =A0 blk_dva[3]; =A0 =A0 /* 128-bit D=
ata Virtual Address */
>> + =A0 =A0 =A0 uint64_t =A0 =A0 =A0 =A0blk_prop; =A0 =A0 =A0 /* size, com=
pression, type, etc */
>> + =A0 =A0 =A0 uint64_t =A0 =A0 =A0 =A0blk_pad[3]; =A0 =A0 /* Extra space=
 for the future =A0 */
>> + =A0 =A0 =A0 uint64_t =A0 =A0 =A0 =A0blk_birth; =A0 =A0 =A0/* transacti=
on group at birth =A0 */
>> + =A0 =A0 =A0 uint64_t =A0 =A0 =A0 =A0blk_fill; =A0 =A0 =A0 /* fill coun=
t =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 */
>> + =A0 =A0 =A0 zio_cksum_t =A0 =A0 blk_cksum; =A0 =A0 =A0/* 256-bit check=
sum =A0 =A0 =A0 =A0 =A0 =A0 */
>> +} blkptr_t;
>> +
>> +#define =A0 =A0 =A0 =A0SPA_BLKPTRSHIFT 7 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /*=
 blkptr_t is 128 bytes
>> =A0 =A0 =A0*/
>> +#define =A0 =A0 =A0 =A0SPA_DVAS_PER_BP 3 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /*=
 Number of DVAs in a bp
>> =A0 =A0 =A0 */
>> +
>> +/*
>> + * Macros to get and set fields in a bp or DVA.
>> + */
>> +#define =A0 =A0 =A0 =A0DVA_GET_ASIZE(dva) =A0 =A0 =A0\
>> + =A0 =A0 =A0 BF64_GET_SB((dva)->dva_word[0], 0, 24, SPA_MINBLOCKSHIFT, =
0)
>> +#define =A0 =A0 =A0 =A0DVA_SET_ASIZE(dva, x) =A0 \
>> + =A0 =A0 =A0 BF64_SET_SB((dva)->dva_word[0], 0, 24, SPA_MINBLOCKSHIFT, =
0, x)
>> +
>> +#define =A0 =A0 =A0 =A0DVA_GET_GRID(dva) =A0 =A0 =A0 BF64_GET((dva)->dv=
a_word[0], 24,
>> 8)
>> +#define =A0 =A0 =A0 =A0DVA_SET_GRID(dva, x) =A0 =A0BF64_SET((dva)->dva_=
word[0], 24,
>> 8, x)
>> +
>> +#define =A0 =A0 =A0 =A0DVA_GET_VDEV(dva) =A0 =A0 =A0 BF64_GET((dva)->dv=
a_word[0], 32,
>> 32)
>> +#define =A0 =A0 =A0 =A0DVA_SET_VDEV(dva, x) =A0 =A0BF64_SET((dva)->dva_=
word[0], 32,
>> 32, x)
>> +
>> +#define =A0 =A0 =A0 =A0DVA_GET_OFFSET(dva) =A0 =A0 \
>> + =A0 =A0 =A0 BF64_GET_SB((dva)->dva_word[1], 0, 63, SPA_MINBLOCKSHIFT, =
0)
>> +#define =A0 =A0 =A0 =A0DVA_SET_OFFSET(dva, x) =A0\
>> + =A0 =A0 =A0 BF64_SET_SB((dva)->dva_word[1], 0, 63, SPA_MINBLOCKSHIFT, =
0, x)
>> +
>> +#define =A0 =A0 =A0 =A0DVA_GET_GANG(dva) =A0 =A0 =A0 BF64_GET((dva)->dv=
a_word[1], 63,
>> 1)
>> +#define =A0 =A0 =A0 =A0DVA_SET_GANG(dva, x) =A0 =A0BF64_SET((dva)->dva_=
word[1], 63,
>> 1, x)
>> +
>> +#define =A0 =A0 =A0 =A0BP_GET_LSIZE(bp) =A0 =A0 =A0 =A0\
>> + =A0 =A0 =A0 (BP_IS_HOLE(bp) ? 0 : \
>> + =A0 =A0 =A0 BF64_GET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1))
>> +#define =A0 =A0 =A0 =A0BP_SET_LSIZE(bp, x) =A0 =A0 \
>> + =A0 =A0 =A0 BF64_SET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1, x=
)
>> +
>> +#define =A0 =A0 =A0 =A0BP_GET_PSIZE(bp) =A0 =A0 =A0 =A0\
>> + =A0 =A0 =A0 BF64_GET_SB((bp)->blk_prop, 16, 16, SPA_MINBLOCKSHIFT, 1)
>> +#define =A0 =A0 =A0 =A0BP_SET_PSIZE(bp, x) =A0 =A0 \
>> + =A0 =A0 =A0 BF64_SET_SB((bp)->blk_prop, 16, 16, SPA_MINBLOCKSHIFT, 1, =
x)
>> +
>> +#define =A0 =A0 =A0 =A0BP_GET_COMPRESS(bp) =A0 =A0 BF64_GET((bp)->blk_p=
rop, 32, 8)
>> +#define =A0 =A0 =A0 =A0BP_SET_COMPRESS(bp, x) =A0BF64_SET((bp)->blk_pro=
p, 32, 8, x)
>> +
>> +#define =A0 =A0 =A0 =A0BP_GET_CHECKSUM(bp) =A0 =A0 BF64_GET((bp)->blk_p=
rop, 40, 8)
>> +#define =A0 =A0 =A0 =A0BP_SET_CHECKSUM(bp, x) =A0BF64_SET((bp)->blk_pro=
p, 40, 8, x)
>> +
>> +#define =A0 =A0 =A0 =A0BP_GET_TYPE(bp) =A0 =A0 =A0 =A0 BF64_GET((bp)->b=
lk_prop, 48, 8)
>> +#define =A0 =A0 =A0 =A0BP_SET_TYPE(bp, x) =A0 =A0 =A0BF64_SET((bp)->blk=
_prop, 48, 8, x)
>> +
>> +#define =A0 =A0 =A0 =A0BP_GET_LEVEL(bp) =A0 =A0 =A0 =A0BF64_GET((bp)->b=
lk_prop, 56, 5)
>> +#define =A0 =A0 =A0 =A0BP_SET_LEVEL(bp, x) =A0 =A0 BF64_SET((bp)->blk_p=
rop, 56, 5, x)
>> +
>> +#define =A0 =A0 =A0 =A0BP_GET_BYTEORDER(bp) =A0 =A0(0 - BF64_GET((bp)->=
blk_prop, 63,
>> 1))
>> +#define =A0 =A0 =A0 =A0BP_SET_BYTEORDER(bp, x) BF64_SET((bp)->blk_prop,=
 63, 1, x)
>> +
>> +#define =A0 =A0 =A0 =A0BP_GET_ASIZE(bp) =A0 =A0 =A0 =A0\
>> + =A0 =A0 =A0 (DVA_GET_ASIZE(&(bp)->blk_dva[0]) +
>> DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 DVA_GET_ASIZE(&(bp)->blk_dva[2]))
>> +
>> +#define =A0 =A0 =A0 =A0BP_GET_UCSIZE(bp) \
>> + =A0 =A0 =A0 ((BP_GET_LEVEL(bp) > 0 || dmu_ot[BP_GET_TYPE(bp)].ot_metad=
ata) ? \
>> + =A0 =A0 =A0 BP_GET_PSIZE(bp) : BP_GET_LSIZE(bp));
>> +
>> +#define =A0 =A0 =A0 =A0BP_GET_NDVAS(bp) =A0 =A0 =A0 =A0\
>> + =A0 =A0 =A0 (!!DVA_GET_ASIZE(&(bp)->blk_dva[0]) + \
>> + =A0 =A0 =A0 !!DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \
>> + =A0 =A0 =A0 !!DVA_GET_ASIZE(&(bp)->blk_dva[2]))
>> +
>> +#define =A0 =A0 =A0 =A0BP_COUNT_GANG(bp) =A0 =A0 =A0 \
>> + =A0 =A0 =A0 (DVA_GET_GANG(&(bp)->blk_dva[0]) + \
>> + =A0 =A0 =A0 DVA_GET_GANG(&(bp)->blk_dva[1]) + \
>> + =A0 =A0 =A0 DVA_GET_GANG(&(bp)->blk_dva[2]))
>> +
>> +#define =A0 =A0 =A0 =A0DVA_EQUAL(dva1, dva2) =A0 \
>> + =A0 =A0 =A0 ((dva1)->dva_word[1] =3D=3D (dva2)->dva_word[1] && \
>> + =A0 =A0 =A0 (dva1)->dva_word[0] =3D=3D (dva2)->dva_word[0])
>> +
>> +#define =A0 =A0 =A0 =A0ZIO_CHECKSUM_EQUAL(zc1, zc2) \
>> + =A0 =A0 =A0 (0 =3D=3D (((zc1).zc_word[0] - (zc2).zc_word[0]) | \
>> + =A0 =A0 =A0 ((zc1).zc_word[1] - (zc2).zc_word[1]) | \
>> + =A0 =A0 =A0 ((zc1).zc_word[2] - (zc2).zc_word[2]) | \
>> + =A0 =A0 =A0 ((zc1).zc_word[3] - (zc2).zc_word[3])))
>> +
>> +
>> +#define =A0 =A0 =A0 =A0DVA_IS_VALID(dva) =A0 =A0 =A0 (DVA_GET_ASIZE(dva=
) !=3D 0)
>> +
>> +#define =A0 =A0 =A0 =A0ZIO_SET_CHECKSUM(zcp, w0, w1, w2, w3) =A0 \
>> +{ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0\
>> + =A0 =A0 =A0 (zcp)->zc_word[0] =3D w0; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
\
>> + =A0 =A0 =A0 (zcp)->zc_word[1] =3D w1; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
\
>> + =A0 =A0 =A0 (zcp)->zc_word[2] =3D w2; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
\
>> + =A0 =A0 =A0 (zcp)->zc_word[3] =3D w3; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
\
>> +}
>> +
>> +#define =A0 =A0 =A0 =A0BP_IDENTITY(bp) =A0 =A0 =A0 =A0 (&(bp)->blk_dva[=
0])
>> +#define =A0 =A0 =A0 =A0BP_IS_GANG(bp) =A0 =A0 =A0 =A0 =A0DVA_GET_GANG(B=
P_IDENTITY(bp))
>> +#define =A0 =A0 =A0 =A0BP_IS_HOLE(bp) =A0 =A0 =A0 =A0 =A0((bp)->blk_bir=
th =3D=3D 0)
>> +#define =A0 =A0 =A0 =A0BP_IS_OLDER(bp, txg) =A0 =A0(!BP_IS_HOLE(bp) &&
>> (bp)->blk_birth < (txg))
>> +
>> +#define =A0 =A0 =A0 =A0BP_ZERO(bp) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 \
>> +{ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0\
>> + =A0 =A0 =A0 (bp)->blk_dva[0].dva_word[0] =3D 0; =A0 =A0 =A0 \
>> + =A0 =A0 =A0 (bp)->blk_dva[0].dva_word[1] =3D 0; =A0 =A0 =A0 \
>> + =A0 =A0 =A0 (bp)->blk_dva[1].dva_word[0] =3D 0; =A0 =A0 =A0 \
>> + =A0 =A0 =A0 (bp)->blk_dva[1].dva_word[1] =3D 0; =A0 =A0 =A0 \
>> + =A0 =A0 =A0 (bp)->blk_dva[2].dva_word[0] =3D 0; =A0 =A0 =A0 \
>> + =A0 =A0 =A0 (bp)->blk_dva[2].dva_word[1] =3D 0; =A0 =A0 =A0 \
>> + =A0 =A0 =A0 (bp)->blk_prop =3D 0; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 \
>> + =A0 =A0 =A0 (bp)->blk_pad[0] =3D 0; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 \
>> + =A0 =A0 =A0 (bp)->blk_pad[1] =3D 0; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 \
>> + =A0 =A0 =A0 (bp)->blk_pad[2] =3D 0; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 \
>> + =A0 =A0 =A0 (bp)->blk_birth =3D 0; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0\
>> + =A0 =A0 =A0 (bp)->blk_fill =3D 0; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 \
>> + =A0 =A0 =A0 ZIO_SET_CHECKSUM(&(bp)->blk_cksum, 0, 0, 0, 0); \
>> +}
>> +
>> +#define =A0 =A0 =A0 =A0ZBT_MAGIC =A0 =A0 =A0 0x210da7ab10c7a11ULL =A0 =
=A0/* zio data bloc
>> tail */
>> +
>> +typedef struct zio_block_tail {
>> + =A0 =A0 =A0 uint64_t =A0 =A0 =A0 =A0zbt_magic; =A0 =A0 =A0/* for valid=
ation, endianness =A0 */
>> + =A0 =A0 =A0 zio_cksum_t =A0 =A0 zbt_cksum; =A0 =A0 =A0/* 256-bit check=
sum =A0 =A0 =A0 =A0 =A0 =A0 */
>> +} zio_block_tail_t;
>> +
>> +#define =A0 =A0 =A0 =A0VDEV_SKIP_SIZE =A0 =A0 =A0 =A0 =A0(8 << 10)
>> +#define =A0 =A0 =A0 =A0VDEV_BOOT_HEADER_SIZE =A0 (8 << 10)
>> +#define =A0 =A0 =A0 =A0VDEV_PHYS_SIZE =A0 =A0 =A0 =A0 =A0(112 << 10)
>> +#define =A0 =A0 =A0 =A0VDEV_UBERBLOCK_RING =A0 =A0 (128 << 10)
>> +
>> +#define =A0 =A0 =A0 =A0VDEV_UBERBLOCK_SHIFT(vd) =A0 =A0 =A0 =A0\
>> + =A0 =A0 =A0 MAX((vd)->vdev_top->vdev_ashift, UBERBLOCK_SHIFT)
>> +#define =A0 =A0 =A0 =A0VDEV_UBERBLOCK_COUNT(vd) =A0 =A0 =A0 =A0\
>> + =A0 =A0 =A0 (VDEV_UBERBLOCK_RING >> VDEV_UBERBLOCK_SHIFT(vd))
>> +#define =A0 =A0 =A0 =A0VDEV_UBERBLOCK_OFFSET(vd, n) =A0 =A0\
>> + =A0 =A0 =A0 offsetof(vdev_label_t, vl_uberblock[(n) <<
>> VDEV_UBERBLOCK_SHIFT(vd)])
>> +#define =A0 =A0 =A0 =A0VDEV_UBERBLOCK_SIZE(vd) =A0 =A0 =A0 =A0 (1ULL <<
>> VDEV_UBERBLOCK_SHIFT(vd))
>> +
>> +/* ZFS boot block */
>> +#define =A0 =A0 =A0 =A0VDEV_BOOT_MAGIC =A0 =A0 =A0 =A0 0x2f5b007b10cULL
>> +#define =A0 =A0 =A0 =A0VDEV_BOOT_VERSION =A0 =A0 =A0 1 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 /* version number
>> =A0 =A0 =A0 */
>> +
>> +typedef struct vdev_boot_header {
>> + =A0 =A0 =A0 uint64_t =A0 =A0 =A0 =A0vb_magic; =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 /* VDEV_BOOT_MAGIC =A0 =A0 =A0*/
>> + =A0 =A0 =A0 uint64_t =A0 =A0 =A0 =A0vb_version; =A0 =A0 =A0 =A0 =A0 =
=A0 /* VDEV_BOOT_VERSION =A0 =A0*/
>> + =A0 =A0 =A0 uint64_t =A0 =A0 =A0 =A0vb_offset; =A0 =A0 =A0 =A0 =A0 =A0=
 =A0/* start offset (bytes) */
>> + =A0 =A0 =A0 uint64_t =A0 =A0 =A0 =A0vb_size; =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0/* size (bytes) =A0 =A0 =A0 =A0 */
>> + =A0 =A0 =A0 char =A0 =A0 =A0 =A0 =A0 =A0vb_pad[VDEV_BOOT_HEADER_SIZE -=
 4 * sizeof
>> (uint64_t)];
>> +} vdev_boot_header_t;
>> +
>> +typedef struct vdev_phys {
>> + =A0 =A0 =A0 char =A0 =A0 =A0 =A0 =A0 =A0vp_nvlist[VDEV_PHYS_SIZE - siz=
eof
>> (zio_block_tail_t)];
>> + =A0 =A0 =A0 zio_block_tail_t vp_zbt;
>> +} vdev_phys_t;
>> +
>> +typedef struct vdev_label {
>> + =A0 =A0 =A0 char =A0 =A0 =A0 =A0 =A0 =A0vl_pad[VDEV_SKIP_SIZE]; =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 /* =A0 8K */
>> + =A0 =A0 =A0 vdev_boot_header_t vl_boot_header; =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 =A0 =A0 =A0 =A0/* =A0 8K */
>> + =A0 =A0 =A0 vdev_phys_t =A0 =A0 vl_vdev_phys; =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 /* 112K */
>> + =A0 =A0 =A0 char =A0 =A0 =A0 =A0 =A0 =A0vl_uberblock[VDEV_UBERBLOCK_RI=
NG]; =A0 =A0 =A0/* 128K */
>> +} vdev_label_t; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/*
>> 256K total */
>> +
>> +/*
>> + * vdev_dirty() flags
>> + */
>> +#define =A0 =A0 =A0 =A0VDD_METASLAB =A0 =A00x01
>> +#define =A0 =A0 =A0 =A0VDD_DTL =A0 =A0 =A0 =A0 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 =A0 =A0 =A0 =A0VDEV_BOOT_OFFSET =A0 =A0 =A0 =A0(2 * sizeof (vde=
v_label_t))
>> +#define =A0 =A0 =A0 =A0VDEV_BOOT_SIZE =A0 =A0 =A0 =A0 =A0(7ULL << 19) =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/*
>> 3.5M */
>> +
>> +/*
>> + * Size of label regions at the start and end of each leaf device.
>> + */
>> +#define =A0 =A0 =A0 =A0VDEV_LABEL_START_SIZE =A0 (2 * sizeof (vdev_labe=
l_t) +
>> VDEV_BOOT_SIZE)
>> +#define =A0 =A0 =A0 =A0VDEV_LABEL_END_SIZE =A0 =A0 (2 * sizeof (vdev_la=
bel_t))
>> +#define =A0 =A0 =A0 =A0VDEV_LABELS =A0 =A0 =A0 =A0 =A0 =A0 4
>> +
>> +enum zio_checksum {
>> + =A0 =A0 =A0 ZIO_CHECKSUM_INHERIT =3D 0,
>> + =A0 =A0 =A0 ZIO_CHECKSUM_ON,
>> + =A0 =A0 =A0 ZIO_CHECKSUM_OFF,
>> + =A0 =A0 =A0 ZIO_CHECKSUM_LABEL,
>> + =A0 =A0 =A0 ZIO_CHECKSUM_GANG_HEADER,
>> + =A0 =A0 =A0 ZIO_CHECKSUM_ZILOG,
>> + =A0 =A0 =A0 ZIO_CHECKSUM_FLETCHER_2,
>> + =A0 =A0 =A0 ZIO_CHECKSUM_FLETCHER_4,
>> + =A0 =A0 =A0 ZIO_CHECKSUM_SHA256,
>> + =A0 =A0 =A0 ZIO_CHECKSUM_FUNCTIONS
>> +};
>> +
>> +#define =A0 =A0 =A0 =A0ZIO_CHECKSUM_ON_VALUE =A0 ZIO_CHECKSUM_FLETCHER_=
2
>> +#define =A0 =A0 =A0 =A0ZIO_CHECKSUM_DEFAULT =A0 =A0ZIO_CHECKSUM_ON
>> +
>> +enum zio_compress {
>> + =A0 =A0 =A0 ZIO_COMPRESS_INHERIT =3D 0,
>> + =A0 =A0 =A0 ZIO_COMPRESS_ON,
>> + =A0 =A0 =A0 ZIO_COMPRESS_OFF,
>> + =A0 =A0 =A0 ZIO_COMPRESS_LZJB,
>> + =A0 =A0 =A0 ZIO_COMPRESS_EMPTY,
>> + =A0 =A0 =A0 ZIO_COMPRESS_GZIP_1,
>> + =A0 =A0 =A0 ZIO_COMPRESS_GZIP_2,
>> + =A0 =A0 =A0 ZIO_COMPRESS_GZIP_3,
>> + =A0 =A0 =A0 ZIO_COMPRESS_GZIP_4,
>> + =A0 =A0 =A0 ZIO_COMPRESS_GZIP_5,
>> + =A0 =A0 =A0 ZIO_COMPRESS_GZIP_6,
>> + =A0 =A0 =A0 ZIO_COMPRESS_GZIP_7,
>> + =A0 =A0 =A0 ZIO_COMPRESS_GZIP_8,
>> + =A0 =A0 =A0 ZIO_COMPRESS_GZIP_9,
>> + =A0 =A0 =A0 ZIO_COMPRESS_FUNCTIONS
>> +};
>> +
>> +#define =A0 =A0 =A0 =A0ZIO_COMPRESS_ON_VALUE =A0 ZIO_COMPRESS_LZJB
>> +#define =A0 =A0 =A0 =A0ZIO_COMPRESS_DEFAULT =A0 =A0ZIO_COMPRESS_OFF
>> +
>> +/* nvlist pack encoding */
>> +#define =A0 =A0 =A0 =A0NV_ENCODE_NATIVE =A0 =A0 =A0 =A00
>> +#define =A0 =A0 =A0 =A0NV_ENCODE_XDR =A0 =A0 =A0 =A0 =A0 1
>> +
>> +typedef enum {
>> + =A0 =A0 =A0 DATA_TYPE_UNKNOWN =3D 0,
>> + =A0 =A0 =A0 DATA_TYPE_BOOLEAN,
>> + =A0 =A0 =A0 DATA_TYPE_BYTE,
>> + =A0 =A0 =A0 DATA_TYPE_INT16,
>> + =A0 =A0 =A0 DATA_TYPE_UINT16,
>> + =A0 =A0 =A0 DATA_TYPE_INT32,
>> + =A0 =A0 =A0 DATA_TYPE_UINT32,
>> + =A0 =A0 =A0 DATA_TYPE_INT64,
>> + =A0 =A0 =A0 DATA_TYPE_UINT64,
>> + =A0 =A0 =A0 DATA_TYPE_STRING,
>> + =A0 =A0 =A0 DATA_TYPE_BYTE_ARRAY,
>> + =A0 =A0 =A0 DATA_TYPE_INT16_ARRAY,
>> + =A0 =A0 =A0 DATA_TYPE_UINT16_ARRAY,
>> + =A0 =A0 =A0 DATA_TYPE_INT32_ARRAY,
>> + =A0 =A0 =A0 DATA_TYPE_UINT32_ARRAY,
>> + =A0 =A0 =A0 DATA_TYPE_INT64_ARRAY,
>> + =A0 =A0 =A0 DATA_TYPE_UINT64_ARRAY,
>>
>> *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
>
>



--=20
When bad men combine, the good must associate; else they will fall one
by one, an unpitied sacrifice in a contemptible struggle.

    Edmund Burke



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3c1674c90905160916m71f75ea8tcd7aa8b9057e1c1b>