Lines Matching refs:gref

105 	struct gntalloc_gref *gref;  member
110 static void __del_gref(struct gntalloc_gref *gref);
114 struct gntalloc_gref *gref, *n; in do_cleanup() local
115 list_for_each_entry_safe(gref, n, &gref_list, next_gref) { in do_cleanup()
116 if (!gref->users) in do_cleanup()
117 __del_gref(gref); in do_cleanup()
127 struct gntalloc_gref *gref, *next; in add_grefs() local
131 gref = kzalloc(sizeof(*gref), GFP_KERNEL); in add_grefs()
132 if (!gref) { in add_grefs()
136 list_add_tail(&gref->next_gref, &queue_gref); in add_grefs()
137 list_add_tail(&gref->next_file, &queue_file); in add_grefs()
138 gref->users = 1; in add_grefs()
139 gref->file_index = op->index + i * PAGE_SIZE; in add_grefs()
140 gref->page = alloc_page(GFP_KERNEL|__GFP_ZERO); in add_grefs()
141 if (!gref->page) { in add_grefs()
148 xen_page_to_gfn(gref->page), in add_grefs()
152 gref_ids[i] = gref->gref_id = rc; in add_grefs()
167 list_for_each_entry_safe(gref, next, &queue_file, next_file) { in add_grefs()
168 list_del(&gref->next_file); in add_grefs()
169 __del_gref(gref); in add_grefs()
176 static void __del_gref(struct gntalloc_gref *gref) in __del_gref() argument
178 if (gref->notify.flags & UNMAP_NOTIFY_CLEAR_BYTE) { in __del_gref()
179 uint8_t *tmp = kmap_local_page(gref->page); in __del_gref()
180 tmp[gref->notify.pgoff] = 0; in __del_gref()
183 if (gref->notify.flags & UNMAP_NOTIFY_SEND_EVENT) { in __del_gref()
184 notify_remote_via_evtchn(gref->notify.event); in __del_gref()
185 evtchn_put(gref->notify.event); in __del_gref()
188 gref->notify.flags = 0; in __del_gref()
190 if (gref->gref_id) { in __del_gref()
191 if (gref->page) in __del_gref()
192 gnttab_end_foreign_access(gref->gref_id, gref->page); in __del_gref()
194 gnttab_free_grant_reference(gref->gref_id); in __del_gref()
198 list_del(&gref->next_gref); in __del_gref()
200 kfree(gref); in __del_gref()
207 struct gntalloc_gref *rv = NULL, *gref; in find_grefs() local
208 list_for_each_entry(gref, &priv->list, next_file) { in find_grefs()
209 if (gref->file_index == index && !rv) in find_grefs()
210 rv = gref; in find_grefs()
212 if (gref->file_index != index) in find_grefs()
250 struct gntalloc_gref *gref; in gntalloc_release() local
256 gref = list_entry(priv->list.next, in gntalloc_release()
258 list_del(&gref->next_file); in gntalloc_release()
259 gref->users--; in gntalloc_release()
260 if (gref->users == 0) in gntalloc_release()
261 __del_gref(gref); in gntalloc_release()
337 struct gntalloc_gref *gref, *n; in gntalloc_ioctl_dealloc() local
347 gref = find_grefs(priv, op.index, op.count); in gntalloc_ioctl_dealloc()
348 if (gref) { in gntalloc_ioctl_dealloc()
354 n = list_entry(gref->next_file.next, in gntalloc_ioctl_dealloc()
356 list_del(&gref->next_file); in gntalloc_ioctl_dealloc()
357 gref->users--; in gntalloc_ioctl_dealloc()
358 gref = n; in gntalloc_ioctl_dealloc()
375 struct gntalloc_gref *gref; in gntalloc_ioctl_unmap_notify() local
388 gref = find_grefs(priv, index, 1); in gntalloc_ioctl_unmap_notify()
389 if (!gref) { in gntalloc_ioctl_unmap_notify()
413 if (gref->notify.flags & UNMAP_NOTIFY_SEND_EVENT) in gntalloc_ioctl_unmap_notify()
414 evtchn_put(gref->notify.event); in gntalloc_ioctl_unmap_notify()
416 gref->notify.flags = op.action; in gntalloc_ioctl_unmap_notify()
417 gref->notify.pgoff = pgoff; in gntalloc_ioctl_unmap_notify()
418 gref->notify.event = op.event_channel_port; in gntalloc_ioctl_unmap_notify()
463 struct gntalloc_gref *gref, *next; in gntalloc_vma_close() local
472 gref = priv->gref; in gntalloc_vma_close()
474 gref->users--; in gntalloc_vma_close()
475 next = list_entry(gref->next_gref.next, in gntalloc_vma_close()
477 if (gref->users == 0) in gntalloc_vma_close()
478 __del_gref(gref); in gntalloc_vma_close()
479 gref = next; in gntalloc_vma_close()
495 struct gntalloc_gref *gref; in gntalloc_mmap() local
513 gref = find_grefs(priv, vma->vm_pgoff << PAGE_SHIFT, count); in gntalloc_mmap()
514 if (gref == NULL) { in gntalloc_mmap()
522 vm_priv->gref = gref; in gntalloc_mmap()
533 gref->users++; in gntalloc_mmap()
535 gref->page); in gntalloc_mmap()
539 gref = list_entry(gref->next_file.next, in gntalloc_mmap()