mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-21 06:33:31 +00:00
parent
f3610dc3a8
commit
5907307af6
@ -47,7 +47,7 @@ proc block_io_vfs_ram_mb { } {
|
|||||||
return [expr 8 * $bench_mb]
|
return [expr 8 * $bench_mb]
|
||||||
}
|
}
|
||||||
# when benchmarks turned off
|
# when benchmarks turned off
|
||||||
return 10
|
return 36
|
||||||
}
|
}
|
||||||
|
|
||||||
proc jent_avail { } {
|
proc jent_avail { } {
|
||||||
|
@ -628,22 +628,22 @@ class File_vault::Main
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Number_of_blocks _tresor_tree_num_leaves(size_t payload_size);
|
static Number_of_blocks _tresor_tree_num_leaves(uint64_t payload_size);
|
||||||
|
|
||||||
|
|
||||||
static size_t _tree_nr_of_blocks(size_t nr_of_lvls,
|
static uint64_t _tree_nr_of_blocks(size_t nr_of_lvls,
|
||||||
size_t nr_of_children,
|
size_t nr_of_children,
|
||||||
size_t nr_of_leafs);
|
uint64_t nr_of_leafs);
|
||||||
|
|
||||||
size_t _tresor_size() const;
|
uint64_t _tresor_size() const;
|
||||||
|
|
||||||
static size_t _tresor_nr_of_blocks(size_t nr_of_superblocks,
|
static uint64_t _tresor_nr_of_blocks(size_t nr_of_superblocks,
|
||||||
size_t nr_of_vbd_lvls,
|
size_t nr_of_vbd_lvls,
|
||||||
size_t nr_of_vbd_children,
|
size_t nr_of_vbd_children,
|
||||||
size_t nr_of_vbd_leafs,
|
uint64_t nr_of_vbd_leafs,
|
||||||
size_t nr_of_ft_lvls,
|
size_t nr_of_ft_lvls,
|
||||||
size_t nr_of_ft_children,
|
size_t nr_of_ft_children,
|
||||||
size_t nr_of_ft_leafs);
|
uint64_t nr_of_ft_leafs);
|
||||||
|
|
||||||
template <size_t N>
|
template <size_t N>
|
||||||
static bool listing_file_starts_with(Xml_node const &fs_query_listing,
|
static bool listing_file_starts_with(Xml_node const &fs_query_listing,
|
||||||
@ -2361,7 +2361,7 @@ void File_vault::Main::wakeup_local_service()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Number_of_blocks Main::_tresor_tree_num_leaves(size_t payload_size)
|
Number_of_blocks Main::_tresor_tree_num_leaves(uint64_t payload_size)
|
||||||
{
|
{
|
||||||
Number_of_blocks nr_of_leaves { payload_size / TRESOR_BLOCK_SIZE };
|
Number_of_blocks nr_of_leaves { payload_size / TRESOR_BLOCK_SIZE };
|
||||||
if (payload_size % TRESOR_BLOCK_SIZE) {
|
if (payload_size % TRESOR_BLOCK_SIZE) {
|
||||||
@ -2673,12 +2673,12 @@ void File_vault::Main::_generate_sandbox_config(Xml_generator &xml) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
size_t Main::_tree_nr_of_blocks(size_t nr_of_lvls,
|
uint64_t Main::_tree_nr_of_blocks(size_t nr_of_lvls,
|
||||||
size_t nr_of_children,
|
size_t nr_of_children,
|
||||||
size_t nr_of_leafs)
|
uint64_t nr_of_leafs)
|
||||||
{
|
{
|
||||||
size_t nr_of_blks { 0 };
|
uint64_t nr_of_blks { 0 };
|
||||||
size_t nr_of_last_lvl_blks { nr_of_leafs };
|
uint64_t nr_of_last_lvl_blks { nr_of_leafs };
|
||||||
for (size_t lvl_idx { 0 }; lvl_idx < nr_of_lvls; lvl_idx++) {
|
for (size_t lvl_idx { 0 }; lvl_idx < nr_of_lvls; lvl_idx++) {
|
||||||
nr_of_blks += nr_of_last_lvl_blks;
|
nr_of_blks += nr_of_last_lvl_blks;
|
||||||
if (nr_of_last_lvl_blks % nr_of_children) {
|
if (nr_of_last_lvl_blks % nr_of_children) {
|
||||||
@ -2691,7 +2691,7 @@ size_t Main::_tree_nr_of_blocks(size_t nr_of_lvls,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
size_t Main::_tresor_size() const
|
uint64_t Main::_tresor_size() const
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
_tresor_nr_of_blocks(
|
_tresor_nr_of_blocks(
|
||||||
@ -2706,21 +2706,21 @@ size_t Main::_tresor_size() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
size_t Main::_tresor_nr_of_blocks(size_t nr_of_superblocks,
|
uint64_t Main::_tresor_nr_of_blocks(size_t nr_of_superblocks,
|
||||||
size_t nr_of_vbd_lvls,
|
size_t nr_of_vbd_lvls,
|
||||||
size_t nr_of_vbd_children,
|
size_t nr_of_vbd_children,
|
||||||
size_t nr_of_vbd_leafs,
|
uint64_t nr_of_vbd_leafs,
|
||||||
size_t nr_of_ft_lvls,
|
size_t nr_of_ft_lvls,
|
||||||
size_t nr_of_ft_children,
|
size_t nr_of_ft_children,
|
||||||
size_t nr_of_ft_leafs)
|
uint64_t nr_of_ft_leafs)
|
||||||
{
|
{
|
||||||
size_t const nr_of_vbd_blks {
|
uint64_t const nr_of_vbd_blks {
|
||||||
_tree_nr_of_blocks(
|
_tree_nr_of_blocks(
|
||||||
nr_of_vbd_lvls,
|
nr_of_vbd_lvls,
|
||||||
nr_of_vbd_children,
|
nr_of_vbd_children,
|
||||||
nr_of_vbd_leafs) };
|
nr_of_vbd_leafs) };
|
||||||
|
|
||||||
size_t const nr_of_ft_blks {
|
uint64_t const nr_of_ft_blks {
|
||||||
_tree_nr_of_blocks(
|
_tree_nr_of_blocks(
|
||||||
nr_of_ft_lvls,
|
nr_of_ft_lvls,
|
||||||
nr_of_ft_children,
|
nr_of_ft_children,
|
||||||
@ -2741,7 +2741,7 @@ size_t Main::_tresor_nr_of_blocks(size_t nr_of_superblocks,
|
|||||||
* nr_of_mt_children,
|
* nr_of_mt_children,
|
||||||
* nr_of_mt_leafs) };
|
* nr_of_mt_leafs) };
|
||||||
*/
|
*/
|
||||||
size_t const nr_of_mt_blks { nr_of_ft_blks };
|
uint64_t const nr_of_mt_blks { nr_of_ft_blks };
|
||||||
|
|
||||||
return
|
return
|
||||||
nr_of_superblocks +
|
nr_of_superblocks +
|
||||||
|
@ -470,7 +470,7 @@ namespace File_vault {
|
|||||||
void gen_truncate_file_start_node(Xml_generator &xml,
|
void gen_truncate_file_start_node(Xml_generator &xml,
|
||||||
Child_state const &child,
|
Child_state const &child,
|
||||||
char const *path,
|
char const *path,
|
||||||
size_t size)
|
uint64_t size)
|
||||||
{
|
{
|
||||||
child.gen_start_node(xml, [&] () {
|
child.gen_start_node(xml, [&] () {
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ class Tresor_tester::Benchmark : Noncopyable
|
|||||||
|
|
||||||
if (_num_virt_blks_read) {
|
if (_num_virt_blks_read) {
|
||||||
|
|
||||||
size_t const bytes_read { _num_virt_blks_read * Tresor::BLOCK_SIZE };
|
uint64_t const bytes_read { _num_virt_blks_read * Tresor::BLOCK_SIZE };
|
||||||
double const mibyte_read { (double)bytes_read / (double)(1024 * 1024) };
|
double const mibyte_read { (double)bytes_read / (double)(1024 * 1024) };
|
||||||
double const mibyte_per_sec_read {
|
double const mibyte_per_sec_read {
|
||||||
(double)bytes_read / (double)passed_time_sec / (double)(1024 * 1024) };
|
(double)bytes_read / (double)passed_time_sec / (double)(1024 * 1024) };
|
||||||
@ -157,7 +157,7 @@ class Tresor_tester::Benchmark : Noncopyable
|
|||||||
}
|
}
|
||||||
if (_num_virt_blks_written) {
|
if (_num_virt_blks_written) {
|
||||||
|
|
||||||
size_t bytes_written { _num_virt_blks_written * Tresor::BLOCK_SIZE };
|
uint64_t bytes_written { _num_virt_blks_written * Tresor::BLOCK_SIZE };
|
||||||
double const mibyte_written { (double)bytes_written / (double)(1024 * 1024) };
|
double const mibyte_written { (double)bytes_written / (double)(1024 * 1024) };
|
||||||
double const mibyte_per_sec_written {
|
double const mibyte_per_sec_written {
|
||||||
(double)bytes_written / (double)passed_time_sec / (double)(1024 * 1024) };
|
(double)bytes_written / (double)passed_time_sec / (double)(1024 * 1024) };
|
||||||
|
@ -98,7 +98,7 @@ class Tresor::Crypto::Encrypt : Noncopyable
|
|||||||
|
|
||||||
Request_helper<Encrypt, State> _helper;
|
Request_helper<Encrypt, State> _helper;
|
||||||
Attr const _attr;
|
Attr const _attr;
|
||||||
off_t _offset { };
|
uint64_t _offset { };
|
||||||
Constructible<File<State> > _file { };
|
Constructible<File<State> > _file { };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -132,7 +132,7 @@ class Tresor::Crypto::Decrypt : Noncopyable
|
|||||||
|
|
||||||
Request_helper<Decrypt, State> _helper;
|
Request_helper<Decrypt, State> _helper;
|
||||||
Attr const _attr;
|
Attr const _attr;
|
||||||
off_t _offset { };
|
uint64_t _offset { };
|
||||||
Constructible<File<State> > _file { };
|
Constructible<File<State> > _file { };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -60,7 +60,7 @@ class Tresor::File
|
|||||||
HOST_STATE &_host_state;
|
HOST_STATE &_host_state;
|
||||||
State _state { IDLE };
|
State _state { IDLE };
|
||||||
Vfs::Vfs_handle &_handle;
|
Vfs::Vfs_handle &_handle;
|
||||||
Vfs::file_size _num_processed_bytes { 0 };
|
size_t _num_processed_bytes { 0 };
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Noncopyable
|
* Noncopyable
|
||||||
|
@ -55,7 +55,7 @@ struct Tresor::Splitter : Noncopyable
|
|||||||
|
|
||||||
Request_helper<Read, State> _helper;
|
Request_helper<Read, State> _helper;
|
||||||
Attr const _attr;
|
Attr const _attr;
|
||||||
addr_t _curr_off { };
|
uint64_t _curr_off { };
|
||||||
addr_t _curr_buf_addr { };
|
addr_t _curr_buf_addr { };
|
||||||
Block _blk { };
|
Block _blk { };
|
||||||
Generation _gen { };
|
Generation _gen { };
|
||||||
@ -88,16 +88,16 @@ struct Tresor::Splitter : Noncopyable
|
|||||||
addr_t _curr_buf_off() const
|
addr_t _curr_buf_off() const
|
||||||
{
|
{
|
||||||
ASSERT(_curr_off >= _attr.in_off && _curr_off <= _attr.in_off + _attr.in_buf_num_bytes);
|
ASSERT(_curr_off >= _attr.in_off && _curr_off <= _attr.in_off + _attr.in_buf_num_bytes);
|
||||||
return _curr_off - _attr.in_off;
|
return (addr_t)(_curr_off - _attr.in_off);
|
||||||
}
|
}
|
||||||
|
|
||||||
addr_t _num_remaining_bytes() const
|
addr_t _num_remaining_bytes() const
|
||||||
{
|
{
|
||||||
ASSERT(_curr_off >= _attr.in_off && _curr_off <= _attr.in_off + _attr.in_buf_num_bytes);
|
ASSERT(_curr_off >= _attr.in_off && _curr_off <= _attr.in_off + _attr.in_buf_num_bytes);
|
||||||
return _attr.in_off + _attr.in_buf_num_bytes - _curr_off;
|
return _attr.in_buf_num_bytes - (size_t)(_curr_off - _attr.in_off);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _advance_curr_off(size_t advance, bool &progress)
|
void _advance_curr_off(uint64_t advance, bool &progress)
|
||||||
{
|
{
|
||||||
_curr_off += advance;
|
_curr_off += advance;
|
||||||
if (!_num_remaining_bytes()) {
|
if (!_num_remaining_bytes()) {
|
||||||
@ -133,7 +133,7 @@ struct Tresor::Splitter : Noncopyable
|
|||||||
case READ_FIRST_VBA: progress |= _execute_read(READ_FIRST_VBA_SUCCEEDED, attr); break;
|
case READ_FIRST_VBA: progress |= _execute_read(READ_FIRST_VBA_SUCCEEDED, attr); break;
|
||||||
case READ_FIRST_VBA_SUCCEEDED:
|
case READ_FIRST_VBA_SUCCEEDED:
|
||||||
{
|
{
|
||||||
size_t num_outside_bytes { _curr_off % BLOCK_SIZE };
|
size_t num_outside_bytes { (size_t)(_curr_off % BLOCK_SIZE) };
|
||||||
size_t num_inside_bytes { min(_num_remaining_bytes(), BLOCK_SIZE - num_outside_bytes) };
|
size_t num_inside_bytes { min(_num_remaining_bytes(), BLOCK_SIZE - num_outside_bytes) };
|
||||||
memcpy(_attr.in_buf_start, (void *)((addr_t)&_blk + num_outside_bytes), num_inside_bytes);
|
memcpy(_attr.in_buf_start, (void *)((addr_t)&_blk + num_outside_bytes), num_inside_bytes);
|
||||||
_advance_curr_off(num_inside_bytes, progress);
|
_advance_curr_off(num_inside_bytes, progress);
|
||||||
@ -201,7 +201,7 @@ struct Tresor::Splitter : Noncopyable
|
|||||||
|
|
||||||
Request_helper<Write, State> _helper;
|
Request_helper<Write, State> _helper;
|
||||||
Attr const _attr;
|
Attr const _attr;
|
||||||
addr_t _curr_off { };
|
uint64_t _curr_off { };
|
||||||
addr_t _curr_buf_addr { };
|
addr_t _curr_buf_addr { };
|
||||||
Block _blk { };
|
Block _blk { };
|
||||||
Generation _gen { };
|
Generation _gen { };
|
||||||
@ -213,13 +213,13 @@ struct Tresor::Splitter : Noncopyable
|
|||||||
addr_t _curr_buf_off() const
|
addr_t _curr_buf_off() const
|
||||||
{
|
{
|
||||||
ASSERT(_curr_off >= _attr.in_off && _curr_off <= _attr.in_off + _attr.in_buf_num_bytes);
|
ASSERT(_curr_off >= _attr.in_off && _curr_off <= _attr.in_off + _attr.in_buf_num_bytes);
|
||||||
return _curr_off - _attr.in_off;
|
return (addr_t)(_curr_off - _attr.in_off);
|
||||||
}
|
}
|
||||||
|
|
||||||
addr_t _num_remaining_bytes() const
|
addr_t _num_remaining_bytes() const
|
||||||
{
|
{
|
||||||
ASSERT(_curr_off >= _attr.in_off && _curr_off <= _attr.in_off + _attr.in_buf_num_bytes);
|
ASSERT(_curr_off >= _attr.in_off && _curr_off <= _attr.in_off + _attr.in_buf_num_bytes);
|
||||||
return _attr.in_off + _attr.in_buf_num_bytes - _curr_off;
|
return _attr.in_buf_num_bytes - (size_t)(_curr_off - _attr.in_off);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _generate_sb_control_request(State target_state, bool &progress)
|
void _generate_sb_control_request(State target_state, bool &progress)
|
||||||
@ -239,7 +239,7 @@ struct Tresor::Splitter : Noncopyable
|
|||||||
progress = true;
|
progress = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _advance_curr_off(size_t advance, bool &progress)
|
void _advance_curr_off(uint64_t advance, bool &progress)
|
||||||
{
|
{
|
||||||
_curr_off += advance;
|
_curr_off += advance;
|
||||||
if (!_num_remaining_bytes()) {
|
if (!_num_remaining_bytes()) {
|
||||||
@ -299,7 +299,7 @@ struct Tresor::Splitter : Noncopyable
|
|||||||
case READ_FIRST_VBA: progress |= _execute_read(READ_FIRST_VBA_SUCCEEDED, attr); break;
|
case READ_FIRST_VBA: progress |= _execute_read(READ_FIRST_VBA_SUCCEEDED, attr); break;
|
||||||
case READ_FIRST_VBA_SUCCEEDED:
|
case READ_FIRST_VBA_SUCCEEDED:
|
||||||
{
|
{
|
||||||
size_t num_outside_bytes { _curr_off % BLOCK_SIZE };
|
size_t num_outside_bytes { (size_t)(_curr_off % BLOCK_SIZE) };
|
||||||
size_t num_inside_bytes { min(_num_remaining_bytes(), BLOCK_SIZE - num_outside_bytes) };
|
size_t num_inside_bytes { min(_num_remaining_bytes(), BLOCK_SIZE - num_outside_bytes) };
|
||||||
memcpy((void *)((addr_t)&_blk + num_outside_bytes), _attr.in_buf_start, num_inside_bytes);
|
memcpy((void *)((addr_t)&_blk + num_outside_bytes), _attr.in_buf_start, num_inside_bytes);
|
||||||
_curr_buf_addr = (addr_t)&_blk;
|
_curr_buf_addr = (addr_t)&_blk;
|
||||||
@ -309,7 +309,7 @@ struct Tresor::Splitter : Noncopyable
|
|||||||
case WRITE_FIRST_VBA: progress |= _execute_write(WRITE_FIRST_VBA_SUCCEEDED, attr); break;
|
case WRITE_FIRST_VBA: progress |= _execute_write(WRITE_FIRST_VBA_SUCCEEDED, attr); break;
|
||||||
case WRITE_FIRST_VBA_SUCCEEDED:
|
case WRITE_FIRST_VBA_SUCCEEDED:
|
||||||
{
|
{
|
||||||
size_t num_outside_bytes { _curr_off % BLOCK_SIZE };
|
size_t num_outside_bytes { (size_t)(_curr_off % BLOCK_SIZE) };
|
||||||
size_t num_inside_bytes { min(_num_remaining_bytes(), BLOCK_SIZE - num_outside_bytes) };
|
size_t num_inside_bytes { min(_num_remaining_bytes(), BLOCK_SIZE - num_outside_bytes) };
|
||||||
_advance_curr_off(num_inside_bytes, progress);
|
_advance_curr_off(num_inside_bytes, progress);
|
||||||
break;
|
break;
|
||||||
|
@ -84,7 +84,7 @@ class Vfs_tresor::Data_operation : private Noncopyable
|
|||||||
State _state { INIT };
|
State _state { INIT };
|
||||||
bool const _verbose;
|
bool const _verbose;
|
||||||
Generation _generation { };
|
Generation _generation { };
|
||||||
addr_t _seek { };
|
Vfs::file_size _seek { };
|
||||||
bool _success { };
|
bool _success { };
|
||||||
Constructible<Byte_range_ptr> _dst { };
|
Constructible<Byte_range_ptr> _dst { };
|
||||||
Constructible<Const_byte_range_ptr> _src { };
|
Constructible<Const_byte_range_ptr> _src { };
|
||||||
@ -92,10 +92,10 @@ class Vfs_tresor::Data_operation : private Noncopyable
|
|||||||
Constructible<Splitter::Read> _read { };
|
Constructible<Splitter::Read> _read { };
|
||||||
Constructible<Superblock_control::Synchronize> _sync { };
|
Constructible<Superblock_control::Synchronize> _sync { };
|
||||||
|
|
||||||
bool _range_violation(Superblock_control &sb_control, addr_t start, size_t num_bytes) const
|
bool _range_violation(Superblock_control &sb_control, uint64_t start, uint64_t num_bytes) const
|
||||||
{
|
{
|
||||||
addr_t last_byte = num_bytes ? start - 1 + num_bytes : start;
|
uint64_t last_byte = num_bytes ? start - 1 + num_bytes : start;
|
||||||
addr_t last_file_byte = (sb_control.max_vba() * BLOCK_SIZE) + (BLOCK_SIZE - 1);
|
uint64_t last_file_byte = (sb_control.max_vba() * BLOCK_SIZE) + (BLOCK_SIZE - 1);
|
||||||
return last_byte > last_file_byte;
|
return last_byte > last_file_byte;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ class Vfs_tresor::Data_operation : private Noncopyable
|
|||||||
|
|
||||||
Data_operation(bool verbose) : _verbose(verbose) { }
|
Data_operation(bool verbose) : _verbose(verbose) { }
|
||||||
|
|
||||||
Result write(addr_t seek, Const_byte_range_ptr const &src)
|
Result write(Vfs::file_size seek, Const_byte_range_ptr const &src)
|
||||||
{
|
{
|
||||||
switch (_state) {
|
switch (_state) {
|
||||||
case INIT:
|
case INIT:
|
||||||
@ -129,7 +129,7 @@ class Vfs_tresor::Data_operation : private Noncopyable
|
|||||||
ASSERT_NEVER_REACHED;
|
ASSERT_NEVER_REACHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result read(addr_t seek, Byte_range_ptr const &dst)
|
Result read(Vfs::file_size seek, Byte_range_ptr const &dst)
|
||||||
{
|
{
|
||||||
switch (_state) {
|
switch (_state) {
|
||||||
case INIT:
|
case INIT:
|
||||||
@ -742,7 +742,7 @@ class Vfs_tresor::Plugin : private Noncopyable, private Client_data_interface, p
|
|||||||
|
|
||||||
void _wakeup_back_end_services() { _vfs_env.io().commit(); }
|
void _wakeup_back_end_services() { _vfs_env.io().commit(); }
|
||||||
|
|
||||||
size_t _data_file_size() const { return (_sb_control.max_vba() + 1) * BLOCK_SIZE; }
|
Vfs::file_size _data_file_size() const { return (_sb_control.max_vba() + 1) * BLOCK_SIZE; }
|
||||||
|
|
||||||
/********************************
|
/********************************
|
||||||
** Crypto_key_files_interface **
|
** Crypto_key_files_interface **
|
||||||
@ -984,7 +984,7 @@ class Vfs_tresor::Data_file_system : private Noncopyable, public Single_file_sys
|
|||||||
Stat_result stat(char const *path, Stat &out) override
|
Stat_result stat(char const *path, Stat &out) override
|
||||||
{
|
{
|
||||||
Stat_result result = STAT_ERR_NO_ENTRY;
|
Stat_result result = STAT_ERR_NO_ENTRY;
|
||||||
_plugin.with_data_file_size([&] (size_t size) {
|
_plugin.with_data_file_size([&] (Vfs::file_size size) {
|
||||||
result = Single_file_system::stat(path, out);
|
result = Single_file_system::stat(path, out);
|
||||||
out.size = size;
|
out.size = size;
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user