summaryrefslogtreecommitdiff
path: root/nuttx/fs
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/fs')
-rw-r--r--nuttx/fs/fs_closedir.c8
-rw-r--r--nuttx/fs/fs_fdopen.c4
-rw-r--r--nuttx/fs/fs_inode.c8
-rw-r--r--nuttx/fs/fs_inoderelease.c5
-rw-r--r--nuttx/fs/fs_inoderemove.c5
-rw-r--r--nuttx/fs/fs_inodereserve.c7
-rw-r--r--nuttx/fs/fs_opendir.c6
-rw-r--r--nuttx/fs/fs_select.c6
8 files changed, 26 insertions, 23 deletions
diff --git a/nuttx/fs/fs_closedir.c b/nuttx/fs/fs_closedir.c
index bfc4f5249..d88bc3347 100644
--- a/nuttx/fs/fs_closedir.c
+++ b/nuttx/fs/fs_closedir.c
@@ -39,10 +39,10 @@
#include <nuttx/config.h>
-#include <stdlib.h>
#include <dirent.h>
#include <errno.h>
+#include <nuttx/kmalloc.h>
#include <nuttx/fs.h>
#include <nuttx/dirent.h>
@@ -134,17 +134,17 @@ int closedir(FAR DIR *dirp)
/* Then release the container */
- free(idir);
+ kfree(idir);
return OK;
#ifndef CONFIG_DISABLE_MOUNTPOINT
errout_with_inode:
inode_release(inode);
- free(idir);
+ kfree(idir);
#endif
errout:
- *get_errno_ptr() = ret;
+ errno = ret;
return ERROR;
}
diff --git a/nuttx/fs/fs_fdopen.c b/nuttx/fs/fs_fdopen.c
index d0a44f9e8..9445e97fa 100644
--- a/nuttx/fs/fs_fdopen.c
+++ b/nuttx/fs/fs_fdopen.c
@@ -40,12 +40,12 @@
#include <nuttx/config.h>
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
#include <semaphore.h>
#include <fcntl.h>
#include <errno.h>
+#include <nuttx/kmalloc.h>
#include <nuttx/fs.h>
/****************************************************************************
@@ -145,7 +145,7 @@ FAR struct file_struct *fs_fdopen(int fd, int oflags, FAR _TCB *tcb)
/* Allocate the IO buffer */
- stream->fs_bufstart = malloc(CONFIG_STDIO_BUFFER_SIZE);
+ stream->fs_bufstart = kmalloc(CONFIG_STDIO_BUFFER_SIZE);
if (!stream)
{
err = ENOMEM;
diff --git a/nuttx/fs/fs_inode.c b/nuttx/fs/fs_inode.c
index f0d6b6948..6bbdea287 100644
--- a/nuttx/fs/fs_inode.c
+++ b/nuttx/fs/fs_inode.c
@@ -1,7 +1,7 @@
/****************************************************************************
- * fs_inode.c
+ * fs/fs_inode.c
*
- * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -179,7 +179,7 @@ void inode_semtake(void)
* the wait was awakened by a signal.
*/
- ASSERT(*get_errno_ptr() == EINTR);
+ ASSERT(errno == EINTR);
}
}
@@ -308,7 +308,7 @@ void inode_free(FAR struct inode *node)
{
inode_free(node->i_peer);
inode_free(node->i_child);
- free(node);
+ kfree(node);
}
}
diff --git a/nuttx/fs/fs_inoderelease.c b/nuttx/fs/fs_inoderelease.c
index db114c936..58aaf3659 100644
--- a/nuttx/fs/fs_inoderelease.c
+++ b/nuttx/fs/fs_inoderelease.c
@@ -39,8 +39,9 @@
#include <nuttx/config.h>
-#include <stdlib.h>
#include <errno.h>
+
+#include <nuttx/kmalloc.h>
#include <nuttx/fs.h>
#include "fs_internal.h"
@@ -95,7 +96,7 @@ void inode_release(FAR struct inode *node)
{
inode_semgive();
inode_free(node->i_child);
- free(node);
+ kfree(node);
}
else
{
diff --git a/nuttx/fs/fs_inoderemove.c b/nuttx/fs/fs_inoderemove.c
index ff8dcc2ee..cdc61f66a 100644
--- a/nuttx/fs/fs_inoderemove.c
+++ b/nuttx/fs/fs_inoderemove.c
@@ -39,8 +39,9 @@
#include <nuttx/config.h>
-#include <stdlib.h>
#include <errno.h>
+
+#include <nuttx/kmalloc.h>
#include <nuttx/fs.h>
#include "fs_internal.h"
@@ -144,7 +145,7 @@ int inode_remove(const char *path)
/* And delete it now -- recursively to delete all of its children */
inode_free(node->i_child);
- free(node);
+ kfree(node);
return OK;
}
}
diff --git a/nuttx/fs/fs_inodereserve.c b/nuttx/fs/fs_inodereserve.c
index f38e349bc..da73b0ac9 100644
--- a/nuttx/fs/fs_inodereserve.c
+++ b/nuttx/fs/fs_inodereserve.c
@@ -1,7 +1,7 @@
/****************************************************************************
* fs/fs_registerreserve.c
*
- * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -39,8 +39,9 @@
#include <nuttx/config.h>
-#include <stdlib.h>
#include <errno.h>
+
+#include <nuttx/kmalloc.h>
#include <nuttx/fs.h>
#include "fs_internal.h"
@@ -89,7 +90,7 @@ static void inode_namecpy(char *dest, const char *src)
static FAR struct inode *inode_alloc(const char *name)
{
int namelen = inode_namelen(name);
- FAR struct inode *node = (FAR struct inode*)zalloc(FSNODE_SIZE(namelen));
+ FAR struct inode *node = (FAR struct inode*)kzalloc(FSNODE_SIZE(namelen));
if (node)
{
inode_namecpy(node->i_name, name);
diff --git a/nuttx/fs/fs_opendir.c b/nuttx/fs/fs_opendir.c
index 0b164734b..b0aae94f6 100644
--- a/nuttx/fs/fs_opendir.c
+++ b/nuttx/fs/fs_opendir.c
@@ -39,13 +39,13 @@
#include <nuttx/config.h>
-#include <stdlib.h>
#include <stdbool.h>
#include <dirent.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
+#include <nuttx/kmalloc.h>
#include <nuttx/fs.h>
#include <nuttx/dirent.h>
@@ -235,7 +235,7 @@ FAR DIR *opendir(FAR const char *path)
* container.
*/
- dir = (FAR struct fs_dirent_s *)zalloc(sizeof(struct fs_dirent_s));
+ dir = (FAR struct fs_dirent_s *)kzalloc(sizeof(struct fs_dirent_s));
if (!dir)
{
/* Insufficient memory to complete the operation.*/
@@ -306,7 +306,7 @@ FAR DIR *opendir(FAR const char *path)
/* Nasty goto's make error handling simpler */
errout_with_direntry:
- free(dir);
+ kfree(dir);
errout_with_semaphore:
inode_semgive();
diff --git a/nuttx/fs/fs_select.c b/nuttx/fs/fs_select.c
index 57f5c36fe..213530e44 100644
--- a/nuttx/fs/fs_select.c
+++ b/nuttx/fs/fs_select.c
@@ -41,7 +41,6 @@
#include <sys/select.h>
-#include <stdlib.h>
#include <string.h>
#include <poll.h>
#include <time.h>
@@ -49,6 +48,7 @@
#include <assert.h>
#include <debug.h>
+#include <nuttx/kmalloc.h>
#include <nuttx/fs.h>
#include "fs_internal.h"
@@ -111,7 +111,7 @@ int select(int nfds, FAR fd_set *readfds, FAR fd_set *writefds,
/* Allocate the descriptor list for poll() */
- pollset = (struct pollfd *)zalloc(nfds * sizeof(struct pollfd));
+ pollset = (struct pollfd *)kzalloc(nfds * sizeof(struct pollfd));
if (!pollset)
{
errno = ENOMEM;
@@ -208,7 +208,7 @@ int select(int nfds, FAR fd_set *readfds, FAR fd_set *writefds,
}
}
- free(pollset);
+ kfree(pollset);
return ret;
}