summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-09-15 20:55:56 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-09-15 20:55:56 +0000
commitdfcb307e3869a6df376eb0c663e1798235a1c40e (patch)
tree56580c76d84b603585b80d895dd0fe141fcb6365
parentea058253e4344a337b61a3e412694361b07f082e (diff)
downloadpx4-nuttx-dfcb307e3869a6df376eb0c663e1798235a1c40e.tar.gz
px4-nuttx-dfcb307e3869a6df376eb0c663e1798235a1c40e.tar.bz2
px4-nuttx-dfcb307e3869a6df376eb0c663e1798235a1c40e.zip
Revert some unnecessary portions of last commit
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3956 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--nuttx/fs/fat/fs_fat32.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/nuttx/fs/fat/fs_fat32.c b/nuttx/fs/fat/fs_fat32.c
index c7157b091..4dfda324f 100644
--- a/nuttx/fs/fat/fs_fat32.c
+++ b/nuttx/fs/fat/fs_fat32.c
@@ -630,7 +630,6 @@ static ssize_t fat_write(FAR struct file *filep, const char *buffer,
int32_t cluster;
unsigned int byteswritten;
unsigned int writesize;
- unsigned int bufsize;
unsigned int nsectors;
uint8_t *userbuffer = (uint8_t*)buffer;
int sectorindex;
@@ -788,8 +787,8 @@ static ssize_t fat_write(FAR struct file *filep, const char *buffer,
/* Copy the partial sector from the user buffer */
- bufsize = fs->fs_hwsectorsize - sectorindex;
- if (bufsize > buflen)
+ writesize = fs->fs_hwsectorsize - sectorindex;
+ if (writesize > buflen)
{
/* We will not write to the end of the buffer. Set
* write size to the size of the user buffer.
@@ -799,12 +798,12 @@ static ssize_t fat_write(FAR struct file *filep, const char *buffer,
}
else
{
- /* We will write to the end of the cached sector and
- * perhaps beyond. Set writesize to the number of
- * bytes still available in the cached sector.
+ /* We will write to the end of the buffer (or beyond). Bump
+ * up the current sector number (actually the next sector number).
*/
- writesize = bufsize;
+ ff->ff_sectorsincluster--;
+ ff->ff_currentsector++;
}
/* Copy the data into the cached sector and make sure that the
@@ -813,20 +812,6 @@ static ssize_t fat_write(FAR struct file *filep, const char *buffer,
memcpy(&ff->ff_buffer[sectorindex], userbuffer, writesize);
ff->ff_bflags |= (FFBUFF_DIRTY|FFBUFF_VALID|FFBUFF_MODIFIED);
-
- /* Do we need to write more in the next sector? We may need
- * to this if we wrote to the end of the cached sector.
- */
-
- if (writesize >= bufsize)
- {
- /* We will write to the end of the buffer (or beyond). Bump
- * up the current sector number.
- */
-
- ff->ff_sectorsincluster--;
- ff->ff_currentsector++;
- }
}
/* Set up for the next write */