Add a test of ROMFS

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@906 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2008-09-11 05:21:36 +00:00
parent 1ef100a5db
commit c54c3b0a25
7 changed files with 35 additions and 11 deletions

View File

@ -463,4 +463,5 @@
random access to large files.
0.3.15 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
* Add support for ROMFS filesystem (initial checkin untested)
* Added support for ROMFS filesystem.
* Added a simple test the ROMFS filesystem (examples/romfs)

View File

@ -1097,7 +1097,8 @@ buildroot-0.1.0 2007-03-09 &lt;spudmonkey@racsa.co.cr&gt
<pre><ul>
nuttx-0.3.15 2008-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
* Add support for ROMFS filesystem (initial checkin untested)
* Added support for ROMFS filesystem.
* Added a simple test the ROMFS filesystem (examples/romfs)
pascal-0.1.3 2008-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;

View File

@ -95,7 +95,9 @@ void up_initialize(void)
devnull_register(); /* Standard /dev/null */
up_devconsole(); /* Our private /dev/console */
#if defined(CONFIG_FS_FAT) && !defined(CONFIG_DISABLE_MOUNTPOINT)
up_registerblockdevice(); /* Our FAT ramdisk at /dev/ram0 */
#endif
#if defined(CONFIG_NET) && defined(linux)
uipdriver_init(); /* Our "real" netwok driver */
#endif

View File

@ -58,6 +58,22 @@ examples/mount
when CONFIG_EXAMPLES_MOUNT_DEVNAME is not defined. The
default is zero (meaning that "/dev/ram0" will be used).
examples/romfs
^^^^^^^^^^^^^^
This example exercises the romfs filesystem. Configuration options
include:
* CONFIG_EXAMPLES_ROMFS_RAMDEVNO
The minor device number to use for the ROM disk. The default is
1 (meaning /dev/ram1)
* CONFIG_EXAMPLES_ROMFS_SECTORSIZE
The ROM disk sector size to use. Default is 64.
* CONFIG_EXAMPLES_ROMFS_MOUNTPOINT
The location to mount the ROM disk. Deafault: "/usr/local/share"
examples/null
^^^^^^^^^^^^^

View File

@ -654,7 +654,7 @@ static int romfs_readdir(struct inode *mountpt, struct internal_dir_s *dir)
dir->fd_dir.d_type = DTYPE_DIRECTORY;
break;
}
else if (IS_DIRECTORY(next))
else if (IS_FILE(next))
{
dir->fd_dir.d_type = DTYPE_FILE;
break;
@ -919,10 +919,6 @@ static int romfs_stat(struct inode *mountpt, const char *relpath, struct stat *b
{
struct romfs_mountpt_s *rm;
struct romfs_dirinfo_s dirinfo;
uint16 date;
uint16 date2;
uint16 time;
ubyte attribute;
int ret;
/* Sanity checks */

View File

@ -77,7 +77,8 @@
* values specified in */
#define RFNEXT_MODEMASK 7 /* Bits 0-2: Mode; bit 3: Executable */
#define RFNEXT_OFFSETMASK (~7) /* Bits n-3: Offset to next entry */
#define RFNEXT_ALLMODEMASK 15 /* Bits 0-3: All mode bits */
#define RFNEXT_OFFSETMASK (~15) /* Bits n-3: Offset to next entry */
#define RFNEXT_HARDLINK 0 /* rf_info = Link destination file header */
#define RFNEXT_DIRECTORY 1 /* rf_info = First file's header */

View File

@ -247,7 +247,7 @@ static inline int romfs_searchdir(struct romfs_mountpt_s *rm,
/* No match... select the offset to the next entry */
offset += next;
offset = next;
}
while (next != 0)
@ -543,9 +543,16 @@ int romfs_finddirentry(struct romfs_mountpt_s *rm, struct romfs_dirinfo_s *dirin
dirinfo->rd_dir.fr_diroffset = 0;
dirinfo->rd_dir.fr_firstoffset = rm->rm_rootoffset;
dirinfo->rd_dir.fr_curroffset = rm->rm_rootoffset;
dirinfo->rd_next = 0;
dirinfo->rd_next = RFNEXT_DIRECTORY;
dirinfo->rd_size = 0;
/* The root directory is a special case */
if (!path || path[0] == '\0')
{
return OK;
}
/* Then loop for each directory/file component in the full path */
entryname = path;
@ -689,7 +696,7 @@ int romfs_parsedirentry(struct romfs_mountpt_s *rm, uint32 offset, uint32 *poffs
*/
*poffset = offset;
*pnext = (save & RFNEXT_OFFSETMASK) | (next & RFNEXT_MODEMASK);
*pnext = (save & RFNEXT_OFFSETMASK) | (next & RFNEXT_ALLMODEMASK);
*pinfo = info;
*psize = size;
return OK;