Messages in this thread | | | Date | Wed, 13 Sep 2006 09:17:11 -0700 | From | "Randy.Dunlap" <> | Subject | Re: [RFC 1/2] kmemdup: introduce |
| |
On Sat, 9 Sep 2006 05:35:55 +0400 Alexey Dobriyan wrote:
> Not tested yet, this is for semantics commentary. > > include/linux/string.h | 1 + > mm/util.c | 18 ++++++++++++++++++ > 2 files changed, 19 insertions(+) > > --- a/mm/util.c > +++ b/mm/util.c > @@ -40,6 +40,24 @@ char *kstrdup(const char *s, gfp_t gfp) > } > EXPORT_SYMBOL(kstrdup); > > +/** > + * kmemdup - duplicate region of memory > + *
No blank line here, please. kernel-doc "language" doesn't allow that. Hopefully that will be fixed someday.
> + * @src: memory region to duplicate > + * @len: memory region length > + * @gfp: GFP mask to use > + */ > +void *kmemdup(const void *src, size_t len, gfp_t gfp) > +{ > + void *p; > + > + p = ____kmalloc(len, gfp); > + if (p) > + memcpy(p, src, len); > + return p; > +} > +EXPORT_SYMBOL(kmemdup);
--- ~Randy - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |