FreeNOS
|
Uses a BootImage as a storage provider. More...
#include <BootImageStorage.h>
Public Member Functions | |
BootImageStorage (const BootImage *image=ZERO) | |
Constructor function. More... | |
const BootImage | bootImage () const |
Get BootImage header. More... | |
virtual FileSystem::Result | initialize () |
Initialize the Storage device. More... | |
virtual FileSystem::Result | read (const u64 offset, void *buffer, const Size size) const |
Reads data from the boot image. More... | |
virtual u64 | capacity () const |
Retrieve maximum storage capacity. More... | |
Public Member Functions inherited from Storage | |
Storage () | |
Constructor function. More... | |
virtual | ~Storage () |
Destructor function. More... | |
virtual FileSystem::Result | write (const u64 offset, void *buffer, const Size size) |
Write a contiguous set of data. More... | |
Private Member Functions | |
const BootImage * | load () const |
Loads the BootImage into virtual memory. More... | |
Private Attributes | |
const BootImage * | m_image |
Pointer to the BootImage. More... | |
Uses a BootImage as a storage provider.
Definition at line 38 of file BootImageStorage.h.
Constructor function.
image | Pointer to mapped BootImage or ZERO to map via kernel |
Definition at line 22 of file BootImageStorage.cpp.
const BootImage BootImageStorage::bootImage | ( | ) | const |
Get BootImage header.
Definition at line 27 of file BootImageStorage.cpp.
References header, and read().
Referenced by Kernel::loadBootImage(), Kernel::loadBootProgram(), BootSymbolStorage::loadSegment(), and BootSymbolStorage::loadSymbol().
|
virtual |
Retrieve maximum storage capacity.
Implements Storage.
Definition at line 63 of file BootImageStorage.cpp.
References BootImage::bootImageSize, and m_image.
|
virtual |
Initialize the Storage device.
Implements Storage.
Definition at line 34 of file BootImageStorage.cpp.
References BOOTIMAGE_MAGIC0, BOOTIMAGE_MAGIC1, BOOTIMAGE_REVISION, ERROR, FileSystem::InvalidArgument, FileSystem::IOError, BootImage::layoutRevision, m_image, BootImage::magic, FileSystem::Success, and ZERO.
Referenced by Kernel::loadBootImage(), and main().
|
private |
Loads the BootImage into virtual memory.
Definition at line 68 of file BootImageStorage.cpp.
References Memory::Range::access, SystemInformation::bootImageAddress, SystemInformation::bootImageSize, ERROR, MapContiguous, Memory::Range::phys, Memory::Readable, SELF, Memory::Range::size, API::Success, Memory::User, Memory::Range::virt, VMCtl(), and ZERO.
|
virtual |
Reads data from the boot image.
offset | Offset to start reading from. |
buffer | Output buffer. |
size | Number of bytes to copied. |
Implements Storage.
Definition at line 56 of file BootImageStorage.cpp.
References MemoryBlock::copy(), m_image, and FileSystem::Success.
Referenced by bootImage(), Kernel::loadBootImage(), Kernel::loadBootProgram(), BootSymbolStorage::loadSegment(), BootSymbolStorage::loadSymbol(), and BootSymbolStorage::read().
|
private |
Pointer to the BootImage.
Definition at line 93 of file BootImageStorage.h.
Referenced by capacity(), initialize(), and read().