Skip to content

Commit

Permalink
在resman中定义一些东西
Browse files Browse the repository at this point in the history
  • Loading branch information
min0911Y committed Dec 19, 2024
1 parent 6822d51 commit e8a04c9
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/kernel/hal/resman.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,23 @@
#include <kernel.h>

typedef struct resman {
rbtree_t rbtree;
i32 next_id;
avltree_t avltree;
i32 next_id;
} *resman_t;

typedef struct file_describtor {
vfs_node_t node;
i32 refrence_cout;
} *file_describtor_t;

list_t file_descrabtors;
void resman_init(resman_t man);

static i32 alloc_next_id(resman_t man) {
while (avltree_get(man->avltree, man->next_id++))
;
return man->next_id - 1;
}
resman_t resman_alloc() {
resman_t man = malloc(sizeof(struct resman));
resman_init(man);
Expand All @@ -17,10 +28,11 @@ resman_t resman_alloc() {

void resman_init(resman_t man) {
if (man == null) return;
man->rbtree = null;
man->avltree = null;
man->next_id = 0;
}

int resman_open(i32 working_dir, cstr path) {}
void resman_deinit(resman_t man) {
rbtree_free(man->rbtree);
avltree_free(man->avltree);
}

0 comments on commit e8a04c9

Please sign in to comment.