MCPcopy Create free account
hub / github.com/SmingHub/Sming / flushMeta

Method flushMeta

Sming/Libraries/Spiffs/src/FileSystem.cpp:432–453  ·  view source on GitHub ↗

* If metadata has changed, flush it to SPIFFS. */

Source from the content-addressed store, hash-verified

430 * If metadata has changed, flush it to SPIFFS.
431 */
432int FileSystem::flushMeta(FileHandle file)
433{
434#ifdef SPIFFS_STORE_META
435 auto smb = getMetaBuffer(file);
436 if(smb == nullptr) {
437 return Error::InvalidHandle;
438 }
439
440 // Changed ?
441 if(smb->flags[SpiffsMetaBuffer::Flag::dirty]) {
442 debug_d("Flushing Metadata to disk");
443 smb->flags[SpiffsMetaBuffer::Flag::dirty] = false;
444 int err = SPIFFS_fupdate_meta(handle(), file, smb);
445 if(err < 0) {
446 err = translateSpiffsError(err);
447 debug_ifserr(err, "fupdate_meta()");
448 return err;
449 }
450 }
451#endif
452 return FS_OK;
453}
454
455int FileSystem::stat(const char* path, Stat* stat)
456{

Callers

nothing calls this directly

Calls 1

translateSpiffsErrorFunction · 0.85

Tested by

no test coverage detected