summaryrefslogtreecommitdiffhomepage
path: root/src/loader/inc/cfg.h
blob: f3a15abf0a7375b1070777222528fab80ae5830b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// MIT License, Copyright (c) 2021 Marvin Borner

#ifndef CFG_H
#define CFG_H

#include <def.h>
#include <impl.h>

// Global config element index (can actually be anything but wth)
#define CFG_GLOBAL 0

enum cfg_key {
	CFG_NONE,
	CFG_NAME,
	CFG_TIMEOUT,
	CFG_PATH,
};

struct cfg_entry {
	u8 exists : 1;
	char name[64];
	char full_path[64]; // With disk name
	const char *path; // Without disk name
	struct dev *dev;
	struct impl impl;
};

struct cfg {
	u32 timeout;
	struct cfg_entry entry[16]; // Up to 16 different entries
};

void cfg_foreach(u8 (*cb)(struct cfg_entry *));
void cfg_exec(struct cfg_entry *entry);
void cfg_read(void);

#endif