More changes for a kernel-mode allocator (more to be done)

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5724 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2013-03-09 21:12:20 +00:00
parent 43d8762499
commit 1c52dce216
264 changed files with 1277 additions and 1648 deletions
+3 -3
View File
@@ -151,7 +151,7 @@ int munmap(FAR void *start, size_t length)
/* Get the offset from the beginning of the region and the actual number
* of bytes to "unmap". All mappings must extend to the end of the region.
* There is no support for free a block of memory but leaving a block of
* memory at the end. This is a consequence of using realloc() to
* memory at the end. This is a consequence of using kurealloc() to
* simulate the unmapping.
*/
@@ -186,7 +186,7 @@ int munmap(FAR void *start, size_t length)
/* Then free the region */
kfree(curr);
kufree(curr);
}
/* No.. We have been asked to "unmap' only a portion of the memory
@@ -195,7 +195,7 @@ int munmap(FAR void *start, size_t length)
else
{
newaddr = krealloc(curr->addr, sizeof(struct fs_rammap_s) + length);
newaddr = kurealloc(curr->addr, sizeof(struct fs_rammap_s) + length);
DEBUGASSERT(newaddr == (FAR void*)(curr->addr));
curr->length = length;
}
+3 -3
View File
@@ -139,7 +139,7 @@ FAR void *rammap(int fd, size_t length, off_t offset)
/* Allocate a region of memory of the specified size */
alloc = (FAR uint8_t *)kmalloc(sizeof(struct fs_rammap_s) + length);
alloc = (FAR uint8_t *)kumalloc(sizeof(struct fs_rammap_s) + length);
if (!alloc)
{
fdbg("Region allocation failed, length: %d\n", (int)length);
@@ -232,13 +232,13 @@ FAR void *rammap(int fd, size_t length, off_t offset)
return map->addr;
errout_with_region:
kfree(alloc);
kufree(alloc);
errout:
set_errno(err);
return MAP_FAILED;
errout_with_errno:
kfree(alloc);
kufree(alloc);
return MAP_FAILED;
}