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

Method fstat

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

Source from the content-addressed store, hash-verified

489}
490
491int FileSystem::fstat(FileHandle file, Stat* stat)
492{
493 spiffs_stat ss;
494 int err = SPIFFS_fstat(handle(), file, &ss);
495 CHECK_RES(err)
496
497 auto smb = getMetaBuffer(file);
498 if(smb == nullptr) {
499 return Error::InvalidHandle;
500 }
501
502#ifdef SPIFFS_STORE_META
503 smb->assign(ss.meta);
504#endif
505
506 if(stat != nullptr) {
507 *stat = Stat{};
508 stat->fs = this;
509 stat->name.copy(reinterpret_cast<const char*>(ss.name));
510 stat->size = ss.size;
511 stat->id = ss.obj_id;
512 fillStat(*stat, *smb);
513 checkStat(*stat);
514 }
515
516 return FS_OK;
517}
518
519int FileSystem::fgetextents(FileHandle file, Storage::Partition* part, Extent* list, uint16_t extcount)
520{

Callers 4

fileStatsFunction · 0.80
fileNameMethod · 0.80
idMethod · 0.80
statMethod · 0.80

Calls 3

fillStatFunction · 0.85
assignMethod · 0.45
copyMethod · 0.45

Tested by

no test coverage detected