summaryrefslogtreecommitdiff
path: root/nuttx/fs
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-04-06 16:40:47 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-04-06 16:40:47 +0000
commit4011b03fa6a6a7889efea3451a3a125faa72c7fc (patch)
treec6a1b2ba8ef824b137cd423a245a8cb1c35a0786 /nuttx/fs
parente888bb3a55e974475a87fee0371f4405ddab696e (diff)
downloadpx4-nuttx-4011b03fa6a6a7889efea3451a3a125faa72c7fc.tar.gz
px4-nuttx-4011b03fa6a6a7889efea3451a3a125faa72c7fc.tar.bz2
px4-nuttx-4011b03fa6a6a7889efea3451a3a125faa72c7fc.zip
Fixes for kernel stub builds
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3473 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/fs')
-rw-r--r--nuttx/fs/fat/fs_fat32.c21
-rw-r--r--nuttx/fs/fat/fs_fat32util.c5
2 files changed, 14 insertions, 12 deletions
diff --git a/nuttx/fs/fat/fs_fat32.c b/nuttx/fs/fat/fs_fat32.c
index e109ca75d..640292145 100644
--- a/nuttx/fs/fat/fs_fat32.c
+++ b/nuttx/fs/fat/fs_fat32.c
@@ -58,6 +58,7 @@
#include <errno.h>
#include <debug.h>
+#include <nuttx/kmalloc.h>
#include <nuttx/fs.h>
#include <nuttx/fat.h>
#include <nuttx/dirent.h>
@@ -286,7 +287,7 @@ static int fat_open(FAR struct file *filep, const char *relpath,
* file.
*/
- ff = (struct fat_file_s *)zalloc(sizeof(struct fat_file_s));
+ ff = (struct fat_file_s *)kzalloc(sizeof(struct fat_file_s));
if (!ff)
{
ret = -ENOMEM;
@@ -295,7 +296,7 @@ static int fat_open(FAR struct file *filep, const char *relpath,
/* Create a file buffer to support partial sector accesses */
- ff->ff_buffer = (uint8_t*)malloc(fs->fs_hwsectorsize);
+ ff->ff_buffer = (uint8_t*)kmalloc(fs->fs_hwsectorsize);
if (!ff->ff_buffer)
{
ret = -ENOMEM;
@@ -344,7 +345,7 @@ static int fat_open(FAR struct file *filep, const char *relpath,
ssize_t offset = (ssize_t)fat_seek(filep, ff->ff_size, SEEK_SET);
if (offset < 0)
{
- free(ff);
+ kfree(ff);
return (int)offset;
}
}
@@ -356,7 +357,7 @@ static int fat_open(FAR struct file *filep, const char *relpath,
*/
errout_with_struct:
- free(ff);
+ kfree(ff);
errout_with_semaphore:
fat_semgive(fs);
@@ -402,12 +403,12 @@ static int fat_close(FAR struct file *filep)
if (ff->ff_buffer)
{
- free(ff->ff_buffer);
+ kfree(ff->ff_buffer);
}
/* Then free the file structure itself. */
- free(ff);
+ kfree(ff);
filep->f_priv = NULL;
return ret;
}
@@ -1491,7 +1492,7 @@ static int fat_bind(FAR struct inode *blkdriver, const void *data,
/* Create an instance of the mountpt state structure */
- fs = (struct fat_mountpt_s *)zalloc(sizeof(struct fat_mountpt_s));
+ fs = (struct fat_mountpt_s *)kzalloc(sizeof(struct fat_mountpt_s));
if (!fs)
{
return -ENOMEM;
@@ -1513,7 +1514,7 @@ static int fat_bind(FAR struct inode *blkdriver, const void *data,
if (ret != 0)
{
sem_destroy(&fs->fs_sem);
- free(fs);
+ kfree(fs);
return ret;
}
@@ -1581,9 +1582,9 @@ static int fat_unbind(void *handle, FAR struct inode **blkdriver)
if (fs->fs_buffer)
{
- free(fs->fs_buffer);
+ kfree(fs->fs_buffer);
}
- free(fs);
+ kfree(fs);
}
fat_semgive(fs);
diff --git a/nuttx/fs/fat/fs_fat32util.c b/nuttx/fs/fat/fs_fat32util.c
index 3233ec707..aa327543b 100644
--- a/nuttx/fs/fat/fs_fat32util.c
+++ b/nuttx/fs/fat/fs_fat32util.c
@@ -56,6 +56,7 @@
#include <errno.h>
#include <debug.h>
+#include <nuttx/kmalloc.h>
#include <nuttx/fs.h>
#include <nuttx/fat.h>
@@ -626,7 +627,7 @@ int fat_mount(struct fat_mountpt_s *fs, bool writeable)
/* Allocate a buffer to hold one hardware sector */
- fs->fs_buffer = (uint8_t*)malloc(fs->fs_hwsectorsize);
+ fs->fs_buffer = (uint8_t*)kmalloc(fs->fs_hwsectorsize);
if (!fs->fs_buffer)
{
ret = -ENOMEM;
@@ -724,7 +725,7 @@ int fat_mount(struct fat_mountpt_s *fs, bool writeable)
return OK;
errout_with_buffer:
- free(fs->fs_buffer);
+ kfree(fs->fs_buffer);
fs->fs_buffer = 0;
errout:
fs->fs_mounted = false;