aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Brown <mcb30@etherboot.org>2007-01-16 08:36:42 +0000
committerMichael Brown <mcb30@etherboot.org>2007-01-16 08:36:42 +0000
commit544fa259287a2b919d8ed05bc201a5133032ef05 (patch)
treeff78f4abbfb22c10f45402f98c11e2d5419f5e70 /src
parentff8528ea9a69ca2ef6cfbed0b7a1283e165aabe6 (diff)
downloadipxe-544fa259287a2b919d8ed05bc201a5133032ef05.zip
ipxe-544fa259287a2b919d8ed05bc201a5133032ef05.tar.gz
ipxe-544fa259287a2b919d8ed05bc201a5133032ef05.tar.bz2
Rename e{malloc,realloc,free} to u{malloc,realloc,free}, to more obviously
reflect the fact that they allocate and deallocate user memory (i.e. things reached through a userptr_t).
Diffstat (limited to 'src')
-rw-r--r--src/arch/i386/core/umalloc.c (renamed from src/arch/i386/core/emalloc.c)16
-rw-r--r--src/core/ebuffer.c6
-rw-r--r--src/core/image.c1
-rw-r--r--src/include/gpxe/emalloc.h17
-rw-r--r--src/include/gpxe/umalloc.h17
-rw-r--r--src/tests/umalloc_test.c (renamed from src/tests/emalloc_test.c)14
-rw-r--r--src/usr/fetch.c8
-rw-r--r--src/usr/imgmgmt.c6
8 files changed, 42 insertions, 43 deletions
diff --git a/src/arch/i386/core/emalloc.c b/src/arch/i386/core/umalloc.c
index 09f2beb..5eef508 100644
--- a/src/arch/i386/core/emalloc.c
+++ b/src/arch/i386/core/umalloc.c
@@ -25,7 +25,7 @@
#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 )
@@ -76,14 +76,14 @@ static void ecollect_free ( void ) {
/**
* 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;
@@ -153,17 +153,17 @@ userptr_t erealloc ( userptr_t ptr, size_t new_size ) {
*
* 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 );
}
diff --git a/src/core/ebuffer.c b/src/core/ebuffer.c
index 5abfca7..16d49a1 100644
--- a/src/core/ebuffer.c
+++ b/src/core/ebuffer.c
@@ -25,7 +25,7 @@
#include <errno.h>
#include <gpxe/buffer.h>
-#include <gpxe/emalloc.h>
+#include <gpxe/umalloc.h>
#include <gpxe/ebuffer.h>
/**
@@ -46,7 +46,7 @@ static int ebuffer_expand ( struct buffer *buffer, size_t new_len ) {
actual_len <<= 1;
/* Reallocate buffer */
- new_addr = erealloc ( buffer->addr, actual_len );
+ new_addr = urealloc ( buffer->addr, actual_len );
if ( ! new_addr )
return -ENOMEM;
@@ -63,7 +63,7 @@ static int ebuffer_expand ( struct buffer *buffer, size_t new_len ) {
* @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 ) );
diff --git a/src/core/image.c b/src/core/image.c
index e0e842c..0ff0a70 100644
--- a/src/core/image.c
+++ b/src/core/image.c
@@ -23,7 +23,6 @@
#include <assert.h>
#include <vsprintf.h>
#include <gpxe/list.h>
-#include <gpxe/emalloc.h>
#include <gpxe/image.h>
/** @file
diff --git a/src/include/gpxe/emalloc.h b/src/include/gpxe/emalloc.h
deleted file mode 100644
index cee220d..0000000
--- a/src/include/gpxe/emalloc.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#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 */
diff --git a/src/include/gpxe/umalloc.h b/src/include/gpxe/umalloc.h
new file mode 100644
index 0000000..49ec22b
--- /dev/null
+++ b/src/include/gpxe/umalloc.h
@@ -0,0 +1,17 @@
+#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 */
diff --git a/src/tests/emalloc_test.c b/src/tests/umalloc_test.c
index e8428f5..98de878 100644
--- a/src/tests/emalloc_test.c
+++ b/src/tests/umalloc_test.c
@@ -1,9 +1,9 @@
#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;
@@ -11,15 +11,15 @@ void emalloc_test ( void ) {
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 );
diff --git a/src/usr/fetch.c b/src/usr/fetch.c
index 11197e9..9260a48 100644
--- a/src/usr/fetch.c
+++ b/src/usr/fetch.c
@@ -25,7 +25,7 @@
#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>
@@ -45,9 +45,9 @@
* @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;
@@ -101,7 +101,7 @@ int fetch ( const char *uri_string, userptr_t *data, size_t *len ) {
return 0;
err:
- efree ( buffer.addr );
+ ufree ( buffer.addr );
err_ebuffer_alloc:
free_uri ( uri );
err_parse_uri:
diff --git a/src/usr/imgmgmt.c b/src/usr/imgmgmt.c
index eb2330a..abd48bb 100644
--- a/src/usr/imgmgmt.c
+++ b/src/usr/imgmgmt.c
@@ -21,7 +21,7 @@
#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>
@@ -66,7 +66,7 @@ int imgfetch ( const char *filename, const char *name,
return 0;
err:
- efree ( image->data );
+ ufree ( image->data );
free ( image );
return rc;
}
@@ -139,6 +139,6 @@ void imgstat ( struct image *image ) {
*/
void imgfree ( struct image *image ) {
unregister_image ( image );
- efree ( image->data );
+ ufree ( image->data );
free ( image );
}