9
0
Fork 0

Initial mount integration

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@222 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2007-05-13 21:47:36 +00:00
parent ced95bdb3f
commit ee4e7953f7
4 changed files with 22 additions and 7 deletions

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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;