Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: sys/cddl/boot/zfs/sha256.c
- ===================================================================
- --- sys/cddl/boot/zfs/sha256.c (revision 185164)
- +++ sys/cddl/boot/zfs/sha256.c (working copy)
- @@ -2,9 +2,8 @@
- * 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.
- + * 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.
- @@ -20,27 +19,27 @@
- * CDDL HEADER END
- */
- /*
- - * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- + * Copyright 2007 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
- + * SHA-256 checksum, as specified in FIPS 180-3, available at:
- + * http://csrc.nist.gov/publications/PubsFIPS.html
- *
- * 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:
- + * The literal definitions of Ch() and Maj() according to FIPS 180-3 are:
- *
- - * Ch(x, y, z) (((x) & (y)) ^ ((~(x)) & (z)))
- - * Maj(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z)))
- + * 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.
- + * We use equivalent logical reductions here that require one less op.
- */
- #define Ch(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
- #define Maj(x, y, z) (((x) & (y)) ^ ((z) & ((x) ^ (y))))
- @@ -101,20 +100,19 @@
- uint32_t H[8] = { 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
- 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 };
- uint8_t pad[128];
- - int padsize = size & 63;
- - int i;
- + int i, padsize;
- - for (i = 0; i < size - padsize; i += 64)
- + for (i = 0; i < (size & ~63ULL); i += 64)
- SHA256Transform(H, (uint8_t *)buf + i);
- - for (i = 0; i < padsize; i++)
- - pad[i] = ((uint8_t *)buf)[i];
- + for (padsize = 0; i < size; i++)
- + pad[padsize++] = *((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 = 56; i >= 0; i -= 8)
- + pad[padsize++] = (size << 3) >> i;
- for (i = 0; i < padsize; i += 64)
- SHA256Transform(H, pad + i);
- Index: sys/cddl/boot/zfs/zfsimpl.h
- ===================================================================
- --- sys/cddl/boot/zfs/zfsimpl.h (revision 185164)
- +++ sys/cddl/boot/zfs/zfsimpl.h (working copy)
- @@ -49,7 +49,7 @@
- * CDDL HEADER END
- */
- /*
- - * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- + * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
- @@ -461,13 +461,14 @@
- #define SPA_VERSION_11 11ULL
- #define SPA_VERSION_12 12ULL
- #define SPA_VERSION_13 13ULL
- +#define SPA_VERSION_14 14ULL
- /*
- * When bumping up SPA_VERSION, make sure GRUB ZFS understand the on-disk
- * format change. Go to usr/src/grub/grub-0.95/stage2/{zfs-include/, fsys_zfs*},
- * and do the appropriate changes.
- */
- -#define SPA_VERSION SPA_VERSION_13
- -#define SPA_VERSION_STRING "13"
- +#define SPA_VERSION SPA_VERSION_14
- +#define SPA_VERSION_STRING "14"
- /*
- * Symbolic names for the changes that caused a SPA_VERSION switch.
- @@ -502,8 +503,29 @@
- #define SPA_VERSION_DSL_SCRUB SPA_VERSION_11
- #define SPA_VERSION_SNAP_PROPS SPA_VERSION_12
- #define SPA_VERSION_USED_BREAKDOWN SPA_VERSION_13
- +#define SPA_VERSION_PASSTHROUGH_X SPA_VERSION_14
- /*
- + * ZPL version - rev'd whenever an incompatible on-disk format change
- + * occurs. This is independent of SPA/DMU/ZAP versioning. You must
- + * also update the version_table[] and help message in zfs_prop.c.
- + *
- + * When changing, be sure to teach GRUB how to read the new format!
- + * See usr/src/grub/grub-0.95/stage2/{zfs-include/,fsys_zfs*}
- + */
- +#define ZPL_VERSION_1 1ULL
- +#define ZPL_VERSION_2 2ULL
- +#define ZPL_VERSION_3 3ULL
- +#define ZPL_VERSION ZPL_VERSION_3
- +#define ZPL_VERSION_STRING "3"
- +
- +#define ZPL_VERSION_INITIAL ZPL_VERSION_1
- +#define ZPL_VERSION_DIRENT_TYPE ZPL_VERSION_2
- +#define ZPL_VERSION_FUID ZPL_VERSION_3
- +#define ZPL_VERSION_NORMALIZATION ZPL_VERSION_3
- +#define ZPL_VERSION_SYSATTR ZPL_VERSION_3
- +
- +/*
- * The following are configuration names used in the nvlist describing a pool's
- * configuration.
- */
- @@ -528,7 +550,6 @@
- #define ZPOOL_CONFIG_DTL "DTL"
- #define ZPOOL_CONFIG_STATS "stats"
- #define ZPOOL_CONFIG_WHOLE_DISK "whole_disk"
- -#define ZPOOL_CONFIG_OFFLINE "offline"
- #define ZPOOL_CONFIG_ERRCOUNT "error_count"
- #define ZPOOL_CONFIG_NOT_PRESENT "not_present"
- #define ZPOOL_CONFIG_SPARES "spares"
- @@ -536,7 +557,22 @@
- #define ZPOOL_CONFIG_NPARITY "nparity"
- #define ZPOOL_CONFIG_HOSTID "hostid"
- #define ZPOOL_CONFIG_HOSTNAME "hostname"
- -#define ZPOOL_CONFIG_TIMESTAMP "timestamp" /* not stored on disk */
- +#define ZPOOL_CONFIG_UNSPARE "unspare"
- +#define ZPOOL_CONFIG_PHYS_PATH "phys_path"
- +#define ZPOOL_CONFIG_IS_LOG "is_log"
- +#define ZPOOL_CONFIG_L2CACHE "l2cache"
- +#define ZPOOL_CONFIG_SUSPENDED "suspended" /* not stored on disk */
- +#define ZPOOL_CONFIG_TIMESTAMP "timestamp" /* not stored on disk */
- +#define ZPOOL_CONFIG_BOOTFS "bootfs" /* not stored on disk */
- +/*
- + * The persistent vdev state is stored as separate values rather than a single
- + * 'vdev_state' entry. This is because a device can be in multiple states, such
- + * as offline and degraded.
- + */
- +#define ZPOOL_CONFIG_OFFLINE "offline"
- +#define ZPOOL_CONFIG_FAULTED "faulted"
- +#define ZPOOL_CONFIG_DEGRADED "degraded"
- +#define ZPOOL_CONFIG_REMOVED "removed"
- #define VDEV_TYPE_ROOT "root"
- #define VDEV_TYPE_MIRROR "mirror"
- @@ -546,6 +582,8 @@
- #define VDEV_TYPE_FILE "file"
- #define VDEV_TYPE_MISSING "missing"
- #define VDEV_TYPE_SPARE "spare"
- +#define VDEV_TYPE_LOG "log"
- +#define VDEV_TYPE_L2CACHE "l2cache"
- /*
- * This is needed in userland to report the minimum necessary device size.
- @@ -556,12 +594,8 @@
- * The location of the pool configuration repository, shared between kernel and
- * userland.
- */
- -#define ZPOOL_CACHE_DIR "/boot/zfs"
- -#define ZPOOL_CACHE_FILE "zpool.cache"
- -#define ZPOOL_CACHE_TMP ".zpool.cache"
- +#define ZPOOL_CACHE "/boot/zfs/zpool.cache"
- -#define ZPOOL_CACHE ZPOOL_CACHE_DIR "/" ZPOOL_CACHE_FILE
- -
- /*
- * vdev states are ordered from least to most healthy.
- * A vdev that's CANT_OPEN or below is considered unusable.
- @@ -570,11 +604,15 @@
- VDEV_STATE_UNKNOWN = 0, /* Uninitialized vdev */
- VDEV_STATE_CLOSED, /* Not currently open */
- VDEV_STATE_OFFLINE, /* Not allowed to open */
- + VDEV_STATE_REMOVED, /* Explicitly removed from system */
- VDEV_STATE_CANT_OPEN, /* Tried to open, but failed */
- + VDEV_STATE_FAULTED, /* External request to fault device */
- VDEV_STATE_DEGRADED, /* Replicated vdev with unhealthy kids */
- VDEV_STATE_HEALTHY /* Presumed good */
- } vdev_state_t;
- +#define VDEV_STATE_ONLINE VDEV_STATE_HEALTHY
- +
- /*
- * vdev aux states. When a vdev is in the CANT_OPEN state, the aux field
- * of the vdev stats structure uses these constants to distinguish why.
- @@ -589,19 +627,24 @@
- VDEV_AUX_BAD_LABEL, /* the label is OK but invalid */
- VDEV_AUX_VERSION_NEWER, /* on-disk version is too new */
- VDEV_AUX_VERSION_OLDER, /* on-disk version is too old */
- - VDEV_AUX_SPARED /* hot spare used in another pool */
- + VDEV_AUX_SPARED, /* hot spare used in another pool */
- + VDEV_AUX_ERR_EXCEEDED, /* too many errors */
- + VDEV_AUX_IO_FAILURE, /* experienced I/O failure */
- + VDEV_AUX_BAD_LOG /* cannot read log chain(s) */
- } vdev_aux_t;
- /*
- * pool state. The following states are written to disk as part of the normal
- - * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE. The remaining states are
- - * software abstractions used at various levels to communicate pool state.
- + * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE. The remaining
- + * states are software abstractions used at various levels to communicate
- + * pool state.
- */
- typedef enum pool_state {
- POOL_STATE_ACTIVE = 0, /* In active use */
- POOL_STATE_EXPORTED, /* Explicitly exported */
- POOL_STATE_DESTROYED, /* Explicitly destroyed */
- POOL_STATE_SPARE, /* Reserved for hot spare use */
- + POOL_STATE_L2CACHE, /* Level 2 ARC device */
- POOL_STATE_UNINITIALIZED, /* Internal spa_t state */
- POOL_STATE_UNAVAIL, /* Internal libzfs state */
- POOL_STATE_POTENTIALLY_ACTIVE /* Internal libzfs state */
- @@ -1068,13 +1111,6 @@
- #define ZFS_FLAG_NOGROWBLOCKS 0x2
- /*
- - * ZPL version - rev'd whenever an incompatible on-disk format change
- - * occurs. Independent of SPA/DMU/ZAP versioning.
- - */
- -
- -#define ZPL_VERSION 1ULL
- -
- -/*
- * The directory entry has the type (currently unused on Solaris) in the
- * top 4 bits, and the object number in the low 48 bits. The "middle"
- * 12 bits are unused.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement