mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 19:03:15 +01:00
fs_data and files structures can now be shared in the vfs task. Currently no means to free shared structures in tcb destruction. Need to add that.
30 lines
773 B
C
30 lines
773 B
C
#ifndef __MM0_IDPOOL_H__
|
|
#define __MM0_IDPOOL_H__
|
|
|
|
#include <lib/bit.h>
|
|
#include <l4/macros.h>
|
|
#include INC_GLUE(memory.h)
|
|
#include <string.h>
|
|
|
|
struct id_pool {
|
|
int nwords;
|
|
u32 bitmap[];
|
|
};
|
|
|
|
/* Copy one id pool to another by calculating its size */
|
|
static inline void id_pool_copy(struct id_pool *to, struct id_pool *from, int totalbits)
|
|
{
|
|
int nwords = BITWISE_GETWORD(totalbits);
|
|
|
|
memcpy(to, from, nwords * SZ_WORD + sizeof(struct id_pool));
|
|
}
|
|
|
|
struct id_pool *id_pool_new_init(int mapsize);
|
|
int id_new(struct id_pool *pool);
|
|
int id_del(struct id_pool *pool, int id);
|
|
int id_get(struct id_pool *pool, int id);
|
|
int ids_new_contiguous(struct id_pool *pool, int numids);
|
|
int ids_del_contiguous(struct id_pool *pool, int first, int numids);
|
|
|
|
#endif /* __MM0_IDPOOL_H__ */
|