summaryrefslogtreecommitdiff
path: root/nuttx/fs
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-09-11 05:21:36 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-09-11 05:21:36 +0000
commit71e9b5634f2d175ecd523dc32aa899fc1752c020 (patch)
tree86dec3db7aaa8f18cb2664b2e8bef706ed30ed6d /nuttx/fs
parentf4d66b6d4b686dd7c6d3e4826151326b10fc3229 (diff)
downloadpx4-nuttx-71e9b5634f2d175ecd523dc32aa899fc1752c020.tar.gz
px4-nuttx-71e9b5634f2d175ecd523dc32aa899fc1752c020.tar.bz2
px4-nuttx-71e9b5634f2d175ecd523dc32aa899fc1752c020.zip
Add a test of ROMFS
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@906 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/fs')
-rw-r--r--nuttx/fs/romfs/fs_romfs.c6
-rw-r--r--nuttx/fs/romfs/fs_romfs.h3
-rw-r--r--nuttx/fs/romfs/fs_romfsutil.c13
3 files changed, 13 insertions, 9 deletions
diff --git a/nuttx/fs/romfs/fs_romfs.c b/nuttx/fs/romfs/fs_romfs.c
index 5400b5d00..55b86869f 100644
--- a/nuttx/fs/romfs/fs_romfs.c
+++ b/nuttx/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/nuttx/fs/romfs/fs_romfs.h b/nuttx/fs/romfs/fs_romfs.h
index 40e166f84..8432c9bd0 100644
--- a/nuttx/fs/romfs/fs_romfs.h
+++ b/nuttx/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/nuttx/fs/romfs/fs_romfsutil.c b/nuttx/fs/romfs/fs_romfsutil.c
index cbd10e3bd..77d03b565 100644
--- a/nuttx/fs/romfs/fs_romfsutil.c
+++ b/nuttx/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;