#ifndef _CUSE_IOCTL_H_
#define _CUSE_IOCTL_H_
#include <sys/ioccom.h>
#include <sys/types.h>
#define CUSE_BUFFER_MAX (1 << 12)
#define CUSE_DEVICES_MAX 64
#define CUSE_BUF_MIN_PTR 0x10000UL
#define CUSE_BUF_MAX_PTR 0x20000UL
#define CUSE_ALLOC_UNIT_MAX 128UL
#define CUSE_ALLOC_UNIT_SHIFT 24
#define CUSE_ALLOC_BYTES_MAX \
(CUSE_ALLOC_UNIT_MAX << CUSE_ALLOC_UNIT_SHIFT)
struct cuse_dev;
struct cuse_data_chunk {
uintptr_t local_ptr;
uintptr_t peer_ptr;
unsigned long length;
};
struct cuse_alloc_info {
unsigned long page_count;
unsigned long alloc_nr;
};
struct cuse_command {
struct cuse_dev *dev;
unsigned long fflags;
uintptr_t per_file_handle;
uintptr_t data_pointer;
unsigned long argument;
unsigned long command;
};
struct cuse_create_dev {
struct cuse_dev *dev;
uid_t user_id;
gid_t group_id;
int permissions;
char devname[80];
};
#define CUSE_IOCTL_GET_COMMAND _IOR('C', 0, struct cuse_command)
#define CUSE_IOCTL_WRITE_DATA _IOW('C', 1, struct cuse_data_chunk)
#define CUSE_IOCTL_READ_DATA _IOW('C', 2, struct cuse_data_chunk)
#define CUSE_IOCTL_SYNC_COMMAND _IOW('C', 3, int)
#define CUSE_IOCTL_GET_SIG _IOR('C', 4, int)
#define CUSE_IOCTL_ALLOC_MEMORY _IOW('C', 5, struct cuse_alloc_info)
#define CUSE_IOCTL_FREE_MEMORY _IOW('C', 6, struct cuse_alloc_info)
#define CUSE_IOCTL_SET_PFH _IOW('C', 7, uintptr_t)
#define CUSE_IOCTL_CREATE_DEV _IOW('C', 8, struct cuse_create_dev)
#define CUSE_IOCTL_DESTROY_DEV _IOW('C', 9, struct cuse_dev *)
#define CUSE_IOCTL_ALLOC_UNIT _IOR('C',10, int)
#define CUSE_IOCTL_FREE_UNIT _IOW('C',11, int)
#define CUSE_IOCTL_SELWAKEUP _IOW('C',12, int)
#define CUSE_IOCTL_ALLOC_UNIT_BY_ID _IOWR('C',13, int)
#define CUSE_IOCTL_FREE_UNIT_BY_ID _IOWR('C',14, int)
#endif