git: 6c32d89ecabe - main - kern_rangelock.c: add rl_e_is_rlock()

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Tue, 06 Aug 2024 04:06:35 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=6c32d89ecabeba8fe5ad79a33aa134412175856e

commit 6c32d89ecabeba8fe5ad79a33aa134412175856e
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-08-18 17:59:05 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-08-06 04:05:58 +0000

    kern_rangelock.c: add rl_e_is_rlock()
    
    Reviewed by:    markj, Olivier Certner <olce.freebsd@certner.fr>
    Tested by:      pho
    Sponsored by:   The FreeBSD Foundation
    Differential revision:  https://reviews.freebsd.org/D41787
---
 sys/kern/kern_rangelock.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sys/kern/kern_rangelock.c b/sys/kern/kern_rangelock.c
index 186a42caebf0..2ed26db49f19 100644
--- a/sys/kern/kern_rangelock.c
+++ b/sys/kern/kern_rangelock.c
@@ -134,6 +134,12 @@ rl_q_load(struct rl_q_entry **p)
 	return ((struct rl_q_entry *)atomic_load_acq_ptr((uintptr_t *)p));
 }
 
+static bool
+rl_e_is_rlock(const struct rl_q_entry *e)
+{
+	return ((e->rl_q_flags & RL_LOCK_TYPE_MASK) == RL_LOCK_READ);
+}
+
 void
 rangelock_unlock(struct rangelock *lock, void *cookie)
 {