22 return make_error<MSFError>(msf_error_code::invalid_format,
23 "MSF magic header doesn't match");
26 return make_error<MSFError>(msf_error_code::invalid_format,
27 "Unsupported block size.");
31 return make_error<MSFError>(msf_error_code::invalid_format,
32 "Directory size is not multiple of 4.");
43 return make_error<MSFError>(msf_error_code::invalid_format,
44 "Too many directory blocks.");
47 return make_error<MSFError>(msf_error_code::invalid_format,
48 "Block 0 is reserved");
51 return make_error<MSFError>(msf_error_code::invalid_format,
52 "Block map address is invalid.");
55 return make_error<MSFError>(
56 msf_error_code::invalid_format,
57 "The free block map isn't at block 1 or block 2.");
63 bool IncludeUnusedFpmData,
76 if (IncludeUnusedFpmData)
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Describes the layout of a stream in an MSF layout.
std::vector< support::ulittle32_t > Blocks
Error validateSuperBlock(const SuperBlock &SB)
uint32_t getFpmIntervalLength(const MSFLayout &L)
bool isValidBlockSize(uint32_t Size)
MSFStreamLayout getFpmStreamLayout(const MSFLayout &Msf, bool IncludeUnusedFpmData=false, bool AltFpm=false)
Determine the layout of the FPM stream, given the MSF layout.
uint64_t bytesToBlocks(uint64_t NumBytes, uint64_t BlockSize)
uint32_t getNumFpmIntervals(uint32_t BlockSize, uint32_t NumBlocks, bool IncludeUnusedFpmData, int FpmNumber)
Given an MSF with the specified block size and number of blocks, determine how many pieces the specif...
static const char Magic[]
This is an optimization pass for GlobalISel generic memory operations.
constexpr T divideCeil(U Numerator, V Denominator)
Returns the integer ceil(Numerator / Denominator).
uint32_t alternateFpmBlock() const
uint32_t mainFpmBlock() const
support::ulittle32_t NumBlocks
support::ulittle32_t BlockSize
char MagicBytes[sizeof(Magic)]
support::ulittle32_t NumDirectoryBytes
support::ulittle32_t BlockMapAddr
support::ulittle32_t FreeBlockMapBlock