summaryrefslogtreecommitdiff
path: root/nuttx/fs/nxffs/nxffs_inode.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-05-02 16:14:20 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-05-02 16:14:20 +0000
commitbbeba1fded523a5e2f7d71f3ad003a8c7c5c9351 (patch)
tree60a0d60420ac62e366ee61bc30a60c6743378d18 /nuttx/fs/nxffs/nxffs_inode.c
parent6e723db07e440e19453f35e8e3a3850e3b4d7373 (diff)
downloadpx4-nuttx-bbeba1fded523a5e2f7d71f3ad003a8c7c5c9351.tar.gz
px4-nuttx-bbeba1fded523a5e2f7d71f3ad003a8c7c5c9351.tar.bz2
px4-nuttx-bbeba1fded523a5e2f7d71f3ad003a8c7c5c9351.zip
More NXFFS bugfixes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3551 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/fs/nxffs/nxffs_inode.c')
-rw-r--r--nuttx/fs/nxffs/nxffs_inode.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/nuttx/fs/nxffs/nxffs_inode.c b/nuttx/fs/nxffs/nxffs_inode.c
index 1e982c90d..3f8891f90 100644
--- a/nuttx/fs/nxffs/nxffs_inode.c
+++ b/nuttx/fs/nxffs/nxffs_inode.c
@@ -102,12 +102,7 @@ static int nxffs_rdentry(FAR struct nxffs_volume_s *volume, off_t offset,
/* Read the header at the FLASH offset */
nxffs_ioseek(volume, offset);
- ret = nxffs_rddata(volume, (FAR uint8_t *)&inode, SIZEOF_NXFFS_INODE_HDR);
- if (ret < 0)
- {
- fdbg("Failed to read inode, offset %d: %d\n", offset, -ret);
- return -EIO;
- }
+ memcpy(&inode, &volume->cache[volume->iooffset], SIZEOF_NXFFS_INODE_HDR);
/* Check if the file is marked as deleted. */
@@ -141,15 +136,24 @@ static int nxffs_rdentry(FAR struct nxffs_volume_s *volume, off_t offset,
return -ENOMEM;
}
- /* Read the file name from the expected offset in FLASH */
+ /* Seek to the expected location of the name in FLASH */
nxffs_ioseek(volume, entry->noffset);
- ret = nxffs_rddata(volume, (FAR uint8_t*)entry->name, namlen);
+
+ /* Make sure that the block is in memory (the name may not be in the
+ * same block as the inode header.
+ */
+
+ ret = nxffs_rdcache(volume, volume->ioblock, 1);
if (ret < 0)
{
- fdbg("Failed to read inode, offset %d: %d\n", offset, -ret);
- return -EIO;
+ fdbg("nxffsx_rdcache failed: %d\n", -ret);
+ return ret;
}
+
+ /* Read the file name from the expected offset in FLASH */
+
+ memcpy(entry->name, &volume->cache[volume->iooffset], namlen);
entry->name[namlen] = '\0';
/* Finish the CRC calculation and verify the entry */
@@ -350,7 +354,7 @@ int nxffs_findinode(FAR struct nxffs_volume_s *volume, FAR const char *name,
ret = nxffs_nextentry(volume, offset, entry);
if (ret < 0)
{
- fdbg("No inode found: %d\n", -ret);
+ fvdbg("No inode found: %d\n", -ret);
return ret;
}