mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 10:53:16 +01:00
Capability accounting for quantitative capabilities - First part done.
Need to make sure accounting charges correct containers during init. Therefore kernel resource spending must also be accounted for.
This commit is contained in:
@@ -138,5 +138,6 @@
|
||||
/* Codezero specific error codes */
|
||||
#define EACTIVE 132 /* Task active */
|
||||
#define ENOIPC 133 /* General IPC error */
|
||||
#define ENOCAP 134 /* None or insufficient capability */
|
||||
|
||||
#endif /* __ERRNO_H__ */
|
||||
|
||||
@@ -71,6 +71,7 @@ struct cap_list {
|
||||
|
||||
void capability_init(struct capability *cap);
|
||||
struct capability *capability_create(void);
|
||||
struct capability *boot_capability_create(void);
|
||||
|
||||
|
||||
static inline void cap_list_init(struct cap_list *clist)
|
||||
@@ -86,6 +87,12 @@ static inline void cap_list_insert(struct capability *cap,
|
||||
clist->ncaps++;
|
||||
}
|
||||
|
||||
/* Capability checking for quantitative capabilities */
|
||||
int capability_consume(struct capability *cap, int quantity);
|
||||
int capability_free(struct capability *cap, int quantity);
|
||||
struct capability *capability_find_by_rtype(struct cap_list *clist,
|
||||
unsigned int rtype);
|
||||
|
||||
#if 0
|
||||
/* Virtual memory space allocated to container */
|
||||
struct capability cap_virtmap = {
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
struct boot_resources {
|
||||
int nconts;
|
||||
int ncaps;
|
||||
int nids;
|
||||
int nthreads;
|
||||
int nspaces;
|
||||
int npmds;
|
||||
@@ -27,6 +26,7 @@ struct boot_resources {
|
||||
int nkpmds;
|
||||
int nkpgds;
|
||||
int nkmemcaps;
|
||||
int nkcaps;
|
||||
};
|
||||
|
||||
/* List of containers */
|
||||
@@ -72,6 +72,9 @@ struct kernel_container {
|
||||
struct cap_list devmem_used;
|
||||
struct cap_list devmem_free;
|
||||
|
||||
/* All other caps that belong to the kernel */
|
||||
struct cap_list other_caps;
|
||||
|
||||
struct mem_cache *pgd_cache;
|
||||
struct mem_cache *pmd_cache;
|
||||
struct mem_cache *ktcb_cache;
|
||||
@@ -95,6 +98,8 @@ pgd_table_t *alloc_pgd(void);
|
||||
pmd_table_t *alloc_pmd(void);
|
||||
struct address_space *alloc_space(void);
|
||||
struct ktcb *alloc_ktcb(void);
|
||||
struct ktcb *alloc_ktcb_use_capability(struct capability *cap);
|
||||
struct capability *boot_alloc_capability(void);
|
||||
struct capability *alloc_capability(void);
|
||||
struct container *alloc_container(void);
|
||||
struct mutex_queue *alloc_user_mutex(void);
|
||||
|
||||
@@ -158,6 +158,7 @@ void tcb_remove(struct ktcb *tcb);
|
||||
|
||||
void tcb_init(struct ktcb *tcb);
|
||||
struct ktcb *tcb_alloc_init(void);
|
||||
struct ktcb *tcb_alloc_init_use_capability(struct capability *cap);
|
||||
void tcb_delete(struct ktcb *tcb);
|
||||
|
||||
void init_ktcb_list(struct ktcb_list *ktcb_list);
|
||||
|
||||
Reference in New Issue
Block a user