mirror of
https://github.com/apache/nuttx.git
synced 2026-05-22 22:20:01 +08:00
Initial mount integration
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@222 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
+12
-4
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user