[Yunq] Add ability to namespace declarations using "package".

This commit is contained in:
Drew Galbraith 2023-11-30 08:50:15 -08:00
parent 9fdd670a23
commit f1e09b2ae6
15 changed files with 153 additions and 10 deletions

View file

@ -4,6 +4,9 @@
#include <mammoth/util/debug.h>
#include <zcall.h>
namespace srv::file {
namespace {
const uint32_t kSentinel = 0xBEEFDEAD;
@ -29,6 +32,18 @@ void VFSServerBaseThreadBootstrap(void* server_base) {
((VFSServerBase*)server_base)->ServerThread();
}
VFSServerBase::~VFSServerBase() {
if (endpoint_ != 0) {
check(ZCapRelease(endpoint_));
}
}
glcr::ErrorOr<z_cap_t> VFSServerBase::CreateClientCap() {
uint64_t client_cap;
RET_ERR(ZCapDuplicate(endpoint_, ~(kZionPerm_Read), &client_cap));
return client_cap;
}
glcr::ErrorOr<VFSClient> VFSServerBase::CreateClient() {
uint64_t client_cap;
RET_ERR(ZCapDuplicate(endpoint_, ~(kZionPerm_Read), &client_cap));
@ -101,7 +116,9 @@ glcr::ErrorCode VFSServerBase::HandleRequest(const glcr::ByteBuffer& request,
RET_ERR(Handleopen(yunq_request, yunq_response));
resp_length = yunq_response.SerializeToBytes(response, kHeaderSize, resp_caps);
break;
}
default: {
@ -110,3 +127,7 @@ glcr::ErrorCode VFSServerBase::HandleRequest(const glcr::ByteBuffer& request,
}
return glcr::OK;
}
} // namepace srv::file