aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2026-01-23 11:35:52 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2026-01-23 11:36:21 +0000
commit498fe07257aa75f0f1eb4639f4a6ae39fafda901 (patch)
treeaf444beb6b7a51ca446f041a09b422e35809976f
parente17d7ab869bbfe3fa5a7da4b74d9f4fa51a0d69f (diff)
buf_ring: Rename some variables
The elements we store in buffer rings are buffers, so refer to them as `buf` throughout instead of a mixture of `buf`, `ret`, and `new`, especially since the latter breaks C++ code that directly or indirectly includes this header. MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: NetApp, Inc. Reviewed by: siderop1_netapp.com, markj Differential Revision: https://reviews.freebsd.org/D54827
-rw-r--r--sys/sys/buf_ring.h12
1 files changed, 5 insertions, 7 deletions
diff --git a/sys/sys/buf_ring.h b/sys/sys/buf_ring.h
index 00870cbf3531..07a4fa52891e 100644
--- a/sys/sys/buf_ring.h
+++ b/sys/sys/buf_ring.h
@@ -266,7 +266,7 @@ buf_ring_advance_sc(struct buf_ring *br)
* the compare and an atomic.
*/
static __inline void
-buf_ring_putback_sc(struct buf_ring *br, void *new)
+buf_ring_putback_sc(struct buf_ring *br, void *buf)
{
uint32_t cons_idx, mask;
@@ -274,7 +274,7 @@ buf_ring_putback_sc(struct buf_ring *br, void *new)
cons_idx = atomic_load_32(&br->br_cons_head) & mask;
KASSERT(cons_idx != (atomic_load_32(&br->br_prod_tail) & mask),
("Buf-Ring has none in putback")) ;
- br->br_ring[cons_idx] = new;
+ br->br_ring[cons_idx] = buf;
}
/*
@@ -305,7 +305,7 @@ static __inline void *
buf_ring_peek_clear_sc(struct buf_ring *br)
{
uint32_t cons_head, prod_tail, mask;
- void *ret;
+ void *buf;
#if defined(DEBUG_BUFRING) && defined(_KERNEL)
if (!mtx_owned(br->br_lock))
@@ -319,7 +319,7 @@ buf_ring_peek_clear_sc(struct buf_ring *br)
if (cons_head == prod_tail)
return (NULL);
- ret = br->br_ring[cons_head & mask];
+ buf = br->br_ring[cons_head & mask];
#ifdef DEBUG_BUFRING
/*
* Single consumer, i.e. cons_head will not move while we are
@@ -327,13 +327,12 @@ buf_ring_peek_clear_sc(struct buf_ring *br)
*/
br->br_ring[cons_head & mask] = NULL;
#endif
- return (ret);
+ return (buf);
}
static __inline int
buf_ring_full(struct buf_ring *br)
{
-
return (atomic_load_32(&br->br_prod_head) ==
atomic_load_32(&br->br_cons_tail) + br->br_cons_size - 1);
}
@@ -341,7 +340,6 @@ buf_ring_full(struct buf_ring *br)
static __inline int
buf_ring_empty(struct buf_ring *br)
{
-
return (atomic_load_32(&br->br_cons_head) ==
atomic_load_32(&br->br_prod_tail));
}