[OpenBIOS] [PATCH 2/6] Introduce ofmem_posix_memalign() function for arbitrary alignment.

Blue Swirl blauwirbel at gmail.com
Wed Dec 29 19:56:25 CET 2010


On Wed, Dec 29, 2010 at 11:07 AM, Mark Cave-Ayland
<mark.cave-ayland at siriusit.co.uk> wrote:
> Rework ofmem_malloc() so that it takes a parameter specifying the alignment for the allocation and then change the API
> to match that of posix_memalign(). Then create ofmem_malloc() as a simple wrapper function onto ofmem_posix_memalign()
> using a default alignment of CONFIG_OFMEM_MALLOC_ALIGN.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at siriusit.co.uk>
> ---
>  openbios-devel/include/libopenbios/ofmem.h |    1 +
>  openbios-devel/libopenbios/ofmem_common.c  |   32 +++++++++++++++++++++------
>  2 files changed, 26 insertions(+), 7 deletions(-)
>
> diff --git a/openbios-devel/include/libopenbios/ofmem.h b/openbios-devel/include/libopenbios/ofmem.h
> index 7b49e48..3d8ddbf 100644
> --- a/openbios-devel/include/libopenbios/ofmem.h
> +++ b/openbios-devel/include/libopenbios/ofmem.h
> @@ -80,6 +80,7 @@ extern inline phys_addr_t va2pa(unsigned long va);
>  extern inline unsigned long pa2va(phys_addr_t pa);
>
>  /* malloc interface */
> +extern int ofmem_posix_memalign( void **memptr, int alignment, size_t size );

Actually the API for posix_memalign uses size_t for alignment.



More information about the OpenBIOS mailing list