treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / tools / testing / selftests / android / ion / ionutils.h
blob9941eb85857666aa07ca771fb4d6b34ad5ed3182
1 #ifndef __ION_UTILS_H
2 #define __ION_UTILS_H
4 #include "ion.h"
6 #define SOCKET_NAME "ion_socket"
7 #define ION_DEVICE "/dev/ion"
9 #define ION_BUFFER_LEN 4096
10 #define MAX_HEAP_COUNT ION_HEAP_TYPE_CUSTOM
12 struct socket_info {
13 int sockfd;
14 int datafd;
15 unsigned long buflen;
18 struct ion_buffer_info {
19 int ionfd;
20 int buffd;
21 unsigned int heap_type;
22 unsigned int flag_type;
23 unsigned long heap_size;
24 unsigned long buflen;
25 unsigned char *buffer;
29 /* This is used to fill the data into the mapped buffer */
30 void write_buffer(void *buffer, unsigned long len);
32 /* This is used to read the data from the exported buffer */
33 void read_buffer(void *buffer, unsigned long len);
35 /* This is used to create an ION buffer FD for the kernel buffer
36 * So you can export this same buffer to others in the form of FD
38 int ion_export_buffer_fd(struct ion_buffer_info *ion_info);
40 /* This is used to import or map an exported FD.
41 * So we point to same buffer without making a copy. Hence zero-copy.
43 int ion_import_buffer_fd(struct ion_buffer_info *ion_info);
45 /* This is used to close all references for the ION client */
46 void ion_close_buffer_fd(struct ion_buffer_info *ion_info);
48 /* This is used to send FD to another process using socket IPC */
49 int socket_send_fd(struct socket_info *skinfo);
51 /* This is used to receive FD from another process using socket IPC */
52 int socket_receive_fd(struct socket_info *skinfo);
55 #endif