[Mammoth] Add a helper method for duplicating memory capabilities.

This commit is contained in:
Drew Galbraith 2023-11-19 20:35:55 -08:00
parent 8e827a5dfb
commit deb2e708cd
3 changed files with 9 additions and 4 deletions

View file

@ -56,9 +56,7 @@ glcr::ErrorCode VFSServer::HandleOpenFile(const OpenFileRequest& request,
// FIXME: There isn't really a reason we need to map the file into memory then
// duplicate the cap. In the future just get the cap from the read then pass
// it to the caller directly.
uint64_t mem_cap;
uint64_t cap = ZCapDuplicate(region.cap(), kZionPerm_All, &mem_cap);
response.set_memory(mem_cap);
response.set_memory(region.DuplicateCap());
// TODO: Consider folding this up into the actual read call.
ASSIGN_OR_RETURN(Inode * inode, driver_.GetInode(inode_num));
// FIXME: This technically only sets the lower 32 bits.