genode/repos/gems/include/cbe/init/configuration.h
Martin Stein 30b8f4efc8 gems: import Genode-specific code of the CBE
The CBE repository contained a lot of Genode-specific code despite the fact
that the CBE core logic is not bound to Genode in any way. Therefore the
Genode-specific CBE code is moved to the 'gems' repository to form part of
Genode mainline. The remaining CBE code becomes a port in Genode instead of
being invoked as sub-repository.

The commit combines the following work steps:

* add all files removed from CBE repository
* add CBE port files
* make all CBE libs and targets build again
* make all CBE run scripts succeed again
* make all CBE recipes build again
* make CBE autopilot succeed again
* let CBE autopilot use 'libsparcrypto' contrib dir and Genode build dir
  instead of '.ci' dir in CBE contrib dir (remove '.ci' dir from CBE repo)
* let CBE autopilot always check for all ports
* make CBE autopilot directly executable
* fix license headers in all Genode CBE files
* remove unused VFS replay component
* remove unused CBE test
* remove unused external crypto
* remove unused files in run dir
* remove unused external trust anchor
* add cbe_tester test to autopilot list
* get rid of directories 'include/cbe_*' and 'include/utils'

Fixes #3937
2020-11-27 09:19:08 +01:00

101 lines
3.0 KiB
C++

/*
* \brief Integration of the Consistent Block Encrypter (CBE)
* \author Martin Stein
* \author Josef Soentgen
* \date 2020-11-10
*/
/*
* Copyright (C) 2020 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#ifndef _CBE__INIT__CONFIGURATION_H_
#define _CBE__INIT__CONFIGURATION_H_
/* Genode includes */
#include <util/xml_node.h>
namespace Cbe_init { class Configuration; }
class Cbe_init::Configuration
{
private:
Genode::uint64_t _vbd_nr_of_lvls { 0 };
Genode::uint64_t _vbd_nr_of_children { 0 };
Genode::uint64_t _vbd_nr_of_leafs { 0 };
Genode::uint64_t _ft_nr_of_lvls { 0 };
Genode::uint64_t _ft_nr_of_children { 0 };
Genode::uint64_t _ft_nr_of_leafs { 0 };
public:
struct Invalid : Genode::Exception { };
Configuration (Genode::Xml_node const &node)
{
node.with_sub_node("virtual-block-device",
[&] (Genode::Xml_node const &vbd)
{
_vbd_nr_of_lvls =
vbd.attribute_value("nr_of_levels", (Genode::uint64_t)0);
_vbd_nr_of_children =
vbd.attribute_value("nr_of_children", (Genode::uint64_t)0);
_vbd_nr_of_leafs =
vbd.attribute_value("nr_of_leafs", (Genode::uint64_t)0);
});
node.with_sub_node("free-tree",
[&] (Genode::Xml_node const &ft)
{
_ft_nr_of_lvls =
ft.attribute_value("nr_of_levels", (Genode::uint64_t)0);
_ft_nr_of_children =
ft.attribute_value("nr_of_children", (Genode::uint64_t)0);
_ft_nr_of_leafs =
ft.attribute_value("nr_of_leafs", (Genode::uint64_t)0);
});
if (_vbd_nr_of_lvls == 0 ||
_vbd_nr_of_children == 0 ||
_vbd_nr_of_leafs == 0 ||
_ft_nr_of_lvls == 0 ||
_ft_nr_of_children == 0 ||
_ft_nr_of_leafs == 0)
{
throw Invalid();
}
}
Configuration (Configuration const &other)
{
_vbd_nr_of_lvls = other._vbd_nr_of_lvls ;
_vbd_nr_of_children = other._vbd_nr_of_children;
_vbd_nr_of_leafs = other._vbd_nr_of_leafs ;
_ft_nr_of_lvls = other._ft_nr_of_lvls ;
_ft_nr_of_children = other._ft_nr_of_children ;
_ft_nr_of_leafs = other._ft_nr_of_leafs ;
}
Genode::uint64_t vbd_nr_of_lvls () const { return _vbd_nr_of_lvls ; }
Genode::uint64_t vbd_nr_of_children () const { return _vbd_nr_of_children; }
Genode::uint64_t vbd_nr_of_leafs () const { return _vbd_nr_of_leafs ; }
Genode::uint64_t ft_nr_of_lvls () const { return _ft_nr_of_lvls ; }
Genode::uint64_t ft_nr_of_children () const { return _ft_nr_of_children ; }
Genode::uint64_t ft_nr_of_leafs () const { return _ft_nr_of_leafs ; }
void print(Genode::Output &out) const
{
Genode::print(out,
"vbd=(lvls=", _vbd_nr_of_lvls,
" children=", _vbd_nr_of_children,
" leafs=", _vbd_nr_of_leafs, ")",
" ft=(lvls=", _ft_nr_of_lvls,
" children=", _ft_nr_of_children,
" leafs=", _ft_nr_of_leafs, ")");
}
};
#endif /* _CBE__INIT__CONFIGURATION_H_ */