void test_unmap_0blocks(void) { int i; int max_nr_bdc = 256; struct unmap_list list[257]; CHECK_FOR_DATALOSS; CHECK_FOR_THIN_PROVISIONING; CHECK_FOR_SBC; logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test UNMAP of 0 blocks at LBA:0-255 as a single descriptor"); for (i = 0; i < 256; i++) { list[0].lba = i; list[0].num = 0; UNMAP(sd, 0, list, 1, EXPECT_STATUS_GOOD); } logging(LOG_VERBOSE, "Test UNMAP of 0 blocks at end-of-LUN"); list[0].lba = num_blocks; list[0].num = 0; UNMAP(sd, 0, list, 1, EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Test UNMAP without any descriptors."); UNMAP(sd, 0, list, 0, EXPECT_STATUS_GOOD); if (inq_bl->max_unmap_bdc <= 1) { CU_PASS("[SKIPPING] Test UNMAP of 0 blocks with multiple descriptos not supported"); return; } if (inq_bl->max_unmap_bdc > 0 && max_nr_bdc > (int)inq_bl->max_unmap_bdc) { max_nr_bdc = (int)inq_bl->max_unmap_bdc; } logging(LOG_VERBOSE, "Test UNMAP of 0 blocks at LBA:0-%d with one descriptor per block", max_nr_bdc - 1); for (i = 0; i < max_nr_bdc; i++) { list[i].lba = i; list[i].num = 0; UNMAP(sd, 0, list, i + 1, EXPECT_STATUS_GOOD); } logging(LOG_VERBOSE, "Test UNMAP of 0 blocks at LBA:0-%d with one descriptor per block, possibly \"overlapping\".", max_nr_bdc - 1); for (i = 0; i < max_nr_bdc; i++) { list[i].lba = i/2; list[i].num = 0; } UNMAP(sd, 0, list, max_nr_bdc, EXPECT_STATUS_GOOD); }
/*--------------------------------------------------------------------- * uvLLab_gFun -- grid-table functions *--------------------------------------------------------------------- */ double uvLLab_gFun (double_p dP, fut_calcData_p dataP) { double u = dP[0], v = dP[1], l = dP[2]; double x, y, z, p, delta, a, astar, bstar; /* Decode piecewise linear functions of u and v: */ delta = u - UGRID0; a = (delta > 0.0) ? ((auxData_p)dataP)->uvLLabC.bu1 : ((auxData_p)dataP)->uvLLabC.bu0; delta = UNMAP (delta, a); u = U0 + delta; delta = v - VGRID0; a = (delta > 0.0) ? ((auxData_p)dataP)->uvLLabC.bv1 : ((auxData_p)dataP)->uvLLabC.bv0; delta = UNMAP (delta, a); v = V0 + delta; u = 0.070 + 0.40996784565916 * u; /* CIE 1976 u' */ v = 0.165 + 0.41986827661910 * v; /* CIE 1976 v' */ /* Compute CIE 1931 tristimulus values: */ y = Hinverse (l, &(((auxData_p)dataP)->lc)); /* CIE 1931 Y */ y = (254.0 * y + 1.0) / 255.0; /* recompress for Prophecy */ x = 2.25 * (u / v) * y; /* CIE 1931 X */ z = ((3.0 - 0.75 * u) / v - 5.0) * y; /* CIE 1931 Z */ /* Scale to white point: */ x /= XWHITE; y /= YWHITE; z /= ZWHITE; /* Convert to CIELAB: */ astar = (Hfunc (x, &(((auxData_p)dataP)->lc)) - Hfunc (y, &(((auxData_p)dataP)->lc))) / 0.00232; /* CIE 1976 a* */ bstar = (Hfunc (y, &(((auxData_p)dataP)->lc)) - Hfunc (z, &(((auxData_p)dataP)->lc))) / 0.00580; /* CIE 1976 b* */ /* Encode CIELAB for L* in [0, 100] and a* & b* in [-200, 200]: */ switch (dataP->chan) { case 0: /* (L*)/100 */ p = Hfunc (y, &(((auxData_p)dataP)->lc)); break; case 1: /* ~ 1/2 + (a*)/400 */ p = MID12BIT + 0.0025 * astar; break; case 2: /* ~ 1/2 + (b*)/400 */ p = MID12BIT + 0.0025 * bstar; break; default: p = 6.023e+23; /* Avogadro's number */ break; } return RESTRICT (p, 0.0, 1.0); }
static void test_unmap(void) { struct unmap_list list[1]; logging(LOG_VERBOSE, "Test UNMAP of one physical block fails with " "WRITE_PROTECTED"); list[0].lba = 0; list[0].num = lbppb; UNMAP(sd, 0, list, 1, EXPECT_WRITE_PROTECTED); logging(LOG_VERBOSE, "Test UNMAP of one logical block fails with " "WRITE_PROTECTED"); list[0].lba = 0; list[0].num = 1; UNMAP(sd, 0, list, 1, EXPECT_WRITE_PROTECTED); }