SRPL_EMPTY_LOCKED(9) FreeBSD Kernel Developer's Manual SRPL_EMPTY_LOCKED(9)
NAME
SRPL_EMPTY_LOCKED, SRPL_FIRST_LOCKED, SRPL_NEXT_LOCKED,
SRPL_FOREACH_LOCKED, SRPL_FOREACH_SAFE_LOCKED, SRPL_INSERT_HEAD_LOCKED,
SRPL_INSERT_AFTER_LOCKED, SRPL_REMOVE_LOCKED - serialised singly-linked
shared reference pointer list operations
SYNOPSIS
#include <sys/srp.h>
int
SRPL_EMPTY_LOCKED(SRPL_HEAD *sl);
void *
SRPL_FIRST_LOCKED(SRPL_HEAD *sl);
void *
SRPL_NEXT_LOCKED(struct TYPE *listelm, FIELDNAME);
SRPL_FOREACH_LOCKED(VARNAME, SRPL_HEAD *sl, FIELDNAME);
SRPL_FOREACH_SAFE_LOCKED(VARNAME, SRPL_HEAD *sl, FIELDNAME,
TEMP_VARNAME);
void
SRPL_INSERT_HEAD_LOCKED(struct srpl_rc *rc, SRPL_HEAD *sl,
struct TYPE *elm, FIELDNAME);
void
SRPL_INSERT_AFTER_LOCKED(struct srpl_rc *rc, struct TYPE *listelm,
struct TYPE *elm, FIELDNAME);
void
SRPL_REMOVE_LOCKED(struct srpl_rc *rc, SRPL_HEAD *sl,
struct TYPE *listelm, TYPE, FIELDNAME);
DESCRIPTION
The SRP list macros build a linked list on top of shared reference
pointers. These macros allow manipulation and traversal of the linked
list while access to the list is serialised by the caller.
SRPL_EMPTY_LOCKED() tests whether the SRP list sl is empty.
SRPL_FIRST_LOCKED() accesses the first element in the SRP list sl.
SRPL_NEXT_LOCKED() accesses the next element in the SRP list after
listelm.
SRPL_FOREACH_LOCKED() creates a loop for traversing the elements in the
SRP list sl.
SRPL_FOREACH_SAFE_LOCKED() creates a loop for traversing the elements in
the SRP list sl, permitting it to remove VARNAME as well as freeing it
from within the loop safely without interfering with the traversal.
SRPL_INSERT_HEAD_LOCKED() inserts elm into the SRP list sl. Reference
counts are adjusted on the list items using the functions specified by
rc.
SRPL_INSERT_AFTER_LOCKED() inserts elm into an SRP list after the element
listelm. Reference counts are adjusted on the list items using the
functions specified by rc.
SRPL_REMOVE_LOCKED() iterates over the SRP list sl until it finds listelm
and then removes it. Reference counts are adjusted on the list items
using the functions specified by rc.
CONTEXT
SRPL_EMPTY_LOCKED(), SRPL_FIRST_LOCKED(), SRPL_NEXT_LOCKED(),
SRPL_FOREACH_LOCKED(), SRPL_INSERT_HEAD_LOCKED(),
SRPL_INSERT_AFTER_LOCKED(), and SRPL_REMOVE_LOCKED() may be called during
autoconf or from process context. An appropriate lock must be held that
prevents concurrent modifications to the list.
RETURN VALUES
SRPL_FIRST_LOCKED(), and SRPL_NEXT_LOCKED() return a pointer to elements
in the SRP list, or NULL if there are no more elements.
SRPL_EMPTY_LOCKED() returns non-zero when the list is empty, otherwise 0.
SEE ALSO
SRPL_FIRST(9)
HISTORY
The srp API was originally written by Jonathan Matthew
<
[email protected]> and David Gwynne <
[email protected]>. The SRP list
API first appeared in OpenBSD 5.9.
FreeBSD 14.1-RELEASE-p8 November 21, 2016 FreeBSD 14.1-RELEASE-p8