buf2_sum = fill_rand(buf2_ptr, buf2_size);
buf3_sum = fill_rand(buf3_ptr, buf3_size);
- raw_xfer(driver_minor, ((u64_t)(0)), iov, 3, FALSE,
+ raw_xfer(driver_minor, 0ULL, iov, 3, FALSE,
buf_size + buf2_size + buf3_size, &res);
test_sum(buf_ptr, buf_size, buf_sum, FALSE, &res);
buf2_sum = fill_rand(buf2_ptr, buf2_size);
buf3_sum = fill_rand(buf3_ptr, buf3_size);
- raw_xfer(driver_minor, ((u64_t)(0)), iov, 3, FALSE, EINVAL, &res);
+ raw_xfer(driver_minor, 0ULL, iov, 3, FALSE, EINVAL, &res);
test_sum(buf_ptr, buf_size, buf_sum, TRUE, &res);
test_sum(buf2_ptr, buf2_size, buf2_sum, TRUE, &res);
memcpy(iov, iovt, sizeof(iovt));
iov[1].iov_size = (vir_bytes) LONG_MAX + 1;
- raw_xfer(driver_minor, ((u64_t)(0)), iov, 3, FALSE, EINVAL, &res);
+ raw_xfer(driver_minor, 0ULL, iov, 3, FALSE, EINVAL, &res);
test_sum(buf_ptr, buf_size, buf_sum, TRUE, &res);
test_sum(buf2_ptr, buf2_size, buf2_sum, TRUE, &res);
iov[0].iov_size = LONG_MAX / 2 - 1;
iov[1].iov_size = LONG_MAX / 2 - 1;
- raw_xfer(driver_minor, ((u64_t)(0)), iov, 3, FALSE, EINVAL, &res);
+ raw_xfer(driver_minor, 0ULL, iov, 3, FALSE, EINVAL, &res);
test_sum(buf_ptr, buf_size, buf_sum, TRUE, &res);
test_sum(buf2_ptr, buf2_size, buf2_sum, TRUE, &res);
iov[0].iov_size = LONG_MAX - 1;
iov[1].iov_size = LONG_MAX - 1;
- raw_xfer(driver_minor, ((u64_t)(0)), iov, 3, FALSE, EINVAL, &res);
+ raw_xfer(driver_minor, 0ULL, iov, 3, FALSE, EINVAL, &res);
test_sum(buf_ptr, buf_size, buf_sum, TRUE, &res);
test_sum(buf2_ptr, buf2_size, buf2_sum, TRUE, &res);
buf3_sum = fill_rand(buf3_ptr, buf3_size);
c1 = buf2_ptr[buf2_size - 1];
- raw_xfer(driver_minor, ((u64_t)(0)), iov, 3, FALSE, BUF_SIZE * 3 - 1,
+ raw_xfer(driver_minor, 0ULL, iov, 3, FALSE, BUF_SIZE * 3 - 1,
&res);
if (accept_result(&res, RESULT_BADSTATUS, EINVAL)) {
buf2_sum = fill_rand(buf2_ptr, buf2_size);
buf3_sum = fill_rand(buf3_ptr, buf3_size);
- raw_xfer(driver_minor, ((u64_t)(0)), iov, 3, FALSE, EINVAL, &res);
+ raw_xfer(driver_minor, 0ULL, iov, 3, FALSE, EINVAL, &res);
/* Do not test the first buffer, as it may contain a partial result. */
test_sum(buf2_ptr, buf2_size, buf2_sum, TRUE, &res);
buf2_sum = fill_rand(buf2_ptr, buf2_size);
buf3_sum = fill_rand(buf3_ptr, buf3_size);
- raw_xfer(driver_minor, ((u64_t)(0)), iov, 3, FALSE, EINVAL, &res);
+ raw_xfer(driver_minor, 0ULL, iov, 3, FALSE, EINVAL, &res);
accept_result(&res, RESULT_BADSTATUS, EPERM);
buf2_sum = fill_rand(buf2_ptr, buf2_size);
buf3_sum = fill_rand(buf3_ptr, buf3_size);
- raw_xfer(driver_minor, ((u64_t)(0)), iov, 3, FALSE, EINVAL, &res);
+ raw_xfer(driver_minor, 0ULL, iov, 3, FALSE, EINVAL, &res);
accept_result(&res, RESULT_BADSTATUS, EPERM);
c1 = buf2_ptr[0];
c2 = buf2_ptr[buf2_size - 1];
- raw_xfer(driver_minor, ((u64_t)(0)), iov, 3, FALSE, BUF_SIZE * 3 - 2,
- &res);
+ raw_xfer(driver_minor, 0ULL, iov, 3, FALSE, BUF_SIZE * 3 - 2, &res);
if (accept_result(&res, RESULT_BADSTATUS, EINVAL)) {
/* Do not test the first buffer, as it may contain a partial
buf2_sum = fill_rand(buf2_ptr, buf2_size);
buf3_sum = fill_rand(buf3_ptr, buf3_size);
- raw_xfer(driver_minor, ((u64_t)(1)), iov, 3, FALSE, EINVAL, &res);
+ raw_xfer(driver_minor, 1ULL, iov, 3, FALSE, EINVAL, &res);
test_sum(buf_ptr, buf_size, buf_sum, TRUE, &res);
test_sum(buf2_ptr, buf2_size, buf2_sum, TRUE, &res);
buf2_sum = fill_rand(buf2_ptr, buf2_size);
buf3_sum = fill_rand(buf3_ptr, buf3_size);
- raw_xfer(driver_minor, ((u64_t)(0)), iov, 3, FALSE,
+ raw_xfer(driver_minor, 0ULL, iov, 3, FALSE,
buf_size + buf2_size + buf3_size, &res);
test_sum(buf_ptr, buf_size, buf_sum, FALSE, &res);
free_buf_and_grant(buf_ptr, buf_grant, buf_size);
}
-#define SECTOR_UNALIGN 2 /* word-aligned and sector-unaligned */
+#define SECTOR_UNALIGN 2ULL /* word-aligned and sector-unaligned */
static void bad_write(void)
{
buf2_sum = fill_rand(buf2_ptr, buf2_size);
buf3_sum = fill_rand(buf3_ptr, buf3_size);
- raw_xfer(driver_minor, ((u64_t)(SECTOR_UNALIGN)), iov, 3, TRUE, EINVAL,
- &res);
+ raw_xfer(driver_minor, SECTOR_UNALIGN, iov, 3, TRUE, EINVAL, &res);
test_sum(buf_ptr, buf_size, buf_sum, TRUE, &res);
test_sum(buf2_ptr, buf2_size, buf2_sum, TRUE, &res);
buf2_sum = fill_rand(buf2_ptr, buf2_size);
buf3_sum = fill_rand(buf3_ptr, buf3_size);
- raw_xfer(driver_minor, ((u64_t)(0)), iov, 3, TRUE, EINVAL, &res);
+ raw_xfer(driver_minor, 0ULL, iov, 3, TRUE, EINVAL, &res);
test_sum(buf_ptr, buf_size, buf_sum, TRUE, &res);
test_sum(buf2_ptr, buf2_size, buf2_sum, TRUE, &res);
buf2_sum = fill_rand(buf2_ptr, buf2_size);
buf3_sum = fill_rand(buf3_ptr, buf3_size);
- raw_xfer(driver_minor, ((u64_t)(0)), iov, 3, TRUE, EINVAL, &res);
+ raw_xfer(driver_minor, 0ULL, iov, 3, TRUE, EINVAL, &res);
accept_result(&res, RESULT_BADSTATUS, EPERM);
result_t res;
int i;
- base_pos = ((u64_t)(sector_size));
+ base_pos = (u64_t)sector_size;
large_size = small_size * NR_IOREQS;
got_result(&res, "ioctl to get partition");
/* The other tests do not check whether there is sufficient room. */
- if (res.type == RESULT_OK && cmp64u(part.size, max_size * 2) < 0)
+ if (res.type == RESULT_OK && part.size < (u64_t)max_size * 2)
printf("WARNING: small partition, some tests may fail\n");
/* Test retrieving global driver open count. */
/* Read one sector up to the partition limit. */
fill_rand(buf_ptr, buf_size);
- simple_xfer(sub0_minor, ((u64_t)(sub_size - sector_size)), buf_ptr,
+ simple_xfer(sub0_minor, (u64_t)sub_size - sector_size, buf_ptr,
sector_size, FALSE, sector_size, &res);
sum = get_sum(buf_ptr, sector_size);
/* Read three sectors up to the partition limit. */
fill_rand(buf_ptr, buf_size);
- simple_xfer(sub0_minor, ((u64_t)(sub_size - buf_size)), buf_ptr, buf_size,
+ simple_xfer(sub0_minor, (u64_t)sub_size - buf_size, buf_ptr, buf_size,
FALSE, buf_size, &res);
test_sum(buf_ptr + sector_size * 2, sector_size, sum, TRUE, &res);
fill_rand(buf_ptr, buf_size);
sum3 = get_sum(buf_ptr + sector_size * 2, sector_size);
- simple_xfer(sub0_minor, ((u64_t)(sub_size - sector_size * 2)), buf_ptr,
+ simple_xfer(sub0_minor, (u64_t)sub_size - sector_size * 2, buf_ptr,
buf_size, FALSE, sector_size * 2, &res);
test_sum(buf_ptr, sector_size * 2, sum2, TRUE, &res);
fill_rand(buf_ptr, buf_size);
sum2 = get_sum(buf_ptr + sector_size, sector_size * 2);
- simple_xfer(sub0_minor, ((u64_t)(sub_size - sector_size)), buf_ptr,
+ simple_xfer(sub0_minor, (u64_t)sub_size - sector_size, buf_ptr,
buf_size, FALSE, sector_size, &res);
test_sum(buf_ptr, sector_size, sum, TRUE, &res);
sum = fill_rand(buf_ptr, buf_size);
sum2 = get_sum(buf_ptr, sector_size);
- simple_xfer(sub0_minor, ((u64_t)(sub_size)), buf_ptr, sector_size, FALSE,
+ simple_xfer(sub0_minor, (u64_t)sub_size, buf_ptr, sector_size, FALSE,
0, &res);
test_sum(buf_ptr, sector_size, sum2, TRUE, &res);
got_result(&res, "one sector read at partition end");
/* Read three sectors starting at the partition end. */
- simple_xfer(sub0_minor, ((u64_t)(sub_size)), buf_ptr, buf_size, FALSE, 0,
+ simple_xfer(sub0_minor, (u64_t)sub_size, buf_ptr, buf_size, FALSE, 0,
&res);
test_sum(buf_ptr, buf_size, sum, TRUE, &res);
got_result(&res, "multisector read at partition end");
/* Read one sector beyond the partition end. */
- simple_xfer(sub0_minor, ((u64_t)(sub_size + sector_size)), buf_ptr,
+ simple_xfer(sub0_minor, (u64_t)sub_size + sector_size, buf_ptr,
buf_size, FALSE, 0, &res);
test_sum(buf_ptr, sector_size, sum2, TRUE, &res);
got_result(&res, "single sector read beyond partition end");
/* Read three sectors way beyond the partition end. */
- simple_xfer(sub0_minor, make64(0L, 0x10000000L), buf_ptr,
- buf_size, FALSE, 0, &res);
+ simple_xfer(sub0_minor, 0x1000000000000000ULL, buf_ptr, buf_size,
+ FALSE, 0, &res);
test_sum(buf_ptr, buf_size, sum, TRUE, &res);
* more or less a bad requests test, but we cannot do it without
* setting up subpartitions first.
*/
- simple_xfer(sub1_minor, make64(0xffffffffL - sector_size + 1,
- 0xffffffffL), buf_ptr, sector_size, FALSE, 0, &res);
+ simple_xfer(sub1_minor, 0xffffffffffffffffULL - sector_size + 1,
+ buf_ptr, sector_size, FALSE, 0, &res);
test_sum(buf_ptr, sector_size, sum2, TRUE, &res);
*/
sub1_sum = fill_rand(buf_ptr, buf_size);
- simple_xfer(sub1_minor, ((u64_t)(0)), buf_ptr, buf_size, TRUE, buf_size,
- &res);
+ simple_xfer(sub1_minor, 0ULL, buf_ptr, buf_size, TRUE, buf_size, &res);
got_result(&res, "write to second subpartition");
/* Write one sector, up to the partition limit. */
sum = fill_rand(buf_ptr, sector_size);
- simple_xfer(sub0_minor, ((u64_t)(sub_size - sector_size)), buf_ptr,
+ simple_xfer(sub0_minor, (u64_t)sub_size - sector_size, buf_ptr,
sector_size, TRUE, sector_size, &res);
got_result(&res, "write up to partition end");
/* Read back to make sure the results have persisted. */
fill_rand(buf_ptr, sector_size * 2);
- simple_xfer(sub0_minor, ((u64_t)(sub_size - sector_size * 2)), buf_ptr,
+ simple_xfer(sub0_minor, (u64_t)sub_size - sector_size * 2, buf_ptr,
sector_size * 2, FALSE, sector_size * 2, &res);
test_sum(buf_ptr + sector_size, sector_size, sum, TRUE, &res);
sum = get_sum(buf_ptr + sector_size, sector_size);
sum3 = get_sum(buf_ptr, sector_size);
- simple_xfer(sub0_minor, ((u64_t)(sub_size - sector_size * 2)), buf_ptr,
+ simple_xfer(sub0_minor, (u64_t)sub_size - sector_size * 2, buf_ptr,
buf_size, TRUE, sector_size * 2, &res);
got_result(&res, "write somewhat across partition end");
fill_rand(buf_ptr, buf_size);
sum2 = get_sum(buf_ptr + sector_size, sector_size * 2);
- simple_xfer(sub0_minor, ((u64_t)(sub_size - sector_size)), buf_ptr,
+ simple_xfer(sub0_minor, (u64_t)sub_size - sector_size, buf_ptr,
buf_size, FALSE, sector_size, &res);
test_sum(buf_ptr, sector_size, sum, TRUE, &res);
fill_rand(buf_ptr, buf_size);
sum = get_sum(buf_ptr, sector_size);
- simple_xfer(sub0_minor, ((u64_t)(sub_size - sector_size)), buf_ptr,
+ simple_xfer(sub0_minor, (u64_t)sub_size - sector_size, buf_ptr,
buf_size, TRUE, sector_size, &res);
got_result(&res, "write mostly across partition end");
fill_rand(buf_ptr, buf_size);
sum2 = get_sum(buf_ptr + sector_size * 2, sector_size);
- simple_xfer(sub0_minor, ((u64_t)(sub_size - sector_size * 2)), buf_ptr,
+ simple_xfer(sub0_minor, (u64_t)sub_size - sector_size * 2, buf_ptr,
buf_size, FALSE, sector_size * 2, &res);
test_sum(buf_ptr, sector_size, sum3, TRUE, &res);
/* Write one sector at the end of the partition. */
fill_rand(buf_ptr, sector_size);
- simple_xfer(sub0_minor, ((u64_t)(sub_size)), buf_ptr, sector_size, TRUE, 0,
+ simple_xfer(sub0_minor, (u64_t)sub_size, buf_ptr, sector_size, TRUE, 0,
&res);
got_result(&res, "write at partition end");
/* Write one sector beyond the end of the partition. */
- simple_xfer(sub0_minor, ((u64_t)(sub_size + sector_size)), buf_ptr,
+ simple_xfer(sub0_minor, (u64_t)sub_size + sector_size, buf_ptr,
sector_size, TRUE, 0, &res);
got_result(&res, "write beyond partition end");
*/
fill_rand(buf_ptr, buf_size);
- simple_xfer(sub1_minor, ((u64_t)(0)), buf_ptr, buf_size, FALSE, buf_size,
+ simple_xfer(sub1_minor, 0ULL, buf_ptr, buf_size, FALSE, buf_size,
&res);
test_sum(buf_ptr, buf_size, sub1_sum, TRUE, &res);
/* Test offset wrapping, but this time for writes. */
fill_rand(buf_ptr, sector_size);
- simple_xfer(sub1_minor, make64(0xffffffffL - sector_size + 1,
- 0xffffffffL), buf_ptr, sector_size, TRUE, 0, &res);
+ simple_xfer(sub1_minor, 0xffffffffffffffffULL - sector_size + 1,
+ buf_ptr, sector_size, TRUE, 0, &res);
got_result(&res, "write with negative offset");
/* If the last request erroneously succeeded, it would have overwritten
* the last sector of the first subpartition.
*/
- simple_xfer(sub0_minor, ((u64_t)(sub_size - sector_size)), buf_ptr,
+ simple_xfer(sub0_minor, (u64_t)sub_size - sector_size, buf_ptr,
sector_size, FALSE, sector_size, &res);
test_sum(buf_ptr, sector_size, sum, TRUE, &res);
/* Set, and check, the size of the first subpartition. */
subpart = part;
- subpart.size = ((u64_t)(sub_size));
+ subpart.size = (u64_t)sub_size;
vir_ioctl(sub0_minor, DIOCSETP, &subpart, OK, &res);
vir_ioctl(sub0_minor, DIOCGETP, &subpart2, OK, &res);
- if (res.type == RESULT_OK && (cmp64(subpart.base, subpart2.base) ||
- cmp64(subpart.size, subpart2.size))) {
+ if (res.type == RESULT_OK && (subpart.base != subpart2.base ||
+ subpart.size != subpart2.size)) {
res.type = RESULT_BADVALUE;
res.value = 0;
}
/* Set, and check, the base and size of the second subpartition. */
subpart = part;
- subpart.base = add64u(subpart.base, sub_size);
- subpart.size = ((u64_t)(sub_size));
+ subpart.base += sub_size;
+ subpart.size = (u64_t)sub_size;
vir_ioctl(sub1_minor, DIOCSETP, &subpart, OK, &res);
vir_ioctl(sub1_minor, DIOCGETP, &subpart2, OK, &res);
- if (res.type == RESULT_OK && (cmp64(subpart.base, subpart2.base) ||
- cmp64(subpart.size, subpart2.size))) {
+ if (res.type == RESULT_OK && (subpart.base != subpart2.base ||
+ subpart.size != subpart2.size)) {
res.type = RESULT_BADVALUE;
res.value = 0;
}
memset(buf_ptr, 0, buf_size);
/* Write an invalid partition table. */
- simple_xfer(driver_minor, ((u64_t)(0)), buf_ptr, buf_size, TRUE, buf_size,
+ simple_xfer(driver_minor, 0ULL, buf_ptr, buf_size, TRUE, buf_size,
&res);
got_result(&res, "write of invalid partition table");
vir_ioctl(sub0_minor, DIOCGETP, &subpart, 0, &res);
- if (res.type == RESULT_OK && cmp64u(subpart.size, 0)) {
+ if (res.type == RESULT_OK && subpart.size != 0) {
res.type = RESULT_BADVALUE;
res.value = ex64lo(subpart.size);
}
vir_ioctl(sub1_minor, DIOCGETP, &subpart, 0, &res);
- if (res.type == RESULT_OK && cmp64u(subpart.size, 0)) {
+ if (res.type == RESULT_OK && subpart.size != 0) {
res.type = RESULT_BADVALUE;
res.value = ex64lo(subpart.size);
}
entry = (struct part_entry *) &buf_ptr[PART_TABLE_OFF];
entry[0].sysind = MINIX_PART;
- entry[0].lowsec = div64u(part.base, sector_size) + 1;
+ entry[0].lowsec = part.base / sector_size + 1;
entry[0].size = part_secs;
entry[1].sysind = MINIX_PART;
entry[1].lowsec = entry[0].lowsec + entry[0].size;
buf_ptr[510] = 0x55;
buf_ptr[511] = 0xAA;
- simple_xfer(driver_minor, ((u64_t)(0)), buf_ptr, buf_size, TRUE, buf_size,
+ simple_xfer(driver_minor, 0ULL, buf_ptr, buf_size, TRUE, buf_size,
&res);
got_result(&res, "write of valid partition table");
vir_ioctl(sub0_minor, DIOCGETP, &subpart, 0, &res);
- if (res.type == RESULT_OK && (cmp64(subpart.base,
- add64u(part.base, sector_size)) ||
- cmp64u(subpart.size, part_secs * sector_size))) {
+ if (res.type == RESULT_OK &&
+ (subpart.base != part.base + sector_size ||
+ subpart.size != (u64_t)part_secs * sector_size)) {
res.type = RESULT_BADVALUE;
res.value = 0;
vir_ioctl(sub1_minor, DIOCGETP, &subpart, 0, &res);
- if (res.type == RESULT_OK && (cmp64(subpart.base,
- add64u(part.base, (1 + part_secs) * sector_size)) ||
- cmp64u(subpart.size, part_secs * sector_size))) {
+ if (res.type == RESULT_OK &&
+ (subpart.base != part.base + (1 + part_secs) * sector_size ||
+ subpart.size != (u64_t)part_secs * sector_size)) {
res.type = RESULT_BADVALUE;
res.value = 0;
size_t total_size;
int i, nr_req;
- base_pos = add64u(base_pos, sector_size);
+ base_pos += sector_size;
total_size = sector_size * sectors;
/* If the limit is two elements per sector, we cannot test three
*/
buf_size = sector_size * 5;
- base_pos = ((u64_t)(sector_size * 2));
+ base_pos = (u64_t)sector_size * 2;
if ((buf_ptr = alloc_contig(buf_size, 0, NULL)) == NULL)
panic("unable to allocate memory");
*/
buf_size = buf2_size = sector_size * 3;
- base_pos = ((u64_t)(sector_size * 3));
+ base_pos = (u64_t)sector_size * 3;
if ((buf_ptr = alloc_contig(buf_size, 0, NULL)) == NULL)
panic("unable to allocate memory");
fill_rand(buf2_ptr, sector_size);
sum = get_sum(buf2_ptr + min_read, sector_size - min_read);
- simple_xfer(driver_minor, add64u(base_pos, sector_size - min_read),
+ simple_xfer(driver_minor, base_pos + sector_size - min_read,
buf2_ptr, min_read, FALSE, min_read, &res);
test_sum(buf2_ptr, min_read, get_sum(buf_ptr + sector_size - min_read,
sum = get_sum(buf2_ptr, min_read);
sum2 = get_sum(buf2_ptr + min_read * 2, sector_size - min_read * 2);
- simple_xfer(driver_minor, add64u(base_pos, min_read),
- buf2_ptr + min_read, min_read, FALSE, min_read, &res);
+ simple_xfer(driver_minor, base_pos + min_read, buf2_ptr + min_read,
+ min_read, FALSE, min_read, &res);
test_sum(buf2_ptr + min_read, min_read, get_sum(buf_ptr + min_read,
min_read), TRUE, &res);
fill_rand(buf2_ptr, buf2_size);
sum = get_sum(buf2_ptr + size, buf2_size - size);
- simple_xfer(driver_minor, add64u(base_pos, sector_size - min_read),
- buf2_ptr, size, FALSE, size, &res);
+ simple_xfer(driver_minor, base_pos + sector_size - min_read, buf2_ptr,
+ size, FALSE, size, &res);
test_sum(buf2_ptr, size, get_sum(buf_ptr + sector_size - min_read,
size), TRUE, &res);
fill_rand(buf2_ptr, buf2_size);
sum = get_sum(buf2_ptr + sector_size, buf2_size - sector_size);
- simple_xfer(driver_minor, add64u(base_pos, min_read), buf2_ptr,
- sector_size, FALSE, sector_size, &res);
+ simple_xfer(driver_minor, base_pos + min_read, buf2_ptr, sector_size,
+ FALSE, sector_size, &res);
test_sum(buf2_ptr, sector_size, get_sum(buf_ptr + min_read,
sector_size), TRUE, &res);
buf_size = buf2_size = max_size + sector_size;
- base_pos = ((u64_t)(sector_size * 3));
+ base_pos = (u64_t)sector_size * 3;
if ((buf_ptr = alloc_contig(buf_size, 0, NULL)) == NULL)
panic("unable to allocate memory");
sum2 = fill_rand(buf_ptr + max_size, sector_size);
- simple_xfer(driver_minor, add64u(base_pos, max_size),
+ simple_xfer(driver_minor, base_pos + max_size,
buf_ptr + max_size, sector_size, TRUE, sector_size,
&res);
got_result(&res, "large baseline read");
- simple_xfer(driver_minor, add64u(base_pos, max_size), buf_ptr +
- max_size, sector_size, FALSE, sector_size, &res);
+ simple_xfer(driver_minor, base_pos + max_size, buf_ptr + max_size,
+ sector_size, FALSE, sector_size, &res);
if (may_write)
test_sum(buf_ptr + max_size, sector_size, sum2, TRUE, &res);
sector_size - min_read);
}
- vir_xfer(driver_minor, add64u(base_pos, min_read), iov, NR_IOREQS,
- FALSE, min_read * NR_IOREQS, &res);
+ vir_xfer(driver_minor, base_pos + min_read, iov, NR_IOREQS, FALSE,
+ min_read * NR_IOREQS, &res);
for (i = 0; i < NR_IOREQS; i++) {
test_sum(buf2_ptr + i * sector_size + min_read,
*/
fill_rand(buf2_ptr, buf2_size);
- simple_xfer(driver_minor, add64u(base_pos, min_read), buf2_ptr,
- max_size, FALSE, max_size, &res);
+ simple_xfer(driver_minor, base_pos + min_read, buf2_ptr, max_size,
+ FALSE, max_size, &res);
test_sum(buf2_ptr, max_size, get_sum(buf_ptr + min_read, max_size),
TRUE, &res);
iov[i].iov_size = max_block;
}
- vir_xfer(driver_minor, add64u(base_pos, min_read), iov, NR_IOREQS,
- FALSE, max_block * NR_IOREQS, &res);
+ vir_xfer(driver_minor, base_pos + min_read, iov, NR_IOREQS, FALSE,
+ max_block * NR_IOREQS, &res);
test_sum(buf2_ptr, max_block * NR_IOREQS, get_sum(buf_ptr + min_read,
max_block * NR_IOREQS), TRUE, &res);
for (i = 0; i < 6; i++) {
fill_rand(buf_ptr, sector_size * 3);
- simple_xfer(driver_minor, add64u(base_pos, sector_size * i),
- buf_ptr, sector_size * 3, FALSE, sector_size * 3,
- &res);
+ simple_xfer(driver_minor, base_pos + sector_size * i, buf_ptr,
+ sector_size * 3, FALSE, sector_size * 3, &res);
for (j = 0; j < 3; j++)
test_sum(buf_ptr + sector_size * j, sector_size,
fill_rand(buf_ptr, sector_size * 3);
- simple_xfer(driver_minor, add64u(base_pos, sector_size * i),
- buf_ptr, sector_size * 3, TRUE, sector_size * 3, &res);
+ simple_xfer(driver_minor, base_pos + sector_size * i, buf_ptr,
+ sector_size * 3, TRUE, sector_size * 3, &res);
for (j = 0; j < 3; j++)
ssum[i + j] = get_sum(buf_ptr + sector_size * j,
if (may_write) {
sum = fill_rand(buf_ptr, buf_size);
- simple_xfer(driver_minor, ((u64_t)(0)), buf_ptr, buf_size,
+ simple_xfer(driver_minor, 0ULL, buf_ptr, buf_size,
TRUE, buf_size, &res);
got_result(&res, "write integrity zone");
fill_rand(buf_ptr, buf_size);
- simple_xfer(driver_minor, ((u64_t)(0)), buf_ptr, buf_size, FALSE,
+ simple_xfer(driver_minor, 0ULL, buf_ptr, buf_size, FALSE,
buf_size, &res);
if (may_write)
if (check_integ) {
fill_rand(buf_ptr, buf_size);
- simple_xfer(driver_minor, ((u64_t)(0)), buf_ptr, buf_size, FALSE,
+ simple_xfer(driver_minor, 0ULL, buf_ptr, buf_size, FALSE,
buf_size, &res);
test_sum(buf_ptr, buf_size, sum, TRUE, &res);
test_group("basic area sweep", TRUE);
- sweep_area(((u64_t)(sector_size)));
+ sweep_area((u64_t)sector_size);
}
static void high_disk_pos(void)
*/
u64_t base_pos;
- base_pos = make64(sector_size * 4, 1L);
- base_pos = sub64u(base_pos, rem64u(base_pos, sector_size));
+ base_pos = 0x100000000ULL | (sector_size * 4);
+ base_pos -= base_pos % sector_size;
/* The partition end must exceed 32 bits. */
- if (cmp64(add64(part.base, part.size), base_pos) < 0) {
+ if (part.base + part.size < base_pos) {
test_group("high disk positions", FALSE);
return;
}
- base_pos = sub64u(base_pos, sector_size * 8);
+ base_pos -= sector_size * 8;
/* The partition start must not. */
- if (cmp64(base_pos, part.base) < 0) {
+ if (base_pos < part.base) {
test_group("high disk positions", FALSE);
return;
}
test_group("high disk positions", TRUE);
- base_pos = sub64(base_pos, part.base);
+ base_pos -= part.base;
- sweep_and_check(base_pos, !cmp64u(part.base, 0));
+ sweep_and_check(base_pos, part.base == 0ULL);
}
static void high_part_pos(void)
/* If the partition starts at the beginning of the disk, this test is
* no different from the high disk position test.
*/
- if (cmp64u(part.base, 0) == 0) {
+ if (part.base == 0ULL) {
/* don't complain: the test is simply superfluous now */
return;
}
- base_pos = make64(sector_size * 4, 1L);
- base_pos = sub64u(base_pos, rem64u(base_pos, sector_size));
+ base_pos = 0x100000000ULL | (sector_size * 4);
+ base_pos -= base_pos % sector_size;
- if (cmp64(part.size, base_pos) < 0) {
+ if (part.size < base_pos) {
test_group("high partition positions", FALSE);
return;
test_group("high partition positions", TRUE);
- base_pos = sub64u(base_pos, sector_size * 8);
+ base_pos -= sector_size * 8;
sweep_and_check(base_pos, TRUE);
}
*/
u64_t base_pos;
- base_pos = mul64u(1L << 24, sector_size);
+ base_pos = (1ULL << 24) * sector_size;
/* The partition end must exceed the 24-bit sector point. */
- if (cmp64(add64(part.base, part.size), base_pos) < 0) {
+ if (part.base + part.size < base_pos) {
test_group("high LBA positions, part one", FALSE);
return;
}
- base_pos = sub64u(base_pos, sector_size * 8);
+ base_pos -= sector_size * 8;
/* The partition start must not. */
- if (cmp64(base_pos, part.base) < 0) {
+ if (base_pos < part.base) {
test_group("high LBA positions, part one", FALSE);
return;
test_group("high LBA positions, part one", TRUE);
- base_pos = sub64(base_pos, part.base);
+ base_pos -= part.base;
- sweep_and_check(base_pos, !cmp64u(part.base, 0));
+ sweep_and_check(base_pos, part.base == 0ULL);
}
static void high_lba_pos2(void)
*/
u64_t base_pos;
- base_pos = mul64u(1L << 28, sector_size);
+ base_pos = (1ULL << 28) * sector_size;
/* The partition end must exceed the 28-bit sector point. */
- if (cmp64(add64(part.base, part.size), base_pos) < 0) {
+ if (part.base + part.size < base_pos) {
test_group("high LBA positions, part two", FALSE);
return;
}
- base_pos = sub64u(base_pos, sector_size * 8);
+ base_pos -= sector_size * 8;
/* The partition start must not. */
- if (cmp64(base_pos, part.base) < 0) {
+ if (base_pos < part.base) {
test_group("high LBA positions, part two", FALSE);
return;
test_group("high LBA positions, part two", TRUE);
- base_pos = sub64(base_pos, part.base);
+ base_pos -= part.base;
- sweep_and_check(base_pos, !cmp64u(part.base, 0));
+ sweep_and_check(base_pos, part.base == 0ULL);
}
static void high_pos(void)