Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * dma-bufs for virtio exported objects
0004  *
0005  * Copyright (C) 2020 Google, Inc.
0006  */
0007 
0008 #ifndef _LINUX_VIRTIO_DMA_BUF_H
0009 #define _LINUX_VIRTIO_DMA_BUF_H
0010 
0011 #include <linux/dma-buf.h>
0012 #include <linux/uuid.h>
0013 #include <linux/virtio.h>
0014 
0015 /**
0016  * struct virtio_dma_buf_ops - operations possible on exported object dma-buf
0017  * @ops: the base dma_buf_ops. ops.attach MUST be virtio_dma_buf_attach.
0018  * @device_attach: [optional] callback invoked by virtio_dma_buf_attach during
0019  *         all attach operations.
0020  * @get_uid: [required] callback to get the uuid of the exported object.
0021  */
0022 struct virtio_dma_buf_ops {
0023     struct dma_buf_ops ops;
0024     int (*device_attach)(struct dma_buf *dma_buf,
0025                  struct dma_buf_attachment *attach);
0026     int (*get_uuid)(struct dma_buf *dma_buf, uuid_t *uuid);
0027 };
0028 
0029 int virtio_dma_buf_attach(struct dma_buf *dma_buf,
0030               struct dma_buf_attachment *attach);
0031 
0032 struct dma_buf *virtio_dma_buf_export
0033     (const struct dma_buf_export_info *exp_info);
0034 bool is_virtio_dma_buf(struct dma_buf *dma_buf);
0035 int virtio_dma_buf_get_uuid(struct dma_buf *dma_buf, uuid_t *uuid);
0036 
0037 #endif /* _LINUX_VIRTIO_DMA_BUF_H */