Commit b101a9e0 authored by Josh Kunz's avatar Josh Kunz

Add functions for allocating/free-ing cspaces

In the refactor it looks like David made `struct cspace` an opaque type,
but kept the API using the same scheme where the user was responsible
for allocating the cspace. This commit adds allocation and free
functions that use the system-independent `cap_zalloc` and `cap_free`
calls.
parent a5415bd8
......@@ -119,6 +119,16 @@ int cap_revoke(struct cspace *cspace, cptr_t c);
*/
void cap_delete(struct cspace *cspace, cptr_t c);
/**
* Allocates a new cspace
*/
struct cspace * cap_alloc_cspace(void);
/**
* Frees a cspace allocated with cap_alloc_cspace
*/
void cap_free_cspace(struct cspace *cspace);
/**
* Sets up cspace - initializes lock, root cnode table, etc.
*/
......
......@@ -173,6 +173,12 @@ static int make_empty_cnode_table(struct cspace *cspace, uint8_t level,
return -ENOMEM;
}
inline struct cspace* cap_alloc_cspace(void) {
return cap_zalloc(1, sizeof(struct cspace));
}
inline void cap_free_cspace(struct cspace *cspace) { cap_free(cspace); }
/**
* Initializes the cspace's fields.
*/
......
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