MCPcopy Create free account
hub / github.com/Duet3D/RepRapFirmware / Truncate

Method Truncate

src/Storage/FileStore.cpp:345–376  ·  view source on GitHub ↗

Truncate file at current file pointer

Source from the content-addressed store, hash-verified

343
344// Truncate file at current file pointer
345bool FileStore::Truncate() noexcept
346{
347 switch (usageMode)
348 {
349 case FileUseMode::free:
350 case FileUseMode::readOnly:
351 REPORT_INTERNAL_ERROR;
352 return false;
353
354 case FileUseMode::readWrite:
355 if (!Flush())
356 {
357 return false;
358 }
359#if HAS_SBC_INTERFACE
360 if (reprap.UsingSbcInterface())
361 {
362 length = offset;
363 return reprap.GetSbcInterface().TruncateFile(handle);
364 }
365#endif
366#if HAS_MASS_STORAGE
367 return f_truncate(&file) == FR_OK;
368#else
369 return false;
370#endif
371
372 case FileUseMode::invalidated:
373 default:
374 return false;
375 }
376}
377
378#endif
379

Callers 8

AccelerometerTaskCodeFunction · 0.80
ProcessReceivedDataMethod · 0.80
SelectMethod · 0.80
CloseDataCollectionFileFunction · 0.80
DirectoryExistsMethod · 0.80
DeleteContentsFunction · 0.80
FindFirstMethod · 0.80
RecordSimulationTimeMethod · 0.80

Calls 3

f_truncateFunction · 0.85
UsingSbcInterfaceMethod · 0.80
TruncateFileMethod · 0.80

Tested by

no test coverage detected