summaryrefslogtreecommitdiff
path: root/src/kernel/vfs/mount.h
blob: 2e10dec73f82be7392aedbf3bb858918d631bfaa (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
#include <kernel/types.h>
#include <kernel/vfs/request.h>
#include <stddef.h>

struct VfsMount {
	VfsMount *prev;
	const char *prefix;
	size_t prefix_len;
	bool prefix_owned;
	VfsBackend *backend;
	size_t refs; /* counts all references, atm from:
	              *  - VfsMount
	              *  - Proc
	              */
};

// prepares init's filesystem view
VfsMount *vfs_mount_seed(void);
VfsMount *vfs_mount_resolve(
		VfsMount *top, const char *path, size_t path_len);
/** Decrements the reference count, potentially freeing the mount. */
void vfs_mount_remref(VfsMount *mnt);

void vfs_root_register(const char *path, void (*accept)(VfsReq *));