#include <linux/cdev.h>
#include <linux/debugfs.h>
#include <linux/device.h>
#include <linux/dma-buf.h>
#include <linux/err.h>
#include <linux/xarray.h>
#include <linux/list.h>
#include <linux/slab.h>
#include <linux/nospec.h>
#include <linux/uaccess.h>
#include <linux/syscalls.h>
#include <linux/dma-heap.h>
#include <uapi/linux/dma-heap.h>
#define DEVNAME …
#define NUM_HEAP_MINORS …
struct dma_heap { … };
static LIST_HEAD(heap_list);
static DEFINE_MUTEX(heap_list_lock);
static dev_t dma_heap_devt;
static struct class *dma_heap_class;
static DEFINE_XARRAY_ALLOC(dma_heap_minors);
static int dma_heap_buffer_alloc(struct dma_heap *heap, size_t len,
u32 fd_flags,
u64 heap_flags)
{ … }
static int dma_heap_open(struct inode *inode, struct file *file)
{ … }
static long dma_heap_ioctl_allocate(struct file *file, void *data)
{ … }
static unsigned int dma_heap_ioctl_cmds[] = …;
static long dma_heap_ioctl(struct file *file, unsigned int ucmd,
unsigned long arg)
{ … }
static const struct file_operations dma_heap_fops = …;
void *dma_heap_get_drvdata(struct dma_heap *heap)
{ … }
const char *dma_heap_get_name(struct dma_heap *heap)
{ … }
struct dma_heap *dma_heap_add(const struct dma_heap_export_info *exp_info)
{ … }
static char *dma_heap_devnode(const struct device *dev, umode_t *mode)
{ … }
static int dma_heap_init(void)
{ … }
subsys_initcall(dma_heap_init);