| 489 | } |
| 490 | |
| 491 | int 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 | |
| 519 | int FileSystem::fgetextents(FileHandle file, Storage::Partition* part, Extent* list, uint16_t extcount) |
| 520 | { |