--- old/usr/src/cmd/ztest/ztest.c Tue Feb 3 13:17:22 2009 +++ new/usr/src/cmd/ztest/ztest.c Tue Feb 3 13:17:22 2009 @@ -87,6 +87,7 @@ #include #include #include +#include #include #include #include @@ -698,6 +699,12 @@ return ((uint8_t)ztest_random(ZIO_COMPRESS_FUNCTIONS)); } +static uint8_t +ztest_random_crypt(void) +{ + return ((uint8_t)ztest_random(ZIO_CRYPT_FUNCTIONS)); +} + static int ztest_replay_create(objset_t *os, lr_create_t *lr, boolean_t byteswap) { @@ -1547,6 +1554,8 @@ ztest_random_checksum(), tx); dmu_object_set_compress(os, batchobj, ztest_random_compress(), tx); + dmu_object_set_crypt(os, batchobj, + ztest_random_crypt(), tx); dmu_write(os, batchobj, b * sizeof (uint64_t), sizeof (uint64_t), &object, tx); @@ -1608,6 +1617,8 @@ ztest_random_checksum(), tx); dmu_object_set_compress(os, object, ztest_random_compress(), tx); + dmu_object_set_crypt(os, object, + ztest_random_crypt(), tx); dmu_write(os, batchobj, b * sizeof (uint64_t), sizeof (uint64_t), &object, tx); @@ -2448,15 +2459,19 @@ dmu_objset_name(os, osname); - for (i = 0; i < 2; i++) { + for (i = 0; i < 3; i++) { if (i == 0) { prop = "checksum"; value = ztest_random_checksum(); inherit = (value == ZIO_CHECKSUM_INHERIT); - } else { + } else if (i == 1) { prop = "compression"; value = ztest_random_compress(); inherit = (value == ZIO_COMPRESS_INHERIT); + } else { + prop = "crypt"; + value = ztest_random_crypt(); + inherit = (value == ZIO_CRYPT_INHERIT); } error = dsl_prop_set(osname, prop, sizeof (value), @@ -2472,11 +2487,15 @@ VERIFY3U(dsl_prop_get(osname, prop, sizeof (value), 1, &value, setpoint), ==, 0); - if (i == 0) + if (i == 0) { valname = zio_checksum_table[value].ci_name; - else + } else if (i == 1) { valname = zio_compress_table[value].ci_name; + } else { + valname = zio_crypt_table[value].ci_name; + } + if (zopt_verbose >= 6) { (void) printf("%s %s = %s for '%s'\n", osname, prop, valname, setpoint);