summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-05-13 21:47:36 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-05-13 21:47:36 +0000
commit116ec488ee7d616e562aecbc236e63ef43a90c7c (patch)
treebfd1c53f660743124cc5890a490afa460a23a1f2
parent50f7cb8fa46cae9496b95559e4f2b0874bfa77ac (diff)
downloadnuttx-116ec488ee7d616e562aecbc236e63ef43a90c7c.tar.gz
nuttx-116ec488ee7d616e562aecbc236e63ef43a90c7c.tar.bz2
nuttx-116ec488ee7d616e562aecbc236e63ef43a90c7c.zip
Initial mount integration
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@222 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--nuttx/TODO5
-rw-r--r--nuttx/arch/sim/src/up_blockdevice.c4
-rw-r--r--nuttx/examples/README.txt4
-rw-r--r--nuttx/fs/fs_fat32.c16
4 files changed, 22 insertions, 7 deletions
diff --git a/nuttx/TODO b/nuttx/TODO
index f2d3a6128..057463a29 100644
--- a/nuttx/TODO
+++ b/nuttx/TODO
@@ -37,7 +37,10 @@ o USB
o Libraries
o File system
-- Add some concept like mount points to handle mounted "real" filesystems.
+- Add disk usage stats, stat(), sync(), unlink(), mkdir(), chmod(), rename(),
+etc.
+- FAT32: long file names
+
o Console Output
diff --git a/nuttx/arch/sim/src/up_blockdevice.c b/nuttx/arch/sim/src/up_blockdevice.c
index 273cad950..0753561bc 100644
--- a/nuttx/arch/sim/src/up_blockdevice.c
+++ b/nuttx/arch/sim/src/up_blockdevice.c
@@ -129,7 +129,7 @@ static ssize_t up_read(FAR struct inode *inode, unsigned char *buffer,
memcpy(buffer,
&src[start_sector*LOGICAL_SECTOR_SIZE],
nsectors*LOGICAL_SECTOR_SIZE);
- return OK;
+ return nsectors;
}
}
return -EINVAL;
@@ -155,7 +155,7 @@ static ssize_t up_write(FAR struct inode *inode, const unsigned char *buffer,
memcpy(&dest[start_sector*LOGICAL_SECTOR_SIZE],
buffer,
nsectors*LOGICAL_SECTOR_SIZE);
- return OK;
+ return nsectors;
}
}
return -EINVAL;
diff --git a/nuttx/examples/README.txt b/nuttx/examples/README.txt
index 6d3d14e8b..3d595dd19 100644
--- a/nuttx/examples/README.txt
+++ b/nuttx/examples/README.txt
@@ -13,6 +13,10 @@ examples/nsh
shell-like application. With some additional development, NSH will
someday be a great NuttX application debugger.
+examples/mount
+
+ This contains a simple test of filesystem mountpoints.
+
examples/null
This is the do nothing application. It is only used for bringing
diff --git a/nuttx/fs/fs_fat32.c b/nuttx/fs/fs_fat32.c
index 35870b3ae..9edd320c4 100644
--- a/nuttx/fs/fs_fat32.c
+++ b/nuttx/fs/fs_fat32.c
@@ -480,8 +480,6 @@ static int fat_checkbootrecord(struct fat_mountpt_s *fs)
if (MBR_GETSIGNATURE(fs->fs_buffer) != 0xaa55 ||
MBR_GETROOTENTCNT(fs->fs_buffer) != 0 ||
- MBR_GETFATSZ16(fs->fs_buffer) != 0 ||
- MBR_GETTOTSEC16(fs->fs_buffer) != 0 ||
MBR_GETBYTESPERSEC(fs->fs_buffer) != fs->fs_hwsectorsize)
{
return -ENODEV;
@@ -495,7 +493,12 @@ static int fat_checkbootrecord(struct fat_mountpt_s *fs)
* Determine the number of sectors in a FAT.
*/
- fs->fs_fatsize = MBR_GETFATSZ32(fs->fs_buffer);
+ fs->fs_fatsize = MBR_GETFATSZ16(fs->fs_buffer); /* Should be zero */
+ if (!fs->fs_fatsize)
+ {
+ fs->fs_fatsize = MBR_GETFATSZ32(fs->fs_buffer);
+ }
+
if (fs->fs_fatsize >= fs->fs_hwnsectors)
{
return -ENODEV;
@@ -503,7 +506,12 @@ static int fat_checkbootrecord(struct fat_mountpt_s *fs)
/* Get the total number of sectors on the volume. */
- fs->fs_fattotsec = MBR_GETTOTSEC32(fs->fs_buffer);
+ fs->fs_fattotsec = MBR_GETTOTSEC16(fs->fs_buffer); /* Should be zero */
+ if (!fs->fs_fattotsec)
+ {
+ fs->fs_fattotsec = MBR_GETTOTSEC32(fs->fs_buffer);
+ }
+
if (fs->fs_fattotsec > fs->fs_hwnsectors)
{
return -ENODEV;