diff options
Diffstat (limited to 'include/linux/genalloc.h')
| -rw-r--r-- | include/linux/genalloc.h | 39 |
1 files changed, 11 insertions, 28 deletions
diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h index dd7c569aaca..ae9daa29395 100644 --- a/include/linux/genalloc.h +++ b/include/linux/genalloc.h | |||
| @@ -29,20 +29,6 @@ | |||
| 29 | 29 | ||
| 30 | #ifndef __GENALLOC_H__ | 30 | #ifndef __GENALLOC_H__ |
| 31 | #define __GENALLOC_H__ | 31 | #define __GENALLOC_H__ |
| 32 | /** | ||
| 33 | * Allocation callback function type definition | ||
| 34 | * @map: Pointer to bitmap | ||
| 35 | * @size: The bitmap size in bits | ||
| 36 | * @start: The bitnumber to start searching at | ||
| 37 | * @nr: The number of zeroed bits we're looking for | ||
| 38 | * @data: optional additional data used by @genpool_algo_t | ||
| 39 | */ | ||
| 40 | typedef unsigned long (*genpool_algo_t)(unsigned long *map, | ||
| 41 | unsigned long size, | ||
| 42 | unsigned long start, | ||
| 43 | unsigned int nr, | ||
| 44 | void *data); | ||
| 45 | |||
| 46 | /* | 32 | /* |
| 47 | * General purpose special memory pool descriptor. | 33 | * General purpose special memory pool descriptor. |
| 48 | */ | 34 | */ |
| @@ -50,9 +36,6 @@ struct gen_pool { | |||
| 50 | spinlock_t lock; | 36 | spinlock_t lock; |
| 51 | struct list_head chunks; /* list of chunks in this pool */ | 37 | struct list_head chunks; /* list of chunks in this pool */ |
| 52 | int min_alloc_order; /* minimum allocation order */ | 38 | int min_alloc_order; /* minimum allocation order */ |
| 53 | |||
| 54 | genpool_algo_t algo; /* allocation function */ | ||
| 55 | void *data; | ||
| 56 | }; | 39 | }; |
| 57 | 40 | ||
| 58 | /* | 41 | /* |
| @@ -89,20 +72,20 @@ static inline int gen_pool_add(struct gen_pool *pool, unsigned long addr, | |||
| 89 | return gen_pool_add_virt(pool, addr, -1, size, nid); | 72 | return gen_pool_add_virt(pool, addr, -1, size, nid); |
| 90 | } | 73 | } |
| 91 | extern void gen_pool_destroy(struct gen_pool *); | 74 | extern void gen_pool_destroy(struct gen_pool *); |
| 92 | extern unsigned long gen_pool_alloc(struct gen_pool *, size_t); | 75 | extern unsigned long gen_pool_alloc_addr(struct gen_pool *, |
| 76 | size_t, unsigned long); | ||
| 77 | /** | ||
| 78 | * gen_pool_alloc - allocate special memory from the pool | ||
| 79 | * @pool: pool to allocate from | ||
| 80 | * @size: number of bytes to allocate from the pool | ||
| 81 | */ | ||
| 82 | static inline unsigned long gen_pool_alloc(struct gen_pool *pool, size_t size) | ||
| 83 | { | ||
| 84 | return gen_pool_alloc_addr(pool, size, 0); | ||
| 85 | } | ||
| 93 | extern void gen_pool_free(struct gen_pool *, unsigned long, size_t); | 86 | extern void gen_pool_free(struct gen_pool *, unsigned long, size_t); |
| 94 | extern void gen_pool_for_each_chunk(struct gen_pool *, | 87 | extern void gen_pool_for_each_chunk(struct gen_pool *, |
| 95 | void (*)(struct gen_pool *, struct gen_pool_chunk *, void *), void *); | 88 | void (*)(struct gen_pool *, struct gen_pool_chunk *, void *), void *); |
| 96 | extern size_t gen_pool_avail(struct gen_pool *); | 89 | extern size_t gen_pool_avail(struct gen_pool *); |
| 97 | extern size_t gen_pool_size(struct gen_pool *); | 90 | extern size_t gen_pool_size(struct gen_pool *); |
| 98 | |||
| 99 | extern void gen_pool_set_algo(struct gen_pool *pool, genpool_algo_t algo, | ||
| 100 | void *data); | ||
| 101 | |||
| 102 | extern unsigned long gen_pool_first_fit(unsigned long *map, unsigned long size, | ||
| 103 | unsigned long start, unsigned int nr, void *data); | ||
| 104 | |||
| 105 | extern unsigned long gen_pool_best_fit(unsigned long *map, unsigned long size, | ||
| 106 | unsigned long start, unsigned int nr, void *data); | ||
| 107 | |||
| 108 | #endif /* __GENALLOC_H__ */ | 91 | #endif /* __GENALLOC_H__ */ |
