You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ag...@apache.org on 2021/02/26 10:45:06 UTC
[incubator-nuttx] branch master updated (6cac6c5 -> 2c7faad)
This is an automated email from the ASF dual-hosted git repository.
aguettouche pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.
from 6cac6c5 unistd/getcwd: enhance getcwd when buf is NULL
new ac52820 fs/lfs: lfs_file_sync() when littlefs_open
new 2c7faad fs/lfs: Remove semret temporary variable
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
fs/littlefs/lfs_vfs.c | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
[incubator-nuttx] 02/02: fs/lfs: Remove semret temporary variable
Posted by ag...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
aguettouche pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 2c7faade4965670b407f095b42baf781d248caf6
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Wed Feb 24 12:35:20 2021 +0800
fs/lfs: Remove semret temporary variable
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
Change-Id: I2df74c7d42fac25c4b010e6b10c2af36f555c480
---
fs/littlefs/lfs_vfs.c | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/fs/littlefs/lfs_vfs.c b/fs/littlefs/lfs_vfs.c
index 4cc41c4..19e5792 100644
--- a/fs/littlefs/lfs_vfs.c
+++ b/fs/littlefs/lfs_vfs.c
@@ -347,7 +347,6 @@ static ssize_t littlefs_read(FAR struct file *filep, FAR char *buffer,
FAR struct lfs_file *priv;
FAR struct inode *inode;
ssize_t ret;
- int semret;
/* Recover our private data from the struct file instance */
@@ -357,10 +356,10 @@ static ssize_t littlefs_read(FAR struct file *filep, FAR char *buffer,
/* Call LFS to perform the read */
- semret = littlefs_semtake(fs);
- if (semret < 0)
+ ret = littlefs_semtake(fs);
+ if (ret < 0)
{
- return (ssize_t)semret;
+ return ret;
}
ret = lfs_file_read(&fs->lfs, priv, buffer, buflen);
@@ -385,7 +384,6 @@ static ssize_t littlefs_write(FAR struct file *filep, const char *buffer,
FAR struct lfs_file *priv;
FAR struct inode *inode;
ssize_t ret;
- int semret;
/* Recover our private data from the struct file instance */
@@ -395,10 +393,10 @@ static ssize_t littlefs_write(FAR struct file *filep, const char *buffer,
/* Call LFS to perform the write */
- semret = littlefs_semtake(fs);
- if (semret < 0)
+ ret = littlefs_semtake(fs);
+ if (ret < 0)
{
- return semret;
+ return ret;
}
ret = lfs_file_write(&fs->lfs, priv, buffer, buflen);
@@ -422,7 +420,6 @@ static off_t littlefs_seek(FAR struct file *filep, off_t offset, int whence)
FAR struct lfs_file *priv;
FAR struct inode *inode;
off_t ret;
- int semret;
/* Recover our private data from the struct file instance */
@@ -432,10 +429,10 @@ static off_t littlefs_seek(FAR struct file *filep, off_t offset, int whence)
/* Call LFS to perform the seek */
- semret = littlefs_semtake(fs);
- if (semret < 0)
+ ret = littlefs_semtake(fs);
+ if (ret < 0)
{
- return (off_t)semret;
+ return ret;
}
ret = lfs_file_seek(&fs->lfs, priv, offset, whence);
[incubator-nuttx] 01/02: fs/lfs: lfs_file_sync() when littlefs_open
Posted by ag...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
aguettouche pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit ac528203fea423731df48861e918a856bc33d78f
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Wed Feb 24 13:26:58 2021 +0800
fs/lfs: lfs_file_sync() when littlefs_open
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
Signed-off-by: ligd <li...@xiaomi.com>
Change-Id: I8935f7aee414580174141f4b114b5faf03ffafd5
---
fs/littlefs/lfs_vfs.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/fs/littlefs/lfs_vfs.c b/fs/littlefs/lfs_vfs.c
index ffaa5a2..4cc41c4 100644
--- a/fs/littlefs/lfs_vfs.c
+++ b/fs/littlefs/lfs_vfs.c
@@ -55,7 +55,7 @@ struct littlefs_mountpt_s
FAR struct inode *drv;
struct mtd_geometry_s geo;
struct lfs_config cfg;
- lfs_t lfs;
+ struct lfs lfs;
};
/****************************************************************************
@@ -279,6 +279,12 @@ static int littlefs_open(FAR struct file *filep, FAR const char *relpath,
}
}
+ /* Sync here in case of O_TRUNC haven't actually done immediately,
+ * e.g. total 8M, fileA 6M, O_TRUNC re-wrting fileA 6M, meet error.
+ */
+
+ lfs_file_sync(&fs->lfs, priv);
+
littlefs_semgive(fs);
/* Attach the private date to the struct file instance */