Lines Matching full:vec
18 * @vec: structure which receives pages / pfns of the addresses mapped.
21 * This function maps virtual addresses from @start and fills @vec structure
41 struct frame_vector *vec) in get_vaddr_frames() argument
49 if (WARN_ON_ONCE(nr_frames > vec->nr_allocated)) in get_vaddr_frames()
50 nr_frames = vec->nr_allocated; in get_vaddr_frames()
58 (struct page **)(vec->ptrs)); in get_vaddr_frames()
59 vec->got_ref = true; in get_vaddr_frames()
60 vec->is_pfns = false; in get_vaddr_frames()
61 vec->nr_frames = ret; in get_vaddr_frames()
66 vec->nr_frames = 0; in get_vaddr_frames()
74 * @vec: frame vector to put
80 void put_vaddr_frames(struct frame_vector *vec) in put_vaddr_frames() argument
84 if (!vec->got_ref) in put_vaddr_frames()
86 pages = frame_vector_pages(vec); in put_vaddr_frames()
89 * get_vaddr_frames() got pages but vec was later converted to pfns. in put_vaddr_frames()
95 unpin_user_pages(pages, vec->nr_frames); in put_vaddr_frames()
96 vec->got_ref = false; in put_vaddr_frames()
98 vec->nr_frames = 0; in put_vaddr_frames()
104 * @vec: frame vector to convert
106 * Convert @vec to contain array of page pointers. If the conversion is
110 int frame_vector_to_pages(struct frame_vector *vec) in frame_vector_to_pages() argument
116 if (!vec->is_pfns) in frame_vector_to_pages()
118 nums = frame_vector_pfns(vec); in frame_vector_to_pages()
119 for (i = 0; i < vec->nr_frames; i++) in frame_vector_to_pages()
123 for (i = 0; i < vec->nr_frames; i++) in frame_vector_to_pages()
125 vec->is_pfns = false; in frame_vector_to_pages()
132 * @vec: frame vector to convert
134 * Convert @vec to contain array of pfns.
136 void frame_vector_to_pfns(struct frame_vector *vec) in frame_vector_to_pfns() argument
142 if (vec->is_pfns) in frame_vector_to_pfns()
144 pages = (struct page **)(vec->ptrs); in frame_vector_to_pfns()
146 for (i = 0; i < vec->nr_frames; i++) in frame_vector_to_pfns()
148 vec->is_pfns = true; in frame_vector_to_pfns()
161 struct frame_vector *vec; in frame_vector_create() local
162 int size = struct_size(vec, ptrs, nr_frames); in frame_vector_create()
176 vec = kvmalloc(size, GFP_KERNEL); in frame_vector_create()
177 if (!vec) in frame_vector_create()
179 vec->nr_allocated = nr_frames; in frame_vector_create()
180 vec->nr_frames = 0; in frame_vector_create()
181 return vec; in frame_vector_create()
187 * @vec: Frame vector to free
191 void frame_vector_destroy(struct frame_vector *vec) in frame_vector_destroy() argument
194 VM_BUG_ON(vec->nr_frames > 0); in frame_vector_destroy()
195 kvfree(vec); in frame_vector_destroy()