diff --git a/ChangeLog b/ChangeLog index eb05614ae748915591a67c8805ff7e3d1bc0e05a..7ed1a3ed64144691a81a53aeac6114cf874ef0dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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) diff --git a/Documentation/NuttX.html b/Documentation/NuttX.html index 9dc58d9092abe8248362aca31514a274d5c094e8..62068e2c2e29f004cc56c3b8d2b7d5630fb5edbc 100644 --- a/Documentation/NuttX.html +++ b/Documentation/NuttX.html @@ -1097,7 +1097,8 @@ buildroot-0.1.0 2007-03-09 <spudmonkey@racsa.co.cr> <pre><ul> nuttx-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) pascal-0.1.3 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> diff --git a/arch/sim/src/up_initialize.c b/arch/sim/src/up_initialize.c index 7eb49cb1fa8d231fc408abdea8ec30f3c586d41a..56c43e8b30f11accffc2caf34537f996447a307f 100644 --- a/arch/sim/src/up_initialize.c +++ b/arch/sim/src/up_initialize.c @@ -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 diff --git a/examples/README.txt b/examples/README.txt index ba6051e16f538816327f631a7d892c1630ae71ef..d47e5cdc1e87fdb8875bacc7d960d5c62107fb7d 100644 --- a/examples/README.txt +++ b/examples/README.txt @@ -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 ^^^^^^^^^^^^^ diff --git a/fs/romfs/fs_romfs.c b/fs/romfs/fs_romfs.c index 5400b5d00d4403250f818b4c9d0eb93025ea6a3f..55b86869f3931d8ad9b19bf4d12c083398fb14dc 100644 --- a/fs/romfs/fs_romfs.c +++ b/fs/romfs/fs_romfs.c @@ -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 */ diff --git a/fs/romfs/fs_romfs.h b/fs/romfs/fs_romfs.h index 40e166f84eccfa20e7426af87304e537c908fa8c..8432c9bd01a5a3c7a997381dc9dadf5f27fd14b5 100644 --- a/fs/romfs/fs_romfs.h +++ b/fs/romfs/fs_romfs.h @@ -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 */ diff --git a/fs/romfs/fs_romfsutil.c b/fs/romfs/fs_romfsutil.c index cbd10e3bd492140488a6a0e8833e3b1d0228b282..77d03b56521a332ff7ec2a0083dff4f9036bcb51 100644 --- a/fs/romfs/fs_romfsutil.c +++ b/fs/romfs/fs_romfsutil.c @@ -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;