FreeNOS
BootImageStorage.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009 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_BOOTIMAGESTORAGE_H
19 #define __LIB_LIBFS_BOOTIMAGESTORAGE_H
20 
21 #include <Types.h>
22 #include <String.h>
23 #include <BootImage.h>
24 #include "FileSystem.h"
25 #include "Storage.h"
26 
38 class BootImageStorage : public Storage
39 {
40  public:
41 
47  BootImageStorage(const BootImage *image = ZERO);
48 
54  const BootImage bootImage() const;
55 
62 
72  virtual FileSystem::Result read(const u64 offset, void *buffer, const Size size) const;
73 
79  virtual u64 capacity() const;
80 
81  private:
82 
88  const BootImage * load() const;
89 
90  private:
91 
94 };
95 
101 #endif /* __LIB_LIBFS_BOOTIMAGESTORAGE_H */
FileSystem.h
Types.h
BootImageStorage::read
virtual FileSystem::Result read(const u64 offset, void *buffer, const Size size) const
Reads data from the boot image.
Definition: BootImageStorage.cpp:56
BootImageStorage
Uses a BootImage as a storage provider.
Definition: BootImageStorage.h:38
Storage.h
BootImageStorage::capacity
virtual u64 capacity() const
Retrieve maximum storage capacity.
Definition: BootImageStorage.cpp:63
BootImageStorage::bootImage
const BootImage bootImage() const
Get BootImage header.
Definition: BootImageStorage.cpp:27
u64
unsigned long long u64
Unsigned 64-bit number.
Definition: Types.h:50
BootImage.h
Size
unsigned int Size
Any sane size indicator cannot go negative.
Definition: Types.h:128
BootImageStorage::initialize
virtual FileSystem::Result initialize()
Initialize the Storage device.
Definition: BootImageStorage.cpp:34
BootImageStorage::m_image
const BootImage * m_image
Pointer to the BootImage.
Definition: BootImageStorage.h:93
FileSystem::Result
Result
Result code for filesystem Actions.
Definition: FileSystem.h:52
BootImageStorage::BootImageStorage
BootImageStorage(const BootImage *image=ZERO)
Constructor function.
Definition: BootImageStorage.cpp:22
String.h
BootImage
BootImage contains executable programs to be loaded at system bootup.
Definition: BootImage.h:44
ZERO
#define ZERO
Zero value.
Definition: Macros.h:43
Storage
Provides a storage device to build filesystems on top.
Definition: Storage.h:35
BootImageStorage::load
const BootImage * load() const
Loads the BootImage into virtual memory.
Definition: BootImageStorage.cpp:68