Rewrite resource subsystem
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#ifndef _KERNEL_PROC_RESOURCE_H
|
||||
#define _KERNEL_PROC_RESOURCE_H
|
||||
|
||||
#include <libk/list.h>
|
||||
#include <libk/rbtree.h>
|
||||
#include <libk/std.h>
|
||||
#include <proc/mem.h>
|
||||
@@ -14,7 +15,6 @@
|
||||
#define RV_PUBLIC 1
|
||||
|
||||
struct proc;
|
||||
struct proc_resource;
|
||||
|
||||
struct proc_resource {
|
||||
int type;
|
||||
@@ -22,7 +22,8 @@ struct proc_resource {
|
||||
int visibility;
|
||||
spin_lock_t lock;
|
||||
atomic_int refs;
|
||||
struct rb_node_link proc_resource_tree_link;
|
||||
struct rb_node_link global_resource_tree_link;
|
||||
struct rb_node_link local_resource_tree_link;
|
||||
union {
|
||||
struct proc_resource_mem mem;
|
||||
struct proc_mutex mutex;
|
||||
@@ -30,11 +31,13 @@ struct proc_resource {
|
||||
struct {
|
||||
void (*cleanup) (struct proc* proc, struct proc_resource* resource);
|
||||
} ops;
|
||||
int created_by_pid;
|
||||
};
|
||||
|
||||
struct proc_resource* proc_create_resource (struct proc* proc, int rid, int type, int vis,
|
||||
void* data);
|
||||
void proc_drop_resource (struct proc* proc, struct proc_resource* resource);
|
||||
struct proc_resource* proc_find_resource (struct proc* proc, int rid, int vis);
|
||||
void proc_drop_resource (struct proc* proc, struct proc_resource* resource, bool lock);
|
||||
void proc_cleanup_resources (struct proc* proc);
|
||||
|
||||
#endif // _KERNEL_PROC_RESOURCE_H
|
||||
|
||||
Reference in New Issue
Block a user