summaryrefslogtreecommitdiff
path: root/src/kernel/handle.h
blob: 088ff936f4f1e35db28a8f238363c165de388054 (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
#pragma once

enum handle_type; // forward declaration for proc.h

#include <kernel/vfs/mount.h>
#include <shared/types.h>
#include <stddef.h>

enum handle_type {
	HANDLE_INVALID = 0,
	HANDLE_FILE,

	HANDLE_FS_FRONT,
};

struct handle {
	enum handle_type type;
	struct vfs_backend *backend;
	int file_id; // only applicable to HANDLE_FILE

	size_t refcount;
};

struct handle *handle_init(enum handle_type);
void handle_close(struct handle *);