dma_buf_dynamic_attach(9)
π dma_buf_dynamic_attach π
okay so bestie, welcome to the dma_buf_dynamic_attach(9) page from the Kernel API Manual β yes we're in kernel-land today, put your hair up π
β¨ NAME β¨
dma_buf_dynamic_attach β adds the device to dma_buf's attachments list π«Ά
πΈ SYNOPSIS πΈ
struct dma_buf_attachment * dma_buf_dynamic_attach (struct dma_buf
*dmabuf , struct device *dev , const struct dma_buf_attach_ops
*importer_ops , void *importer_priv );
like, yes, that's a lot of asterisks, but she's serving function signature realness π
π¦ ARGUMENTS π¦
dmabuf[in]β the buffer you're attaching the device to, literally the whole point πdev[in]β the device being attached, main character energy fr fr πimporter_ops[in]β the importer operations for the attachment β¨importer_priv[in]β the importer's private pointer for the attachment, iykyk π
π DESCRIPTION π
So what does she actually do? She returns a struct dma_buf_attachment pointer for this attachment. That's it, that's the vibe.
β οΈ but bestie listen β attachments must be cleaned up by calling dma_buf_detach. no leaving them lying around, that's not the move π
Optionally, this calls dma_buf_ops.attach so device-specific attach functionality can get its moment β¨
On success you get a pointer to the newly created dma_buf_attachment, or β plot twist β a negative error code wrapped into a pointer on failure π
And ngl, this can fail if the backing storage of dmabuf is in a place that's not accessible to dev, and it can't be moved to a more suitable place. When that happens it's indicated with the error code -EBUSY. periodt. π₯
π SEE ALSO π
Kernel file ./drivers/dma-buf/dma-buf.c, plus the whole friend group:
dma_buf_iter_begin(9)dma_buf_iter_next(9)- implicit fence polling(9)
dma_buf_set_name(9)- dma buf device access(9)
dma_buf_export(9)dma_buf_fd(9)dma_buf_fd_install(9)dma_buf_get(9)dma_buf_put(9)- locking convention(9)
dma_buf_attach(9)dma_buf_detach(9)dma_buf_pin(9)dma_buf_unpin(9)dma_buf_map_attachment(9)dma_buf_map_attachment_unlocked(9)dma_buf_unmap_attachment(9)dma_buf_unmap_attachment_unlocked(9)dma_buf_attach_revocable(9)dma_buf_invalidate_mappings(9)- cpu access(9)
dma_buf_begin_cpu_access(9)dma_buf_end_cpu_access(9)dma_buf_mmap(9)dma_buf_vmap(9)dma_buf_vmap_unlocked(9)dma_buf_vunmap(9)dma_buf_vunmap_unlocked(9)
π§ sign-off π§
this lil page lives in ./drivers/dma-buf, dated October 2026, and she's filed under dma_buf_dynamic_attach(9) π slay, go attach something, mwah π«Άβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms