9
0
Fork 0

ROMFS filesystem support

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@903 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2008-09-10 19:29:24 +00:00
parent 8235fd63ee
commit 7866c38227
22 changed files with 227 additions and 90 deletions

View File

@ -463,3 +463,4 @@
random access to large files. random access to large files.
0.3.15 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> 0.3.15 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
* Add support for ROMFS filesystem (initial checkin untested)

View File

@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4"> <tr align="center" bgcolor="#e4e4e4">
<td> <td>
<h1><big><font color="#3c34ec"><i>NuttShell (NSH)</i></font></big></h1> <h1><big><font color="#3c34ec"><i>NuttShell (NSH)</i></font></big></h1>
<p>Last Updated: September 5, 2008</p> <p>Last Updated: September 10, 2008</p>
</td> </td>
</tr> </tr>
</table> </table>
@ -1485,7 +1485,7 @@ nsh>
</tr> </tr>
<tr> <tr>
<td><b><code>cd</code></b></td> <td><b><code>cd</code></b></td>
<td>!<code>CONFIG_DISABLE_ENVIRON</code> && <code>CONFIG_NFILE_DESCRIPTORS</code> &gt; 0</td> <td>!<code>CONFIG_DISABLE_ENVIRON</code> &amp;&amp; <code>CONFIG_NFILE_DESCRIPTORS</code> &gt; 0</td>
</tr> </tr>
<tr> <tr>
<td><b><code>cp</code></b></td> <td><b><code>cp</code></b></td>
@ -1530,11 +1530,11 @@ nsh>
</tr> </tr>
<tr> <tr>
<td><b><code>mkdir</code></b></td> <td><b><code>mkdir</code></b></td>
<td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> && <code>CONFIG_NFILE_DESCRIPTORS</code> &gt; 0</td> <td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> &amp;&amp; <code>CONFIG_NFILE_DESCRIPTORS</code> &gt; 0 &amp;&amp; <code>CONFIG_FS_WRITABLE</code><sup>4</sup></td>
</tr> </tr>
<tr> <tr>
<td><b><code>mkfatfs</code></b></td> <td><b><code>mkfatfs</code></b></td>
<td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> && <code>CONFIG_NFILE_DESCRIPTORS</code> &gt; 0 && <code>CONFIG_FS_FAT</code></td> <td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> &amp;&amp; <code>CONFIG_NFILE_DESCRIPTORS</code> &gt; 0 &amp;&amp; <code>CONFIG_FS_FAT</code></td>
</tr> </tr>
<tr> <tr>
<td><b><code>mkfifo</code></b></td> <td><b><code>mkfifo</code></b></td>
@ -1542,11 +1542,11 @@ nsh>
</tr> </tr>
<tr> <tr>
<td><b><code>mkrd</code></b></td> <td><b><code>mkrd</code></b></td>
<td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> && <code>CONFIG_NFILE_DESCRIPTORS</code> &gt; 0 && <code>CONFIG_FS_FAT</code></td> <td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> &amp;&amp; <code>CONFIG_NFILE_DESCRIPTORS</code> &gt; 0 &amp;&amp; <code>CONFIG_FS_WRITABLE</code><sup>4</sup></td>
</tr> </tr>
<tr> <tr>
<td><b><code>mount</code></b></td> <td><b><code>mount</code></b></td>
<td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> && <code>CONFIG_NFILE_DESCRIPTORS</code> &gt; 0 && <code>CONFIG_FS_FAT</code></td> <td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> &amp;&amp; <code>CONFIG_NFILE_DESCRIPTORS</code> &gt; 0 &amp;&amp; <code>CONFIG_FS_READABLE</code><sup>3</sup></td>
</tr> </tr>
<tr> <tr>
<td><b><code>ping</code></b></td> <td><b><code>ping</code></b></td>
@ -1569,11 +1569,11 @@ nsh>
</tr> </tr>
<tr> <tr>
<td><b><code>rm</code></b></td> <td><b><code>rm</code></b></td>
<td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> &amp;&amp; <code>CONFIG_NFILE_DESCRIPTORS</code> &gt; 0</td> <td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> &amp;&amp; <code>CONFIG_NFILE_DESCRIPTORS</code> &gt; 0 &amp;&amp; <code>CONFIG_FS_WRITABLE</code><sup>4</sup></td>
</tr> </tr>
<tr> <tr>
<td><b><code>rmdir</code></b></td> <td><b><code>rmdir</code></b></td>
<td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> &amp;&amp; <code>CONFIG_NFILE_DESCRIPTORS</code> &gt; 0</td> <td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> &amp;&amp; <code>CONFIG_NFILE_DESCRIPTORS</code> &gt; 0 &amp;&amp; <code>CONFIG_FS_WRITABLE</code><sup>4</sup></td>
</tr> </tr>
<tr> <tr>
<td><b><code>set</code></b></td> <td><b><code>set</code></b></td>
@ -1593,7 +1593,7 @@ nsh>
</tr> </tr>
<tr> <tr>
<td><b><code>umount</code></b></td> <td><b><code>umount</code></b></td>
<td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> &amp;&amp; <code>CONFIG_NFILE_DESCRIPTORS</code> &gt; 0 &amp;&amp; <code>CONFIG_FS_FAT</code></td> <td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> &amp;&amp; <code>CONFIG_NFILE_DESCRIPTORS</code> &gt; 0 &amp;&amp; <code>CONFIG_FS_READABLE</code><sup>3</sup></td>
</tr> </tr>
<tr> <tr>
<td><b><code>unset</code></b></td> <td><b><code>unset</code></b></td>
@ -1606,10 +1606,18 @@ nsh>
</table></center> </table></center>
<p><sup>1</sup><small> <p><sup>1</sup><small>
Because of hardware padding, the actual required packet size may be larger</small></p> Because of hardware padding, the actual required packet size may be larger</small><br>
<p><sup>2</sup><small> <sup>2</sup><small>
Special TFTP server start-up optionss will probably be required to permit Special TFTP server start-up optionss will probably be required to permit
creation of files for the correct operation of the <code>put</code> command.</small></p> creation of files for the correct operation of the <code>put</code> command.</small><br>
<sup>3</sup><small>
<code>CONFIG_FS_READABLE</code> is not a user configuration but is set automatically
if any readable filesystem is selected. At present, this is either <code>CONFIG_FS_FAT</code>
or <code>CONFIG_FS_ROMFS</code>.</small><br>
<sup>4</sup><small>
<code>CONFIG_FS_WRITABLE</code> is not a user configuration but is set automatically
if any writable filesystem is selected. At present, this is only <code>CONFIG_FS_FAT</code>.</small><br>
</p>
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">

View File

@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4"> <tr align="center" bgcolor="#e4e4e4">
<td> <td>
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1> <h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
<p>Last Updated: September 8, 2008</p> <p>Last Updated: September 10, 2008</p>
</td> </td>
</tr> </tr>
</table> </table>
@ -379,10 +379,17 @@
<td><br></td> <td><br></td>
<td> <td>
<p> <p>
<li>VFAT filesystem support.</li> <li>FAT12/16/32 filesystem support.</li>
</p> </p>
</tr> </tr>
<tr>
<td><br></td>
<td>
<p>
<li>ROMFS filesystem support.</li>
</p>
</tr>
<tr> <tr>
<td valign="top" width="22"><img height="20" width="20" src="favicon.ico"></td> <td valign="top" width="22"><img height="20" width="20" src="favicon.ico"></td>
<td bgcolor="#5eaee1"> <td bgcolor="#5eaee1">
@ -1090,6 +1097,7 @@ buildroot-0.1.0 2007-03-09 &lt;spudmonkey@racsa.co.cr&gt
<pre><ul> <pre><ul>
nuttx-0.3.15 2008-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt; nuttx-0.3.15 2008-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
* Add support for ROMFS filesystem (initial checkin untested)
pascal-0.1.3 2008-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt; pascal-0.1.3 2008-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;

View File

@ -1515,6 +1515,19 @@ The system can be re-made subsequently by just typing <code>make</code>.
</li> </li>
</ul> </ul>
<h2>File Systems</h2>
<ul>
<li>
<code>CONFIG_FS_FAT</code>: Enable FAT filesystem support.
</li>
<li>
<code>CONFIG_FAT_SECTORSIZE</code>: Max supported sector size.
</li>
<li>
<code>CONFIG_FS_ROMFS</code>: Enable ROMFS filesystem support
</li>
</ul>
<h2>Network Support</h2> <h2>Network Support</h2>
<h3>TCP/IP and UDP support via uIP</h2> <h3>TCP/IP and UDP support via uIP</h2>
<ul> <ul>

View File

@ -83,5 +83,5 @@
void up_registerblockdevice(void) void up_registerblockdevice(void)
{ {
rd_register(0, (ubyte*)up_deviceimage(), NSECTORS, LOGICAL_SECTOR_SIZE, TRUE); ramdisk_register(0, (ubyte*)up_deviceimage(), NSECTORS, LOGICAL_SECTOR_SIZE, TRUE);
} }

View File

@ -253,7 +253,9 @@ CONFIG_PREALLOC_TIMERS=8
# FAT filesystem configuration # FAT filesystem configuration
# CONFIG_FS_FAT - Enable FAT filesystem support # CONFIG_FS_FAT - Enable FAT filesystem support
# CONFIG_FAT_SECTORSIZE - Max supported sector size # CONFIG_FAT_SECTORSIZE - Max supported sector size
# CONFIG_FS_ROMFS - Enable ROMFS filesystem support
CONFIG_FS_FAT=n CONFIG_FS_FAT=n
CONFIG_FS_ROMFS=n
# #
# TCP/IP and UDP support via uIP # TCP/IP and UDP support via uIP

View File

@ -208,7 +208,9 @@ CONFIG_PREALLOC_TIMERS=8
# FAT filesystem configuration # FAT filesystem configuration
# CONFIG_FS_FAT - Enable FAT filesystem support # CONFIG_FS_FAT - Enable FAT filesystem support
# CONFIG_FAT_SECTORSIZE - Max supported sector size # CONFIG_FAT_SECTORSIZE - Max supported sector size
# CONFIG_FS_ROMFS - Enable ROMFS filesystem support
CONFIG_FS_FAT=y CONFIG_FS_FAT=y
CONFIG_FS_ROMFS=n
# #
# TCP/IP and UDP support via uIP # TCP/IP and UDP support via uIP

View File

@ -1,5 +1,5 @@
############################################################################ ############################################################################
# sim/nettest/defconfig # configs/sim/nettest/defconfig
# #
# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. # Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr> # Author: Gregory Nutt <spudmonkey@racsa.co.cr>
@ -208,7 +208,9 @@ CONFIG_PREALLOC_TIMERS=8
# FAT filesystem configuration # FAT filesystem configuration
# CONFIG_FS_FAT - Enable FAT filesystem support # CONFIG_FS_FAT - Enable FAT filesystem support
# CONFIG_FAT_SECTORSIZE - Max supported sector size # CONFIG_FAT_SECTORSIZE - Max supported sector size
# CONFIG_FS_ROMFS - Enable ROMFS filesystem support
CONFIG_FS_FAT=y CONFIG_FS_FAT=y
CONFIG_FS_ROMFS=n
# #
# TCP/IP and UDP support via uIP # TCP/IP and UDP support via uIP

View File

@ -1,5 +1,5 @@
############################################################################ ############################################################################
# sim/defconfig # configs/sim/ostest/defconfig
# #
# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. # Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr> # Author: Gregory Nutt <spudmonkey@racsa.co.cr>
@ -209,7 +209,9 @@ CONFIG_PREALLOC_TIMERS=8
# FAT filesystem configuration # FAT filesystem configuration
# CONFIG_FS_FAT - Enable FAT filesystem support # CONFIG_FS_FAT - Enable FAT filesystem support
# CONFIG_FAT_SECTORSIZE - Max supported sector size # CONFIG_FAT_SECTORSIZE - Max supported sector size
# CONFIG_FS_ROMFS - Enable ROMFS filesystem support
CONFIG_FS_FAT=y CONFIG_FS_FAT=y
CONFIG_FS_ROMFS=n
# #
# TCP/IP and UDP support via uIP # TCP/IP and UDP support via uIP

View File

@ -1,5 +1,5 @@
############################################################################ ############################################################################
# configs/sim/defconfig # configs/sim/pashello/defconfig
# #
# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. # Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr> # Author: Gregory Nutt <spudmonkey@racsa.co.cr>
@ -208,7 +208,9 @@ CONFIG_PREALLOC_TIMERS=8
# FAT filesystem configuration # FAT filesystem configuration
# CONFIG_FS_FAT - Enable FAT filesystem support # CONFIG_FS_FAT - Enable FAT filesystem support
# CONFIG_FAT_SECTORSIZE - Max supported sector size # CONFIG_FAT_SECTORSIZE - Max supported sector size
# CONFIG_FS_ROMFS - Enable ROMFS filesystem support
CONFIG_FS_FAT=y CONFIG_FS_FAT=y
CONFIG_FS_ROMFS=n
# #
# TCP/IP and UDP support via uIP # TCP/IP and UDP support via uIP

View File

@ -59,10 +59,14 @@
struct rd_struct_s struct rd_struct_s
{ {
uint32 rd_nsectors; /* Number of sectors on device */ uint32 rd_nsectors; /* Number of sectors on device */
uint16 rd_sectsize; /* The size of one sector */ uint16 rd_sectsize; /* The size of one sector */
boolean rd_writeenabled; /* TRUE: can write to ram disk */ #ifdef CONFIG_FS_WRITABLE
ubyte *rd_buffer; /* RAM disk backup memory */ boolean rd_writeenabled; /* TRUE: can write to ram disk */
ubyte *rd_buffer; /* RAM disk backup memory */
#else
const ubyte *rd_buffer; /* ROM disk backup memory */
#endif
}; };
/**************************************************************************** /****************************************************************************
@ -73,8 +77,10 @@ static int rd_open(FAR struct inode *inode);
static int rd_close(FAR struct inode *inode); static int rd_close(FAR struct inode *inode);
static ssize_t rd_read(FAR struct inode *inode, unsigned char *buffer, static ssize_t rd_read(FAR struct inode *inode, unsigned char *buffer,
size_t start_sector, unsigned int nsectors); size_t start_sector, unsigned int nsectors);
#ifdef CONFIG_FS_WRITABLE
static ssize_t rd_write(FAR struct inode *inode, const unsigned char *buffer, static ssize_t rd_write(FAR struct inode *inode, const unsigned char *buffer,
size_t start_sector, unsigned int nsectors); size_t start_sector, unsigned int nsectors);
#endif
static int rd_geometry(FAR struct inode *inode, struct geometry *geometry); static int rd_geometry(FAR struct inode *inode, struct geometry *geometry);
/**************************************************************************** /****************************************************************************
@ -86,7 +92,11 @@ static const struct block_operations g_bops =
rd_open, /* open */ rd_open, /* open */
rd_close, /* close */ rd_close, /* close */
rd_read, /* read */ rd_read, /* read */
#ifdef CONFIG_FS_WRITABLE
rd_write, /* write */ rd_write, /* write */
#else
NULL, /* write */
#endif
rd_geometry, /* geometry */ rd_geometry, /* geometry */
NULL /* ioctl */ NULL /* ioctl */
}; };
@ -153,6 +163,7 @@ static ssize_t rd_read(FAR struct inode *inode, unsigned char *buffer,
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_FS_WRITABLE
static ssize_t rd_write(FAR struct inode *inode, const unsigned char *buffer, static ssize_t rd_write(FAR struct inode *inode, const unsigned char *buffer,
size_t start_sector, unsigned int nsectors) size_t start_sector, unsigned int nsectors)
{ {
@ -160,18 +171,25 @@ static ssize_t rd_write(FAR struct inode *inode, const unsigned char *buffer,
if (inode) if (inode)
{ {
dev = (struct rd_struct_s *)inode->i_private; dev = (struct rd_struct_s *)inode->i_private;
if (dev && if (dev)
start_sector < dev->rd_nsectors &&
start_sector + nsectors <= dev->rd_nsectors)
{ {
memcpy(&dev->rd_buffer[start_sector * dev->rd_sectsize], if (!dev->rd_writeenabled)
buffer, {
nsectors * dev->rd_sectsize); return -EACCES;
return nsectors; }
else if (start_sector < dev->rd_nsectors &&
start_sector + nsectors <= dev->rd_nsectors)
{
memcpy(&dev->rd_buffer[start_sector * dev->rd_sectsize],
buffer,
nsectors * dev->rd_sectsize);
return nsectors;
}
} }
} }
return -EINVAL; return -EINVAL;
} }
#endif
/**************************************************************************** /****************************************************************************
* Name: rd_geometry * Name: rd_geometry
@ -188,7 +206,11 @@ static int rd_geometry(FAR struct inode *inode, struct geometry *geometry)
dev = (struct rd_struct_s *)inode->i_private; dev = (struct rd_struct_s *)inode->i_private;
geometry->geo_available = TRUE; geometry->geo_available = TRUE;
geometry->geo_mediachanged = FALSE; geometry->geo_mediachanged = FALSE;
#ifdef CONFIG_FS_WRITABLE
geometry->geo_writeenabled = dev->rd_writeenabled; geometry->geo_writeenabled = dev->rd_writeenabled;
#else
geometry->geo_writeenabled = FALSE;
#endif
geometry->geo_nsectors = dev->rd_nsectors; geometry->geo_nsectors = dev->rd_nsectors;
geometry->geo_sectorsize = dev->rd_sectsize; geometry->geo_sectorsize = dev->rd_sectsize;
return OK; return OK;
@ -201,14 +223,18 @@ static int rd_geometry(FAR struct inode *inode, struct geometry *geometry)
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: rd_register * Name: ramdisk_register
* *
* Description: Register the a ramdisk * Description: Register the a ramdisk
****************************************************************************/ ****************************************************************************/
int rd_register(int minor, ubyte *buffer, uint32 nsectors, uint16 sectsize, #ifdef CONFIG_FS_WRITABLE
boolean writeenabled) int ramdisk_register(int minor, ubyte *buffer, uint32 nsectors, uint16 sectsize,
boolean writeenabled)
#else
int romdisk_register(int minor, ubyte *buffer, uint32 nsectors, uint16 sectsize)
#endif
{ {
struct rd_struct_s *dev; struct rd_struct_s *dev;
char devname[16]; char devname[16];
@ -232,7 +258,9 @@ int rd_register(int minor, ubyte *buffer, uint32 nsectors, uint16 sectsize,
dev->rd_nsectors = nsectors; /* Number of sectors on device */ dev->rd_nsectors = nsectors; /* Number of sectors on device */
dev->rd_sectsize = sectsize; /* The size of one sector */ dev->rd_sectsize = sectsize; /* The size of one sector */
#ifdef CONFIG_FS_WRITABLE
dev->rd_writeenabled = writeenabled; /* TRUE: can write to ram disk */ dev->rd_writeenabled = writeenabled; /* TRUE: can write to ram disk */
#endif
dev->rd_buffer = buffer; /* RAM disk backup memory */ dev->rd_buffer = buffer; /* RAM disk backup memory */
/* Create a ramdisk device name */ /* Create a ramdisk device name */

View File

@ -49,6 +49,9 @@
/* Configure the test */ /* Configure the test */
#if defined(CONFIG_EXAMPLES_MOUNT_DEVNAME) #if defined(CONFIG_EXAMPLES_MOUNT_DEVNAME)
# if !defined(CONFIG_FS_WRITABLE)
# error "Writable filesystem required in this configuration"
# endif
# undef CONFIG_EXAMPLES_MOUNT_NSECTORS # undef CONFIG_EXAMPLES_MOUNT_NSECTORS
# undef CONFIG_EXAMPLES_MOUNT_SECTORSIZE # undef CONFIG_EXAMPLES_MOUNT_SECTORSIZE
# undef CONFIG_EXAMPLES_MOUNT_RAMDEVNO # undef CONFIG_EXAMPLES_MOUNT_RAMDEVNO

View File

@ -112,7 +112,7 @@ int create_ramdisk(void)
/* Register a RAMDISK device to manage this RAM image */ /* Register a RAMDISK device to manage this RAM image */
ret = rd_register(CONFIG_EXAMPLES_MOUNT_RAMDEVNO, ret = ramdisk_register(CONFIG_EXAMPLES_MOUNT_RAMDEVNO,
pbuffer, pbuffer,
CONFIG_EXAMPLES_MOUNT_NSECTORS, CONFIG_EXAMPLES_MOUNT_NSECTORS,
CONFIG_EXAMPLES_MOUNT_SECTORSIZE, CONFIG_EXAMPLES_MOUNT_SECTORSIZE,

View File

@ -589,36 +589,42 @@ Command Dependencies on Configuration Settings
echo -- echo --
exec -- exec --
exit -- exit --
get CONFIG_NET && CONFIG_NET_UDP && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NET_BUFSIZE >= 558* get CONFIG_NET && CONFIG_NET_UDP && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NET_BUFSIZE >= 558 (see note 1)
help -- help --
ifconfig CONFIG_NET ifconfig CONFIG_NET
ls CONFIG_NFILE_DESCRIPTORS > 0 ls CONFIG_NFILE_DESCRIPTORS > 0
mb,mh,mw --- mb,mh,mw ---
mem --- mem ---
mkdir !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 mkdir !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_WRITABLE (see note 4)
mkfatfs !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_FAT mkfatfs !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_FAT
mkfifo CONFIG_NFILE_DESCRIPTORS > 0 mkfifo CONFIG_NFILE_DESCRIPTORS > 0
mkrd !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_FAT mkrd !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_WRITABLE (see note 4)
mount !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_FAT mount !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_READABLE (see note 3)
ping CONFIG_NET && CONFIG_NET_ICMP && CONFIG_NET_ICMP_PING && !CONFIG_DISABLE_CLOCK && !CONFIG_DISABLE_SIGNALS ping CONFIG_NET && CONFIG_NET_ICMP && CONFIG_NET_ICMP_PING && !CONFIG_DISABLE_CLOCK && !CONFIG_DISABLE_SIGNALS
ps -- ps --
put CONFIG_NET && CONFIG_NET_UDP && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NET_BUFSIZE >= 558* put CONFIG_NET && CONFIG_NET_UDP && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NET_BUFSIZE >= 558 (see note 1,2)
pwd !CONFIG_DISABLE_ENVIRON && CONFIG_NFILE_DESCRIPTORS > 0 pwd !CONFIG_DISABLE_ENVIRON && CONFIG_NFILE_DESCRIPTORS > 0
rm !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 rm !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_WRITABLE (see note 4)
rmdir !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 rmdir !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_WRITABLE (see note 4)
set !CONFIG_DISABLE_ENVIRON set !CONFIG_DISABLE_ENVIRON
sh CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !CONFIG_EXAMPLES_NSH_DISABLESCRIPT sh CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !CONFIG_EXAMPLES_NSH_DISABLESCRIPT
sleep !CONFIG_DISABLE_SIGNALS sleep !CONFIG_DISABLE_SIGNALS
test !CONFIG_EXAMPLES_NSH_DISABLESCRIPT test !CONFIG_EXAMPLES_NSH_DISABLESCRIPT
umount !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_FAT umount !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_READABLE
unset !CONFIG_DISABLE_ENVIRON unset !CONFIG_DISABLE_ENVIRON
usleep !CONFIG_DISABLE_SIGNALS usleep !CONFIG_DISABLE_SIGNALS
xd --- xd ---
* NOTES: * NOTES:
- Because of hardware padding, the actual required size may be larger. 1. Because of hardware padding, the actual required for put and get
- Special TFTP server start-up optionss will probably be required to permit operations size may be larger.
creation of file for the correct operation of the put command. 2. Special TFTP server start-up optionss will probably be required to permit
creation of file for the correct operation of the put command.
3. CONFIG_FS_READABLE is not a user configuration but is set automatically
if any readable filesystem is selected. At present, this is either CONFIG_FS_FAT
and CONFIG_FS_ROMFS.
4. CONFIG_FS_WRITABLE is not a user configuration but is set automatically
if any writable filesystem is selected. At present, this is only CONFIG_FS_FAT.
NSH-Specific Configuration Settings NSH-Specific Configuration Settings
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -288,15 +288,19 @@ extern int cmd_lbracket(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
extern int cmd_sh(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); extern int cmd_sh(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif /* CONFIG_NFILE_STREAMS && !CONFIG_EXAMPLES_NSH_DISABLESCRIPT */ # endif /* CONFIG_NFILE_STREAMS && !CONFIG_EXAMPLES_NSH_DISABLESCRIPT */
# ifndef CONFIG_DISABLE_MOUNTPOINT # ifndef CONFIG_DISABLE_MOUNTPOINT
extern int cmd_mkdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
extern int cmd_mkfifo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); extern int cmd_mkfifo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
extern int cmd_mkrd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # ifdef CONFIG_FS_READABLE
extern int cmd_rm(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
extern int cmd_rmdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# ifdef CONFIG_FS_FAT
extern int cmd_mkfatfs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
extern int cmd_mount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); extern int cmd_mount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
extern int cmd_umount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); extern int cmd_umount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# ifdef CONFIG_FS_WRITABLE
extern int cmd_mkdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
extern int cmd_mkrd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
extern int cmd_rm(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
extern int cmd_rmdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif /* CONFIG_FS_WRITABLE */
# endif /* CONFIG_FS_READABLE */
# ifdef CONFIG_FS_FAT
extern int cmd_mkfatfs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif /* CONFIG_FS_FAT */ # endif /* CONFIG_FS_FAT */
# endif /* !CONFIG_DISABLE_MOUNTPOINT */ # endif /* !CONFIG_DISABLE_MOUNTPOINT */
# if !defined(CONFIG_DISABLE_ENVIRON) # if !defined(CONFIG_DISABLE_ENVIRON)

View File

@ -44,11 +44,13 @@
# include <sys/stat.h> # include <sys/stat.h>
# include <fcntl.h> # include <fcntl.h>
# if !defined(CONFIG_DISABLE_MOUNTPOINT) # if !defined(CONFIG_DISABLE_MOUNTPOINT)
# ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */ # ifdef CONFIG_FS_READABLE /* Need at least one filesytem in configuration */
# include <sys/mount.h> # include <sys/mount.h>
# include <nuttx/ramdisk.h>
# endif
# ifdef CONFIG_FS_FAT
# include <nuttx/mkfatfs.h> # include <nuttx/mkfatfs.h>
# endif # endif
# include <nuttx/ramdisk.h>
#endif #endif
#endif #endif
@ -711,7 +713,7 @@ int cmd_ls(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
* Name: cmd_mkdir * Name: cmd_mkdir
****************************************************************************/ ****************************************************************************/
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 #if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_WRITABLE)
int cmd_mkdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) int cmd_mkdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{ {
char *fullpath = nsh_getfullpath(vtbl, argv[1]); char *fullpath = nsh_getfullpath(vtbl, argv[1]);
@ -781,7 +783,7 @@ int cmd_mkfifo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
* Name: cmd_mkrd * Name: cmd_mkrd
****************************************************************************/ ****************************************************************************/
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 #if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_WRITABLE)
int cmd_mkrd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) int cmd_mkrd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{ {
const char *fmt; const char *fmt;
@ -860,10 +862,10 @@ int cmd_mkrd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
/* Then register the ramdisk */ /* Then register the ramdisk */
ret = rd_register(minor, buffer, nsectors, sectsize, TRUE); ret = ramdisk_register(minor, buffer, nsectors, sectsize, TRUE);
if (ret < 0) if (ret < 0)
{ {
nsh_output(vtbl, g_fmtcmdfailed, argv[0], "rd_register", NSH_ERRNO_OF(-ret)); nsh_output(vtbl, g_fmtcmdfailed, argv[0], "ramdisk_register", NSH_ERRNO_OF(-ret));
free(buffer); free(buffer);
return ERROR; return ERROR;
} }
@ -879,8 +881,7 @@ errout_with_fmt:
* Name: cmd_mount * Name: cmd_mount
****************************************************************************/ ****************************************************************************/
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 #if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_READABLE)
#ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */
int cmd_mount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) int cmd_mount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{ {
char *source; char *source;
@ -953,13 +954,12 @@ int cmd_mount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
return ret; return ret;
} }
#endif #endif
#endif
/**************************************************************************** /****************************************************************************
* Name: cmd_rm * Name: cmd_rm
****************************************************************************/ ****************************************************************************/
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 #if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_WRITABLE)
int cmd_rm(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) int cmd_rm(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{ {
char *fullpath = nsh_getfullpath(vtbl, argv[1]); char *fullpath = nsh_getfullpath(vtbl, argv[1]);
@ -982,7 +982,7 @@ int cmd_rm(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
* Name: cmd_rmdir * Name: cmd_rmdir
****************************************************************************/ ****************************************************************************/
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 #if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_WRITABLE)
int cmd_rmdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) int cmd_rmdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{ {
char *fullpath = nsh_getfullpath(vtbl, argv[1]); char *fullpath = nsh_getfullpath(vtbl, argv[1]);
@ -1070,8 +1070,7 @@ int cmd_sh(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
* Name: cmd_umount * Name: cmd_umount
****************************************************************************/ ****************************************************************************/
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 #if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_READABLE)
#ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */
int cmd_umount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) int cmd_umount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{ {
char *fullpath = nsh_getfullpath(vtbl, argv[1]); char *fullpath = nsh_getfullpath(vtbl, argv[1]);
@ -1091,4 +1090,3 @@ int cmd_umount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
return ret; return ret;
} }
#endif #endif
#endif

View File

@ -157,19 +157,21 @@ static const struct cmdmap_s g_cmdmap[] =
#endif #endif
{ "mb", cmd_mb, 2, 3, "<hex-address>[=<hex-value>][ <hex-byte-count>]" }, { "mb", cmd_mb, 2, 3, "<hex-address>[=<hex-value>][ <hex-byte-count>]" },
{ "mem", cmd_mem, 1, 1, NULL }, { "mem", cmd_mem, 1, 1, NULL },
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 #if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_WRITABLE)
{ "mkdir", cmd_mkdir, 2, 2, "<path>" }, { "mkdir", cmd_mkdir, 2, 2, "<path>" },
#ifdef CONFIG_FS_FAT #endif
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_FAT)
{ "mkfatfs", cmd_mkfatfs, 2, 2, "<path>" }, { "mkfatfs", cmd_mkfatfs, 2, 2, "<path>" },
#endif #endif
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0
{ "mkfifo", cmd_mkfifo, 2, 2, "<path>" }, { "mkfifo", cmd_mkfifo, 2, 2, "<path>" },
#endif
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_WRITABLE)
{ "mkrd", cmd_mkrd, 2, 6, "[-m <minor>] [-s <sector-size>] <nsectors>" }, { "mkrd", cmd_mkrd, 2, 6, "[-m <minor>] [-s <sector-size>] <nsectors>" },
#endif #endif
{ "mh", cmd_mh, 2, 3, "<hex-address>[=<hex-value>][ <hex-byte-count>]" }, { "mh", cmd_mh, 2, 3, "<hex-address>[=<hex-value>][ <hex-byte-count>]" },
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 #if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_READABLE)
#ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */
{ "mount", cmd_mount, 4, 5, "-t <fstype> <block-device> <dir-path>" }, { "mount", cmd_mount, 4, 5, "-t <fstype> <block-device> <dir-path>" },
#endif
#endif #endif
{ "mw", cmd_mw, 2, 3, "<hex-address>[=<hex-value>][ <hex-byte-count>]" }, { "mw", cmd_mw, 2, 3, "<hex-address>[=<hex-value>][ <hex-byte-count>]" },
{ "ps", cmd_ps, 1, 1, NULL }, { "ps", cmd_ps, 1, 1, NULL },
@ -183,7 +185,7 @@ static const struct cmdmap_s g_cmdmap[] =
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON) #if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON)
{ "pwd", cmd_pwd, 1, 1, NULL }, { "pwd", cmd_pwd, 1, 1, NULL },
#endif #endif
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 #if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_WRITABLE)
{ "rm", cmd_rm, 2, 2, "<file-path>" }, { "rm", cmd_rm, 2, 2, "<file-path>" },
{ "rmdir", cmd_rmdir, 2, 2, "<dir-path>" }, { "rmdir", cmd_rmdir, 2, 2, "<dir-path>" },
#endif #endif
@ -199,10 +201,8 @@ static const struct cmdmap_s g_cmdmap[] =
#ifndef CONFIG_EXAMPLES_NSH_DISABLESCRIPT #ifndef CONFIG_EXAMPLES_NSH_DISABLESCRIPT
{ "test", cmd_test, 3, NSH_MAX_ARGUMENTS, "<expression>" }, { "test", cmd_test, 3, NSH_MAX_ARGUMENTS, "<expression>" },
#endif #endif
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 #if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_READABLE)
# ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */
{ "umount", cmd_umount, 2, 2, "<dir-path>" }, { "umount", cmd_umount, 2, 2, "<dir-path>" },
# endif
#endif #endif
#ifndef CONFIG_DISABLE_ENVIRON #ifndef CONFIG_DISABLE_ENVIRON
{ "unset", cmd_unset, 2, 2, "<name>" }, { "unset", cmd_unset, 2, 2, "<name>" },

View File

@ -57,6 +57,7 @@ CSRCS += fs_registerblockdriver.c fs_unregisterblockdriver.c \
fs_fsync.c fs_unlink.c fs_rename.c \ fs_fsync.c fs_unlink.c fs_rename.c \
fs_mkdir.c fs_rmdir.c fs_mkdir.c fs_rmdir.c
include fat/Make.defs include fat/Make.defs
include romfs/Make.defs
endif endif
endif endif
@ -67,8 +68,8 @@ OBJS = $(AOBJS) $(COBJS)
BIN = libfs$(LIBEXT) BIN = libfs$(LIBEXT)
SUBDIRS = fat SUBDIRS = fat romfs
VPATH = fat VPATH = fat:romfs
all: $(BIN) all: $(BIN)
@ -84,7 +85,7 @@ $(BIN): $(OBJS)
done ; ) done ; )
.depend: Makefile $(SRCS) .depend: Makefile $(SRCS)
@$(MKDEP) --dep-path . --dep-path fat $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @$(MKDEP) --dep-path . --dep-path fat --dep-path romfs $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@ @touch $@
depend: .depend depend: .depend

View File

@ -94,19 +94,34 @@ struct fs_psuedodir_s
struct inode *fd_next; /* The inode for the next call to readdir() */ struct inode *fd_next; /* The inode for the next call to readdir() */
}; };
#if defined(CONFIG_FS_FAT) && !defined(CONFIG_DISABLE_MOUNTPOINT) #ifndef CONFIG_DISABLE_MOUNTPOINT
/* For fat, we need to retun the start cluster, current cluster, current #ifdef CONFIG_FS_FAT
/* For fat, we need to return the start cluster, current cluster, current
* sector and current directory index. * sector and current directory index.
*/ */
struct fs_fatdir_s struct fs_fatdir_s
{ {
uint32 fd_startcluster; /* Start cluster number of the directory*/ uint32 fd_startcluster; /* Start cluster number of the directory */
uint32 fd_currcluster; /* Current cluster number being read*/ uint32 fd_currcluster; /* Current cluster number being read */
size_t fd_currsector; /* Current sector being read*/ size_t fd_currsector; /* Current sector being read */
unsigned int fd_index; /* Current index of the directory entry to read */ unsigned int fd_index; /* Current index of the directory entry to read */
}; };
#endif #endif /* CONFIG_FS_FAT */
#ifdef CONFIG_FS_ROMFS
/* For ROMFS, we need to return the offset to the current and start positions
* of the directory entry being read
*/
struct fs_romfsdir_s
{
uint32 fr_diroffset; /* Offset to the directory entry */
uint32 fr_firstoffset; /* Offset to the first entry */
uint32 fr_curroffset; /* Current offset into the directory contents */
};
#endif /* CONFIG_FS_ROMFS */
#endif /* CONFIG_DISABLE_MOUNTPOINT */
struct internal_dir_s struct internal_dir_s
{ {
@ -148,6 +163,9 @@ struct internal_dir_s
#ifdef CONFIG_FS_FAT #ifdef CONFIG_FS_FAT
struct fs_fatdir_s fat; struct fs_fatdir_s fat;
#endif #endif
#ifdef CONFIG_FS_ROMFS
struct fs_romfsdir_s romfs;
#endif
#endif #endif
} u; } u;

View File

@ -53,7 +53,7 @@
* every configured filesystem. * every configured filesystem.
*/ */
#ifdef CONFIG_FS_FAT #ifdef CONFIG_FS_READABLE
/**************************************************************************** /****************************************************************************
* Definitions * Definitions
@ -76,11 +76,17 @@ struct fsmap_t
#ifdef CONFIG_FS_FAT #ifdef CONFIG_FS_FAT
extern const struct mountpt_operations fat_operations; extern const struct mountpt_operations fat_operations;
#endif #endif
#ifdef CONFIG_FS_ROMFS
extern const struct mountpt_operations romfs_operations;
#endif
static const struct fsmap_t g_fsmap[] = static const struct fsmap_t g_fsmap[] =
{ {
#ifdef CONFIG_FS_FAT #ifdef CONFIG_FS_FAT
{ "vfat", &fat_operations }, { "vfat", &fat_operations },
#endif
#ifdef CONFIG_FS_ROMFS
{ "romfs", &romfs_operations },
#endif #endif
{ NULL, NULL }, { NULL, NULL },
}; };

View File

@ -40,6 +40,7 @@
* Included Files * Included Files
****************************************************************************/ ****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h> #include <sys/types.h>
/**************************************************************************** /****************************************************************************
@ -62,7 +63,7 @@ extern "C" {
#define EXTERN extern #define EXTERN extern
#endif #endif
/* Non-standard function to register a ramdisk /* Non-standard function to register a ramdisk or a romdisk
* *
* minor: Selects suffix of device named /dev/ramN, N={1,2,3...} * minor: Selects suffix of device named /dev/ramN, N={1,2,3...}
* nsectors: Number of sectors on device * nsectors: Number of sectors on device
@ -71,8 +72,14 @@ extern "C" {
* buffer: RAM disk backup memory * buffer: RAM disk backup memory
*/ */
EXTERN int rd_register(int minor, ubyte *buffer, uint32 nsectors, #ifdef CONFIG_FS_WRITABLE
uint16 sectize, boolean writeenabled); EXTERN int ramdisk_register(int minor, ubyte *buffer, uint32 nsectors,
uint16 sectize, boolean writeenabled);
#define romdisk_register(m,b,n,s) ramdisk_register(m,b,n,s,0)
#else
EXTERN int romdisk_register(int minor, ubyte *buffer, uint32 nsectors,
uint16 sectize);
#endif
#undef EXTERN #undef EXTERN
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -1,7 +1,7 @@
/************************************************************ /****************************************************************************
* mkconfig.c * mkconfig.c
* *
* Copyright (C) 2007 Gregory Nutt. All rights reserved. * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in * notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the * the documentation and/or other materials provided with the
* distribution. * distribution.
* 3. Neither the name Gregory Nutt nor the names of its contributors may be * 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software * used to endorse or promote products derived from this software
* without specific prior written permission. * without specific prior written permission.
* *
@ -31,7 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
* *
************************************************************/ ****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -41,9 +45,17 @@
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
/****************************************************************************
* Definitions
****************************************************************************/
#define DEFCONFIG ".config" #define DEFCONFIG ".config"
#define LINESIZE ( PATH_MAX > 256 ? PATH_MAX : 256 ) #define LINESIZE ( PATH_MAX > 256 ? PATH_MAX : 256 )
/****************************************************************************
* Private Functions
****************************************************************************/
static char line[LINESIZE+1]; static char line[LINESIZE+1];
static char *skip_space(char *ptr) static char *skip_space(char *ptr)
@ -167,6 +179,10 @@ static void show_usage(const char *progname)
exit(1); exit(1);
} }
/****************************************************************************
* Public Functions
****************************************************************************/
int main(int argc, char **argv, char **envp) int main(int argc, char **argv, char **envp)
{ {
char *filepath; char *filepath;
@ -245,6 +261,16 @@ int main(int argc, char **argv, char **envp)
printf("/* If mountpoint support in not included, then no filesystem can be supported */\n\n"); printf("/* If mountpoint support in not included, then no filesystem can be supported */\n\n");
printf("#ifdef CONFIG_DISABLE_MOUNTPOINT\n"); printf("#ifdef CONFIG_DISABLE_MOUNTPOINT\n");
printf("# undef CONFIG_FS_FAT\n"); printf("# undef CONFIG_FS_FAT\n");
printf("# undef CONFIG_FS_ROMFS\n");
printf("#endif\n\n");
printf("/* Check if any readable and writable filesystem is supported */\n\n");
printf("#undef CONFIG_FS_READABLE\n");
printf("#undef CONFIG_FS_WRITABLE\n");
printf("#if defined(CONFIG_FS_FAT) || defined(CONFIG_FS_ROMFS)\n");
printf("# define CONFIG_FS_READABLE 1\n");
printf("#endif\n\n");
printf("#if defined(CONFIG_FS_FAT)\n");
printf("# define CONFIG_FS_WRITABLE 1\n");
printf("#endif\n\n"); printf("#endif\n\n");
printf("/* There can be no network support with no socket descriptors */\n\n"); printf("/* There can be no network support with no socket descriptors */\n\n");
printf("#if CONFIG_NSOCKET_DESCRIPTORS <= 0\n"); printf("#if CONFIG_NSOCKET_DESCRIPTORS <= 0\n");