virtio_dma_buf.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * dma-bufs for virtio exported objects
  4. *
  5. * Copyright (C) 2020 Google, Inc.
  6. */
  7. #ifndef _LINUX_VIRTIO_DMA_BUF_H
  8. #define _LINUX_VIRTIO_DMA_BUF_H
  9. #include <linux/dma-buf.h>
  10. #include <linux/uuid.h>
  11. #include <linux/virtio.h>
  12. /**
  13. * struct virtio_dma_buf_ops - operations possible on exported object dma-buf
  14. * @ops: the base dma_buf_ops. ops.attach MUST be virtio_dma_buf_attach.
  15. * @device_attach: [optional] callback invoked by virtio_dma_buf_attach during
  16. * all attach operations.
  17. * @get_uid: [required] callback to get the uuid of the exported object.
  18. */
  19. struct virtio_dma_buf_ops {
  20. struct dma_buf_ops ops;
  21. int (*device_attach)(struct dma_buf *dma_buf,
  22. struct dma_buf_attachment *attach);
  23. int (*get_uuid)(struct dma_buf *dma_buf, uuid_t *uuid);
  24. };
  25. int virtio_dma_buf_attach(struct dma_buf *dma_buf,
  26. struct dma_buf_attachment *attach);
  27. struct dma_buf *virtio_dma_buf_export
  28. (const struct dma_buf_export_info *exp_info);
  29. bool is_virtio_dma_buf(struct dma_buf *dma_buf);
  30. int virtio_dma_buf_get_uuid(struct dma_buf *dma_buf, uuid_t *uuid);
  31. #endif /* _LINUX_VIRTIO_DMA_BUF_H */