FreeNOS
BootSymbolStorage.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Niek Linnenbank
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __LIB_LIBFS_BOOTSYMBOLSTORAGE_H
19 #define __LIB_LIBFS_BOOTSYMBOLSTORAGE_H
20 
21 #include <Types.h>
22 #include <String.h>
23 #include <BootImage.h>
24 #include "FileSystem.h"
25 #include "Storage.h"
26 #include "BootImageStorage.h"
27 
39 class BootSymbolStorage : public Storage
40 {
41  public:
42 
49  BootSymbolStorage(const BootImageStorage &bootImage,
50  const char *symbolName);
51 
58 
68  virtual FileSystem::Result read(const u64 offset, void *buffer, const Size size) const;
69 
75  virtual u64 capacity() const;
76 
77  private:
78 
84  const BootSymbol loadSymbol(const char *name) const;
85 
93  const BootSegment loadSegment(const BootSymbol &symbol) const;
94 
95  private:
96 
99 
102 
105 };
106 
112 #endif /* __LIB_LIBFS_BOOTSYMBOLSTORAGE_H */
FileSystem.h
BootSymbolStorage::m_segment
const BootSegment m_segment
BootSegment value.
Definition: BootSymbolStorage.h:104
Types.h
BootImageStorage
Uses a BootImage as a storage provider.
Definition: BootImageStorage.h:38
Storage.h
BootSymbolStorage::m_bootImage
const BootImageStorage & m_bootImage
Read-only reference to the BootImage storage.
Definition: BootSymbolStorage.h:98
u64
unsigned long long u64
Unsigned 64-bit number.
Definition: Types.h:50
BootSymbolStorage::BootSymbolStorage
BootSymbolStorage(const BootImageStorage &bootImage, const char *symbolName)
Constructor function.
Definition: BootSymbolStorage.cpp:22
BootImage.h
BootSymbolStorage::capacity
virtual u64 capacity() const
Retrieve maximum storage capacity.
Definition: BootSymbolStorage.cpp:47
Size
unsigned int Size
Any sane size indicator cannot go negative.
Definition: Types.h:128
BootSymbolStorage::initialize
virtual FileSystem::Result initialize()
Initialize the Storage device.
Definition: BootSymbolStorage.cpp:30
BootSymbol
Program embedded in the BootImage.
Definition: BootImage.h:84
BootSymbolStorage
Uses a BootSymbol inside a BootImage as a storage provider.
Definition: BootSymbolStorage.h:39
FileSystem::Result
Result
Result code for filesystem Actions.
Definition: FileSystem.h:52
String.h
BootImageStorage.h
BootSymbolStorage::m_symbol
const BootSymbol m_symbol
BootSymbol value.
Definition: BootSymbolStorage.h:101
BootSymbolStorage::loadSymbol
const BootSymbol loadSymbol(const char *name) const
Loads the BootSymbol from the BootImage.
Definition: BootSymbolStorage.cpp:52
BootSegment
Memory segment.
Definition: BootImage.h:109
BootSymbolStorage::read
virtual FileSystem::Result read(const u64 offset, void *buffer, const Size size) const
Reads data from the BootSymbol.
Definition: BootSymbolStorage.cpp:42
Storage
Provides a storage device to build filesystems on top.
Definition: Storage.h:35
BootSymbolStorage::loadSegment
const BootSegment loadSegment(const BootSymbol &symbol) const
Load the BootSegment for the given BootSymbol.
Definition: BootSymbolStorage.cpp:83