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
2
#include "
ioforge/ioforge_block.h
"
3
#include "
ioforge/ioforge.h
"
4
#include <
type.h
>
5
6
static
bool
ioforge_can_contain_block_device
(
IoForgeType
type
) {
7
switch
(
type
) {
8
case
IOFORGE_ROOT
:
9
case
IOFORGE_BLOCK
:
10
return
true
;
11
default
:
12
return
false
;
13
}
14
}
15
16
void
KERNEL_API
foreach_block_device_by_type
(
17
struct
ioforge_device
* node,
uint8_t
type
,
18
ioforge_block_visitor_fn
callback,
void
* ctx) {
19
20
if
(!node)
21
return
;
22
23
if
(!
ioforge_can_contain_block_device
(node->
type
))
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
}
ioforge.h
IoForgeType
IoForgeType
Definition
ioforge.h:10
IOFORGE_BLOCK
@ IOFORGE_BLOCK
Definition
ioforge.h:19
IOFORGE_ROOT
@ IOFORGE_ROOT
Definition
ioforge.h:11
ioforge_can_contain_block_device
static bool ioforge_can_contain_block_device(IoForgeType type)
Definition
ioforge_block.c:6
ioforge_block.h
foreach_block_device_by_type
void foreach_block_device_by_type(struct ioforge_device *node, uint8_t type, ioforge_block_visitor_fn callback, void *ctx)
ioforge_block_visitor_fn
void(* ioforge_block_visitor_fn)(struct ioforge_block_device *dev, void *ctx)
Definition
ioforge_block.h:69
ioforge_block_device
Definition
ioforge_block.h:60
ioforge_block_device::type
uint8_t type
Definition
ioforge_block.h:64
ioforge_device
Definition
ioforge.h:29
ioforge_device::first_child
struct ioforge_device * first_child
Definition
ioforge.h:36
ioforge_device::next_sibling
struct ioforge_device * next_sibling
Definition
ioforge.h:37
ioforge_device::type
IoForgeType type
Definition
ioforge.h:31
type.h
KERNEL_API
#define KERNEL_API
Definition
type.h:93
uint8_t
unsigned char uint8_t
Definition
type.h:7
type
uint8_t type
Definition
vnode.h:2
kernel
sys
ioforge
ioforge_block.c
Generated on Sat May 30 2026 11:09:57 for Voxia OS by
1.13.2