mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@xenotime.net>
To: Steve Wise <swise@opengridcomputing.com>
Cc: linux-kernel@vger.kernel.org, dcn@sgi.com,
	jes@trained-monkey.org, avolkov@varma-el.com
Subject: Re: [PATCH 2.6.18 ] LIB Add gen_pool_destroy().
Date: Wed, 27 Sep 2006 08:51:23 -0700	[thread overview]
Message-ID: <20060927085123.99749d2c.rdunlap@xenotime.net> (raw)
In-Reply-To: <20060927153545.28235.76214.stgit@dell3.ogc.int>

On Wed, 27 Sep 2006 10:35:45 -0500 Steve Wise wrote:

> Modules using the genpool allocator need to be able to destroy the data
> structure when unloading.
> 
> Signed-off-by: Steve Wise <swise@opengridcomputing.com>
> ---
> 
>  include/linux/genalloc.h |    1 +
>  lib/genalloc.c           |   22 ++++++++++++++++++++++
>  2 files changed, 23 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h
> index 690c428..ca2b119 100644
> --- a/include/linux/genalloc.h
> +++ b/include/linux/genalloc.h
> @@ -30,6 +30,7 @@ struct gen_pool_chunk {
>  };
>  
>  extern struct gen_pool *gen_pool_create(int, int);
> +extern void gen_pool_destroy(struct gen_pool *);
>  extern int gen_pool_add(struct gen_pool *, unsigned long, size_t, int);
>  extern unsigned long gen_pool_alloc(struct gen_pool *, size_t);
>  extern void gen_pool_free(struct gen_pool *, unsigned long, size_t);
> diff --git a/lib/genalloc.c b/lib/genalloc.c
> index 71338b4..c8afa10 100644
> --- a/lib/genalloc.c
> +++ b/lib/genalloc.c
> @@ -36,6 +36,28 @@ EXPORT_SYMBOL(gen_pool_create);
>  
>  
>  /*
> + * Destroy a memory pool.  Assumes the user deals with releasing the
> + * actual memory managed by the pool.  
> + *
> + * @pool: pool to destroy.
> + *
> + */

Please use kernel-doc for exported kernel interfaces.
See Documentation/kernel-doc-nano-HOWTO.txt for info,
and/or see some file like kernel/printk.c for examples.

> +void gen_pool_destroy(struct gen_pool *pool)
> +{
> +	struct list_head *_chunk, *next;
> +	struct gen_pool_chunk *chunk;
> +
> +	list_for_each_safe(_chunk, next, &pool->chunks) {
> +		chunk = list_entry(_chunk, struct gen_pool_chunk, next_chunk);
> +		kfree(chunk);
> +	}
> +	kfree(pool);
> +	return;
> +}
> +EXPORT_SYMBOL(gen_pool_destroy);
> +
> +
> +/*
>   * Add a new chunk of memory to the specified pool.
>   *
>   * @pool: pool to add new memory chunk to
> -

argh.  more.  (not part of your patch)

---
~Randy

  reply	other threads:[~2006-09-27 15:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-27 15:35 Steve Wise
2006-09-27 15:51 ` Randy Dunlap [this message]
2006-09-27 15:53   ` Steve Wise
2006-09-27 15:56     ` Randy Dunlap
2006-09-27 19:59       ` Dean Nelson
2006-09-27 20:27         ` Randy Dunlap
2006-09-28 17:24           ` [PATCH] make genpool allocator adhere to kernel-doc standards Dean Nelson
2006-09-28 17:48             ` Randy Dunlap
2006-09-28 18:17               ` Dean Nelson
2006-09-27 19:51 ` [PATCH 2.6.18 ] LIB Add gen_pool_destroy() Dean Nelson
2006-09-27 21:09   ` Steve Wise
2006-09-28 13:16     ` [PATCH] add gen_pool_destroy() Dean Nelson
2006-09-28 14:51       ` Robin Holt
2006-09-28 15:48         ` Dean Nelson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060927085123.99749d2c.rdunlap@xenotime.net \
    --to=rdunlap@xenotime.net \
    --cc=avolkov@varma-el.com \
    --cc=dcn@sgi.com \
    --cc=jes@trained-monkey.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=swise@opengridcomputing.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®