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
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 */
Uses a BootImage as a storage provider.
Uses a BootSymbol inside a BootImage as a storage provider.
virtual FileSystem::Result initialize()
Initialize the Storage device.
virtual u64 capacity() const
Retrieve maximum storage capacity.
const BootSymbol m_symbol
BootSymbol value.
const BootSymbol loadSymbol(const char *name) const
Loads the BootSymbol from the BootImage.
const BootSegment m_segment
BootSegment value.
virtual FileSystem::Result read(const u64 offset, void *buffer, const Size size) const
Reads data from the BootSymbol.
const BootSegment loadSegment(const BootSymbol &symbol) const
Load the BootSegment for the given BootSymbol.
const BootImageStorage & m_bootImage
Read-only reference to the BootImage storage.
Provides a storage device to build filesystems on top.
Definition Storage.h:36
unsigned int Size
Any sane size indicator cannot go negative.
Definition Types.h:128
unsigned long long u64
Unsigned 64-bit number.
Definition Types.h:50
Result
Result code for filesystem Actions.
Definition FileSystem.h:53
Memory segment.
Definition BootImage.h:110
Program embedded in the BootImage.
Definition BootImage.h:85