diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-01-15 21:01:37 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-01-15 21:01:37 +0000 |
commit | 9cc7477faf3e49678aa827a6bc1ab99e2812c4d8 (patch) | |
tree | a84eb181060b4367ba7278a829a2ce7f3a83ffa9 /nuttx/fs/romfs | |
parent | fa14e61b3b4bca193293aba75f7ee106cbe4dd69 (diff) | |
download | px4-nuttx-9cc7477faf3e49678aa827a6bc1ab99e2812c4d8.tar.gz px4-nuttx-9cc7477faf3e49678aa827a6bc1ab99e2812c4d8.tar.bz2 px4-nuttx-9cc7477faf3e49678aa827a6bc1ab99e2812c4d8.zip |
Implement redirection of output from NSH builtin commands to a file in a mounted volume
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5521 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/fs/romfs')
-rw-r--r-- | nuttx/fs/romfs/fs_romfs.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/nuttx/fs/romfs/fs_romfs.c b/nuttx/fs/romfs/fs_romfs.c index 2814aa49d..6a6fca355 100644 --- a/nuttx/fs/romfs/fs_romfs.c +++ b/nuttx/fs/romfs/fs_romfs.c @@ -56,6 +56,7 @@ #include <errno.h> #include <debug.h> +#include <nuttx/kmalloc.h> #include <nuttx/fs/fs.h> #include <nuttx/fs/ioctl.h> #include <nuttx/fs/dirent.h> @@ -225,7 +226,7 @@ static int romfs_open(FAR struct file *filep, FAR const char *relpath, * file. */ - rf = (FAR struct romfs_file_s *)zalloc(sizeof(struct romfs_file_s)); + rf = (FAR struct romfs_file_s *)kzalloc(sizeof(struct romfs_file_s)); if (!rf) { fdbg("Failed to allocate private data\n", ret); @@ -317,12 +318,12 @@ static int romfs_close(FAR struct file *filep) if (!rm->rm_xipbase && rf->rf_buffer) { - free(rf->rf_buffer); + kfree(rf->rf_buffer); } /* Then free the file structure itself. */ - free(rf); + kfree(rf); filep->f_priv = NULL; return ret; } @@ -915,7 +916,7 @@ static int romfs_bind(FAR struct inode *blkdriver, FAR const void *data, /* Create an instance of the mountpt state structure */ - rm = (FAR struct romfs_mountpt_s *)zalloc(sizeof(struct romfs_mountpt_s)); + rm = (FAR struct romfs_mountpt_s *)kzalloc(sizeof(struct romfs_mountpt_s)); if (!rm) { fdbg("Failed to allocate mountpoint structure\n"); @@ -959,12 +960,12 @@ static int romfs_bind(FAR struct inode *blkdriver, FAR const void *data, errout_with_buffer: if (!rm->rm_xipbase) { - free(rm->rm_buffer); + kfree(rm->rm_buffer); } errout_with_sem: sem_destroy(&rm->rm_sem); - free(rm); + kfree(rm); return ret; } @@ -1031,11 +1032,11 @@ static int romfs_unbind(FAR void *handle, FAR struct inode **blkdriver) if (!rm->rm_xipbase && rm->rm_buffer) { - free(rm->rm_buffer); + kfree(rm->rm_buffer); } sem_destroy(&rm->rm_sem); - free(rm); + kfree(rm); return OK; } |