include/linux/dma-fence-array.h
Source file repositories/reference/linux-study-clean/include/linux/dma-fence-array.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/dma-fence-array.h- Extension
.h- Size
- 2849 bytes
- Lines
- 97
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/dma-fence.hlinux/irq_work.h
Detected Declarations
struct dma_fence_array_cbstruct dma_fence_arrayfunction to_dma_fence_array
Annotated Snippet
struct dma_fence_array_cb {
struct dma_fence_cb cb;
struct dma_fence_array *array;
};
/**
* struct dma_fence_array - fence to represent an array of fences
* @base: fence base class
* @lock: spinlock for fence handling
* @num_fences: number of fences in the array
* @num_pending: fences in the array still pending
* @fences: array of the fences
* @work: internal irq_work function
* @callbacks: array of callback helpers
*/
struct dma_fence_array {
struct dma_fence base;
unsigned num_fences;
atomic_t num_pending;
struct dma_fence **fences;
struct irq_work work;
struct dma_fence_array_cb callbacks[] __counted_by(num_fences);
};
/**
* to_dma_fence_array - cast a fence to a dma_fence_array
* @fence: fence to cast to a dma_fence_array
*
* Returns NULL if the fence is not a dma_fence_array,
* or the dma_fence_array otherwise.
*/
static inline struct dma_fence_array *
to_dma_fence_array(struct dma_fence *fence)
{
if (!fence || !dma_fence_is_array(fence))
return NULL;
return container_of(fence, struct dma_fence_array, base);
}
/**
* dma_fence_array_for_each - iterate over all fences in array
* @fence: current fence
* @index: index into the array
* @head: potential dma_fence_array object
*
* Test if @array is a dma_fence_array object and if yes iterate over all fences
* in the array. If not just iterate over the fence in @array itself.
*
* For a deep dive iterator see dma_fence_unwrap_for_each().
*/
#define dma_fence_array_for_each(fence, index, head) \
for (index = 0, fence = dma_fence_array_first(head); fence; \
++(index), fence = dma_fence_array_next(head, index))
struct dma_fence_array *dma_fence_array_alloc(int num_fences);
void dma_fence_array_init(struct dma_fence_array *array,
int num_fences, struct dma_fence **fences,
u64 context, unsigned seqno);
struct dma_fence_array *dma_fence_array_create(int num_fences,
struct dma_fence **fences,
u64 context, unsigned seqno);
bool dma_fence_match_context(struct dma_fence *fence, u64 context);
struct dma_fence *dma_fence_array_first(struct dma_fence *head);
struct dma_fence *dma_fence_array_next(struct dma_fence *head,
unsigned int index);
#endif /* __LINUX_DMA_FENCE_ARRAY_H */
Annotation
- Immediate include surface: `linux/dma-fence.h`, `linux/irq_work.h`.
- Detected declarations: `struct dma_fence_array_cb`, `struct dma_fence_array`, `function to_dma_fence_array`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.