Voxia OS v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
ioforge_block.c
Go to the documentation of this file.
1
3#include "ioforge/ioforge.h"
4#include <type.h>
5
7 switch (type) {
8 case IOFORGE_ROOT:
9 case IOFORGE_BLOCK:
10 return true;
11 default:
12 return false;
13 }
14}
15
17 struct ioforge_device* node, uint8_t type,
18 ioforge_block_visitor_fn callback, void* ctx) {
19
20 if (!node)
21 return;
22
24 return;
25
26 struct ioforge_block_device* block =
27 (struct ioforge_block_device*) node;
28 if (block->type == type) {
29 callback(block, ctx);
30 }
31
32 struct ioforge_device* child = node->first_child;
33 while (child) {
34 foreach_block_device_by_type(child, type, callback, ctx);
35 child = child->next_sibling;
36 }
37}
IoForgeType
Definition ioforge.h:10
@ IOFORGE_BLOCK
Definition ioforge.h:19
@ IOFORGE_ROOT
Definition ioforge.h:11
static bool ioforge_can_contain_block_device(IoForgeType type)
void foreach_block_device_by_type(struct ioforge_device *node, uint8_t type, ioforge_block_visitor_fn callback, void *ctx)
void(* ioforge_block_visitor_fn)(struct ioforge_block_device *dev, void *ctx)
struct ioforge_device * first_child
Definition ioforge.h:36
struct ioforge_device * next_sibling
Definition ioforge.h:37
IoForgeType type
Definition ioforge.h:31
#define KERNEL_API
Definition type.h:93
unsigned char uint8_t
Definition type.h:7
uint8_t type
Definition vnode.h:2