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
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 */
Uses a BootImage as a storage provider.
const BootImage bootImage() const
Get BootImage header.
virtual FileSystem::Result initialize()
Initialize the Storage device.
virtual FileSystem::Result read(const u64 offset, void *buffer, const Size size) const
Reads data from the boot image.
const BootImage * load() const
Loads the BootImage into virtual memory.
const BootImage * m_image
Pointer to the BootImage.
virtual u64 capacity() const
Retrieve maximum storage capacity.
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
#define ZERO
Zero value.
Definition Macros.h:43
unsigned long long u64
Unsigned 64-bit number.
Definition Types.h:50
Result
Result code for filesystem Actions.
Definition FileSystem.h:53
BootImage contains executable programs to be loaded at system bootup.
Definition BootImage.h:45