Lines Matching refs:vma
160 static void dma_buf_vma_open(struct vm_area_struct *vma)
162 struct dma_buf *dmabuf = vma->vm_file->private_data;
165 /* call the heap provided vma open() op */
167 dmabuf->exp_vm_ops->open(vma);
171 static void dma_buf_vma_close(struct vm_area_struct *vma)
173 struct dma_buf *dmabuf = vma->vm_file->private_data;
178 /* call the heap provided vma close() op */
180 dmabuf->exp_vm_ops->close(vma);
184 static int dma_buf_do_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma)
186 /* call this first because the exporter might override vma->vm_ops */
187 int ret = dmabuf->ops->mmap(dmabuf, vma);
193 dmabuf->exp_vm_ops = vma->vm_ops;
198 vma->vm_ops = &dmabuf->vm_ops;
204 static int dma_buf_do_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma)
206 return dmabuf->ops->mmap(dmabuf, vma);
210 static int dma_buf_mmap_internal(struct file *file, struct vm_area_struct *vma)
226 if ((vma->vm_pgoff + vma_pages(vma)) > (dmabuf->size >> PAGE_SHIFT)) {
230 return dma_buf_do_mmap(dmabuf, vma);
1318 * dma_buf_mmap - Setup up a userspace mmap with the given vma
1319 * @dmabuf: [in] buffer that should back the vma
1320 * @vma: [in] vma for the mmap
1324 * This function adjusts the passed in vma so that it points at the file of the
1326 * checking on the size of the vma. Then it calls the exporters mmap function to
1331 int dma_buf_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma, unsigned long pgoff)
1336 if (WARN_ON(!dmabuf || !vma)) {
1346 if (pgoff + vma_pages(vma) < pgoff) {
1351 if ((pgoff + vma_pages(vma)) > (dmabuf->size >> PAGE_SHIFT)) {
1355 /* readjust the vma */
1357 oldfile = vma->vm_file;
1358 vma->vm_file = dmabuf->file;
1359 vma->vm_pgoff = pgoff;
1361 ret = dmabuf->ops->mmap(dmabuf, vma);
1364 vma->vm_file = oldfile;