diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2006-09-27 04:49:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-27 11:26:11 -0400 |
commit | 133d205a18b7a4d8cb52959c5310f6664277cf61 (patch) | |
tree | be3056dedc3190d06647a07425e8fcdcce5da868 | |
parent | 1a1d92c10dd24bbdc28b3d6e2d03ec199dd3a65b (diff) |
[PATCH] Make kmem_cache_destroy() return void
un-, de-, -free, -destroy, -exit, etc functions should in general return
void. Also,
There is very little, say, filesystem driver code can do upon failed
kmem_cache_destroy(). If it will be decided to BUG in this case, BUG
should be put in generic code, instead.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | include/linux/slab.h | 4 | ||||
-rw-r--r-- | mm/slab.c | 6 | ||||
-rw-r--r-- | mm/slob.c | 3 |
3 files changed, 5 insertions, 8 deletions
diff --git a/include/linux/slab.h b/include/linux/slab.h index 66d6eb78d1c6..a96fd9310d55 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
@@ -60,7 +60,7 @@ extern void __init kmem_cache_init(void); | |||
60 | extern kmem_cache_t *kmem_cache_create(const char *, size_t, size_t, unsigned long, | 60 | extern kmem_cache_t *kmem_cache_create(const char *, size_t, size_t, unsigned long, |
61 | void (*)(void *, kmem_cache_t *, unsigned long), | 61 | void (*)(void *, kmem_cache_t *, unsigned long), |
62 | void (*)(void *, kmem_cache_t *, unsigned long)); | 62 | void (*)(void *, kmem_cache_t *, unsigned long)); |
63 | extern int kmem_cache_destroy(kmem_cache_t *); | 63 | extern void kmem_cache_destroy(kmem_cache_t *); |
64 | extern int kmem_cache_shrink(kmem_cache_t *); | 64 | extern int kmem_cache_shrink(kmem_cache_t *); |
65 | extern void *kmem_cache_alloc(kmem_cache_t *, gfp_t); | 65 | extern void *kmem_cache_alloc(kmem_cache_t *, gfp_t); |
66 | extern void *kmem_cache_zalloc(struct kmem_cache *, gfp_t); | 66 | extern void *kmem_cache_zalloc(struct kmem_cache *, gfp_t); |
@@ -249,7 +249,7 @@ struct kmem_cache *kmem_cache_create(const char *c, size_t, size_t, | |||
249 | unsigned long, | 249 | unsigned long, |
250 | void (*)(void *, struct kmem_cache *, unsigned long), | 250 | void (*)(void *, struct kmem_cache *, unsigned long), |
251 | void (*)(void *, struct kmem_cache *, unsigned long)); | 251 | void (*)(void *, struct kmem_cache *, unsigned long)); |
252 | int kmem_cache_destroy(struct kmem_cache *c); | 252 | void kmem_cache_destroy(struct kmem_cache *c); |
253 | void *kmem_cache_alloc(struct kmem_cache *c, gfp_t flags); | 253 | void *kmem_cache_alloc(struct kmem_cache *c, gfp_t flags); |
254 | void *kmem_cache_zalloc(struct kmem_cache *, gfp_t); | 254 | void *kmem_cache_zalloc(struct kmem_cache *, gfp_t); |
255 | void kmem_cache_free(struct kmem_cache *c, void *b); | 255 | void kmem_cache_free(struct kmem_cache *c, void *b); |
@@ -2442,7 +2442,6 @@ EXPORT_SYMBOL(kmem_cache_shrink); | |||
2442 | * @cachep: the cache to destroy | 2442 | * @cachep: the cache to destroy |
2443 | * | 2443 | * |
2444 | * Remove a struct kmem_cache object from the slab cache. | 2444 | * Remove a struct kmem_cache object from the slab cache. |
2445 | * Returns 0 on success. | ||
2446 | * | 2445 | * |
2447 | * It is expected this function will be called by a module when it is | 2446 | * It is expected this function will be called by a module when it is |
2448 | * unloaded. This will remove the cache completely, and avoid a duplicate | 2447 | * unloaded. This will remove the cache completely, and avoid a duplicate |
@@ -2454,7 +2453,7 @@ EXPORT_SYMBOL(kmem_cache_shrink); | |||
2454 | * The caller must guarantee that noone will allocate memory from the cache | 2453 | * The caller must guarantee that noone will allocate memory from the cache |
2455 | * during the kmem_cache_destroy(). | 2454 | * during the kmem_cache_destroy(). |
2456 | */ | 2455 | */ |
2457 | int kmem_cache_destroy(struct kmem_cache *cachep) | 2456 | void kmem_cache_destroy(struct kmem_cache *cachep) |
2458 | { | 2457 | { |
2459 | BUG_ON(!cachep || in_interrupt()); | 2458 | BUG_ON(!cachep || in_interrupt()); |
2460 | 2459 | ||
@@ -2475,7 +2474,7 @@ int kmem_cache_destroy(struct kmem_cache *cachep) | |||
2475 | list_add(&cachep->next, &cache_chain); | 2474 | list_add(&cachep->next, &cache_chain); |
2476 | mutex_unlock(&cache_chain_mutex); | 2475 | mutex_unlock(&cache_chain_mutex); |
2477 | unlock_cpu_hotplug(); | 2476 | unlock_cpu_hotplug(); |
2478 | return 1; | 2477 | return; |
2479 | } | 2478 | } |
2480 | 2479 | ||
2481 | if (unlikely(cachep->flags & SLAB_DESTROY_BY_RCU)) | 2480 | if (unlikely(cachep->flags & SLAB_DESTROY_BY_RCU)) |
@@ -2483,7 +2482,6 @@ int kmem_cache_destroy(struct kmem_cache *cachep) | |||
2483 | 2482 | ||
2484 | __kmem_cache_destroy(cachep); | 2483 | __kmem_cache_destroy(cachep); |
2485 | unlock_cpu_hotplug(); | 2484 | unlock_cpu_hotplug(); |
2486 | return 0; | ||
2487 | } | 2485 | } |
2488 | EXPORT_SYMBOL(kmem_cache_destroy); | 2486 | EXPORT_SYMBOL(kmem_cache_destroy); |
2489 | 2487 | ||
@@ -270,10 +270,9 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size, | |||
270 | } | 270 | } |
271 | EXPORT_SYMBOL(kmem_cache_create); | 271 | EXPORT_SYMBOL(kmem_cache_create); |
272 | 272 | ||
273 | int kmem_cache_destroy(struct kmem_cache *c) | 273 | void kmem_cache_destroy(struct kmem_cache *c) |
274 | { | 274 | { |
275 | slob_free(c, sizeof(struct kmem_cache)); | 275 | slob_free(c, sizeof(struct kmem_cache)); |
276 | return 0; | ||
277 | } | 276 | } |
278 | EXPORT_SYMBOL(kmem_cache_destroy); | 277 | EXPORT_SYMBOL(kmem_cache_destroy); |
279 | 278 | ||