Lines Matching refs:vma_priv
54 static void privcmd_buf_vmapriv_free(struct privcmd_buf_vma_private *vma_priv) in privcmd_buf_vmapriv_free() argument
58 list_del(&vma_priv->list); in privcmd_buf_vmapriv_free()
60 for (i = 0; i < vma_priv->n_pages; i++) in privcmd_buf_vmapriv_free()
61 __free_page(vma_priv->pages[i]); in privcmd_buf_vmapriv_free()
63 kfree(vma_priv); in privcmd_buf_vmapriv_free()
69 struct privcmd_buf_vma_private *vma_priv; in privcmd_buf_release() local
74 vma_priv = list_first_entry(&file_priv->list, in privcmd_buf_release()
77 privcmd_buf_vmapriv_free(vma_priv); in privcmd_buf_release()
89 struct privcmd_buf_vma_private *vma_priv = vma->vm_private_data; in privcmd_buf_vma_open() local
91 if (!vma_priv) in privcmd_buf_vma_open()
94 mutex_lock(&vma_priv->file_priv->lock); in privcmd_buf_vma_open()
95 vma_priv->users++; in privcmd_buf_vma_open()
96 mutex_unlock(&vma_priv->file_priv->lock); in privcmd_buf_vma_open()
101 struct privcmd_buf_vma_private *vma_priv = vma->vm_private_data; in privcmd_buf_vma_close() local
104 if (!vma_priv) in privcmd_buf_vma_close()
107 file_priv = vma_priv->file_priv; in privcmd_buf_vma_close()
111 vma_priv->users--; in privcmd_buf_vma_close()
112 if (!vma_priv->users) in privcmd_buf_vma_close()
113 privcmd_buf_vmapriv_free(vma_priv); in privcmd_buf_vma_close()
136 struct privcmd_buf_vma_private *vma_priv; in privcmd_buf_mmap() local
144 vma_priv = kzalloc(struct_size(vma_priv, pages, count), GFP_KERNEL); in privcmd_buf_mmap()
145 if (!vma_priv) in privcmd_buf_mmap()
149 vma_priv->pages[i] = alloc_page(GFP_KERNEL | __GFP_ZERO); in privcmd_buf_mmap()
150 if (!vma_priv->pages[i]) in privcmd_buf_mmap()
152 vma_priv->n_pages++; in privcmd_buf_mmap()
157 vma_priv->file_priv = file_priv; in privcmd_buf_mmap()
158 vma_priv->users = 1; in privcmd_buf_mmap()
162 vma->vm_private_data = vma_priv; in privcmd_buf_mmap()
164 list_add(&vma_priv->list, &file_priv->list); in privcmd_buf_mmap()
166 if (vma_priv->n_pages != count) in privcmd_buf_mmap()
169 ret = vm_map_pages_zero(vma, vma_priv->pages, in privcmd_buf_mmap()
170 vma_priv->n_pages); in privcmd_buf_mmap()
173 privcmd_buf_vmapriv_free(vma_priv); in privcmd_buf_mmap()