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

Method CopyFrom

src/Storage/FileStore.cpp:780–794  ·  view source on GitHub ↗

Copy an open file handle to make a duplicate with its own position. Intended for use on files opened in read-only mode. We assume that FatFs doesn't keep a count of open files, so it's OK for us to just make a copy of the FIL structure.

Source from the content-addressed store, hash-verified

778// Copy an open file handle to make a duplicate with its own position. Intended for use on files opened in read-only mode.
779// We assume that FatFs doesn't keep a count of open files, so it's OK for us to just make a copy of the FIL structure.
780void FileStore::CopyFrom(const FileStore *f) noexcept
781{
782 usageMode = FileUseMode::readOnly;
783#if HAS_EMBEDDED_FILES
784 fileIndex = f->fileIndex;
785#else
786 file = f->file;
787 writeBuffer = nullptr;
788 crc.Reset();
789 calcCrc = false;
790#endif
791 closeRequested = false;
792 openCount = 1;
793 reprap.VolumesUpdated();
794}
795
796#endif
797

Callers 3

GCodeMachineStateMethod · 0.45
ReadFromFileMethod · 0.45
MassStorage.cppFile · 0.45

Calls 2

VolumesUpdatedMethod · 0.80
ResetMethod · 0.45

Tested by

no test coverage detected