Expand description
Abstractions for scatter-gather lists.
C header: include/linux/scatterlist.h
Scatter-gather (SG) I/O is a memory access technique that allows devices to perform DMA operations on data buffers that are not physically contiguous in memory. It works by creating a “scatter-gather list”, an array where each entry specifies the address and length of a physically contiguous memory segment.
The device’s DMA controller can then read this list and process the segments sequentially as part of one logical I/O request. This avoids the need for a single, large, physically contiguous memory buffer, which can be difficult or impossible to allocate.
This module provides safe Rust abstractions over the kernel’s struct scatterlist and
struct sg_table types.
The main entry point is the SGTable type, which represents a complete scatter-gather table.
It can be either:
- An owned table (SGTable<Owned<P>>), created from a Rust memory buffer (e.g.,VVec). This type manages the allocation of thestruct sg_table, the DMA mapping of the buffer, and the automatic cleanup of all resources.
- A borrowed reference (&SGTable), which provides safe, read-only access to a table that was allocated by other (e.g., C) code.
Individual entries in the table are represented by SGEntry, which can be accessed by
iterating over an SGTable.