Remove Genode namespace from File_system

Fixes #1845
This commit is contained in:
Emery Hemingway 2016-01-07 10:52:10 +01:00 committed by Christian Helmuth
parent 9fb08e045a
commit 2d50552522
20 changed files with 84 additions and 60 deletions

View File

@ -23,6 +23,7 @@
namespace File_system { namespace File_system {
using namespace Genode;
class Node; class Node;
} }

View File

@ -18,6 +18,8 @@ namespace Ffat { extern "C" {
namespace File_system { namespace File_system {
using namespace Genode;
class Directory : public Node class Directory : public Node
{ {
private: private:

View File

@ -19,6 +19,8 @@
namespace File_system { namespace File_system {
using namespace Genode;
typedef Genode::Path<MAX_PATH_LEN> Absolute_path; typedef Genode::Path<MAX_PATH_LEN> Absolute_path;
class Node : public Node_base, public List<Node>::Element class Node : public Node_base, public List<Node>::Element

View File

@ -27,7 +27,7 @@ namespace File_system {
Listener() : _marked_as_updated(false) { } Listener() : _marked_as_updated(false) { }
Listener(Signal_context_capability sigh) Listener(Genode::Signal_context_capability sigh)
: _sigh(sigh), _marked_as_updated(false) { } : _sigh(sigh), _marked_as_updated(false) { }
void notify() void notify()
@ -35,7 +35,7 @@ namespace File_system {
Genode::Lock::Guard guard(_lock); Genode::Lock::Guard guard(_lock);
if (_marked_as_updated && _sigh.valid()) if (_marked_as_updated && _sigh.valid())
Signal_transmitter(_sigh).submit(); Genode::Signal_transmitter(_sigh).submit();
_marked_as_updated = false; _marked_as_updated = false;
} }

View File

@ -19,8 +19,8 @@ namespace File_system {
{ {
private: private:
Lock _lock; Genode::Lock _lock;
List<Listener> _listeners; Genode::List<Listener> _listeners;
public: public:

View File

@ -43,7 +43,7 @@ namespace File_system {
/* maximum number of open nodes per session */ /* maximum number of open nodes per session */
enum { MAX_NODE_HANDLES = 128U }; enum { MAX_NODE_HANDLES = 128U };
Lock mutable _lock; Genode::Lock mutable _lock;
Node_base *_nodes[MAX_NODE_HANDLES]; Node_base *_nodes[MAX_NODE_HANDLES];
@ -60,7 +60,7 @@ namespace File_system {
*/ */
int _alloc(Node_base *node) int _alloc(Node_base *node)
{ {
Lock::Guard guard(_lock); Genode::Lock::Guard guard(_lock);
for (unsigned i = 0; i < MAX_NODE_HANDLES; i++) for (unsigned i = 0; i < MAX_NODE_HANDLES; i++)
if (!_nodes[i]) { if (!_nodes[i]) {
@ -96,7 +96,7 @@ namespace File_system {
*/ */
void free(Node_handle handle) void free(Node_handle handle)
{ {
Lock::Guard guard(_lock); Genode::Lock::Guard guard(_lock);
if (!_in_range(handle.value)) if (!_in_range(handle.value))
return; return;
@ -132,7 +132,7 @@ namespace File_system {
template <typename HANDLE_TYPE> template <typename HANDLE_TYPE>
typename Node_type<HANDLE_TYPE>::Type *lookup(HANDLE_TYPE handle) typename Node_type<HANDLE_TYPE>::Type *lookup(HANDLE_TYPE handle)
{ {
Lock::Guard guard(_lock); Genode::Lock::Guard guard(_lock);
if (!_in_range(handle.value)) if (!_in_range(handle.value))
throw Invalid_handle(); throw Invalid_handle();
@ -155,7 +155,7 @@ namespace File_system {
template <typename HANDLE_TYPE> template <typename HANDLE_TYPE>
typename Node_type<HANDLE_TYPE>::Type *lookup_and_lock(HANDLE_TYPE handle) 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)) if (!_in_range(handle.value))
throw Invalid_handle(); throw Invalid_handle();
@ -171,7 +171,7 @@ namespace File_system {
bool refer_to_same_node(Node_handle h1, Node_handle h2) const 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)) { if (!_in_range(h1.value) || !_in_range(h2.value)) {
PDBG("refer_to_same_node -> Invalid_handle"); PDBG("refer_to_same_node -> Invalid_handle");
@ -184,9 +184,9 @@ namespace File_system {
/** /**
* Register signal handler to be notified of node changes * 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)) if (!_in_range(handle.value))
throw Invalid_handle(); throw Invalid_handle();

View File

@ -117,7 +117,8 @@ namespace File_system {
collect_acknowledgements(source); 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_descriptor
packet(source.alloc_packet(curr_packet_size), packet(source.alloc_packet(curr_packet_size),
@ -132,10 +133,11 @@ namespace File_system {
packet = source.get_acked_packet(); packet = source.get_acked_packet();
success = packet.succeeded(); 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 */ /* 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); source.release_packet(packet);
@ -173,7 +175,8 @@ namespace File_system {
collect_acknowledgements(source); 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_descriptor
packet(source.alloc_packet(curr_packet_size), packet(source.alloc_packet(curr_packet_size),
@ -183,7 +186,7 @@ namespace File_system {
seek_offset); seek_offset);
/* copy-out source buffer into payload */ /* 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 */ /* pass packet to server side */
source.submit_packet(packet); source.submit_packet(packet);

View File

@ -21,7 +21,7 @@
namespace File_system { class Session_client; } 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: private:
@ -36,8 +36,8 @@ class File_system::Session_client : public Rpc_client<Session>
* \param tx_buffer_alloc allocator used for managing the * \param tx_buffer_alloc allocator used for managing the
* transmission buffer * transmission buffer
*/ */
Session_client(Session_capability session, Session_client(Session_capability session,
Range_allocator &tx_buffer_alloc) Genode::Range_allocator &tx_buffer_alloc)
: :
Rpc_client<Session>(session), Rpc_client<Session>(session),
_tx(call<Rpc_tx_cap>(), &tx_buffer_alloc) _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); 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); call<Rpc_sigh>(node, sigh);
} }

View File

@ -37,11 +37,11 @@ struct File_system::Connection : Genode::Connection<Session>, Session_client
* transmission buffer * transmission buffer
* \param tx_buf_size size of transmission buffer in bytes * \param tx_buf_size size of transmission buffer in bytes
*/ */
Connection(Range_allocator &tx_block_alloc, Connection(Genode::Range_allocator &tx_block_alloc,
size_t tx_buf_size = DEFAULT_TX_BUF_SIZE, size_t tx_buf_size = DEFAULT_TX_BUF_SIZE,
char const *label = "", char const *label = "",
char const *root = "/", char const *root = "/",
bool writeable = true) bool writeable = true)
: :
Genode::Connection<Session>( Genode::Connection<Session>(
session("ram_quota=%zd, " session("ram_quota=%zd, "

View File

@ -21,13 +21,13 @@
namespace File_system { namespace File_system {
using namespace Genode;
struct Node_handle; struct Node_handle;
struct File_handle; struct File_handle;
struct Dir_handle; struct Dir_handle;
struct Symlink_handle; struct Symlink_handle;
using Genode::size_t;
typedef Genode::uint64_t seek_off_t; typedef Genode::uint64_t seek_off_t;
typedef Genode::uint64_t file_size_t; typedef Genode::uint64_t file_size_t;
@ -40,8 +40,8 @@ namespace File_system {
enum { MAX_NAME_LEN = 256, MAX_PATH_LEN = 1024 }; enum { MAX_NAME_LEN = 256, MAX_PATH_LEN = 1024 };
typedef Rpc_in_buffer<MAX_NAME_LEN> Name; typedef Genode::Rpc_in_buffer<MAX_NAME_LEN> Name;
typedef Rpc_in_buffer<MAX_PATH_LEN> Path; typedef Genode::Rpc_in_buffer<MAX_PATH_LEN> Path;
struct Status; struct Status;
struct Control; struct Control;
@ -112,7 +112,7 @@ class File_system::Packet_descriptor : public Genode::Packet_descriptor
Node_handle _handle; /* node handle */ Node_handle _handle; /* node handle */
Opcode _op; /* requested operation */ 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 */ size_t _length; /* transaction length in bytes */
bool _success; /* indicates success of operation */ bool _success; /* indicates success of operation */
@ -121,9 +121,10 @@ class File_system::Packet_descriptor : public Genode::Packet_descriptor
/** /**
* Constructor * 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) { } _op(READ), _position(0), _length(0), _success(false) { }
/** /**
@ -194,9 +195,9 @@ struct File_system::Session : public Genode::Session
{ {
enum { TX_QUEUE_SIZE = 16 }; enum { TX_QUEUE_SIZE = 16 };
typedef Packet_stream_policy<File_system::Packet_descriptor, typedef Genode::Packet_stream_policy<File_system::Packet_descriptor,
TX_QUEUE_SIZE, TX_QUEUE_SIZE, TX_QUEUE_SIZE, TX_QUEUE_SIZE,
char> Tx_policy; char> Tx_policy;
typedef Packet_stream_tx::Channel<Tx_policy> Tx; 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 * 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 * Synchronize file system
@ -318,7 +319,7 @@ struct File_system::Session : public Genode::Session
** RPC interface ** ** 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_RPC_THROW(Rpc_file, File_handle, file,
GENODE_TYPE_LIST(Invalid_handle, Node_already_exists, GENODE_TYPE_LIST(Invalid_handle, Node_already_exists,
Invalid_name, Lookup_failed, Invalid_name, Lookup_failed,
@ -354,7 +355,7 @@ struct File_system::Session : public Genode::Session
Dir_handle, Name const &, Dir_handle, Name const &); Dir_handle, Name const &, Dir_handle, Name const &);
GENODE_RPC_THROW(Rpc_sigh, void, sigh, GENODE_RPC_THROW(Rpc_sigh, void, sigh,
GENODE_TYPE_LIST(Invalid_handle), GENODE_TYPE_LIST(Invalid_handle),
Node_handle, Signal_context_capability); Node_handle, Genode::Signal_context_capability);
GENODE_RPC(Rpc_sync, void, sync, Node_handle); 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 * exceeds the maximum number of type-list elements supported by
* 'Genode::Meta::Type_list<>'. * 'Genode::Meta::Type_list<>'.
*/ */
typedef Meta::Type_tuple<Rpc_tx_cap, typedef Genode::Meta::Type_tuple<Rpc_tx_cap,
Meta::Type_tuple<Rpc_file, Genode::Meta::Type_tuple<Rpc_file,
Meta::Type_tuple<Rpc_symlink, Genode::Meta::Type_tuple<Rpc_symlink,
Meta::Type_tuple<Rpc_dir, Genode::Meta::Type_tuple<Rpc_dir,
Meta::Type_tuple<Rpc_node, Genode::Meta::Type_tuple<Rpc_node,
Meta::Type_tuple<Rpc_close, Genode::Meta::Type_tuple<Rpc_close,
Meta::Type_tuple<Rpc_status, Genode::Meta::Type_tuple<Rpc_status,
Meta::Type_tuple<Rpc_control, Genode::Meta::Type_tuple<Rpc_control,
Meta::Type_tuple<Rpc_unlink, Genode::Meta::Type_tuple<Rpc_unlink,
Meta::Type_tuple<Rpc_truncate, Genode::Meta::Type_tuple<Rpc_truncate,
Meta::Type_tuple<Rpc_move, Genode::Meta::Type_tuple<Rpc_move,
Meta::Type_tuple<Rpc_sigh, Genode::Meta::Type_tuple<Rpc_sigh,
Meta::Type_tuple<Rpc_sync, Genode::Meta::Type_tuple<Rpc_sync,
Meta::Empty> Genode::Meta::Empty>
> > > > > > > > > > > > Rpc_functions; > > > > > > > > > > > > Rpc_functions;
}; };

View File

@ -35,7 +35,8 @@ class File_system::Session_rpc_object : public Genode::Rpc_object<Session, Sessi
* for the tx packet stream * for the tx packet stream
* \param ep entry point used for packet-stream channel * \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) { } : _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 * This method is called by the client via an RPC call at session
* construction time. * construction time.
*/ */
Capability<Tx> _tx_cap() { return _tx.cap(); } Genode::Capability<Tx> _tx_cap() { return _tx.cap(); }
Tx::Sink *tx_sink() { return _tx.sink(); } Tx::Sink *tx_sink() { return _tx.sink(); }
}; };

View File

@ -22,6 +22,8 @@
namespace File_system { namespace File_system {
using namespace Genode;
using Genode::Noncopyable; using Genode::Noncopyable;
class Chunk_base; class Chunk_base;

View File

@ -19,7 +19,10 @@
#include <file_system/node.h> #include <file_system/node.h>
#include <util/list.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 class File_system::Node : public Node_base, public List<Node>::Element

View File

@ -24,6 +24,8 @@
#include <os/path.h> #include <os/path.h>
using namespace Genode;
/***************** /*****************
** ROM service ** ** ROM service **
*****************/ *****************/

View File

@ -20,6 +20,7 @@
namespace File_system { namespace File_system {
using namespace Genode;
class Directory; class Directory;
} }

View File

@ -36,7 +36,7 @@ namespace File_system {
/** /**
* Assign name * 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 read(char *dst, size_t len, seek_off_t) = 0;
virtual size_t write(char const *src, size_t len, seek_off_t) = 0; virtual size_t write(char const *src, size_t len, seek_off_t) = 0;

View File

@ -22,6 +22,8 @@
namespace File_system { namespace File_system {
using namespace Genode;
class Directory : public Node class Directory : public Node
{ {
public: public:

View File

@ -19,6 +19,8 @@
namespace File_system { namespace File_system {
using namespace Genode;
class Record class Record
{ {
private: private:

View File

@ -15,6 +15,8 @@
namespace File_system { namespace File_system {
using namespace Genode;
class Node : public Node_base, public List<Node>::Element class Node : public Node_base, public List<Node>::Element
{ {
public: public:

View File

@ -28,7 +28,7 @@ namespace File_system {
struct Symlink; struct Symlink;
class Node_cache; 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(); Vfs::File_system *root();
} }
@ -38,7 +38,7 @@ namespace File_system {
* Reference counted node object that can be inserted * Reference counted node object that can be inserted
* into an AVL tree. * 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; friend class Node_cache;
@ -256,7 +256,7 @@ struct File_system::Symlink : Node
* This structure deduplicates nodes between sessions, without it * This structure deduplicates nodes between sessions, without it
* the signal notifications would not propagate between sessions. * 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) { Node *find(char const *path) {
return first() ? (Node *)first()->find_by_path(path) : nullptr; } return first() ? (Node *)first()->find_by_path(path) : nullptr; }