lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Sun,  4 Jan 2015 15:11:51 +0800
From:	Feng Tang <feng.tang@...el.com>
To:	Greg KH <gregkh@...uxfoundation.org>,
	John Stultz <john.stultz@...aro.org>
Cc:	Colin Cross <ccross@...roid.com>,
	Heesub Shin <heesub.shin@...sung.com>,
	Mitchel Humpherys <mitchelh@...eaurora.org>,
	linux-kernel@...r.kernel.org, Feng Tang <feng.tang@...el.com>
Subject: [PATCH 1/2] staging: andriod: ion: Add ion_phys_get_by_id function

There is user case that user only knows the ion_handle idand
needs to get the physical addr and len. So add this wrapper to
meet this requirement.

Signed-off-by: Feng Tang <feng.tang@...el.com>
---
 drivers/staging/android/ion/ion.c |   16 ++++++++++++++++
 drivers/staging/android/ion/ion.h |   14 ++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index 296d347..3d378ef 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -577,6 +577,22 @@ int ion_phys(struct ion_client *client, struct ion_handle *handle,
 }
 EXPORT_SYMBOL(ion_phys);
 
+int ion_phys_get_by_id(struct ion_client *client, int id,
+	     ion_phys_addr_t *addr, size_t *len)
+{
+	struct ion_handle *handle;
+	int ret;
+
+	handle = ion_handle_get_by_id(client, id);
+	if (!handle)
+		return -EINVAL;
+
+	ret = ion_phys(client, handle, addr, len);
+	ion_handle_put(handle);
+	return ret;
+}
+EXPORT_SYMBOL(ion_phys_get_by_id);
+
 static void *ion_buffer_kmap_get(struct ion_buffer *buffer)
 {
 	void *vaddr;
diff --git a/drivers/staging/android/ion/ion.h b/drivers/staging/android/ion/ion.h
index 443db84..9ef0f18 100644
--- a/drivers/staging/android/ion/ion.h
+++ b/drivers/staging/android/ion/ion.h
@@ -147,6 +147,20 @@ int ion_phys(struct ion_client *client, struct ion_handle *handle,
 	     ion_phys_addr_t *addr, size_t *len);
 
 /**
+ * ion_phys_get_by_id - returns the physical address and len of a handle
+ * @client:	the client
+ * @id:		id bound to ion_handle, which may be passed to user space
+ * @addr:	a pointer to put the address in
+ * @len:	a pointer to put the length in
+ *
+ * This function will first get ion_handle from the id, and then
+ * use upper ion_phys() to get the physical and len.
+ */
+
+int ion_phys_get_by_id(struct ion_client *client, int id,
+	     ion_phys_addr_t *addr, size_t *len);
+
+/**
  * ion_map_dma - return an sg_table describing a handle
  * @client:	the client
  * @handle:	the handle
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ