* If metadata has changed, flush it to SPIFFS. */
| 430 | * If metadata has changed, flush it to SPIFFS. |
| 431 | */ |
| 432 | int 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 | |
| 455 | int FileSystem::stat(const char* path, Stat* stat) |
| 456 | { |
nothing calls this directly
no test coverage detected