Lines Matching defs:handle
38 * allocation function, zbud_alloc(), returns an opaque handle to the user,
39 * not a dereferenceable pointer. The user must map the handle using
41 * allocation data and unmap the handle with zbud_unmap() when operations
152 * Encodes the handle of a particular buddy within a zbud page
157 unsigned long handle;
160 * For now, the encoded handle is actually just the pointer to the data
162 * Add CHUNK_SIZE to the handle if it is the first allocation to jump
165 handle = (unsigned long)zhdr;
168 handle += ZHDR_SIZE_ALIGNED;
170 handle += PAGE_SIZE - (zhdr->last_chunks << CHUNK_SHIFT);
171 return handle;
174 /* Returns the zbud page where a given handle is stored */
175 static struct zbud_header *handle_to_zbud_header(unsigned long handle)
177 return (struct zbud_header *)(handle & PAGE_MASK);
232 * @handle: handle of the new allocation
242 * Return: 0 if success and handle is set, otherwise -EINVAL if the size or
247 unsigned long *handle)
300 *handle = encode_handle(zhdr, bud);
307 * zbud_free() - frees the allocation associated with the given handle
309 * @handle: handle associated with the allocation returned by zbud_alloc()
311 static void zbud_free(struct zbud_pool *pool, unsigned long handle)
317 zhdr = handle_to_zbud_header(handle);
319 /* If first buddy, handle will be page aligned */
320 if ((handle - ZHDR_SIZE_ALIGNED) & ~PAGE_MASK)
342 * zbud_map() - maps the allocation associated with the given handle
344 * @handle: handle associated with the allocation to be mapped
348 * in the handle and could create temporary mappings to make the data
353 static void *zbud_map(struct zbud_pool *pool, unsigned long handle)
355 return (void *)(handle);
359 * zbud_unmap() - maps the allocation associated with the given handle
361 * @handle: handle associated with the allocation to be unmapped
363 static void zbud_unmap(struct zbud_pool *pool, unsigned long handle)
394 unsigned long *handle)
396 return zbud_alloc(pool, size, gfp, handle);
398 static void zbud_zpool_free(void *pool, unsigned long handle)
400 zbud_free(pool, handle);
403 static void *zbud_zpool_map(void *pool, unsigned long handle,
406 return zbud_map(pool, handle);
408 static void zbud_zpool_unmap(void *pool, unsigned long handle)
410 zbud_unmap(pool, handle);