Commit 2a8bb6a8 authored by Josh Kunz's avatar Josh Kunz

Add cnode manipulation functions to the public interface

parent 414b24d9
Pipeline #178 passed with stage
......@@ -187,6 +187,24 @@ int cap_cnode_verify(struct cspace *cspace, cptr_t cap);
*/
cptr_t cap_cnode_cptr(struct cnode *cnode);
/**
* Return the cnode that this cptr points to in the given cspace. Acquires
* a lock to the cnode. Returns zero on success. Make sure to call
* cap_cnode_put after every cap_cnode_get.
*/
int cap_cnode_get(struct cspace *cspace, cptr_t cptr, struct cnode **cnode);
/**
* Unlock the cnode. Call this on every cnode you've called
* cap_cnode_get on.
*/
void cap_cnode_put(struct cnode *cnode);
/**
* Get the object stored at this cnode.
*/
void* cap_cnode_object(struct cnode *cnode);
/**
* For now, put debug macros in the user-accessible part; convenient.
*/
......
......@@ -449,6 +449,8 @@ void cap_cnode_put(struct cnode *cnode)
cap_mutex_unlock(&cnode->lock);
}
void* cap_cnode_object(struct cnode *cnode) { return cnode->object; }
int cap_cnode_verify(struct cspace *cspace, cptr_t c)
{
struct cnode *cnode;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment