eab58da22c
* kern/mm.c (grub_zalloc): New function. (grub_debug_zalloc): Likewise. * include/grub/mm.h: Declare grub_zalloc() and grub_debug_zalloc(). * util/misc.c (grub_zalloc): New function. * bus/usb/uhci.c (grub_uhci_pci_iter): Use grub_zalloc() instead of grub_malloc(), remove unneeded initializations. * bus/usb/usbhub.c (grub_usb_hub_add_dev): Likewise. * commands/extcmd.c (grub_extcmd_dispatcher): Likewise. * commands/parttool.c (grub_cmd_parttool): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_open): Likewise. * disk/raid5_recover.c (grub_raid5_recover): Likewise. * disk/raid6_recover.c (grub_raid6_recover): Likewise. * disk/usbms.c (grub_usbms_finddevs): Likewise. * efiemu/mm.c (grub_efiemu_request_memalign): Likewise. * efiemu/pnvram.c (grub_efiemu_pnvram): Likewise. (grub_cmd_efiemu_pnvram): Likewise. * fs/i386/pc/pxe.c (grub_pxefs_open): Likewise. * fs/iso9660.c (grub_iso9660_mount): Likewise. (grub_iso9660_iterate_dir): Likewise. * fs/jfs.c (grub_jfs_opendir): Likewise. * fs/ntfs.c (list_file): Likewise. (grub_ntfs_mount): Likewise. * kern/disk.c (grub_disk_open): Likewise. * kern/dl.c (grub_dl_load_core): Likewise. * kern/elf.c (grub_elf_file): Likewise. * kern/env.c (grub_env_context_open): Likewise. (grub_env_set): Likewise. (grub_env_set_data_slot): Likewise. * kern/file.c (grub_file_open): Likewise. * kern/fs.c (grub_fs_blocklist_open): Likewise. * loader/i386/multiboot.c (grub_module): Likewise. * loader/xnu.c (grub_xnu_create_key): Likewise. (grub_xnu_create_value): Likewise. * normal/main.c (grub_normal_add_menu_entry): Likewise. (read_config_file): Likewise. * normal/menu_entry.c (make_screen): Likewise. * partmap/sun.c (sun_partition_map_iterate): Likewise. * script/sh/lexer.c (grub_script_lexer_init): Likewise. * script/sh/script.c (grub_script_parse): Likewise. * video/bitmap.c (grub_video_bitmap_create): Likewise. * video/readers/jpeg.c (grub_video_reader_jpeg): Likewise. * video/readers/png.c (grub_png_output_byte): Likewise. (grub_video_reader_png): Likewise.
72 lines
2.4 KiB
C
72 lines
2.4 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 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* GRUB 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, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#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_zalloc) (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_zalloc(size) \
|
|
grub_debug_zalloc (__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_zalloc) (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 */
|