ANDROID: dma-buf: add get_each_dmabuf function
Add and export get_each_dmabuf function which helps in traversing the db_list, this will be used by the minidump module to get dmabuf info. Bug: 181203151 Change-Id: Ie24788fcf9cf0a49316cb871dcb9191e8084ccde Signed-off-by: Vijayanand Jitta <vjitta@codeaurora.org>
This commit is contained in:

committed by
Suren Baghdasaryan

parent
a05c4bdbc0
commit
51b610b87d
@@ -38,6 +38,30 @@ struct dma_buf_list {
|
||||
|
||||
static struct dma_buf_list db_list;
|
||||
|
||||
/*
|
||||
* This function helps in traversing the db_list and calls the
|
||||
* callback function which can extract required info out of each
|
||||
* dmabuf.
|
||||
*/
|
||||
int get_each_dmabuf(int (*callback)(const struct dma_buf *dmabuf,
|
||||
void *private), void *private)
|
||||
{
|
||||
struct dma_buf *buf;
|
||||
int ret = mutex_lock_interruptible(&db_list.lock);
|
||||
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
list_for_each_entry(buf, &db_list.head, list_node) {
|
||||
ret = callback(buf, private);
|
||||
if (ret)
|
||||
break;
|
||||
}
|
||||
mutex_unlock(&db_list.lock);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(get_each_dmabuf);
|
||||
|
||||
static char *dmabuffs_dname(struct dentry *dentry, char *buffer, int buflen)
|
||||
{
|
||||
struct dma_buf *dmabuf;
|
||||
|
@@ -588,6 +588,8 @@ dma_buf_attachment_is_dynamic(struct dma_buf_attachment *attach)
|
||||
return !!attach->importer_ops;
|
||||
}
|
||||
|
||||
int get_each_dmabuf(int (*callback)(const struct dma_buf *dmabuf,
|
||||
void *private), void *private);
|
||||
int is_dma_buf_file(struct file *file);
|
||||
struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
|
||||
struct device *dev);
|
||||
|
Reference in New Issue
Block a user