Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Only update LittleFS timestamp when opened write#6956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
earlephilhower merged 2 commits intoesp8266:masterfromearlephilhower:fixtime
Dec 30, 2019
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletionslibraries/LittleFS/src/LittleFS.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -72,9 +72,9 @@ FileImplPtr LittleFSImpl::open(const char* path, OpenMode openMode, AccessMode a
if (rc == LFS_ERR_ISDIR) {
// To support the SD.openNextFile, a null FD indicates to the LittleFSFile this is just
// a directory whose name we are carrying around but which cannot be read or written
return std::make_shared<LittleFSFileImpl>(this, path, nullptr);
return std::make_shared<LittleFSFileImpl>(this, path, nullptr, flags);
} else if (rc == 0) {
return std::make_shared<LittleFSFileImpl>(this, path, fd);
return std::make_shared<LittleFSFileImpl>(this, path, fd, flags);
} else {
DEBUGV("LittleFSDirImpl::openFile: rc=%d fd=%p path=`%s` openMode=%d accessMode=%d err=%d\n",
rc, fd.get(), path, openMode, accessMode, rc);
Expand Down
5 changes: 3 additions & 2 deletionslibraries/LittleFS/src/LittleFS.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -323,7 +323,7 @@ class LittleFSImpl : public FSImpl
class LittleFSFileImpl : public FileImpl
{
public:
LittleFSFileImpl(LittleFSImpl* fs, const char *name, std::shared_ptr<lfs_file_t> fd) : _fs(fs), _fd(fd), _opened(true) {
LittleFSFileImpl(LittleFSImpl* fs, const char *name, std::shared_ptr<lfs_file_t> fd, int flags) : _fs(fs), _fd(fd), _opened(true), _flags(flags) {
_name = std::shared_ptr<char>(new char[strlen(name) + 1], std::default_delete<char[]>());
strcpy(_name.get(), name);
}
Expand DownExpand Up@@ -419,7 +419,7 @@ class LittleFSFileImpl : public FileImpl
lfs_file_close(_fs->getFS(), _getFD());
_opened = false;
DEBUGV("lfs_file_close: fd=%p\n", _getFD());
if (timeCallback) {
if (timeCallback && (_flags & LFS_O_WRONLY)) {
// Add metadata with last write time
time_t now = timeCallback();
int rc = lfs_setattr(_fs->getFS(), _name.get(), 't', (const void *)&now, sizeof(now));
Expand DownExpand Up@@ -483,6 +483,7 @@ class LittleFSFileImpl : public FileImpl
std::shared_ptr<lfs_file_t> _fd;
std::shared_ptr<char> _name;
bool _opened;
int _flags;
};

class LittleFSDirImpl : public DirImpl
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp