Voxia OS v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
ioforge_block.hpp
Go to the documentation of this file.
1#ifndef __IOFORGE__IOFORGE_BLOCK_HPP__
2#define __IOFORGE__IOFORGE_BLOCK_HPP__
3
4#include "block/block.h"
5#include "ioforge/ioforge.hpp"
7
8class IOForgeBlock : public IOForge {
9 public:
10 inline IOForgeBlock(const char* mod) : IOForge(mod) {}
11 static void create(const char* name, block_device_operations_t* ops,
12 void* identifier);
13
14 template <typename T>
15 void foreach_by_type(ioforge_device* node, uint8_t type, T&& callback) {
17 node, type,
18 [](ioforge_block_device* dev, void* ctx) {
19 (*reinterpret_cast<T*>(ctx))(dev);
20 },
21 &callback);
22 }
23
24 virtual void load() = 0;
25 virtual void unload() = 0;
26};
27
28#endif // __IOFORGE__IOFORGE_BLOCK_HPP__
void foreach_by_type(ioforge_device *node, uint8_t type, T &&callback)
IOForgeBlock(const char *mod)
virtual void unload()=0
virtual void load()=0
static void create(const char *name, block_device_operations_t *ops, void *identifier)
IOForge(const char *mod)
Definition ioforge.hpp:18
const char * mod
Definition ioforge.hpp:65
kstring name
Definition dentry.h:5
void * ops
Definition dev.h:2
void foreach_block_device_by_type(struct ioforge_device *node, uint8_t type, ioforge_block_visitor_fn callback, void *ctx)
uint16_t identifier
Definition icmp.h:4
unsigned char uint8_t
Definition type.h:7
uint8_t type
Definition vnode.h:2