Lines Matching refs:fd
36 int fd = open("/dev/ion", O_RDWR); in ion_open() local
37 if (fd < 0) in ion_open()
39 return fd; in ion_open()
42 int ion_close(int fd) in ion_close() argument
44 int ret = close(fd); in ion_close()
50 static int ion_ioctl(int fd, int req, void *arg) in ion_ioctl() argument
52 int ret = ioctl(fd, req, arg); in ion_ioctl()
61 int ion_alloc(int fd, size_t len, size_t align, unsigned int heap_mask, in ion_alloc() argument
75 ret = ion_ioctl(fd, ION_IOC_ALLOC, &data); in ion_alloc()
82 int ion_free(int fd, ion_user_handle_t handle) in ion_free() argument
87 return ion_ioctl(fd, ION_IOC_FREE, &data); in ion_free()
90 int ion_map(int fd, ion_user_handle_t handle, size_t length, int prot, in ion_map() argument
104 ret = ion_ioctl(fd, ION_IOC_MAP, &data); in ion_map()
107 if (data.fd < 0) { in ion_map()
111 tmp_ptr = mmap(NULL, length, prot, flags, data.fd, offset); in ion_map()
116 *map_fd = data.fd; in ion_map()
121 int ion_share(int fd, ion_user_handle_t handle, int *share_fd) in ion_share() argument
131 ret = ion_ioctl(fd, ION_IOC_SHARE, &data); in ion_share()
134 if (data.fd < 0) { in ion_share()
138 *share_fd = data.fd; in ion_share()
142 int ion_alloc_fd(int fd, size_t len, size_t align, unsigned int heap_mask, in ion_alloc_fd() argument
147 ret = ion_alloc(fd, len, align, heap_mask, flags, &handle); in ion_alloc_fd()
150 ret = ion_share(fd, handle, handle_fd); in ion_alloc_fd()
151 ion_free(fd, handle); in ion_alloc_fd()
155 int ion_import(int fd, int share_fd, ion_user_handle_t *handle) in ion_import() argument
159 .fd = share_fd, in ion_import()
165 ret = ion_ioctl(fd, ION_IOC_IMPORT, &data); in ion_import()
172 int ion_sync_fd(int fd, int handle_fd) in ion_sync_fd() argument
175 .fd = handle_fd, in ion_sync_fd()
177 return ion_ioctl(fd, ION_IOC_SYNC, &data); in ion_sync_fd()