mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 14:27:37 +08:00
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
This commit is contained in:
@@ -73,7 +73,7 @@ CONFIG_SCHED_WORKPRIORITY=192
|
|||||||
CONFIG_SCHED_WORKPERIOD=50000
|
CONFIG_SCHED_WORKPERIOD=50000
|
||||||
CONFIG_SCHED_WORKSTACKSIZE=1024
|
CONFIG_SCHED_WORKSTACKSIZE=1024
|
||||||
CONFIG_SIG_SIGWORK=17
|
CONFIG_SIG_SIGWORK=17
|
||||||
CONFIG_SCHED_WAITPID=n
|
CONFIG_SCHED_WAITPID=y
|
||||||
CONFIG_SCHED_ATEXIT=n
|
CONFIG_SCHED_ATEXIT=n
|
||||||
CONFIG_SCHED_ONEXIT=n
|
CONFIG_SCHED_ONEXIT=n
|
||||||
|
|
||||||
@@ -224,6 +224,7 @@ CONFIG_EXAMPLES_OSTEST_STACKSIZE=8192
|
|||||||
#
|
#
|
||||||
# Settings for apps/nshlib
|
# Settings for apps/nshlib
|
||||||
#
|
#
|
||||||
|
CONFIG_NSH_BUILTIN_APPS=n
|
||||||
CONFIG_NSH_FILEIOSIZE=1024
|
CONFIG_NSH_FILEIOSIZE=1024
|
||||||
CONFIG_NSH_STRERROR=n
|
CONFIG_NSH_STRERROR=n
|
||||||
CONFIG_NSH_LINELEN=80
|
CONFIG_NSH_LINELEN=80
|
||||||
|
|||||||
@@ -12,8 +12,7 @@ Execution starts in the following order:
|
|||||||
is set. It must be set for the VSN board.
|
is set. It must be set for the VSN board.
|
||||||
|
|
||||||
- boot, performs initial chip and board initialization
|
- boot, performs initial chip and board initialization
|
||||||
- sched/os_bringup.c then calls either user_start or exec_builtin()
|
- sched/os_bringup.c then calls user entry defined in the .config file.
|
||||||
with application as set in the .config
|
|
||||||
|
|
||||||
|
|
||||||
Naming throughout the code
|
Naming throughout the code
|
||||||
|
|||||||
+10
-9
@@ -1314,15 +1314,16 @@ static int fat_dup(FAR const struct file *oldp, FAR struct file *newp)
|
|||||||
* file is re-opened.
|
* file is re-opened.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
newff->ff_bflags = 0;
|
newff->ff_bflags = 0; /* File buffer flags */
|
||||||
newff->ff_oflags = oldff->ff_oflags;
|
newff->ff_oflags = oldff->ff_oflags; /* File open flags */
|
||||||
newff->ff_sectorsincluster = oldff->ff_sectorsincluster;
|
newff->ff_sectorsincluster = oldff->ff_sectorsincluster; /* Sectors remaining in cluster */
|
||||||
newff->ff_dirindex = oldff->ff_dirindex;
|
newff->ff_dirindex = oldff->ff_dirindex; /* Index to directory entry */
|
||||||
newff->ff_currentcluster = oldff->ff_currentcluster;
|
newff->ff_currentcluster = oldff->ff_currentcluster; /* Current cluster */
|
||||||
newff->ff_dirsector = oldff->ff_dirsector;
|
newff->ff_dirsector = oldff->ff_dirsector; /* Sector containing directory entry */
|
||||||
newff->ff_size = oldff->ff_size;
|
newff->ff_size = oldff->ff_size; /* Size of the file */
|
||||||
newff->ff_currentsector = 0;
|
newff->ff_startcluster = oldff->ff_startcluster; /* Start cluster of file on media */
|
||||||
newff->ff_cachesector = 0;
|
newff->ff_currentsector = oldff->ff_currentsector; /* Current sector */
|
||||||
|
newff->ff_cachesector = 0; /* Sector in file buffer */
|
||||||
|
|
||||||
/* Attach the private date to the struct file instance */
|
/* Attach the private date to the struct file instance */
|
||||||
|
|
||||||
|
|||||||
+9
-8
@@ -56,6 +56,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include <nuttx/kmalloc.h>
|
||||||
#include <nuttx/fs/fs.h>
|
#include <nuttx/fs/fs.h>
|
||||||
#include <nuttx/fs/ioctl.h>
|
#include <nuttx/fs/ioctl.h>
|
||||||
#include <nuttx/fs/dirent.h>
|
#include <nuttx/fs/dirent.h>
|
||||||
@@ -225,7 +226,7 @@ static int romfs_open(FAR struct file *filep, FAR const char *relpath,
|
|||||||
* file.
|
* 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)
|
if (!rf)
|
||||||
{
|
{
|
||||||
fdbg("Failed to allocate private data\n", ret);
|
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)
|
if (!rm->rm_xipbase && rf->rf_buffer)
|
||||||
{
|
{
|
||||||
free(rf->rf_buffer);
|
kfree(rf->rf_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Then free the file structure itself. */
|
/* Then free the file structure itself. */
|
||||||
|
|
||||||
free(rf);
|
kfree(rf);
|
||||||
filep->f_priv = NULL;
|
filep->f_priv = NULL;
|
||||||
return ret;
|
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 */
|
/* 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)
|
if (!rm)
|
||||||
{
|
{
|
||||||
fdbg("Failed to allocate mountpoint structure\n");
|
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:
|
errout_with_buffer:
|
||||||
if (!rm->rm_xipbase)
|
if (!rm->rm_xipbase)
|
||||||
{
|
{
|
||||||
free(rm->rm_buffer);
|
kfree(rm->rm_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
errout_with_sem:
|
errout_with_sem:
|
||||||
sem_destroy(&rm->rm_sem);
|
sem_destroy(&rm->rm_sem);
|
||||||
free(rm);
|
kfree(rm);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1031,11 +1032,11 @@ static int romfs_unbind(FAR void *handle, FAR struct inode **blkdriver)
|
|||||||
|
|
||||||
if (!rm->rm_xipbase && rm->rm_buffer)
|
if (!rm->rm_xipbase && rm->rm_buffer)
|
||||||
{
|
{
|
||||||
free(rm->rm_buffer);
|
kfree(rm->rm_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
sem_destroy(&rm->rm_sem);
|
sem_destroy(&rm->rm_sem);
|
||||||
free(rm);
|
kfree(rm);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user