iPXE
umalloc.h File Reference

User memory allocation. More...

#include <stddef.h>
#include <ipxe/api.h>
#include <ipxe/malloc.h>
#include <config/umalloc.h>
#include <ipxe/uheap.h>
#include <ipxe/efi/efi_umalloc.h>
#include <ipxe/linux/linux_umalloc.h>
#include <bits/umalloc.h>

Go to the source code of this file.

Macros

#define PROVIDE_UMALLOC(_subsys, _api_func, _func)
 Provide a user memory allocation API implementation.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 FILE_SECBOOT (PERMITTED)
void * urealloc (void *ptr, size_t new_size)
 Reallocate external memory.
static __always_inline void * umalloc (size_t size)
 Allocate external memory.
static __always_inline void ufree (void *ptr)
 Free external memory.

Detailed Description

User memory allocation.

Definition in file umalloc.h.

Macro Definition Documentation

◆ PROVIDE_UMALLOC

#define PROVIDE_UMALLOC ( _subsys,
_api_func,
_func )
Value:
PROVIDE_SINGLE_API ( UMALLOC_PREFIX_ ## _subsys, _api_func, _func )
#define PROVIDE_SINGLE_API(_prefix, _api_func, _func)
Provide an API implementation.
Definition api.h:55

Provide a user memory allocation API implementation.

Parameters
_prefixSubsystem prefix
_api_funcAPI function
_funcImplementing function

Definition at line 26 of file umalloc.h.

26#define PROVIDE_UMALLOC( _subsys, _api_func, _func ) \
27 PROVIDE_SINGLE_API ( UMALLOC_PREFIX_ ## _subsys, _api_func, _func )

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED )

◆ urealloc()

void * urealloc ( void * ptr,
size_t new_size )

Reallocate external memory.

Parameters
old_ptrMemory previously allocated by umalloc(), or NULL
new_sizeRequested size
Return values
new_ptrAllocated memory, or NULL

Calling realloc() with a new size of zero is a valid way to free a memory block.

Referenced by fdt_urealloc(), image_set_len(), PROVIDE_UMALLOC(), PROVIDE_UMALLOC(), ufree(), umalloc(), and xferbuf_umalloc_realloc().

◆ umalloc()

__always_inline void * umalloc ( size_t size)
inlinestatic

Allocate external memory.

Parameters
sizeRequested size
Return values
ptrMemory, or NULL

Memory is guaranteed to be aligned to a page boundary.

Definition at line 57 of file umalloc.h.

57 {
58 return urealloc ( NULL, size );
59}
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
uint16_t size
Buffer size.
Definition dwmac.h:3
void * urealloc(void *ptr, size_t new_size)
Reallocate external memory.

References __always_inline, NULL, size, and urealloc().

Referenced by alloc_pixbuf(), arbel_alloc_icm(), arbel_start_firmware(), efifb_glyphs(), exanic_probe_port(), fbcon_init(), fbcon_picture_init(), fdt_create(), golan_provide_pages(), hermon_map_icm(), hermon_start_firmware(), netvsc_create_buffer(), nii_initialise_flags(), png_image_header(), txnic_alloc(), and ucode_update_all().

◆ ufree()

__always_inline void ufree ( void * ptr)
inlinestatic