Lines Matching refs:sg_table
17 //! `struct sg_table` types.
23 //! This type manages the allocation of the `struct sg_table`, the DMA mapping of the buffer, and
103 pub struct Borrowed(Opaque<bindings::sg_table>);
113 /// This struct is a wrapper around the kernel's `struct sg_table`. It manages a list of DMA-mapped
134 /// Creates a borrowed `&'a SGTable` from a raw `struct sg_table` pointer.
136 /// This allows safe access to an `sg_table` that is managed elsewhere (for example, in C code).
142 /// - the `struct sg_table` pointed to by `ptr` is valid for the entire lifetime of `'a`,
145 pub unsafe fn from_raw<'a>(ptr: *mut bindings::sg_table) -> &'a Self {
147 // to a `struct sg_table` for the duration of `'a`.
152 fn as_raw(&self) -> *mut bindings::sg_table {
158 // SAFETY: `self.as_raw()` is a valid pointer to a `struct sg_table`.
162 // SAFETY: `self.as_raw()` is a valid pointer to a `struct sg_table`.
175 /// Represents the DMA mapping state of a `struct sg_table`.
181 /// - `sgt` is a valid pointer to a `struct sg_table` for the entire lifetime of the
185 sgt: NonNull<bindings::sg_table>,
199 /// - `sgt` must be a valid pointer to a `struct sg_table` for the entire lifetime of the
204 sgt: NonNull<bindings::sg_table>,
211 // - `sgt` is a valid pointer to a `struct sg_table`.
232 // - `self.sgt.as_ptr()` is a valid pointer to a `struct sg_table` by the type invariants
242 /// A transparent wrapper around a `struct sg_table`.
244 /// While we could also create the `struct sg_table` in the constructor of [`Owned`], we can't tear
245 /// down the `struct sg_table` in [`Owned::drop`]; the drop order in [`Owned`] matters.
247 struct RawSGTable(Opaque<bindings::sg_table>);
293 fn as_raw(&self) -> *mut bindings::sg_table {
301 // SAFETY: `sgt` is a valid and initialized `struct sg_table`.
311 /// - The `struct sg_table` allocation (`sgt`).
318 // Note: The drop order is relevant; we first have to unmap the `struct sg_table`, then free the
319 // `struct sg_table` and finally free the backing pages.
393 /// It allocates a `struct sg_table`, populates it with entries corresponding to the physical
450 // - `self.inner.sgt.as_raw()` is a valid pointer to a `struct sg_table` for the entire
452 // - The backing `struct sg_table` is not modified for the entire lifetime of `self`.
470 /// The number of DMA mapped entries in a `struct sg_table`.