reflect the fact that they allocate and deallocate user memory (i.e.
things reached through a userptr_t).
#include <gpxe/uaccess.h>
#include <gpxe/hidemem.h>
-#include <gpxe/emalloc.h>
+#include <gpxe/umalloc.h>
/** Alignment of external allocated memory */
#define EM_ALIGN ( 4 * 1024 )
/**
* Reallocate external memory
*
- * @v old_ptr Memory previously allocated by emalloc(), or UNULL
+ * @v old_ptr Memory previously allocated by umalloc(), or UNULL
* @v new_size Requested size
* @ret new_ptr Allocated memory, or UNULL
*
* Calling realloc() with a new size of zero is a valid way to free a
* memory block.
*/
-userptr_t erealloc ( userptr_t ptr, size_t new_size ) {
+userptr_t urealloc ( userptr_t ptr, size_t new_size ) {
struct external_memory extmem;
userptr_t new = ptr;
size_t align;
*
* Memory is guaranteed to be aligned to a page boundary.
*/
-userptr_t emalloc ( size_t size ) {
- return erealloc ( UNULL, size );
+userptr_t umalloc ( size_t size ) {
+ return urealloc ( UNULL, size );
}
/**
* Free external memory
*
- * @v ptr Memory allocated by emalloc(), or UNULL
+ * @v ptr Memory allocated by umalloc(), or UNULL
*
* If @c ptr is UNULL, no action is taken.
*/
-void efree ( userptr_t ptr ) {
- erealloc ( ptr, 0 );
+void ufree ( userptr_t ptr ) {
+ urealloc ( ptr, 0 );
}
#include <errno.h>
#include <gpxe/buffer.h>
-#include <gpxe/emalloc.h>
+#include <gpxe/umalloc.h>
#include <gpxe/ebuffer.h>
/**
actual_len <<= 1;
/* Reallocate buffer */
- new_addr = erealloc ( buffer->addr, actual_len );
+ new_addr = urealloc ( buffer->addr, actual_len );
if ( ! new_addr )
return -ENOMEM;
* @ret rc Return status code
*
* Allocates space for the buffer and stores it in @c buffer->addr.
- * The space must eventually be freed by calling efree(buffer->addr).
+ * The space must eventually be freed by calling ufree(buffer->addr).
*/
int ebuffer_alloc ( struct buffer *buffer, size_t len ) {
memset ( buffer, 0, sizeof ( *buffer ) );
#include <assert.h>
#include <vsprintf.h>
#include <gpxe/list.h>
-#include <gpxe/emalloc.h>
#include <gpxe/image.h>
/** @file
+++ /dev/null
-#ifndef _GPXE_EMALLOC_H
-#define _GPXE_EMALLOC_H
-
-/**
- * @file
- *
- * External memory allocation
- *
- */
-
-#include <gpxe/uaccess.h>
-
-extern userptr_t emalloc ( size_t size );
-extern userptr_t erealloc ( userptr_t ptr, size_t new_size );
-extern void efree ( userptr_t ptr );
-
-#endif /* _GPXE_EMALLOC_H */
--- /dev/null
+#ifndef _GPXE_UMALLOC_H
+#define _GPXE_UMALLOC_H
+
+/**
+ * @file
+ *
+ * User memory allocation
+ *
+ */
+
+#include <gpxe/uaccess.h>
+
+extern userptr_t umalloc ( size_t size );
+extern userptr_t urealloc ( userptr_t ptr, size_t new_size );
+extern void ufree ( userptr_t ptr );
+
+#endif /* _GPXE_UMALLOC_H */
#include <vsprintf.h>
#include <gpxe/uaccess.h>
-#include <gpxe/emalloc.h>
+#include <gpxe/umalloc.h>
#include <gpxe/memmap.h>
-void emalloc_test ( void ) {
+void umalloc_test ( void ) {
struct memory_map memmap;
userptr_t bob;
userptr_t fred;
printf ( "Before allocation:\n" );
get_memmap ( &memmap );
- bob = emalloc ( 1234 );
- bob = erealloc ( bob, 12345 );
- fred = emalloc ( 999 );
+ bob = ymalloc ( 1234 );
+ bob = yrealloc ( bob, 12345 );
+ fred = ymalloc ( 999 );
printf ( "After allocation:\n" );
get_memmap ( &memmap );
- efree ( bob );
- efree ( fred );
+ ufree ( bob );
+ ufree ( fred );
printf ( "After freeing:\n" );
get_memmap ( &memmap );
#include <errno.h>
#include <vsprintf.h>
-#include <gpxe/emalloc.h>
+#include <gpxe/umalloc.h>
#include <gpxe/ebuffer.h>
#include <gpxe/image.h>
#include <gpxe/uri.h>
* @ret len Length of loaded file
* @ret rc Return status code
*
- * Fetch file to an external buffer allocated with emalloc(). The
+ * Fetch file to an external buffer allocated with umalloc(). The
* caller is responsible for eventually freeing the buffer with
- * efree().
+ * ufree().
*/
int fetch ( const char *uri_string, userptr_t *data, size_t *len ) {
struct uri *uri;
return 0;
err:
- efree ( buffer.addr );
+ ufree ( buffer.addr );
err_ebuffer_alloc:
free_uri ( uri );
err_parse_uri:
#include <errno.h>
#include <vsprintf.h>
#include <gpxe/image.h>
-#include <gpxe/emalloc.h>
+#include <gpxe/umalloc.h>
#include <usr/fetch.h>
#include <usr/imgmgmt.h>
return 0;
err:
- efree ( image->data );
+ ufree ( image->data );
free ( image );
return rc;
}
*/
void imgfree ( struct image *image ) {
unregister_image ( image );
- efree ( image->data );
+ ufree ( image->data );
free ( image );
}