macro_rules! clist_create {
($head:expr, $rust_type:ty, $c_type:ty, $($field:tt).+) => { ... };
}Expand description
Create a C doubly-circular linked list interface CList from a raw list_head pointer.
This macro creates a CList<T, OFFSET> that can iterate over items of type $rust_type
linked via the $field field in the underlying C struct $c_type.
§Arguments
$head: Raw pointer to the sentinellist_headobject (*mut bindings::list_head).$rust_type: Each item’s Rust wrapper type.$c_type: Each item’s C struct type that contains the embeddedlist_head.$field: The name of thelist_headfield within the C struct.
§Safety
The caller must ensure:
$headis a valid, initialized sentinellist_head(e.g. viaINIT_LIST_HEAD()) pointing to a list that is not concurrently modified for the lifetime of theCList.- The list contains items of type
$c_typelinked via an embedded$field. $rust_typeis#[repr(transparent)]over$c_typeor has compatible layout.
§Examples
Refer to the examples in the crate::interop::list module documentation.