aboutsummaryrefslogtreecommitdiffstats
path: root/libion/ion.c
diff options
context:
space:
mode:
authorRebecca Schultz Zavin <rebecca@android.com>2012-06-11 15:12:37 -0700
committerRebecca Schultz Zavin <rebecca@android.com>2012-06-28 13:43:53 -0700
commita50fd5568ea72ea1ad662207ccea512735803174 (patch)
treefe07f7d3376c3eea390ea69cb5823f5163b25896 /libion/ion.c
parent22aec573b718c57aea2b9bd91607631a6d521911 (diff)
downloadsystem_core-a50fd5568ea72ea1ad662207ccea512735803174.tar.gz
system_core-a50fd5568ea72ea1ad662207ccea512735803174.tar.bz2
system_core-a50fd5568ea72ea1ad662207ccea512735803174.zip
Modify ion to use new definition of ALLOC ioctl argument
Also add ion_alloc_fd helper for when you only want a filedescriptor and know you won't need to access this handle again by its ion_handle Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com> Change-Id: Ia4bae22946b0078084b62f5447fecbf261dfaa83
Diffstat (limited to 'libion/ion.c')
-rw-r--r--libion/ion.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/libion/ion.c b/libion/ion.c
index dbeac238..164cec96 100644
--- a/libion/ion.c
+++ b/libion/ion.c
@@ -54,13 +54,14 @@ static int ion_ioctl(int fd, int req, void *arg)
return ret;
}
-int ion_alloc(int fd, size_t len, size_t align, unsigned int flags,
- struct ion_handle **handle)
+int ion_alloc(int fd, size_t len, size_t align, unsigned int heap_mask,
+ unsigned int flags, struct ion_handle **handle)
{
int ret;
struct ion_allocation_data data = {
.len = len,
.align = align,
+ .heap_mask = heap_mask,
.flags = flags,
};
@@ -120,6 +121,19 @@ int ion_share(int fd, struct ion_handle *handle, int *share_fd)
return ret;
}
+int ion_alloc_fd(int fd, size_t len, size_t align, unsigned int heap_mask,
+ unsigned int flags, int *handle_fd) {
+ struct ion_handle *handle;
+ int ret;
+
+ ret = ion_alloc(fd, len, align, heap_mask, flags, &handle);
+ if (ret < 0)
+ return ret;
+ ret = ion_share(fd, handle, handle_fd);
+ ion_free(fd, handle);
+ return ret;
+}
+
int ion_import(int fd, int share_fd, struct ion_handle **handle)
{
struct ion_fd_data data = {