mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 17:52:52 +00:00
New session arguments at File_system connection
Session root and writeablity may be specified at the session convenience constructor. Issue #1648
This commit is contained in:
parent
2da239d0c8
commit
48fd034cfe
@ -18,7 +18,14 @@
|
||||
#include <base/connection.h>
|
||||
#include <base/allocator.h>
|
||||
|
||||
namespace File_system { struct Connection; }
|
||||
namespace File_system {
|
||||
|
||||
struct Connection;
|
||||
|
||||
/* recommended packet transmission buffer size */
|
||||
enum { DEFAULT_TX_BUF_SIZE = 128*1024 };
|
||||
|
||||
}
|
||||
|
||||
|
||||
struct File_system::Connection : Genode::Connection<Session>, Session_client
|
||||
@ -31,13 +38,22 @@ struct File_system::Connection : Genode::Connection<Session>, Session_client
|
||||
* \param tx_buf_size size of transmission buffer in bytes
|
||||
*/
|
||||
Connection(Range_allocator &tx_block_alloc,
|
||||
size_t tx_buf_size = 128*1024,
|
||||
const char *label = "")
|
||||
size_t tx_buf_size = DEFAULT_TX_BUF_SIZE,
|
||||
char const *label = "",
|
||||
char const *root = "/",
|
||||
bool writeable = true)
|
||||
:
|
||||
Genode::Connection<Session>(
|
||||
session("ram_quota=%zd, tx_buf_size=%zd, label=\"%s\"",
|
||||
4*1024*sizeof(long) + tx_buf_size, tx_buf_size, label)),
|
||||
Session_client(cap(), tx_block_alloc) { }
|
||||
session("ram_quota=%zd, "
|
||||
"tx_buf_size=%zd, "
|
||||
"label=\"%s\", "
|
||||
"root=\"%s\", "
|
||||
"writeable=%d",
|
||||
4*1024*sizeof(long) + tx_buf_size,
|
||||
tx_buf_size,
|
||||
label, root, writeable)),
|
||||
Session_client(cap(), tx_block_alloc)
|
||||
{ }
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__FILE_SYSTEM_SESSION__CONNECTION_H_ */
|
||||
|
@ -17,6 +17,7 @@
|
||||
/* Genode includes */
|
||||
#include <base/allocator_avl.h>
|
||||
#include <file_system_session/connection.h>
|
||||
#include <util/string.h>
|
||||
|
||||
namespace Vfs { class Fs_file_system; }
|
||||
|
||||
@ -38,18 +39,11 @@ class Vfs::Fs_file_system : public File_system
|
||||
|
||||
Genode::Allocator_avl _fs_packet_alloc;
|
||||
|
||||
struct Label
|
||||
{
|
||||
enum { LABEL_MAX_LEN = 64 };
|
||||
char string[LABEL_MAX_LEN];
|
||||
typedef Genode::String<64> Label_string;
|
||||
Label_string _label;
|
||||
|
||||
Label(Xml_node config)
|
||||
{
|
||||
string[0] = 0;
|
||||
try { config.attribute("label").value(string, sizeof(string)); }
|
||||
catch (...) { }
|
||||
}
|
||||
} _label;
|
||||
typedef Genode::String<::File_system::MAX_NAME_LEN> Root_string;
|
||||
Root_string _root;
|
||||
|
||||
::File_system::Connection _fs;
|
||||
|
||||
@ -159,14 +153,15 @@ class Vfs::Fs_file_system : public File_system
|
||||
|
||||
public:
|
||||
|
||||
/*
|
||||
* XXX read label from config
|
||||
*/
|
||||
Fs_file_system(Xml_node config)
|
||||
:
|
||||
_fs_packet_alloc(env()->heap()),
|
||||
_label(config),
|
||||
_fs(_fs_packet_alloc, 128*1024, _label.string)
|
||||
_label(config.attribute_value("label", Label_string())),
|
||||
_root( config.attribute_value("root", Root_string())),
|
||||
_fs(_fs_packet_alloc,
|
||||
::File_system::DEFAULT_TX_BUF_SIZE,
|
||||
_label.string(), _root.string(),
|
||||
config.attribute_value("writeable", true))
|
||||
{ }
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user