mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-18 17:00:26 +00:00
parent
9fb08e045a
commit
2d50552522
@ -23,6 +23,7 @@
|
||||
|
||||
|
||||
namespace File_system {
|
||||
using namespace Genode;
|
||||
class Node;
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,8 @@ namespace Ffat { extern "C" {
|
||||
|
||||
namespace File_system {
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
class Directory : public Node
|
||||
{
|
||||
private:
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
namespace File_system {
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
typedef Genode::Path<MAX_PATH_LEN> Absolute_path;
|
||||
|
||||
class Node : public Node_base, public List<Node>::Element
|
||||
|
@ -27,7 +27,7 @@ namespace File_system {
|
||||
|
||||
Listener() : _marked_as_updated(false) { }
|
||||
|
||||
Listener(Signal_context_capability sigh)
|
||||
Listener(Genode::Signal_context_capability sigh)
|
||||
: _sigh(sigh), _marked_as_updated(false) { }
|
||||
|
||||
void notify()
|
||||
@ -35,7 +35,7 @@ namespace File_system {
|
||||
Genode::Lock::Guard guard(_lock);
|
||||
|
||||
if (_marked_as_updated && _sigh.valid())
|
||||
Signal_transmitter(_sigh).submit();
|
||||
Genode::Signal_transmitter(_sigh).submit();
|
||||
|
||||
_marked_as_updated = false;
|
||||
}
|
||||
|
@ -19,8 +19,8 @@ namespace File_system {
|
||||
{
|
||||
private:
|
||||
|
||||
Lock _lock;
|
||||
List<Listener> _listeners;
|
||||
Genode::Lock _lock;
|
||||
Genode::List<Listener> _listeners;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -43,7 +43,7 @@ namespace File_system {
|
||||
/* maximum number of open nodes per session */
|
||||
enum { MAX_NODE_HANDLES = 128U };
|
||||
|
||||
Lock mutable _lock;
|
||||
Genode::Lock mutable _lock;
|
||||
|
||||
Node_base *_nodes[MAX_NODE_HANDLES];
|
||||
|
||||
@ -60,7 +60,7 @@ namespace File_system {
|
||||
*/
|
||||
int _alloc(Node_base *node)
|
||||
{
|
||||
Lock::Guard guard(_lock);
|
||||
Genode::Lock::Guard guard(_lock);
|
||||
|
||||
for (unsigned i = 0; i < MAX_NODE_HANDLES; i++)
|
||||
if (!_nodes[i]) {
|
||||
@ -96,7 +96,7 @@ namespace File_system {
|
||||
*/
|
||||
void free(Node_handle handle)
|
||||
{
|
||||
Lock::Guard guard(_lock);
|
||||
Genode::Lock::Guard guard(_lock);
|
||||
|
||||
if (!_in_range(handle.value))
|
||||
return;
|
||||
@ -132,7 +132,7 @@ namespace File_system {
|
||||
template <typename HANDLE_TYPE>
|
||||
typename Node_type<HANDLE_TYPE>::Type *lookup(HANDLE_TYPE handle)
|
||||
{
|
||||
Lock::Guard guard(_lock);
|
||||
Genode::Lock::Guard guard(_lock);
|
||||
|
||||
if (!_in_range(handle.value))
|
||||
throw Invalid_handle();
|
||||
@ -155,7 +155,7 @@ namespace File_system {
|
||||
template <typename HANDLE_TYPE>
|
||||
typename Node_type<HANDLE_TYPE>::Type *lookup_and_lock(HANDLE_TYPE handle)
|
||||
{
|
||||
Lock::Guard guard(_lock);
|
||||
Genode::Lock::Guard guard(_lock);
|
||||
|
||||
if (!_in_range(handle.value))
|
||||
throw Invalid_handle();
|
||||
@ -171,7 +171,7 @@ namespace File_system {
|
||||
|
||||
bool refer_to_same_node(Node_handle h1, Node_handle h2) const
|
||||
{
|
||||
Lock::Guard guard(_lock);
|
||||
Genode::Lock::Guard guard(_lock);
|
||||
|
||||
if (!_in_range(h1.value) || !_in_range(h2.value)) {
|
||||
PDBG("refer_to_same_node -> Invalid_handle");
|
||||
@ -184,9 +184,9 @@ namespace File_system {
|
||||
/**
|
||||
* Register signal handler to be notified of node changes
|
||||
*/
|
||||
void sigh(Node_handle handle, Signal_context_capability sigh)
|
||||
void sigh(Node_handle handle, Genode::Signal_context_capability sigh)
|
||||
{
|
||||
Lock::Guard guard(_lock);
|
||||
Genode::Lock::Guard guard(_lock);
|
||||
|
||||
if (!_in_range(handle.value))
|
||||
throw Invalid_handle();
|
||||
|
@ -117,7 +117,8 @@ namespace File_system {
|
||||
|
||||
collect_acknowledgements(source);
|
||||
|
||||
size_t const curr_packet_size = min(remaining_count, max_packet_size);
|
||||
size_t const curr_packet_size =
|
||||
Genode::min(remaining_count, max_packet_size);
|
||||
|
||||
Packet_descriptor
|
||||
packet(source.alloc_packet(curr_packet_size),
|
||||
@ -132,10 +133,11 @@ namespace File_system {
|
||||
packet = source.get_acked_packet();
|
||||
success = packet.succeeded();
|
||||
|
||||
size_t const read_num_bytes = min(packet.length(), curr_packet_size);
|
||||
size_t const read_num_bytes =
|
||||
Genode::min(packet.length(), curr_packet_size);
|
||||
|
||||
/* copy-out payload into destination buffer */
|
||||
memcpy(dst, source.packet_content(packet), read_num_bytes);
|
||||
Genode::memcpy(dst, source.packet_content(packet), read_num_bytes);
|
||||
|
||||
source.release_packet(packet);
|
||||
|
||||
@ -173,7 +175,8 @@ namespace File_system {
|
||||
|
||||
collect_acknowledgements(source);
|
||||
|
||||
size_t const curr_packet_size = min(remaining_count, max_packet_size);
|
||||
size_t const curr_packet_size =
|
||||
Genode::min(remaining_count, max_packet_size);
|
||||
|
||||
Packet_descriptor
|
||||
packet(source.alloc_packet(curr_packet_size),
|
||||
@ -183,7 +186,7 @@ namespace File_system {
|
||||
seek_offset);
|
||||
|
||||
/* copy-out source buffer into payload */
|
||||
memcpy(source.packet_content(packet), src, curr_packet_size);
|
||||
Genode::memcpy(source.packet_content(packet), src, curr_packet_size);
|
||||
|
||||
/* pass packet to server side */
|
||||
source.submit_packet(packet);
|
||||
|
@ -21,7 +21,7 @@
|
||||
namespace File_system { class Session_client; }
|
||||
|
||||
|
||||
class File_system::Session_client : public Rpc_client<Session>
|
||||
class File_system::Session_client : public Genode::Rpc_client<Session>
|
||||
{
|
||||
private:
|
||||
|
||||
@ -36,8 +36,8 @@ class File_system::Session_client : public Rpc_client<Session>
|
||||
* \param tx_buffer_alloc allocator used for managing the
|
||||
* transmission buffer
|
||||
*/
|
||||
Session_client(Session_capability session,
|
||||
Range_allocator &tx_buffer_alloc)
|
||||
Session_client(Session_capability session,
|
||||
Genode::Range_allocator &tx_buffer_alloc)
|
||||
:
|
||||
Rpc_client<Session>(session),
|
||||
_tx(call<Rpc_tx_cap>(), &tx_buffer_alloc)
|
||||
@ -101,7 +101,7 @@ class File_system::Session_client : public Rpc_client<Session>
|
||||
call<Rpc_move>(from_dir, from_name, to_dir, to_name);
|
||||
}
|
||||
|
||||
void sigh(Node_handle node, Signal_context_capability sigh) override
|
||||
void sigh(Node_handle node, Genode::Signal_context_capability sigh) override
|
||||
{
|
||||
call<Rpc_sigh>(node, sigh);
|
||||
}
|
||||
|
@ -37,11 +37,11 @@ struct File_system::Connection : Genode::Connection<Session>, Session_client
|
||||
* transmission buffer
|
||||
* \param tx_buf_size size of transmission buffer in bytes
|
||||
*/
|
||||
Connection(Range_allocator &tx_block_alloc,
|
||||
size_t tx_buf_size = DEFAULT_TX_BUF_SIZE,
|
||||
char const *label = "",
|
||||
char const *root = "/",
|
||||
bool writeable = true)
|
||||
Connection(Genode::Range_allocator &tx_block_alloc,
|
||||
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, "
|
||||
|
@ -21,13 +21,13 @@
|
||||
|
||||
namespace File_system {
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
struct Node_handle;
|
||||
struct File_handle;
|
||||
struct Dir_handle;
|
||||
struct Symlink_handle;
|
||||
|
||||
using Genode::size_t;
|
||||
|
||||
typedef Genode::uint64_t seek_off_t;
|
||||
typedef Genode::uint64_t file_size_t;
|
||||
|
||||
@ -40,8 +40,8 @@ namespace File_system {
|
||||
|
||||
enum { MAX_NAME_LEN = 256, MAX_PATH_LEN = 1024 };
|
||||
|
||||
typedef Rpc_in_buffer<MAX_NAME_LEN> Name;
|
||||
typedef Rpc_in_buffer<MAX_PATH_LEN> Path;
|
||||
typedef Genode::Rpc_in_buffer<MAX_NAME_LEN> Name;
|
||||
typedef Genode::Rpc_in_buffer<MAX_PATH_LEN> Path;
|
||||
|
||||
struct Status;
|
||||
struct Control;
|
||||
@ -112,7 +112,7 @@ class File_system::Packet_descriptor : public Genode::Packet_descriptor
|
||||
|
||||
Node_handle _handle; /* node handle */
|
||||
Opcode _op; /* requested operation */
|
||||
seek_off_t _position; /* seek offset in bytes */
|
||||
seek_off_t _position; /* file seek offset in bytes */
|
||||
size_t _length; /* transaction length in bytes */
|
||||
bool _success; /* indicates success of operation */
|
||||
|
||||
@ -121,9 +121,10 @@ class File_system::Packet_descriptor : public Genode::Packet_descriptor
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Packet_descriptor(off_t offset = 0, size_t size = 0)
|
||||
Packet_descriptor(Genode::off_t buf_offset = 0,
|
||||
Genode::size_t buf_size = 0)
|
||||
:
|
||||
Genode::Packet_descriptor(offset, size), _handle(-1),
|
||||
Genode::Packet_descriptor(buf_offset, buf_size), _handle(-1),
|
||||
_op(READ), _position(0), _length(0), _success(false) { }
|
||||
|
||||
/**
|
||||
@ -194,9 +195,9 @@ struct File_system::Session : public Genode::Session
|
||||
{
|
||||
enum { TX_QUEUE_SIZE = 16 };
|
||||
|
||||
typedef Packet_stream_policy<File_system::Packet_descriptor,
|
||||
TX_QUEUE_SIZE, TX_QUEUE_SIZE,
|
||||
char> Tx_policy;
|
||||
typedef Genode::Packet_stream_policy<File_system::Packet_descriptor,
|
||||
TX_QUEUE_SIZE, TX_QUEUE_SIZE,
|
||||
char> Tx_policy;
|
||||
|
||||
typedef Packet_stream_tx::Channel<Tx_policy> Tx;
|
||||
|
||||
@ -303,7 +304,7 @@ struct File_system::Session : public Genode::Session
|
||||
/**
|
||||
* Register handler that should be notified on node changes
|
||||
*/
|
||||
virtual void sigh(Node_handle, Signal_context_capability sigh) = 0;
|
||||
virtual void sigh(Node_handle, Genode::Signal_context_capability sigh) = 0;
|
||||
|
||||
/**
|
||||
* Synchronize file system
|
||||
@ -318,7 +319,7 @@ struct File_system::Session : public Genode::Session
|
||||
** RPC interface **
|
||||
*******************/
|
||||
|
||||
GENODE_RPC(Rpc_tx_cap, Capability<Tx>, _tx_cap);
|
||||
GENODE_RPC(Rpc_tx_cap, Genode::Capability<Tx>, _tx_cap);
|
||||
GENODE_RPC_THROW(Rpc_file, File_handle, file,
|
||||
GENODE_TYPE_LIST(Invalid_handle, Node_already_exists,
|
||||
Invalid_name, Lookup_failed,
|
||||
@ -354,7 +355,7 @@ struct File_system::Session : public Genode::Session
|
||||
Dir_handle, Name const &, Dir_handle, Name const &);
|
||||
GENODE_RPC_THROW(Rpc_sigh, void, sigh,
|
||||
GENODE_TYPE_LIST(Invalid_handle),
|
||||
Node_handle, Signal_context_capability);
|
||||
Node_handle, Genode::Signal_context_capability);
|
||||
GENODE_RPC(Rpc_sync, void, sync, Node_handle);
|
||||
|
||||
/*
|
||||
@ -362,20 +363,20 @@ struct File_system::Session : public Genode::Session
|
||||
* exceeds the maximum number of type-list elements supported by
|
||||
* 'Genode::Meta::Type_list<>'.
|
||||
*/
|
||||
typedef Meta::Type_tuple<Rpc_tx_cap,
|
||||
Meta::Type_tuple<Rpc_file,
|
||||
Meta::Type_tuple<Rpc_symlink,
|
||||
Meta::Type_tuple<Rpc_dir,
|
||||
Meta::Type_tuple<Rpc_node,
|
||||
Meta::Type_tuple<Rpc_close,
|
||||
Meta::Type_tuple<Rpc_status,
|
||||
Meta::Type_tuple<Rpc_control,
|
||||
Meta::Type_tuple<Rpc_unlink,
|
||||
Meta::Type_tuple<Rpc_truncate,
|
||||
Meta::Type_tuple<Rpc_move,
|
||||
Meta::Type_tuple<Rpc_sigh,
|
||||
Meta::Type_tuple<Rpc_sync,
|
||||
Meta::Empty>
|
||||
typedef Genode::Meta::Type_tuple<Rpc_tx_cap,
|
||||
Genode::Meta::Type_tuple<Rpc_file,
|
||||
Genode::Meta::Type_tuple<Rpc_symlink,
|
||||
Genode::Meta::Type_tuple<Rpc_dir,
|
||||
Genode::Meta::Type_tuple<Rpc_node,
|
||||
Genode::Meta::Type_tuple<Rpc_close,
|
||||
Genode::Meta::Type_tuple<Rpc_status,
|
||||
Genode::Meta::Type_tuple<Rpc_control,
|
||||
Genode::Meta::Type_tuple<Rpc_unlink,
|
||||
Genode::Meta::Type_tuple<Rpc_truncate,
|
||||
Genode::Meta::Type_tuple<Rpc_move,
|
||||
Genode::Meta::Type_tuple<Rpc_sigh,
|
||||
Genode::Meta::Type_tuple<Rpc_sync,
|
||||
Genode::Meta::Empty>
|
||||
> > > > > > > > > > > > Rpc_functions;
|
||||
};
|
||||
|
||||
|
@ -35,7 +35,8 @@ class File_system::Session_rpc_object : public Genode::Rpc_object<Session, Sessi
|
||||
* for the tx packet stream
|
||||
* \param ep entry point used for packet-stream channel
|
||||
*/
|
||||
Session_rpc_object(Dataspace_capability tx_ds, Rpc_entrypoint &ep)
|
||||
Session_rpc_object(Genode::Dataspace_capability tx_ds,
|
||||
Genode::Rpc_entrypoint &ep)
|
||||
: _tx(tx_ds, ep) { }
|
||||
|
||||
/**
|
||||
@ -44,7 +45,7 @@ class File_system::Session_rpc_object : public Genode::Rpc_object<Session, Sessi
|
||||
* This method is called by the client via an RPC call at session
|
||||
* construction time.
|
||||
*/
|
||||
Capability<Tx> _tx_cap() { return _tx.cap(); }
|
||||
Genode::Capability<Tx> _tx_cap() { return _tx.cap(); }
|
||||
|
||||
Tx::Sink *tx_sink() { return _tx.sink(); }
|
||||
};
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
namespace File_system {
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
using Genode::Noncopyable;
|
||||
|
||||
class Chunk_base;
|
||||
|
@ -19,7 +19,10 @@
|
||||
#include <file_system/node.h>
|
||||
#include <util/list.h>
|
||||
|
||||
namespace File_system { class Node; }
|
||||
namespace File_system {
|
||||
using namespace Genode;
|
||||
class Node;
|
||||
}
|
||||
|
||||
|
||||
class File_system::Node : public Node_base, public List<Node>::Element
|
||||
|
@ -24,6 +24,8 @@
|
||||
#include <os/path.h>
|
||||
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
/*****************
|
||||
** ROM service **
|
||||
*****************/
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
|
||||
namespace File_system {
|
||||
using namespace Genode;
|
||||
class Directory;
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ namespace File_system {
|
||||
/**
|
||||
* Assign name
|
||||
*/
|
||||
void name(char const *name) { strncpy(_name, name, sizeof(_name)); }
|
||||
void name(char const *name) { Genode::strncpy(_name, name, sizeof(_name)); }
|
||||
|
||||
virtual size_t read(char *dst, size_t len, seek_off_t) = 0;
|
||||
virtual size_t write(char const *src, size_t len, seek_off_t) = 0;
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
namespace File_system {
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
class Directory : public Node
|
||||
{
|
||||
public:
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
namespace File_system {
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
class Record
|
||||
{
|
||||
private:
|
||||
|
@ -15,6 +15,8 @@
|
||||
|
||||
namespace File_system {
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
class Node : public Node_base, public List<Node>::Element
|
||||
{
|
||||
public:
|
||||
|
@ -28,7 +28,7 @@ namespace File_system {
|
||||
struct Symlink;
|
||||
class Node_cache;
|
||||
|
||||
typedef Avl_string<MAX_PATH_LEN> Avl_path_string;
|
||||
typedef Genode::Avl_string<MAX_PATH_LEN> Avl_path_string;
|
||||
|
||||
Vfs::File_system *root();
|
||||
}
|
||||
@ -38,7 +38,7 @@ namespace File_system {
|
||||
* Reference counted node object that can be inserted
|
||||
* into an AVL tree.
|
||||
*/
|
||||
class File_system::Node : public Node_base, public Avl_node<Node>, private Noncopyable
|
||||
class File_system::Node : public Node_base, public Genode::Avl_node<Node>, private Genode::Noncopyable
|
||||
{
|
||||
friend class Node_cache;
|
||||
|
||||
@ -256,7 +256,7 @@ struct File_system::Symlink : Node
|
||||
* This structure deduplicates nodes between sessions, without it
|
||||
* the signal notifications would not propagate between sessions.
|
||||
*/
|
||||
struct File_system::Node_cache : Avl_tree<Node>
|
||||
struct File_system::Node_cache : Genode::Avl_tree<Node>
|
||||
{
|
||||
Node *find(char const *path) {
|
||||
return first() ? (Node *)first()->find_by_path(path) : nullptr; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user