Commit de4eda9d authored by Al Viro's avatar Al Viro
Browse files

use less confusing names for iov_iter direction initializers



READ/WRITE proved to be actively confusing - the meanings are
"data destination, as used with read(2)" and "data source, as
used with write(2)", but people keep interpreting those as
"we read data from it" and "we write data to it", i.e. exactly
the wrong way.

Call them ITER_DEST and ITER_SOURCE - at least that is harder
to misinterpret...

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent a41dad90
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -153,7 +153,7 @@ int copy_oldmem_kernel(void *dst, unsigned long src, size_t count)

	kvec.iov_base = dst;
	kvec.iov_len = count;
	iov_iter_kvec(&iter, READ, &kvec, 1, count);
	iov_iter_kvec(&iter, ITER_DEST, &kvec, 1, count);
	if (copy_oldmem_iter(&iter, src, count) < count)
		return -EFAULT;
	return 0;
+1 −1
Original line number Diff line number Diff line
@@ -128,7 +128,7 @@ int memcpy_real(void *dest, unsigned long src, size_t count)

	kvec.iov_base = dest;
	kvec.iov_len = count;
	iov_iter_kvec(&iter, READ, &kvec, 1, count);
	iov_iter_kvec(&iter, ITER_DEST, &kvec, 1, count);
	if (memcpy_real_iter(&iter, src, count) < count)
		return -EFAULT;
	return 0;
+1 −1
Original line number Diff line number Diff line
@@ -908,7 +908,7 @@ static enum ucode_state request_microcode_fw(int cpu, struct device *device,

	kvec.iov_base = (void *)firmware->data;
	kvec.iov_len = firmware->size;
	iov_iter_kvec(&iter, WRITE, &kvec, 1, firmware->size);
	iov_iter_kvec(&iter, ITER_SOURCE, &kvec, 1, firmware->size);
	ret = generic_load_microcode(cpu, &iter);

	release_firmware(firmware);
+1 −1
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ ssize_t elfcorehdr_read(char *buf, size_t count, u64 *ppos)
	struct kvec kvec = { .iov_base = buf, .iov_len = count };
	struct iov_iter iter;

	iov_iter_kvec(&iter, READ, &kvec, 1, count);
	iov_iter_kvec(&iter, ITER_DEST, &kvec, 1, count);

	return read_from_oldmem(&iter, count, ppos,
				cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT));
+2 −2
Original line number Diff line number Diff line
@@ -766,7 +766,7 @@ static int build_cipher_test_sglists(struct cipher_test_sglists *tsgls,
	struct iov_iter input;
	int err;

	iov_iter_kvec(&input, WRITE, inputs, nr_inputs, src_total_len);
	iov_iter_kvec(&input, ITER_SOURCE, inputs, nr_inputs, src_total_len);
	err = build_test_sglist(&tsgls->src, cfg->src_divs, alignmask,
				cfg->inplace_mode != OUT_OF_PLACE ?
					max(dst_total_len, src_total_len) :
@@ -1180,7 +1180,7 @@ static int build_hash_sglist(struct test_sglist *tsgl,

	kv.iov_base = (void *)vec->plaintext;
	kv.iov_len = vec->psize;
	iov_iter_kvec(&input, WRITE, &kv, 1, vec->psize);
	iov_iter_kvec(&input, ITER_SOURCE, &kv, 1, vec->psize);
	return build_test_sglist(tsgl, cfg->src_divs, alignmask, vec->psize,
				 &input, divs);
}
Loading