[Mammoth] Move most classes to the mmth namespace.
This commit is contained in:
parent
5f8d577948
commit
8d730c67c1
42 changed files with 130 additions and 60 deletions
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "util/debug.h"
|
||||
|
||||
namespace mmth {
|
||||
namespace {
|
||||
|
||||
uint64_t strlen(const char* ptr) {
|
||||
|
|
@ -55,3 +56,5 @@ z_err_t CreateChannels(Channel& c1, Channel& c2) {
|
|||
c2.adopt_cap(chan2);
|
||||
return glcr::OK;
|
||||
}
|
||||
|
||||
} // namespace mmth
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@
|
|||
#include <stdint.h>
|
||||
#include <zcall.h>
|
||||
|
||||
namespace mmth {
|
||||
|
||||
class Channel {
|
||||
public:
|
||||
Channel() {}
|
||||
|
|
@ -45,3 +47,5 @@ z_err_t Channel::ReadStructAndCap(T* obj, uint64_t* cap) {
|
|||
}
|
||||
return glcr::OK;
|
||||
}
|
||||
|
||||
} // namespace mmth
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
#include "ipc/endpoint_server.h"
|
||||
|
||||
namespace mmth {
|
||||
|
||||
glcr::UniquePtr<EndpointClient> EndpointClient::AdoptEndpoint(z_cap_t cap) {
|
||||
return glcr::UniquePtr<EndpointClient>(new EndpointClient(cap));
|
||||
}
|
||||
|
||||
} // namespace mmth
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
#include <zcall.h>
|
||||
#include <ztypes.h>
|
||||
|
||||
namespace mmth {
|
||||
|
||||
class EndpointClient {
|
||||
public:
|
||||
EndpointClient() = delete;
|
||||
|
|
@ -63,3 +65,5 @@ glcr::ErrorOr<Resp> EndpointClient::CallEndpoint(const Req& req) {
|
|||
|
||||
return resp;
|
||||
}
|
||||
|
||||
} // namespace mmth
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "util/debug.h"
|
||||
|
||||
namespace mmth {
|
||||
// Declared as friend in EndpointServer.
|
||||
void EndpointServerThreadBootstrap(void* endpoint_server) {
|
||||
reinterpret_cast<EndpointServer*>(endpoint_server)->ServerThread();
|
||||
|
|
@ -40,3 +41,5 @@ void EndpointServer::ServerThread() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace mmth
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include "mammoth/ipc/response_context.h"
|
||||
#include "mammoth/proc/thread.h"
|
||||
|
||||
namespace mmth {
|
||||
class EndpointServer {
|
||||
public:
|
||||
EndpointServer() = delete;
|
||||
|
|
@ -34,3 +35,5 @@ class EndpointServer {
|
|||
friend void EndpointServerThreadBootstrap(void* endpoint_server);
|
||||
void ServerThread();
|
||||
};
|
||||
|
||||
} // namespace mmth
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include "util/debug.h"
|
||||
|
||||
namespace mmth {
|
||||
|
||||
PortClient PortClient::AdoptPort(z_cap_t cap) { return PortClient(cap); }
|
||||
PortClient::PortClient(z_cap_t port_cap) : port_cap_(port_cap) {}
|
||||
|
||||
|
|
@ -12,3 +14,5 @@ glcr::ErrorCode PortClient::WriteString(glcr::String str, z_cap_t cap) {
|
|||
return static_cast<glcr::ErrorCode>(
|
||||
ZPortSend(port_cap_, str.length() + 1, str.cstr(), 1, &cap));
|
||||
}
|
||||
|
||||
} // namespace mmth
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
#include <stdint.h>
|
||||
#include <zcall.h>
|
||||
|
||||
namespace mmth {
|
||||
|
||||
class PortClient {
|
||||
public:
|
||||
PortClient() {}
|
||||
|
|
@ -29,3 +31,5 @@ template <typename T>
|
|||
z_err_t PortClient::WriteMessage(const T& obj, z_cap_t cap) {
|
||||
return ZPortSend(port_cap_, sizeof(obj), &obj, 1, &cap);
|
||||
}
|
||||
|
||||
} // namespace mmth
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include <zcall.h>
|
||||
|
||||
namespace mmth {
|
||||
|
||||
glcr::ErrorOr<PortServer> PortServer::Create() {
|
||||
z_cap_t port;
|
||||
RET_ERR(ZPortCreate(&port));
|
||||
|
|
@ -44,3 +46,5 @@ glcr::ErrorCode PortServer::PollForIntCap(uint64_t *msg, uint64_t *cap) {
|
|||
}
|
||||
return glcr::OK;
|
||||
}
|
||||
|
||||
} // namespace mmth
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include "mammoth/ipc/port_client.h"
|
||||
|
||||
namespace mmth {
|
||||
|
||||
class PortServer {
|
||||
public:
|
||||
static glcr::ErrorOr<PortServer> Create();
|
||||
|
|
@ -22,3 +24,5 @@ class PortServer {
|
|||
|
||||
PortServer(z_cap_t cap);
|
||||
};
|
||||
|
||||
} // namespace mmth
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue