*参照元 [#p60476ab] #backlinks *説明 [#za95f6b0] -パス: [[linux-4.4.1/drivers/staging/android/ion/ion.c]] -FIXME: これは何? --説明 **引数 [#z07d1d24] -struct dma_buf *dmabuf -- --[[linux-4.4.1/dma_buf]] -struct vm_area_struct *vma -- --[[linux-4.4.1/vm_area_struct]] **返り値 [#j3f41edb] -int -- **参考 [#wf9f43a4] *実装 [#o45c814a] static int ion_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma) { struct ion_buffer *buffer = dmabuf->priv; int ret = 0; - --[[linux-4.4.1/ion_buffer]] if (!buffer->heap->ops->map_user) { pr_err("%s: this heap does not define a method for mapping to userspace\n", __func__); return -EINVAL; } - -buffer->heap は 型の変数。 --[[linux-4.4.1/]] -buffer->heap->ops は 型の変数。 --[[linux-4.4.1/]] -buffer->heap は struct ion_heap * 型の変数。 --[[linux-4.4.1/ion_heap]] -buffer->heap->ops は struct ion_heap_ops * 型の変数。 --[[linux-4.4.1/ion_heap_ops]] --[[linux-4.4.1/pr_err()]] if (ion_buffer_fault_user_mappings(buffer)) { vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP; vma->vm_private_data = buffer; vma->vm_ops = &ion_vma_ops; ion_vm_open(vma); return 0; } - --[[linux-4.4.1/ion_buffer_fault_user_mappings()]] --[[linux-4.4.1/ion_vma_ops(global)]] --[[linux-4.4.1/ion_vm_open()]] if (!(buffer->flags & ION_FLAG_CACHED)) vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); - --[[linux-4.4.1/ION_FLAG_CACHED]] --[[linux-4.4.1/pgprot_writecombine()]] mutex_lock(&buffer->lock); /* now map it to userspace */ ret = buffer->heap->ops->map_user(buffer->heap, buffer, vma); mutex_unlock(&buffer->lock); - --[[linux-4.4.1/mutex_lock()]] --[[linux-4.4.1/mutex_unlock()]] if (ret) pr_err("%s: failure mapping buffer to userspace\n", __func__); return ret; } *コメント [#x0b664b4]