summaryrefslogtreecommitdiff
path: root/src/kernel/handle.h
blob: 4ec8e57f5cd2e2f9cf1e274fab327b4de83cce34 (plain)
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
#pragma once
#include <kernel/types.h>
#include <kernel/vfs/mount.h>
#include <stddef.h>

#define HANDLE_MAX 16

typedef int handle_t; // TODO duplicated in syscalls.h

enum handle_type {
	HANDLE_EMPTY,
	HANDLE_FILE,

	HANDLE_FS_FRONT,
	HANDLE_FS_BACK,
};

struct handle {
	enum handle_type type;
	union {
		struct {
			struct vfs_backend *backend;
			int id;
		} file;
		struct {
			struct vfs_backend *backend;
		} fs;
	};
};