diff mbox series

[liburing,3/8] test/reg-wait: use queried page_size

Message ID aec96dc7c43d7479820f686e615f7e949cf7f358.1731792294.git.asml.silence@gmail.com (mailing list archive)
State New
Headers show
Series region test fixes + improvements | expand

Commit Message

Pavel Begunkov Nov. 16, 2024, 9:27 p.m. UTC
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 test/reg-wait.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/test/reg-wait.c b/test/reg-wait.c
index ec90019..6cf47bf 100644
--- a/test/reg-wait.c
+++ b/test/reg-wait.c
@@ -101,7 +101,7 @@  static int test_offsets(struct io_uring *ring)
 		return T_EXIT_FAIL;
 	}
 
-	offset = 4096 - sizeof(long);
+	offset = page_size - sizeof(long);
 	rw = (void *)reg + offset;
 	memset(rw, 0, sizeof(*rw));
 	rw->flags = IORING_REG_WAIT_TS;
@@ -259,14 +259,14 @@  static int test_regions(void)
 	void *buffer;
 	int ret;
 
-	buffer = aligned_alloc(4096, 4096 * 4);
+	buffer = aligned_alloc(page_size, page_size * 4);
 	if (!buffer) {
 		fprintf(stderr, "allocation failed\n");
 		return T_EXIT_FAIL;
 	}
 
 	rd.user_addr = (__u64)(unsigned long)buffer;
-	rd.size = 4096;
+	rd.size = page_size;
 	rd.flags = IORING_MEM_REGION_TYPE_USER;
 
 	mr.region_uptr = (__u64)(unsigned long)&rd;
@@ -286,13 +286,13 @@  static int test_regions(void)
 		return T_EXIT_FAIL;
 	}
 
-	rd.size = 4096 * 4;
+	rd.size = page_size * 4;
 	ret = test_try_register_region(&mr, true);
 	if (ret) {
 		fprintf(stderr, "test_try_register_region() 16KB fail %i\n", ret);
 		return T_EXIT_FAIL;
 	}
-	rd.size = 4096;
+	rd.size = page_size;
 
 	rd.user_addr = 0;
 	ret = test_try_register_region(&mr, true);
@@ -316,7 +316,7 @@  static int test_regions(void)
 		fprintf(stderr, "test_try_register_region() 0-size fail %i\n", ret);
 		return T_EXIT_FAIL;
 	}
-	rd.size = 4096;
+	rd.size = page_size;
 
 	mr.region_uptr = 0;
 	ret = test_try_register_region(&mr, true);