grub2/include/grub/mm.h
hollisb 3ce27299eb 2007-02-20 Hollis Blanchard <hollis@penguinppc.org>
* kern/mm.c: Update copyright.
	(grub_mm_debug): Correct syntax error.
	(grub_mm_dump_free): New function.
	(grub_debug_free): Call `grub_free'.
	* include/grub/mm.h: Update copyright.
	(grub_mm_dump_free): Add declaration.
2007-02-20 22:39:57 +00:00

68 lines
2.3 KiB
C

/* mm.h - prototypes and declarations for memory manager */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2007 Free Software Foundation, Inc.
*
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef GRUB_MM_H
#define GRUB_MM_H 1
#include <grub/types.h>
#include <grub/symbol.h>
#include <config.h>
#ifndef NULL
# define NULL ((void *) 0)
#endif
void grub_mm_init_region (void *addr, grub_size_t size);
void *EXPORT_FUNC(grub_malloc) (grub_size_t size);
void EXPORT_FUNC(grub_free) (void *ptr);
void *EXPORT_FUNC(grub_realloc) (void *ptr, grub_size_t size);
void *EXPORT_FUNC(grub_memalign) (grub_size_t align, grub_size_t size);
/* For debugging. */
#if defined(MM_DEBUG) && !defined(GRUB_UTIL)
/* Set this variable to 1 when you want to trace all memory function calls. */
extern int EXPORT_VAR(grub_mm_debug);
void grub_mm_dump_free (void);
void grub_mm_dump (unsigned lineno);
#define grub_malloc(size) \
grub_debug_malloc (__FILE__, __LINE__, size)
#define grub_realloc(ptr,size) \
grub_debug_realloc (__FILE__, __LINE__, ptr, size)
#define grub_memalign(align,size) \
grub_debug_memalign (__FILE__, __LINE__, align, size)
#define grub_free(ptr) \
grub_debug_free (__FILE__, __LINE__, ptr)
void *EXPORT_FUNC(grub_debug_malloc) (const char *file, int line,
grub_size_t size);
void EXPORT_FUNC(grub_debug_free) (const char *file, int line, void *ptr);
void *EXPORT_FUNC(grub_debug_realloc) (const char *file, int line, void *ptr,
grub_size_t size);
void *EXPORT_FUNC(grub_debug_memalign) (const char *file, int line,
grub_size_t align, grub_size_t size);
#endif /* MM_DEBUG && ! GRUB_UTIL */
#endif /* ! GRUB_MM_H */