From: Haiyue Wang <haiyue.wang@cloudprime.ai>
To: io-uring@vger.kernel.org
Cc: Haiyue Wang <haiyue.wang@cloudprime.ai>
Subject: [PATCH liburing v2 4/6] examples/zcrx: use uring_ptr_to_u64() helper to convert ptr to u64
Date: Wed, 18 Jun 2025 18:55:41 +0800 [thread overview]
Message-ID: <202C948B9FF7C1C1+20250618110034.30904-5-haiyue.wang@cloudprime.ai> (raw)
In-Reply-To: <20250618110034.30904-1-haiyue.wang@cloudprime.ai>
Use the helper to handle type convertions, instead of two type
convertions by hand: '(__u64) (unsigned long)'.
Signed-off-by: Haiyue Wang <haiyue.wang@cloudprime.ai>
---
examples/zcrx.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/examples/zcrx.c b/examples/zcrx.c
index 5fc8814..a269b1a 100644
--- a/examples/zcrx.c
+++ b/examples/zcrx.c
@@ -163,7 +163,7 @@ static void zcrx_populate_area(struct io_uring_zcrx_area_reg *area_reg)
t_error(1, 0, "mmap(): area allocation failed");
memset(area_reg, 0, sizeof(*area_reg));
- area_reg->addr = (__u64)(unsigned long)area_ptr;
+ area_reg->addr = uring_ptr_to_u64(area_ptr);
area_reg->len = AREA_SIZE;
area_reg->flags = 0;
}
@@ -194,7 +194,7 @@ static void setup_zcrx(struct io_uring *ring)
struct io_uring_region_desc region_reg = {
.size = ring_size,
- .user_addr = (__u64)(unsigned long)ring_ptr,
+ .user_addr = uring_ptr_to_u64(ring_ptr),
.flags = rq_flags,
};
@@ -204,8 +204,8 @@ static void setup_zcrx(struct io_uring *ring)
.if_idx = ifindex,
.if_rxq = cfg_queue_id,
.rq_entries = rq_entries,
- .area_ptr = (__u64)(unsigned long)&area_reg,
- .region_ptr = (__u64)(unsigned long)®ion_reg,
+ .area_ptr = uring_ptr_to_u64(&area_reg),
+ .region_ptr = uring_ptr_to_u64(®ion_reg),
};
ret = io_uring_register_ifq(ring, ®);
--
2.49.0
next prev parent reply other threads:[~2025-06-18 11:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20250618110034.30904-1-haiyue.wang@cloudprime.ai>
2025-06-18 10:55 ` [PATCH liburing v2 1/6] Add uring_ptr_to_u64() helper Haiyue Wang
2025-06-18 16:05 ` Jens Axboe
2025-06-18 10:55 ` [PATCH liburing v2 2/6] liburing: use uring_ptr_to_u64() helper to convert ptr to u64 Haiyue Wang
2025-06-18 10:55 ` [PATCH liburing v2 3/6] examples/reg-wait: " Haiyue Wang
2025-06-18 10:55 ` Haiyue Wang [this message]
2025-06-18 10:55 ` [PATCH liburing v2 5/6] test/reg-wait: " Haiyue Wang
2025-06-18 10:55 ` [PATCH liburing v2 6/6] test/zcrx: " Haiyue Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202C948B9FF7C1C1+20250618110034.30904-5-haiyue.wang@cloudprime.ai \
--to=haiyue.wang@cloudprime.ai \
--cc=io-uring@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox