[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1513711816-2618-52-git-send-email-dongwon.kim@intel.com>
Date: Tue, 19 Dec 2017 11:30:08 -0800
From: Dongwon Kim <dongwon.kim@...el.com>
To: linux-kernel@...r.kernel.org
Cc: dri-devel@...ts.freedesktop.org, xen-devel@...ts.xenproject.org,
mateuszx.potrola@...el.com, dongwon.kim@...el.com
Subject: [RFC PATCH 52/60] hyper_dmabuf: remove prefix 'hyper_dmabuf' from static func and backend APIs
Removed prefix "hyper_dmabuf" from backend functions and static func
(except for driver APIs) and add 'be' after 'xen' in backend function
calls to show those are backend APIs.
Also, modified some of function names for clarification and addressed
some missing errors and warnings in hyper_dmabuf_list.c and
hyper_dmabuf_list.h.
Signed-off-by: Dongwon Kim <dongwon.kim@...el.com>
---
drivers/xen/hyper_dmabuf/hyper_dmabuf_drv.c | 9 +-
drivers/xen/hyper_dmabuf/hyper_dmabuf_event.c | 6 +-
drivers/xen/hyper_dmabuf/hyper_dmabuf_id.c | 9 +-
drivers/xen/hyper_dmabuf/hyper_dmabuf_id.h | 8 +-
drivers/xen/hyper_dmabuf/hyper_dmabuf_ioctl.c | 23 ++---
drivers/xen/hyper_dmabuf/hyper_dmabuf_list.c | 113 +++++++++++----------
drivers/xen/hyper_dmabuf/hyper_dmabuf_list.h | 20 ++--
drivers/xen/hyper_dmabuf/hyper_dmabuf_msg.c | 4 +-
drivers/xen/hyper_dmabuf/hyper_dmabuf_ops.c | 54 +++++-----
.../xen/hyper_dmabuf/hyper_dmabuf_remote_sync.c | 4 +-
drivers/xen/hyper_dmabuf/hyper_dmabuf_sgl_proc.c | 20 +---
drivers/xen/hyper_dmabuf/hyper_dmabuf_sgl_proc.h | 2 -
.../xen/hyper_dmabuf/xen/hyper_dmabuf_xen_comm.c | 45 ++++----
.../xen/hyper_dmabuf/xen/hyper_dmabuf_xen_comm.h | 20 ++--
.../hyper_dmabuf/xen/hyper_dmabuf_xen_comm_list.c | 1 -
.../xen/hyper_dmabuf/xen/hyper_dmabuf_xen_drv.c | 26 ++---
.../xen/hyper_dmabuf/xen/hyper_dmabuf_xen_shm.c | 14 ++-
.../xen/hyper_dmabuf/xen/hyper_dmabuf_xen_shm.h | 14 +--
18 files changed, 179 insertions(+), 213 deletions(-)
diff --git a/drivers/xen/hyper_dmabuf/hyper_dmabuf_drv.c b/drivers/xen/hyper_dmabuf/hyper_dmabuf_drv.c
index 76f57c2..387cc63 100644
--- a/drivers/xen/hyper_dmabuf/hyper_dmabuf_drv.c
+++ b/drivers/xen/hyper_dmabuf/hyper_dmabuf_drv.c
@@ -37,7 +37,6 @@
#include <linux/dma-buf.h>
#include "hyper_dmabuf_drv.h"
#include "hyper_dmabuf_ioctl.h"
-#include "hyper_dmabuf_msg.h"
#include "hyper_dmabuf_list.h"
#include "hyper_dmabuf_id.h"
#include "hyper_dmabuf_event.h"
@@ -51,8 +50,8 @@ MODULE_AUTHOR("Intel Corporation");
struct hyper_dmabuf_private *hy_drv_priv;
-static void hyper_dmabuf_force_free(struct exported_sgt_info *exported,
- void *attr)
+static void force_free(struct exported_sgt_info *exported,
+ void *attr)
{
struct ioctl_hyper_dmabuf_unexport unexport_attr;
struct file *filp = (struct file *)attr;
@@ -86,7 +85,7 @@ static int hyper_dmabuf_open(struct inode *inode, struct file *filp)
static int hyper_dmabuf_release(struct inode *inode, struct file *filp)
{
- hyper_dmabuf_foreach_exported(hyper_dmabuf_force_free, filp);
+ hyper_dmabuf_foreach_exported(force_free, filp);
return 0;
}
@@ -369,7 +368,7 @@ static void hyper_dmabuf_drv_exit(void)
/* destroy id_queue */
if (hy_drv_priv->id_queue)
- destroy_reusable_list();
+ hyper_dmabuf_free_hid_list();
#ifdef CONFIG_HYPER_DMABUF_EVENT_GEN
/* clean up event queue */
diff --git a/drivers/xen/hyper_dmabuf/hyper_dmabuf_event.c b/drivers/xen/hyper_dmabuf/hyper_dmabuf_event.c
index ae8cb43..392ea99 100644
--- a/drivers/xen/hyper_dmabuf/hyper_dmabuf_event.c
+++ b/drivers/xen/hyper_dmabuf/hyper_dmabuf_event.c
@@ -28,16 +28,14 @@
#include <linux/kernel.h>
#include <linux/errno.h>
-#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/module.h>
-#include <linux/dma-buf.h>
#include "hyper_dmabuf_drv.h"
#include "hyper_dmabuf_struct.h"
#include "hyper_dmabuf_list.h"
#include "hyper_dmabuf_event.h"
-static void hyper_dmabuf_send_event(struct hyper_dmabuf_event *e)
+static void send_event(struct hyper_dmabuf_event *e)
{
struct hyper_dmabuf_event *oldest;
unsigned long irqflags;
@@ -110,7 +108,7 @@ int hyper_dmabuf_import_event(hyper_dmabuf_id_t hid)
e->event_data.data = (void *)imported->priv;
e->event_data.hdr.size = imported->sz_priv;
- hyper_dmabuf_send_event(e);
+ send_event(e);
dev_dbg(hy_drv_priv->dev,
"event number = %d :", hy_drv_priv->pending);
diff --git a/drivers/xen/hyper_dmabuf/hyper_dmabuf_id.c b/drivers/xen/hyper_dmabuf/hyper_dmabuf_id.c
index 312dea5..e67b84a 100644
--- a/drivers/xen/hyper_dmabuf/hyper_dmabuf_id.c
+++ b/drivers/xen/hyper_dmabuf/hyper_dmabuf_id.c
@@ -31,9 +31,8 @@
#include <linux/random.h>
#include "hyper_dmabuf_drv.h"
#include "hyper_dmabuf_id.h"
-#include "hyper_dmabuf_msg.h"
-void store_reusable_hid(hyper_dmabuf_id_t hid)
+void hyper_dmabuf_store_hid(hyper_dmabuf_id_t hid)
{
struct list_reusable_id *reusable_head = hy_drv_priv->id_queue;
struct list_reusable_id *new_reusable;
@@ -48,7 +47,7 @@ void store_reusable_hid(hyper_dmabuf_id_t hid)
list_add(&new_reusable->list, &reusable_head->list);
}
-static hyper_dmabuf_id_t retrieve_reusable_hid(void)
+static hyper_dmabuf_id_t get_reusable_hid(void)
{
struct list_reusable_id *reusable_head = hy_drv_priv->id_queue;
hyper_dmabuf_id_t hid = {-1, {0, 0, 0} };
@@ -67,7 +66,7 @@ static hyper_dmabuf_id_t retrieve_reusable_hid(void)
return hid;
}
-void destroy_reusable_list(void)
+void hyper_dmabuf_free_hid_list(void)
{
struct list_reusable_id *reusable_head = hy_drv_priv->id_queue;
struct list_reusable_id *temp_head;
@@ -106,7 +105,7 @@ hyper_dmabuf_id_t hyper_dmabuf_get_hid(void)
hy_drv_priv->id_queue = reusable_head;
}
- hid = retrieve_reusable_hid();
+ hid = get_reusable_hid();
/*creating a new H-ID only if nothing in the reusable id queue
* and count is less than maximum allowed
diff --git a/drivers/xen/hyper_dmabuf/hyper_dmabuf_id.h b/drivers/xen/hyper_dmabuf/hyper_dmabuf_id.h
index 61c4fb3..ed690f3 100644
--- a/drivers/xen/hyper_dmabuf/hyper_dmabuf_id.h
+++ b/drivers/xen/hyper_dmabuf/hyper_dmabuf_id.h
@@ -36,12 +36,16 @@
*/
#define HYPER_DMABUF_ID_MAX 1000
-void store_reusable_hid(hyper_dmabuf_id_t hid);
+/* adding freed hid to the reusable list */
+void hyper_dmabuf_store_hid(hyper_dmabuf_id_t hid);
-void destroy_reusable_list(void);
+/* freeing the reusasble list */
+void hyper_dmabuf_free_hid_list(void);
+/* getting a hid available to use. */
hyper_dmabuf_id_t hyper_dmabuf_get_hid(void);
+/* comparing two different hid */
bool hyper_dmabuf_hid_keycomp(hyper_dmabuf_id_t hid1, hyper_dmabuf_id_t hid2);
#endif /*__HYPER_DMABUF_ID_H*/
diff --git a/drivers/xen/hyper_dmabuf/hyper_dmabuf_ioctl.c b/drivers/xen/hyper_dmabuf/hyper_dmabuf_ioctl.c
index 195cede..b40cf89 100644
--- a/drivers/xen/hyper_dmabuf/hyper_dmabuf_ioctl.c
+++ b/drivers/xen/hyper_dmabuf/hyper_dmabuf_ioctl.c
@@ -28,13 +28,9 @@
#include <linux/kernel.h>
#include <linux/errno.h>
-#include <linux/module.h>
#include <linux/slab.h>
-#include <linux/miscdevice.h>
#include <linux/uaccess.h>
#include <linux/dma-buf.h>
-#include <linux/delay.h>
-#include <linux/list.h>
#include "hyper_dmabuf_drv.h"
#include "hyper_dmabuf_id.h"
#include "hyper_dmabuf_struct.h"
@@ -80,8 +76,8 @@ static int hyper_dmabuf_rx_ch_setup_ioctl(struct file *filp, void *data)
return ret;
}
-static int hyper_dmabuf_send_export_msg(struct exported_sgt_info *exported,
- struct pages_info *pg_info)
+static int send_export_msg(struct exported_sgt_info *exported,
+ struct pages_info *pg_info)
{
struct hyper_dmabuf_backend_ops *ops = hy_drv_priv->backend_ops;
struct hyper_dmabuf_req *req;
@@ -102,7 +98,7 @@ static int hyper_dmabuf_send_export_msg(struct exported_sgt_info *exported,
pg_info->nents, &exported->refs_info);
if (op[7] < 0) {
dev_err(hy_drv_priv->dev, "pages sharing failed\n");
- return -1;
+ return op[7];
}
}
@@ -114,7 +110,7 @@ static int hyper_dmabuf_send_export_msg(struct exported_sgt_info *exported,
req = kcalloc(1, sizeof(*req), GFP_KERNEL);
if (!req)
- return -1;
+ return -ENOMEM;
/* composing a message to the importer */
hyper_dmabuf_create_req(req, HYPER_DMABUF_EXPORT, &op[0]);
@@ -212,7 +208,7 @@ static int hyper_dmabuf_export_remote_ioctl(struct file *filp, void *data)
ret = -EINVAL;
} else {
/* send an export msg for updating priv in importer */
- ret = hyper_dmabuf_send_export_msg(exported, NULL);
+ ret = send_export_msg(exported, NULL);
if (ret < 0) {
dev_err(hy_drv_priv->dev,
@@ -347,7 +343,7 @@ static int hyper_dmabuf_export_remote_ioctl(struct file *filp, void *data)
export_remote_attr->hid = exported->hid;
- ret = hyper_dmabuf_send_export_msg(exported, pg_info);
+ ret = send_export_msg(exported, pg_info);
if (ret < 0) {
dev_err(hy_drv_priv->dev,
@@ -550,7 +546,7 @@ static int hyper_dmabuf_export_fd_ioctl(struct file *filp, void *data)
/* unexport dmabuf from the database and send int req to the source domain
* to unmap it.
*/
-static void hyper_dmabuf_delayed_unexport(struct work_struct *work)
+static void delayed_unexport(struct work_struct *work)
{
struct hyper_dmabuf_req *req;
struct hyper_dmabuf_backend_ops *ops = hy_drv_priv->backend_ops;
@@ -612,7 +608,7 @@ static void hyper_dmabuf_delayed_unexport(struct work_struct *work)
hyper_dmabuf_remove_exported(exported->hid);
/* register hyper_dmabuf_id to the list for reuse */
- store_reusable_hid(exported->hid);
+ hyper_dmabuf_store_hid(exported->hid);
if (exported->sz_priv > 0 && !exported->priv)
kfree(exported->priv);
@@ -649,8 +645,7 @@ int hyper_dmabuf_unexport_ioctl(struct file *filp, void *data)
return 0;
exported->unexport_sched = true;
- INIT_DELAYED_WORK(&exported->unexport,
- hyper_dmabuf_delayed_unexport);
+ INIT_DELAYED_WORK(&exported->unexport, delayed_unexport);
schedule_delayed_work(&exported->unexport,
msecs_to_jiffies(unexport_attr->delay_ms));
diff --git a/drivers/xen/hyper_dmabuf/hyper_dmabuf_list.c b/drivers/xen/hyper_dmabuf/hyper_dmabuf_list.c
index 1b3745e..bba6d1d 100644
--- a/drivers/xen/hyper_dmabuf/hyper_dmabuf_list.c
+++ b/drivers/xen/hyper_dmabuf/hyper_dmabuf_list.c
@@ -28,12 +28,9 @@
#include <linux/kernel.h>
#include <linux/errno.h>
-#include <linux/module.h>
#include <linux/slab.h>
#include <linux/cdev.h>
-#include <asm/uaccess.h>
#include <linux/hashtable.h>
-#include <linux/dma-buf.h>
#include "hyper_dmabuf_drv.h"
#include "hyper_dmabuf_list.h"
#include "hyper_dmabuf_id.h"
@@ -43,7 +40,9 @@ DECLARE_HASHTABLE(hyper_dmabuf_hash_imported, MAX_ENTRY_IMPORTED);
DECLARE_HASHTABLE(hyper_dmabuf_hash_exported, MAX_ENTRY_EXPORTED);
#ifdef CONFIG_HYPER_DMABUF_SYSFS
-static ssize_t hyper_dmabuf_imported_show(struct device *drv, struct device_attribute *attr, char *buf)
+static ssize_t hyper_dmabuf_imported_show(struct device *drv,
+ struct device_attribute *attr,
+ char *buf)
{
struct list_entry_imported *info_entry;
int bkt;
@@ -55,19 +54,23 @@ static ssize_t hyper_dmabuf_imported_show(struct device *drv, struct device_attr
int nents = info_entry->imported->nents;
bool valid = info_entry->imported->valid;
int num_importers = info_entry->imported->importers;
+
total += nents;
count += scnprintf(buf + count, PAGE_SIZE - count,
- "hid:{id:%d keys:%d %d %d}, nents:%d, v:%c, numi:%d\n",
- hid.id, hid.rng_key[0], hid.rng_key[1], hid.rng_key[2],
- nents, (valid ? 't' : 'f'), num_importers);
+ "hid:{%d %d %d %d}, nent:%d, v:%c, numi:%d\n",
+ hid.id, hid.rng_key[0], hid.rng_key[1],
+ hid.rng_key[2], nents, (valid ? 't' : 'f'),
+ num_importers);
}
- count += scnprintf(buf + count, PAGE_SIZE - count, "total nents: %lu\n",
- total);
+ count += scnprintf(buf + count, PAGE_SIZE - count,
+ "total nents: %lu\n", total);
return count;
}
-static ssize_t hyper_dmabuf_exported_show(struct device *drv, struct device_attribute *attr, char *buf)
+static ssize_t hyper_dmabuf_exported_show(struct device *drv,
+ struct device_attribute *attr,
+ char *buf)
{
struct list_entry_exported *info_entry;
int bkt;
@@ -79,20 +82,22 @@ static ssize_t hyper_dmabuf_exported_show(struct device *drv, struct device_attr
int nents = info_entry->exported->nents;
bool valid = info_entry->exported->valid;
int importer_exported = info_entry->exported->active;
+
total += nents;
count += scnprintf(buf + count, PAGE_SIZE - count,
- "hid:{hid:%d keys:%d %d %d}, nents:%d, v:%c, ie:%d\n",
- hid.id, hid.rng_key[0], hid.rng_key[1], hid.rng_key[2],
- nents, (valid ? 't' : 'f'), importer_exported);
+ "hid:{%d %d %d %d}, nent:%d, v:%c, ie:%d\n",
+ hid.id, hid.rng_key[0], hid.rng_key[1],
+ hid.rng_key[2], nents, (valid ? 't' : 'f'),
+ importer_exported);
}
- count += scnprintf(buf + count, PAGE_SIZE - count, "total nents: %lu\n",
- total);
+ count += scnprintf(buf + count, PAGE_SIZE - count,
+ "total nents: %lu\n", total);
return count;
}
-static DEVICE_ATTR(imported, S_IRUSR, hyper_dmabuf_imported_show, NULL);
-static DEVICE_ATTR(exported, S_IRUSR, hyper_dmabuf_exported_show, NULL);
+static DEVICE_ATTR(imported, 0400, hyper_dmabuf_imported_show, NULL);
+static DEVICE_ATTR(exported, 0400, hyper_dmabuf_exported_show, NULL);
int hyper_dmabuf_register_sysfs(struct device *dev)
{
@@ -118,18 +123,21 @@ int hyper_dmabuf_unregister_sysfs(struct device *dev)
device_remove_file(dev, &dev_attr_exported);
return 0;
}
+
#endif
-int hyper_dmabuf_table_init()
+int hyper_dmabuf_table_init(void)
{
hash_init(hyper_dmabuf_hash_imported);
hash_init(hyper_dmabuf_hash_exported);
return 0;
}
-int hyper_dmabuf_table_destroy()
+int hyper_dmabuf_table_destroy(void)
{
- /* TODO: cleanup hyper_dmabuf_hash_imported and hyper_dmabuf_hash_exported */
+ /* TODO: cleanup hyper_dmabuf_hash_imported
+ * and hyper_dmabuf_hash_exported
+ */
return 0;
}
@@ -139,11 +147,8 @@ int hyper_dmabuf_register_exported(struct exported_sgt_info *exported)
info_entry = kmalloc(sizeof(*info_entry), GFP_KERNEL);
- if (!info_entry) {
- dev_err(hy_drv_priv->dev,
- "No memory left to be allocated\n");
+ if (!info_entry)
return -ENOMEM;
- }
info_entry->exported = exported;
@@ -153,17 +158,14 @@ int hyper_dmabuf_register_exported(struct exported_sgt_info *exported)
return 0;
}
-int hyper_dmabuf_register_imported(struct imported_sgt_info* imported)
+int hyper_dmabuf_register_imported(struct imported_sgt_info *imported)
{
struct list_entry_imported *info_entry;
info_entry = kmalloc(sizeof(*info_entry), GFP_KERNEL);
- if (!info_entry) {
- dev_err(hy_drv_priv->dev,
- "No memory left to be allocated\n");
+ if (!info_entry)
return -ENOMEM;
- }
info_entry->imported = imported;
@@ -180,28 +182,32 @@ struct exported_sgt_info *hyper_dmabuf_find_exported(hyper_dmabuf_id_t hid)
hash_for_each(hyper_dmabuf_hash_exported, bkt, info_entry, node)
/* checking hid.id first */
- if(info_entry->exported->hid.id == hid.id) {
+ if (info_entry->exported->hid.id == hid.id) {
/* then key is compared */
- if(hyper_dmabuf_hid_keycomp(info_entry->exported->hid, hid))
+ if (hyper_dmabuf_hid_keycomp(info_entry->exported->hid,
+ hid))
return info_entry->exported;
- /* if key is unmatched, given HID is invalid, so returning NULL */
- else
- break;
+
+ /* if key is unmatched, given HID is invalid,
+ * so returning NULL
+ */
+ break;
}
return NULL;
}
/* search for pre-exported sgt and return id of it if it exist */
-hyper_dmabuf_id_t hyper_dmabuf_find_hid_exported(struct dma_buf *dmabuf, int domid)
+hyper_dmabuf_id_t hyper_dmabuf_find_hid_exported(struct dma_buf *dmabuf,
+ int domid)
{
struct list_entry_exported *info_entry;
- hyper_dmabuf_id_t hid = {-1, {0, 0, 0}};
+ hyper_dmabuf_id_t hid = {-1, {0, 0, 0} };
int bkt;
hash_for_each(hyper_dmabuf_hash_exported, bkt, info_entry, node)
- if(info_entry->exported->dma_buf == dmabuf &&
- info_entry->exported->rdomid == domid)
+ if (info_entry->exported->dma_buf == dmabuf &&
+ info_entry->exported->rdomid == domid)
return info_entry->exported->hid;
return hid;
@@ -214,14 +220,15 @@ struct imported_sgt_info *hyper_dmabuf_find_imported(hyper_dmabuf_id_t hid)
hash_for_each(hyper_dmabuf_hash_imported, bkt, info_entry, node)
/* checking hid.id first */
- if(info_entry->imported->hid.id == hid.id) {
+ if (info_entry->imported->hid.id == hid.id) {
/* then key is compared */
- if(hyper_dmabuf_hid_keycomp(info_entry->imported->hid, hid))
+ if (hyper_dmabuf_hid_keycomp(info_entry->imported->hid,
+ hid))
return info_entry->imported;
- /* if key is unmatched, given HID is invalid, so returning NULL */
- else {
- break;
- }
+ /* if key is unmatched, given HID is invalid,
+ * so returning NULL
+ */
+ break;
}
return NULL;
@@ -234,15 +241,16 @@ int hyper_dmabuf_remove_exported(hyper_dmabuf_id_t hid)
hash_for_each(hyper_dmabuf_hash_exported, bkt, info_entry, node)
/* checking hid.id first */
- if(info_entry->exported->hid.id == hid.id) {
+ if (info_entry->exported->hid.id == hid.id) {
/* then key is compared */
- if(hyper_dmabuf_hid_keycomp(info_entry->exported->hid, hid)) {
+ if (hyper_dmabuf_hid_keycomp(info_entry->exported->hid,
+ hid)) {
hash_del(&info_entry->node);
kfree(info_entry);
return 0;
- } else {
- break;
}
+
+ break;
}
return -ENOENT;
@@ -255,15 +263,16 @@ int hyper_dmabuf_remove_imported(hyper_dmabuf_id_t hid)
hash_for_each(hyper_dmabuf_hash_imported, bkt, info_entry, node)
/* checking hid.id first */
- if(info_entry->imported->hid.id == hid.id) {
+ if (info_entry->imported->hid.id == hid.id) {
/* then key is compared */
- if(hyper_dmabuf_hid_keycomp(info_entry->imported->hid, hid)) {
+ if (hyper_dmabuf_hid_keycomp(info_entry->imported->hid,
+ hid)) {
hash_del(&info_entry->node);
kfree(info_entry);
return 0;
- } else {
- break;
}
+
+ break;
}
return -ENOENT;
diff --git a/drivers/xen/hyper_dmabuf/hyper_dmabuf_list.h b/drivers/xen/hyper_dmabuf/hyper_dmabuf_list.h
index d5c17ef..f7102f5 100644
--- a/drivers/xen/hyper_dmabuf/hyper_dmabuf_list.h
+++ b/drivers/xen/hyper_dmabuf/hyper_dmabuf_list.h
@@ -33,13 +33,13 @@
#define MAX_ENTRY_IMPORTED 7
struct list_entry_exported {
- struct exported_sgt_info *exported;
- struct hlist_node node;
+ struct exported_sgt_info *exported;
+ struct hlist_node node;
};
struct list_entry_imported {
- struct imported_sgt_info *imported;
- struct hlist_node node;
+ struct imported_sgt_info *imported;
+ struct hlist_node node;
};
int hyper_dmabuf_table_init(void);
@@ -49,9 +49,10 @@ int hyper_dmabuf_table_destroy(void);
int hyper_dmabuf_register_exported(struct exported_sgt_info *info);
/* search for pre-exported sgt and return id of it if it exist */
-hyper_dmabuf_id_t hyper_dmabuf_find_hid_exported(struct dma_buf *dmabuf, int domid);
+hyper_dmabuf_id_t hyper_dmabuf_find_hid_exported(struct dma_buf *dmabuf,
+ int domid);
-int hyper_dmabuf_register_imported(struct imported_sgt_info* info);
+int hyper_dmabuf_register_imported(struct imported_sgt_info *info);
struct exported_sgt_info *hyper_dmabuf_find_exported(hyper_dmabuf_id_t hid);
@@ -61,11 +62,10 @@ int hyper_dmabuf_remove_exported(hyper_dmabuf_id_t hid);
int hyper_dmabuf_remove_imported(hyper_dmabuf_id_t hid);
-void hyper_dmabuf_foreach_exported(
- void (*func)(struct exported_sgt_info *, void *attr),
- void *attr);
+void hyper_dmabuf_foreach_exported(void (*func)(struct exported_sgt_info *,
+ void *attr), void *attr);
int hyper_dmabuf_register_sysfs(struct device *dev);
int hyper_dmabuf_unregister_sysfs(struct device *dev);
-#endif // __HYPER_DMABUF_LIST_H__
+#endif /* __HYPER_DMABUF_LIST_H__ */
diff --git a/drivers/xen/hyper_dmabuf/hyper_dmabuf_msg.c b/drivers/xen/hyper_dmabuf/hyper_dmabuf_msg.c
index fbbcc39..afc1fd6e 100644
--- a/drivers/xen/hyper_dmabuf/hyper_dmabuf_msg.c
+++ b/drivers/xen/hyper_dmabuf/hyper_dmabuf_msg.c
@@ -28,12 +28,10 @@
#include <linux/kernel.h>
#include <linux/errno.h>
-#include <linux/module.h>
#include <linux/slab.h>
-#include <linux/dma-buf.h>
#include <linux/workqueue.h>
-#include "hyper_dmabuf_msg.h"
#include "hyper_dmabuf_drv.h"
+#include "hyper_dmabuf_msg.h"
#include "hyper_dmabuf_remote_sync.h"
#include "hyper_dmabuf_event.h"
#include "hyper_dmabuf_list.h"
diff --git a/drivers/xen/hyper_dmabuf/hyper_dmabuf_ops.c b/drivers/xen/hyper_dmabuf/hyper_dmabuf_ops.c
index 03fdd30..bf805b1 100644
--- a/drivers/xen/hyper_dmabuf/hyper_dmabuf_ops.c
+++ b/drivers/xen/hyper_dmabuf/hyper_dmabuf_ops.c
@@ -28,9 +28,7 @@
#include <linux/kernel.h>
#include <linux/errno.h>
-#include <linux/fs.h>
#include <linux/slab.h>
-#include <linux/module.h>
#include <linux/dma-buf.h>
#include "hyper_dmabuf_drv.h"
#include "hyper_dmabuf_struct.h"
@@ -43,7 +41,15 @@
#define WAIT_AFTER_SYNC_REQ 0
#define REFS_PER_PAGE (PAGE_SIZE/sizeof(grant_ref_t))
-static int hyper_dmabuf_sync_request(hyper_dmabuf_id_t hid, int dmabuf_ops)
+static int dmabuf_refcount(struct dma_buf *dma_buf)
+{
+ if ((dma_buf != NULL) && (dma_buf->file != NULL))
+ return file_count(dma_buf->file);
+
+ return -EINVAL;
+}
+
+static int sync_request(hyper_dmabuf_id_t hid, int dmabuf_ops)
{
struct hyper_dmabuf_req *req;
struct hyper_dmabuf_backend_ops *ops = hy_drv_priv->backend_ops;
@@ -90,8 +96,7 @@ static int hyper_dmabuf_ops_attach(struct dma_buf *dmabuf,
imported = (struct imported_sgt_info *)attach->dmabuf->priv;
- ret = hyper_dmabuf_sync_request(imported->hid,
- HYPER_DMABUF_OPS_ATTACH);
+ ret = sync_request(imported->hid, HYPER_DMABUF_OPS_ATTACH);
return ret;
}
@@ -107,8 +112,7 @@ static void hyper_dmabuf_ops_detach(struct dma_buf *dmabuf,
imported = (struct imported_sgt_info *)attach->dmabuf->priv;
- ret = hyper_dmabuf_sync_request(imported->hid,
- HYPER_DMABUF_OPS_DETACH);
+ ret = sync_request(imported->hid, HYPER_DMABUF_OPS_DETACH);
}
static struct sg_table *hyper_dmabuf_ops_map(
@@ -140,8 +144,7 @@ static struct sg_table *hyper_dmabuf_ops_map(
if (!dma_map_sg(attachment->dev, st->sgl, st->nents, dir))
goto err_free_sg;
- ret = hyper_dmabuf_sync_request(imported->hid,
- HYPER_DMABUF_OPS_MAP);
+ ret = sync_request(imported->hid, HYPER_DMABUF_OPS_MAP);
kfree(pg_info->pgs);
kfree(pg_info);
@@ -177,8 +180,7 @@ static void hyper_dmabuf_ops_unmap(struct dma_buf_attachment *attachment,
sg_free_table(sg);
kfree(sg);
- ret = hyper_dmabuf_sync_request(imported->hid,
- HYPER_DMABUF_OPS_UNMAP);
+ ret = sync_request(imported->hid, HYPER_DMABUF_OPS_UNMAP);
}
static void hyper_dmabuf_ops_release(struct dma_buf *dma_buf)
@@ -211,8 +213,7 @@ static void hyper_dmabuf_ops_release(struct dma_buf *dma_buf)
finish = imported && !imported->valid &&
!imported->importers;
- ret = hyper_dmabuf_sync_request(imported->hid,
- HYPER_DMABUF_OPS_RELEASE);
+ ret = sync_request(imported->hid, HYPER_DMABUF_OPS_RELEASE);
/*
* Check if buffer is still valid and if not remove it
@@ -236,8 +237,7 @@ static int hyper_dmabuf_ops_begin_cpu_access(struct dma_buf *dmabuf,
imported = (struct imported_sgt_info *)dmabuf->priv;
- ret = hyper_dmabuf_sync_request(imported->hid,
- HYPER_DMABUF_OPS_BEGIN_CPU_ACCESS);
+ ret = sync_request(imported->hid, HYPER_DMABUF_OPS_BEGIN_CPU_ACCESS);
return ret;
}
@@ -253,8 +253,7 @@ static int hyper_dmabuf_ops_end_cpu_access(struct dma_buf *dmabuf,
imported = (struct imported_sgt_info *)dmabuf->priv;
- ret = hyper_dmabuf_sync_request(imported->hid,
- HYPER_DMABUF_OPS_END_CPU_ACCESS);
+ ret = sync_request(imported->hid, HYPER_DMABUF_OPS_END_CPU_ACCESS);
return 0;
}
@@ -270,8 +269,7 @@ static void *hyper_dmabuf_ops_kmap_atomic(struct dma_buf *dmabuf,
imported = (struct imported_sgt_info *)dmabuf->priv;
- ret = hyper_dmabuf_sync_request(imported->hid,
- HYPER_DMABUF_OPS_KMAP_ATOMIC);
+ ret = sync_request(imported->hid, HYPER_DMABUF_OPS_KMAP_ATOMIC);
/* TODO: NULL for now. Need to return the addr of mapped region */
return NULL;
@@ -288,8 +286,7 @@ static void hyper_dmabuf_ops_kunmap_atomic(struct dma_buf *dmabuf,
imported = (struct imported_sgt_info *)dmabuf->priv;
- ret = hyper_dmabuf_sync_request(imported->hid,
- HYPER_DMABUF_OPS_KUNMAP_ATOMIC);
+ ret = sync_request(imported->hid, HYPER_DMABUF_OPS_KUNMAP_ATOMIC);
}
static void *hyper_dmabuf_ops_kmap(struct dma_buf *dmabuf, unsigned long pgnum)
@@ -302,8 +299,7 @@ static void *hyper_dmabuf_ops_kmap(struct dma_buf *dmabuf, unsigned long pgnum)
imported = (struct imported_sgt_info *)dmabuf->priv;
- ret = hyper_dmabuf_sync_request(imported->hid,
- HYPER_DMABUF_OPS_KMAP);
+ ret = sync_request(imported->hid, HYPER_DMABUF_OPS_KMAP);
/* for now NULL.. need to return the address of mapped region */
return NULL;
@@ -320,8 +316,7 @@ static void hyper_dmabuf_ops_kunmap(struct dma_buf *dmabuf, unsigned long pgnum,
imported = (struct imported_sgt_info *)dmabuf->priv;
- ret = hyper_dmabuf_sync_request(imported->hid,
- HYPER_DMABUF_OPS_KUNMAP);
+ ret = sync_request(imported->hid, HYPER_DMABUF_OPS_KUNMAP);
}
static int hyper_dmabuf_ops_mmap(struct dma_buf *dmabuf,
@@ -335,8 +330,7 @@ static int hyper_dmabuf_ops_mmap(struct dma_buf *dmabuf,
imported = (struct imported_sgt_info *)dmabuf->priv;
- ret = hyper_dmabuf_sync_request(imported->hid,
- HYPER_DMABUF_OPS_MMAP);
+ ret = sync_request(imported->hid, HYPER_DMABUF_OPS_MMAP);
return ret;
}
@@ -351,8 +345,7 @@ static void *hyper_dmabuf_ops_vmap(struct dma_buf *dmabuf)
imported = (struct imported_sgt_info *)dmabuf->priv;
- ret = hyper_dmabuf_sync_request(imported->hid,
- HYPER_DMABUF_OPS_VMAP);
+ ret = sync_request(imported->hid, HYPER_DMABUF_OPS_VMAP);
return NULL;
}
@@ -367,8 +360,7 @@ static void hyper_dmabuf_ops_vunmap(struct dma_buf *dmabuf, void *vaddr)
imported = (struct imported_sgt_info *)dmabuf->priv;
- ret = hyper_dmabuf_sync_request(imported->hid,
- HYPER_DMABUF_OPS_VUNMAP);
+ ret = sync_request(imported->hid, HYPER_DMABUF_OPS_VUNMAP);
}
static const struct dma_buf_ops hyper_dmabuf_ops = {
diff --git a/drivers/xen/hyper_dmabuf/hyper_dmabuf_remote_sync.c b/drivers/xen/hyper_dmabuf/hyper_dmabuf_remote_sync.c
index c9fe040..a82fd7b 100644
--- a/drivers/xen/hyper_dmabuf/hyper_dmabuf_remote_sync.c
+++ b/drivers/xen/hyper_dmabuf/hyper_dmabuf_remote_sync.c
@@ -28,7 +28,6 @@
#include <linux/kernel.h>
#include <linux/errno.h>
-#include <linux/module.h>
#include <linux/slab.h>
#include <linux/dma-buf.h>
#include "hyper_dmabuf_drv.h"
@@ -36,7 +35,6 @@
#include "hyper_dmabuf_list.h"
#include "hyper_dmabuf_msg.h"
#include "hyper_dmabuf_id.h"
-#include "hyper_dmabuf_msg.h"
#include "hyper_dmabuf_sgl_proc.h"
/* Whenever importer does dma operations from remote domain,
@@ -189,7 +187,7 @@ int hyper_dmabuf_remote_sync(hyper_dmabuf_id_t hid, int ops)
hyper_dmabuf_remove_exported(hid);
kfree(exported);
/* store hyper_dmabuf_id in the list for reuse */
- store_reusable_hid(hid);
+ hyper_dmabuf_store_hid(hid);
}
break;
diff --git a/drivers/xen/hyper_dmabuf/hyper_dmabuf_sgl_proc.c b/drivers/xen/hyper_dmabuf/hyper_dmabuf_sgl_proc.c
index e9299e5..9ad7ab9 100644
--- a/drivers/xen/hyper_dmabuf/hyper_dmabuf_sgl_proc.c
+++ b/drivers/xen/hyper_dmabuf/hyper_dmabuf_sgl_proc.c
@@ -28,31 +28,18 @@
#include <linux/kernel.h>
#include <linux/errno.h>
-#include <linux/fs.h>
#include <linux/slab.h>
-#include <linux/module.h>
#include <linux/dma-buf.h>
#include "hyper_dmabuf_drv.h"
#include "hyper_dmabuf_struct.h"
#include "hyper_dmabuf_sgl_proc.h"
-#include "hyper_dmabuf_id.h"
-#include "hyper_dmabuf_msg.h"
-#include "hyper_dmabuf_list.h"
#define REFS_PER_PAGE (PAGE_SIZE/sizeof(grant_ref_t))
-int dmabuf_refcount(struct dma_buf *dma_buf)
-{
- if ((dma_buf != NULL) && (dma_buf->file != NULL))
- return file_count(dma_buf->file);
-
- return -1;
-}
-
/* return total number of pages referenced by a sgt
* for pre-calculation of # of pages behind a given sgt
*/
-static int hyper_dmabuf_get_num_pgs(struct sg_table *sgt)
+static int get_num_pgs(struct sg_table *sgt)
{
struct scatterlist *sgl;
int length, i;
@@ -89,8 +76,9 @@ struct pages_info *hyper_dmabuf_ext_pgs(struct sg_table *sgt)
if (!pg_info)
return NULL;
- pg_info->pgs = kmalloc_array(hyper_dmabuf_get_num_pgs(sgt),
- sizeof(struct page *), GFP_KERNEL);
+ pg_info->pgs = kmalloc_array(get_num_pgs(sgt),
+ sizeof(struct page *),
+ GFP_KERNEL);
if (!pg_info->pgs) {
kfree(pg_info);
diff --git a/drivers/xen/hyper_dmabuf/hyper_dmabuf_sgl_proc.h b/drivers/xen/hyper_dmabuf/hyper_dmabuf_sgl_proc.h
index 152f78c..869d982 100644
--- a/drivers/xen/hyper_dmabuf/hyper_dmabuf_sgl_proc.h
+++ b/drivers/xen/hyper_dmabuf/hyper_dmabuf_sgl_proc.h
@@ -25,8 +25,6 @@
#ifndef __HYPER_DMABUF_IMP_H__
#define __HYPER_DMABUF_IMP_H__
-int dmabuf_refcount(struct dma_buf *dma_buf);
-
/* extract pages directly from struct sg_table */
struct pages_info *hyper_dmabuf_ext_pgs(struct sg_table *sgt);
diff --git a/drivers/xen/hyper_dmabuf/xen/hyper_dmabuf_xen_comm.c b/drivers/xen/hyper_dmabuf/xen/hyper_dmabuf_xen_comm.c
index 05f3521..4a073ce 100644
--- a/drivers/xen/hyper_dmabuf/xen/hyper_dmabuf_xen_comm.c
+++ b/drivers/xen/hyper_dmabuf/xen/hyper_dmabuf_xen_comm.c
@@ -26,13 +26,10 @@
*
*/
-#include <linux/kernel.h>
#include <linux/errno.h>
-#include <linux/module.h>
#include <linux/slab.h>
#include <linux/workqueue.h>
#include <linux/delay.h>
-#include <linux/time.h>
#include <xen/grant_table.h>
#include <xen/events.h>
#include <xen/xenbus.h>
@@ -152,7 +149,7 @@ static int xen_comm_get_ring_details(int domid, int rdomid,
return (ret <= 0 ? 1 : 0);
}
-void xen_get_domid_delayed(struct work_struct *unused)
+static void xen_get_domid_delayed(struct work_struct *unused)
{
struct xenbus_transaction xbt;
int domid, ret;
@@ -191,7 +188,7 @@ void xen_get_domid_delayed(struct work_struct *unused)
}
}
-int hyper_dmabuf_xen_get_domid(void)
+int xen_be_get_domid(void)
{
struct xenbus_transaction xbt;
int domid;
@@ -261,22 +258,22 @@ static void remote_dom_exporter_watch_cb(struct xenbus_watch *watch,
* connect to it.
*/
- ret = xen_comm_get_ring_details(hyper_dmabuf_xen_get_domid(),
+ ret = xen_comm_get_ring_details(xen_be_get_domid(),
rdom, &grefid, &port);
if (ring_info && ret != 0) {
dev_info(hy_drv_priv->dev,
"Remote exporter closed, cleaninup importer\n");
- hyper_dmabuf_xen_cleanup_rx_rbuf(rdom);
+ xen_be_cleanup_rx_rbuf(rdom);
} else if (!ring_info && ret == 0) {
dev_info(hy_drv_priv->dev,
"Registering importer\n");
- hyper_dmabuf_xen_init_rx_rbuf(rdom);
+ xen_be_init_rx_rbuf(rdom);
}
}
/* exporter needs to generated info for page sharing */
-int hyper_dmabuf_xen_init_tx_rbuf(int domid)
+int xen_be_init_tx_rbuf(int domid)
{
struct xen_comm_tx_ring_info *ring_info;
struct xen_comm_sring *sring;
@@ -365,7 +362,7 @@ int hyper_dmabuf_xen_init_tx_rbuf(int domid)
ret = xen_comm_add_tx_ring(ring_info);
- ret = xen_comm_expose_ring_details(hyper_dmabuf_xen_get_domid(),
+ ret = xen_comm_expose_ring_details(xen_be_get_domid(),
domid,
ring_info->gref_ring,
ring_info->port);
@@ -384,7 +381,7 @@ int hyper_dmabuf_xen_init_tx_rbuf(int domid)
sprintf((char *)ring_info->watch.node,
"/local/domain/%d/data/hyper_dmabuf/%d/port",
- domid, hyper_dmabuf_xen_get_domid());
+ domid, xen_be_get_domid());
register_xenbus_watch(&ring_info->watch);
@@ -392,7 +389,7 @@ int hyper_dmabuf_xen_init_tx_rbuf(int domid)
}
/* cleans up exporter ring created for given remote domain */
-void hyper_dmabuf_xen_cleanup_tx_rbuf(int domid)
+void xen_be_cleanup_tx_rbuf(int domid)
{
struct xen_comm_tx_ring_info *ring_info;
struct xen_comm_rx_ring_info *rx_ring_info;
@@ -433,7 +430,7 @@ void hyper_dmabuf_xen_cleanup_tx_rbuf(int domid)
/* importer needs to know about shared page and port numbers for
* ring buffer and event channel
*/
-int hyper_dmabuf_xen_init_rx_rbuf(int domid)
+int xen_be_init_rx_rbuf(int domid)
{
struct xen_comm_rx_ring_info *ring_info;
struct xen_comm_sring *sring;
@@ -456,7 +453,7 @@ int hyper_dmabuf_xen_init_rx_rbuf(int domid)
return 0;
}
- ret = xen_comm_get_ring_details(hyper_dmabuf_xen_get_domid(), domid,
+ ret = xen_comm_get_ring_details(xen_be_get_domid(), domid,
&rx_gref, &rx_port);
if (ret) {
@@ -536,7 +533,7 @@ int hyper_dmabuf_xen_init_rx_rbuf(int domid)
/* Setup communcation channel in opposite direction */
if (!xen_comm_find_tx_ring(domid))
- ret = hyper_dmabuf_xen_init_tx_rbuf(domid);
+ ret = xen_be_init_tx_rbuf(domid);
ret = request_irq(ring_info->irq,
back_ring_isr, 0,
@@ -554,7 +551,7 @@ int hyper_dmabuf_xen_init_rx_rbuf(int domid)
}
/* clenas up importer ring create for given source domain */
-void hyper_dmabuf_xen_cleanup_rx_rbuf(int domid)
+void xen_be_cleanup_rx_rbuf(int domid)
{
struct xen_comm_rx_ring_info *ring_info;
struct xen_comm_tx_ring_info *tx_ring_info;
@@ -624,7 +621,7 @@ static void xen_rx_ch_add_delayed(struct work_struct *unused)
if (xen_comm_find_rx_ring(i) != NULL)
continue;
- ret = hyper_dmabuf_xen_init_rx_rbuf(i);
+ ret = xen_be_init_rx_rbuf(i);
if (!ret)
dev_info(hy_drv_priv->dev,
@@ -672,7 +669,7 @@ void xen_init_comm_env_delayed(struct work_struct *unused)
}
}
-int hyper_dmabuf_xen_init_comm_env(void)
+int xen_be_init_comm_env(void)
{
int ret;
@@ -699,19 +696,19 @@ int hyper_dmabuf_xen_init_comm_env(void)
}
/* cleans up all tx/rx rings */
-static void hyper_dmabuf_xen_cleanup_all_rbufs(void)
+static void xen_be_cleanup_all_rbufs(void)
{
- xen_comm_foreach_tx_ring(hyper_dmabuf_xen_cleanup_tx_rbuf);
- xen_comm_foreach_rx_ring(hyper_dmabuf_xen_cleanup_rx_rbuf);
+ xen_comm_foreach_tx_ring(xen_be_cleanup_tx_rbuf);
+ xen_comm_foreach_rx_ring(xen_be_cleanup_rx_rbuf);
}
-void hyper_dmabuf_xen_destroy_comm(void)
+void xen_be_destroy_comm(void)
{
- hyper_dmabuf_xen_cleanup_all_rbufs();
+ xen_be_cleanup_all_rbufs();
xen_comm_destroy_data_dir();
}
-int hyper_dmabuf_xen_send_req(int domid, struct hyper_dmabuf_req *req,
+int xen_be_send_req(int domid, struct hyper_dmabuf_req *req,
int wait)
{
struct xen_comm_front_ring *ring;
diff --git a/drivers/xen/hyper_dmabuf/xen/hyper_dmabuf_xen_comm.h b/drivers/xen/hyper_dmabuf/xen/hyper_dmabuf_xen_comm.h
index 8e2d1d0..70a2b70 100644
--- a/drivers/xen/hyper_dmabuf/xen/hyper_dmabuf_xen_comm.h
+++ b/drivers/xen/hyper_dmabuf/xen/hyper_dmabuf_xen_comm.h
@@ -51,28 +51,28 @@ struct xen_comm_rx_ring_info {
struct gnttab_unmap_grant_ref unmap_op;
};
-int hyper_dmabuf_xen_get_domid(void);
+int xen_be_get_domid(void);
-int hyper_dmabuf_xen_init_comm_env(void);
+int xen_be_init_comm_env(void);
/* exporter needs to generated info for page sharing */
-int hyper_dmabuf_xen_init_tx_rbuf(int domid);
+int xen_be_init_tx_rbuf(int domid);
/* importer needs to know about shared page and port numbers
* for ring buffer and event channel
*/
-int hyper_dmabuf_xen_init_rx_rbuf(int domid);
+int xen_be_init_rx_rbuf(int domid);
/* cleans up exporter ring created for given domain */
-void hyper_dmabuf_xen_cleanup_tx_rbuf(int domid);
+void xen_be_cleanup_tx_rbuf(int domid);
/* cleans up importer ring created for given domain */
-void hyper_dmabuf_xen_cleanup_rx_rbuf(int domid);
+void xen_be_cleanup_rx_rbuf(int domid);
-void hyper_dmabuf_xen_destroy_comm(void);
+void xen_be_destroy_comm(void);
/* send request to the remote domain */
-int hyper_dmabuf_xen_send_req(int domid, struct hyper_dmabuf_req *req,
- int wait);
+int xen_be_send_req(int domid, struct hyper_dmabuf_req *req,
+ int wait);
-#endif // __HYPER_DMABUF_XEN_COMM_H__
+#endif /* __HYPER_DMABUF_XEN_COMM_H__ */
diff --git a/drivers/xen/hyper_dmabuf/xen/hyper_dmabuf_xen_comm_list.c b/drivers/xen/hyper_dmabuf/xen/hyper_dmabuf_xen_comm_list.c
index 343aab3..15023db 100644
--- a/drivers/xen/hyper_dmabuf/xen/hyper_dmabuf_xen_comm_list.c
+++ b/drivers/xen/hyper_dmabuf/xen/hyper_dmabuf_xen_comm_list.c
@@ -28,7 +28,6 @@
#include <linux/kernel.h>
#include <linux/errno.h>
-#include <linux/module.h>
#include <linux/slab.h>
#include <linux/cdev.h>
#include <linux/hashtable.h>
diff --git a/drivers/xen/hyper_dmabuf/xen/hyper_dmabuf_xen_drv.c b/drivers/xen/hyper_dmabuf/xen/hyper_dmabuf_xen_drv.c
index aa4c2f5..23965b8 100644
--- a/drivers/xen/hyper_dmabuf/xen/hyper_dmabuf_xen_drv.c
+++ b/drivers/xen/hyper_dmabuf/xen/hyper_dmabuf_xen_drv.c
@@ -26,25 +26,19 @@
*
*/
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/module.h>
-#include <xen/grant_table.h>
-#include "../hyper_dmabuf_msg.h"
#include "../hyper_dmabuf_drv.h"
-#include "hyper_dmabuf_xen_drv.h"
#include "hyper_dmabuf_xen_comm.h"
#include "hyper_dmabuf_xen_shm.h"
struct hyper_dmabuf_backend_ops xen_backend_ops = {
- .get_vm_id = hyper_dmabuf_xen_get_domid,
- .share_pages = hyper_dmabuf_xen_share_pages,
- .unshare_pages = hyper_dmabuf_xen_unshare_pages,
- .map_shared_pages = (void *)hyper_dmabuf_xen_map_shared_pages,
- .unmap_shared_pages = hyper_dmabuf_xen_unmap_shared_pages,
- .init_comm_env = hyper_dmabuf_xen_init_comm_env,
- .destroy_comm = hyper_dmabuf_xen_destroy_comm,
- .init_rx_ch = hyper_dmabuf_xen_init_rx_rbuf,
- .init_tx_ch = hyper_dmabuf_xen_init_tx_rbuf,
- .send_req = hyper_dmabuf_xen_send_req,
+ .get_vm_id = xen_be_get_domid,
+ .share_pages = xen_be_share_pages,
+ .unshare_pages = xen_be_unshare_pages,
+ .map_shared_pages = (void *)xen_be_map_shared_pages,
+ .unmap_shared_pages = xen_be_unmap_shared_pages,
+ .init_comm_env = xen_be_init_comm_env,
+ .destroy_comm = xen_be_destroy_comm,
+ .init_rx_ch = xen_be_init_rx_rbuf,
+ .init_tx_ch = xen_be_init_tx_rbuf,
+ .send_req = xen_be_send_req,
};
diff --git a/drivers/xen/hyper_dmabuf/xen/hyper_dmabuf_xen_shm.c b/drivers/xen/hyper_dmabuf/xen/hyper_dmabuf_xen_shm.c
index a86313a..16416f8 100644
--- a/drivers/xen/hyper_dmabuf/xen/hyper_dmabuf_xen_shm.c
+++ b/drivers/xen/hyper_dmabuf/xen/hyper_dmabuf_xen_shm.c
@@ -26,8 +26,6 @@
*
*/
-#include <linux/kernel.h>
-#include <linux/errno.h>
#include <linux/slab.h>
#include <xen/grant_table.h>
#include <asm/xen/page.h>
@@ -75,8 +73,8 @@
*
* Returns refid of top level page.
*/
-int hyper_dmabuf_xen_share_pages(struct page **pages, int domid, int nents,
- void **refs_info)
+int xen_be_share_pages(struct page **pages, int domid, int nents,
+ void **refs_info)
{
grant_ref_t lvl3_gref;
grant_ref_t *lvl2_table;
@@ -191,7 +189,7 @@ int hyper_dmabuf_xen_share_pages(struct page **pages, int domid, int nents,
return -ENOSPC;
}
-int hyper_dmabuf_xen_unshare_pages(void **refs_info, int nents)
+int xen_be_unshare_pages(void **refs_info, int nents)
{
struct xen_shared_pages_info *sh_pages_info;
int n_lvl2_grefs = (nents/REFS_PER_PAGE +
@@ -254,8 +252,8 @@ int hyper_dmabuf_xen_unshare_pages(void **refs_info, int nents)
/* Maps provided top level ref id and then return array of pages
* containing data refs.
*/
-struct page **hyper_dmabuf_xen_map_shared_pages(int lvl3_gref, int domid,
- int nents, void **refs_info)
+struct page **xen_be_map_shared_pages(int lvl3_gref, int domid,
+ int nents, void **refs_info)
{
struct page *lvl3_table_page;
struct page **lvl2_table_pages;
@@ -492,7 +490,7 @@ struct page **hyper_dmabuf_xen_map_shared_pages(int lvl3_gref, int domid,
return NULL;
}
-int hyper_dmabuf_xen_unmap_shared_pages(void **refs_info, int nents)
+int xen_be_unmap_shared_pages(void **refs_info, int nents)
{
struct xen_shared_pages_info *sh_pages_info;
diff --git a/drivers/xen/hyper_dmabuf/xen/hyper_dmabuf_xen_shm.h b/drivers/xen/hyper_dmabuf/xen/hyper_dmabuf_xen_shm.h
index e7ae731..e02fab0b 100644
--- a/drivers/xen/hyper_dmabuf/xen/hyper_dmabuf_xen_shm.h
+++ b/drivers/xen/hyper_dmabuf/xen/hyper_dmabuf_xen_shm.h
@@ -29,18 +29,18 @@
* create a table with those in 1st level shared pages then return reference
* numbers for this top level table.
*/
-int hyper_dmabuf_xen_share_pages(struct page **pages, int domid, int nents,
- void **refs_info);
+int xen_be_share_pages(struct page **pages, int domid, int nents,
+ void **refs_info);
-int hyper_dmabuf_xen_unshare_pages(void **refs_info, int nents);
+int xen_be_unshare_pages(void **refs_info, int nents);
/* Maps provided top level ref id and then return array of pages containing
* data refs.
*/
-struct page **hyper_dmabuf_xen_map_shared_pages(int lvl3_gref, int domid,
- int nents,
- void **refs_info);
+struct page **xen_be_map_shared_pages(int lvl3_gref, int domid,
+ int nents,
+ void **refs_info);
-int hyper_dmabuf_xen_unmap_shared_pages(void **refs_info, int nents);
+int xen_be_unmap_shared_pages(void **refs_info, int nents);
#endif /* __HYPER_DMABUF_XEN_SHM_H__ */
--
2.7.4
Powered by blists - more mailing lists