fat_io_lib finally works, implement virtual partition devices, manage devices via string keys
All checks were successful
Build documentation / build-and-deploy (push) Successful in 3m35s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 3m35s
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
#ifndef _KERNEL_DEVICE_DEVICE_H
|
||||
#define _KERNEL_DEVICE_DEVICE_H
|
||||
|
||||
#include <libk/hash.h>
|
||||
#include <libk/list.h>
|
||||
#include <libk/rbtree.h>
|
||||
#include <libk/std.h>
|
||||
#include <proc/proc.h>
|
||||
#include <proc/reschedule.h>
|
||||
#include <sync/spin_lock.h>
|
||||
#include <sys/smp.h>
|
||||
|
||||
#define DEVICES_MAX 1024
|
||||
|
||||
#define device_op1(d, op, proc, rctx, a1, a2, a3, a4, ...) \
|
||||
(d)->ops[(op)]((d), (proc), (rctx), (void*)(a1), (void*)(a2), (void*)(a3), (void*)(a4))
|
||||
|
||||
@@ -24,19 +26,20 @@ typedef bool (*device_init_func_t) (struct device* device, void* arg);
|
||||
typedef void (*device_fini_func_t) (struct device* device);
|
||||
|
||||
struct device {
|
||||
int id;
|
||||
char key[0x100];
|
||||
device_op_func_t ops[32];
|
||||
spin_lock_t lock;
|
||||
struct rb_node_link device_tree_link;
|
||||
struct hash_node_link device_table_link;
|
||||
device_init_func_t init;
|
||||
device_fini_func_t fini;
|
||||
void* udata;
|
||||
};
|
||||
|
||||
struct device* device_create (int id, device_op_func_t* ops, size_t ops_len,
|
||||
struct device* device_create (const char* key, device_op_func_t* ops, size_t ops_len,
|
||||
device_init_func_t init, device_fini_func_t fini, void* arg);
|
||||
struct device* device_find (int id);
|
||||
void device_delete (struct device* device);
|
||||
|
||||
struct device* device_find (const char* key);
|
||||
|
||||
void devices_init (void);
|
||||
|
||||
#endif // _KERNEL_DEVICE_DEVICE_H
|
||||
|
||||
Reference in New Issue
Block a user