diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/dma-buf.h | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h index 694e1fe1c4b4..2f0b431b73e0 100644 --- a/include/linux/dma-buf.h +++ b/include/linux/dma-buf.h | |||
| @@ -163,6 +163,33 @@ struct dma_buf_attachment { | |||
| 163 | }; | 163 | }; |
| 164 | 164 | ||
| 165 | /** | 165 | /** |
| 166 | * struct dma_buf_export_info - holds information needed to export a dma_buf | ||
| 167 | * @exp_name: name of the exporting module - useful for debugging. | ||
| 168 | * @ops: Attach allocator-defined dma buf ops to the new buffer | ||
| 169 | * @size: Size of the buffer | ||
| 170 | * @flags: mode flags for the file | ||
| 171 | * @resv: reservation-object, NULL to allocate default one | ||
| 172 | * @priv: Attach private data of allocator to this buffer | ||
| 173 | * | ||
| 174 | * This structure holds the information required to export the buffer. Used | ||
| 175 | * with dma_buf_export() only. | ||
| 176 | */ | ||
| 177 | struct dma_buf_export_info { | ||
| 178 | const char *exp_name; | ||
| 179 | const struct dma_buf_ops *ops; | ||
| 180 | size_t size; | ||
| 181 | int flags; | ||
| 182 | struct reservation_object *resv; | ||
| 183 | void *priv; | ||
| 184 | }; | ||
| 185 | |||
| 186 | /** | ||
| 187 | * helper macro for exporters; zeros and fills in most common values | ||
| 188 | */ | ||
| 189 | #define DEFINE_DMA_BUF_EXPORT_INFO(a) \ | ||
| 190 | struct dma_buf_export_info a = { .exp_name = KBUILD_MODNAME } | ||
| 191 | |||
| 192 | /** | ||
| 166 | * get_dma_buf - convenience wrapper for get_file. | 193 | * get_dma_buf - convenience wrapper for get_file. |
| 167 | * @dmabuf: [in] pointer to dma_buf | 194 | * @dmabuf: [in] pointer to dma_buf |
| 168 | * | 195 | * |
| @@ -181,12 +208,7 @@ struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, | |||
| 181 | void dma_buf_detach(struct dma_buf *dmabuf, | 208 | void dma_buf_detach(struct dma_buf *dmabuf, |
| 182 | struct dma_buf_attachment *dmabuf_attach); | 209 | struct dma_buf_attachment *dmabuf_attach); |
| 183 | 210 | ||
| 184 | struct dma_buf *dma_buf_export_named(void *priv, const struct dma_buf_ops *ops, | 211 | struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info); |
| 185 | size_t size, int flags, const char *, | ||
| 186 | struct reservation_object *); | ||
| 187 | |||
| 188 | #define dma_buf_export(priv, ops, size, flags, resv) \ | ||
| 189 | dma_buf_export_named(priv, ops, size, flags, KBUILD_MODNAME, resv) | ||
| 190 | 212 | ||
| 191 | int dma_buf_fd(struct dma_buf *dmabuf, int flags); | 213 | int dma_buf_fd(struct dma_buf *dmabuf, int flags); |
| 192 | struct dma_buf *dma_buf_get(int fd); | 214 | struct dma_buf *dma_buf_get(int fd); |
