linux-4.4.1/dma_buf_export()
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*参照元 [#da7010d9]
#backlinks
*説明 [#tcdd40c0]
-パス: [[linux-4.4.1/drivers/dma-buf/dma-buf.c]]
-FIXME: これは何?
--説明
**引数 [#k08f2e3c]
-const struct dma_buf_export_info *exp_info
--
--[[linux-4.4.1/dma_buf_export_info]]
**返り値 [#g06af5a1]
-struct dma_buf *
--
--[[linux-4.4.1/dma_buf]]
**参考 [#k72722e7]
*実装 [#r1330984]
/**
* dma_buf_export - Creates a new dma_buf, and associate...
* with this buffer, so it can be exported.
* Also connect the allocator specific data and ops to t...
* Additionally, provide a name string for exporter; use...
*
* @exp_info: [in] holds all the export related inf...
* by the exporter. see struct dma_...
* for further details.
*
* Returns, on success, a newly created dma_buf object, ...
* supplied private data and operations for dma_buf_ops....
* ops, or error in allocating struct dma_buf, will retu...
*
*/
struct dma_buf *dma_buf_export(const struct dma_buf_expo...
{
struct dma_buf *dmabuf;
struct reservation_object *resv = exp_info->resv;
struct file *file;
size_t alloc_size = sizeof(struct dma_buf);
-
--[[linux-4.4.1/dma_buf]]
--[[linux-4.4.1/reservation_object]]
--[[linux-4.4.1/file]]
if (!exp_info->resv)
alloc_size += sizeof(struct reservation_...
else
/* prevent &dma_buf[1] == dma_buf->resv */
alloc_size += 1;
if (WARN_ON(!exp_info->priv
|| !exp_info->ops
|| !exp_info->ops->map_dma_buf
|| !exp_info->ops->unmap_dma_buf
|| !exp_info->ops->release
|| !exp_info->ops->kmap_atomic
|| !exp_info->ops->kmap
|| !exp_info->ops->mmap)) {
return ERR_PTR(-EINVAL);
}
if (!try_module_get(exp_info->owner))
return ERR_PTR(-ENOENT);
-
--[[linux-4.4.1/try_module_get()]]
dmabuf = kzalloc(alloc_size, GFP_KERNEL);
if (!dmabuf) {
module_put(exp_info->owner);
return ERR_PTR(-ENOMEM);
}
-
--[[linux-4.4.1/kzalloc()]]
--[[linux-4.4.1/module_put()]]
--[[linux-4.4.1/GFP_KERNEL]]
dmabuf->priv = exp_info->priv;
dmabuf->ops = exp_info->ops;
dmabuf->size = exp_info->size;
dmabuf->exp_name = exp_info->exp_name;
dmabuf->owner = exp_info->owner;
init_waitqueue_head(&dmabuf->poll);
dmabuf->cb_excl.poll = dmabuf->cb_shared.poll = ...
dmabuf->cb_excl.active = dmabuf->cb_shared.activ...
-
--[[linux-4.4.1/init_waitqueue_head()]]
--dmabuf->cb_excl は struct dma_buf_poll_cb_t 型
--[[linux-4.4.1/dma_buf_poll_cb_t]]
if (!resv) {
resv = (struct reservation_object *)&dma...
reservation_object_init(resv);
}
dmabuf->resv = resv;
-
--[[linux-4.4.1/reservation_object_init()]]
file = anon_inode_getfile("dmabuf", &dma_buf_fop...
exp_info->flags);
if (IS_ERR(file)) {
kfree(dmabuf);
return ERR_CAST(file);
}
-
--[[linux-4.4.1/anon_inode_getfile()]]
--[[linux-4.4.1/dma_buf_fops(global)]]
--[[linux-4.4.1/IS_ERR()]]
--[[linux-4.4.1/kfree()]]
--[[linux-4.4.1/ERR_CAST()]]
file->f_mode |= FMODE_LSEEK;
dmabuf->file = file;
mutex_init(&dmabuf->lock);
INIT_LIST_HEAD(&dmabuf->attachments);
-
--[[linux-4.4.1/mutex_init()]]
--[[linux-4.4.1/INIT_LIST_HEAD()]]
mutex_lock(&db_list.lock);
list_add(&dmabuf->list_node, &db_list.head);
mutex_unlock(&db_list.lock);
-
--[[linux-4.4.1/mutex_lock()]]
--[[linux-4.4.1/list_add()]]
--[[linux-4.4.1/mutex_unlock()]]
return dmabuf;
}
EXPORT_SYMBOL_GPL(dma_buf_export);
-
--[[linux-4.4.1/EXPORT_SYMBOL_GPL()]]
*コメント [#kfb99a4f]
終了行:
*参照元 [#da7010d9]
#backlinks
*説明 [#tcdd40c0]
-パス: [[linux-4.4.1/drivers/dma-buf/dma-buf.c]]
-FIXME: これは何?
--説明
**引数 [#k08f2e3c]
-const struct dma_buf_export_info *exp_info
--
--[[linux-4.4.1/dma_buf_export_info]]
**返り値 [#g06af5a1]
-struct dma_buf *
--
--[[linux-4.4.1/dma_buf]]
**参考 [#k72722e7]
*実装 [#r1330984]
/**
* dma_buf_export - Creates a new dma_buf, and associate...
* with this buffer, so it can be exported.
* Also connect the allocator specific data and ops to t...
* Additionally, provide a name string for exporter; use...
*
* @exp_info: [in] holds all the export related inf...
* by the exporter. see struct dma_...
* for further details.
*
* Returns, on success, a newly created dma_buf object, ...
* supplied private data and operations for dma_buf_ops....
* ops, or error in allocating struct dma_buf, will retu...
*
*/
struct dma_buf *dma_buf_export(const struct dma_buf_expo...
{
struct dma_buf *dmabuf;
struct reservation_object *resv = exp_info->resv;
struct file *file;
size_t alloc_size = sizeof(struct dma_buf);
-
--[[linux-4.4.1/dma_buf]]
--[[linux-4.4.1/reservation_object]]
--[[linux-4.4.1/file]]
if (!exp_info->resv)
alloc_size += sizeof(struct reservation_...
else
/* prevent &dma_buf[1] == dma_buf->resv */
alloc_size += 1;
if (WARN_ON(!exp_info->priv
|| !exp_info->ops
|| !exp_info->ops->map_dma_buf
|| !exp_info->ops->unmap_dma_buf
|| !exp_info->ops->release
|| !exp_info->ops->kmap_atomic
|| !exp_info->ops->kmap
|| !exp_info->ops->mmap)) {
return ERR_PTR(-EINVAL);
}
if (!try_module_get(exp_info->owner))
return ERR_PTR(-ENOENT);
-
--[[linux-4.4.1/try_module_get()]]
dmabuf = kzalloc(alloc_size, GFP_KERNEL);
if (!dmabuf) {
module_put(exp_info->owner);
return ERR_PTR(-ENOMEM);
}
-
--[[linux-4.4.1/kzalloc()]]
--[[linux-4.4.1/module_put()]]
--[[linux-4.4.1/GFP_KERNEL]]
dmabuf->priv = exp_info->priv;
dmabuf->ops = exp_info->ops;
dmabuf->size = exp_info->size;
dmabuf->exp_name = exp_info->exp_name;
dmabuf->owner = exp_info->owner;
init_waitqueue_head(&dmabuf->poll);
dmabuf->cb_excl.poll = dmabuf->cb_shared.poll = ...
dmabuf->cb_excl.active = dmabuf->cb_shared.activ...
-
--[[linux-4.4.1/init_waitqueue_head()]]
--dmabuf->cb_excl は struct dma_buf_poll_cb_t 型
--[[linux-4.4.1/dma_buf_poll_cb_t]]
if (!resv) {
resv = (struct reservation_object *)&dma...
reservation_object_init(resv);
}
dmabuf->resv = resv;
-
--[[linux-4.4.1/reservation_object_init()]]
file = anon_inode_getfile("dmabuf", &dma_buf_fop...
exp_info->flags);
if (IS_ERR(file)) {
kfree(dmabuf);
return ERR_CAST(file);
}
-
--[[linux-4.4.1/anon_inode_getfile()]]
--[[linux-4.4.1/dma_buf_fops(global)]]
--[[linux-4.4.1/IS_ERR()]]
--[[linux-4.4.1/kfree()]]
--[[linux-4.4.1/ERR_CAST()]]
file->f_mode |= FMODE_LSEEK;
dmabuf->file = file;
mutex_init(&dmabuf->lock);
INIT_LIST_HEAD(&dmabuf->attachments);
-
--[[linux-4.4.1/mutex_init()]]
--[[linux-4.4.1/INIT_LIST_HEAD()]]
mutex_lock(&db_list.lock);
list_add(&dmabuf->list_node, &db_list.head);
mutex_unlock(&db_list.lock);
-
--[[linux-4.4.1/mutex_lock()]]
--[[linux-4.4.1/list_add()]]
--[[linux-4.4.1/mutex_unlock()]]
return dmabuf;
}
EXPORT_SYMBOL_GPL(dma_buf_export);
-
--[[linux-4.4.1/EXPORT_SYMBOL_GPL()]]
*コメント [#kfb99a4f]
ページ名: