summaryrefslogtreecommitdiff
path: root/nuttx/fs
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-10-31 17:04:03 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-10-31 17:04:03 +0000
commit1670d2d218ad2dbcf33c53dbce818b8514836f65 (patch)
tree245651e92a8faef6478b57a7d13088f017443c13 /nuttx/fs
parent2ebabef806fdfc5b9ddbac2a71bad3a62a3e91f4 (diff)
downloadpx4-nuttx-1670d2d218ad2dbcf33c53dbce818b8514836f65.tar.gz
px4-nuttx-1670d2d218ad2dbcf33c53dbce818b8514836f65.tar.bz2
px4-nuttx-1670d2d218ad2dbcf33c53dbce818b8514836f65.zip
Fix an NXFFS initialization problem
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4074 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/fs')
-rw-r--r--nuttx/fs/nxffs/nxffs_initialize.c19
-rw-r--r--nuttx/fs/nxffs/nxffs_inode.c6
2 files changed, 22 insertions, 3 deletions
diff --git a/nuttx/fs/nxffs/nxffs_initialize.c b/nuttx/fs/nxffs/nxffs_initialize.c
index 0fa879f75..0fe519cee 100644
--- a/nuttx/fs/nxffs/nxffs_initialize.c
+++ b/nuttx/fs/nxffs/nxffs_initialize.c
@@ -398,7 +398,24 @@ int nxffs_limits(FAR struct nxffs_volume_s *volume)
* is full?
*/
- fvdbg("nxffs_getc failed: %d\n", -ch);
+ if (volume->ioblock + 1 >= volume->nblocks &&
+ volume->iooffset + 1 >= volume->geo.blocksize)
+ {
+ /* Yes.. the FLASH is full. Force the offsets to the end of FLASH */
+
+ volume->froffset = volume->nblocks * volume->geo.blocksize;
+ fvdbg("Assume no free FLASH, froffset: %d\n", volume->froffset);
+ if (noinodes)
+ {
+ volume->inoffset = volume->froffset;
+ fvdbg("No inodes, inoffset: %d\n", volume->inoffset);
+ }
+ return OK;
+ }
+
+ // No? Then it is some other failure that we do not know how to handle
+
+ fdbg("nxffs_getc failed: %d\n", -ch);
return ch;
}
diff --git a/nuttx/fs/nxffs/nxffs_inode.c b/nuttx/fs/nxffs/nxffs_inode.c
index 121c1f6db..3362d1f29 100644
--- a/nuttx/fs/nxffs/nxffs_inode.c
+++ b/nuttx/fs/nxffs/nxffs_inode.c
@@ -470,9 +470,11 @@ off_t nxffs_inodeend(FAR struct nxffs_volume_s *volume,
if (entry->doffset)
{
- /* This is the maximum size of one data block */
+ /* This is the maximum size of one data block. It is the physcal size
+ * of the block minus the minimum number of headers: block sna data
+ */
- uint16_t maxsize = volume->geo.blocksize - SIZEOF_NXFFS_DATA_HDR;
+ uint16_t maxsize = volume->geo.blocksize - SIZEOF_NXFFS_BLOCK_HDR - SIZEOF_NXFFS_DATA_HDR;
/* This is the minimum number of blocks require to span all of the
* inode data. One additional block could possibly be required -- we