Skip to content
API Documentation
BastionGuard™
anonymous_namespace{hfs_recovery.cpp} Namespace Reference

Functions

bool read_exact (DiskReader &reader, uint64_t off, void *dst, size_t n)
bool validate_geometry (DiskReader &reader, uint64_t volume_offset, const hfs::VolumeHeader &vh, std::string &err)

Function Documentation

◆ read_exact()

bool anonymous_namespace{hfs_recovery.cpp}::read_exact ( DiskReader & reader,
uint64_t off,
void * dst,
size_t n )

Definition at line 33 of file hfs_recovery.cpp.

33 {
34 return reader.read_at(off, dst, n);
35}
bool read_at(uint64_t offset, void *buffer, size_t len)

References DiskReader::read_at(), and read_exact().

Referenced by read_exact().

◆ validate_geometry()

bool anonymous_namespace{hfs_recovery.cpp}::validate_geometry ( DiskReader & reader,
uint64_t volume_offset,
const hfs::VolumeHeader & vh,
std::string & err )

Definition at line 41 of file hfs_recovery.cpp.

42 {
43 const uint64_t disk_size = reader.size();
44 if (volume_offset >= disk_size) {
45 err = "Volume offset beyond disk end";
46 return false;
47 }
48 const uint64_t fs_size = vh.volume_size_bytes();
49 if (volume_offset + fs_size > disk_size + 64u * 1024) {
50 err = "Filesystem extends past end of disk";
51 return false;
52 }
53 return true;
54}
uint64_t size() const
uint64_t volume_size_bytes() const

References DiskReader::size(), validate_geometry(), and hfs::VolumeHeader::volume_size_bytes().

Referenced by validate_geometry().