MOS Source Code
Loading...
Searching...
No Matches
vfs.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-3.0-or-later
2// Virtual File System Public API
3
4#pragma once
5
9#include <mos/types.hpp>
10
17
18extern dentry_t *root_dentry;
19
31PtrResult<FsBaseFile> vfs_do_open_dentry(dentry_t *entry, bool created, bool read, bool write, bool exec, bool truncate);
32
34
45PtrResult<void> vfs_mount(const char *device, const char *path, const char *fs, const char *options);
46
54long vfs_unmount(const char *path);
55
64PtrResult<FsBaseFile> vfs_openat(int fd, mos::string_view path, OpenFlags flags);
65
81long vfs_fstatat(fd_t fd, const char *path, file_stat_t *__restrict stat, FStatAtFlags flags);
82
92size_t vfs_readlinkat(fd_t dirfd, const char *path, char *buf, size_t size);
93
102long vfs_symlink(const char *path, const char *target);
103
111PtrResult<void> vfs_mkdir(const char *path);
112PtrResult<void> vfs_rmdir(const char *path);
113
123size_t vfs_list_dir(IO *io, void *buf, size_t size);
124
132long vfs_chdirat(fd_t dirfd, const char *path);
133
141ssize_t vfs_getcwd(char *buf, size_t size);
142
152long vfs_fchmodat(fd_t fd, const char *path, int perm, int flags);
153
161long vfs_unlinkat(fd_t dirfd, const char *path);
162
172long vfs_fsync(IO *io, bool sync_metadata, off_t start, off_t end);
173
dentry_t * root_dentry
Definition vfs.cpp:35
long vfs_chdirat(fd_t dirfd, const char *path)
Change the current working directory.
Definition vfs.cpp:787
long vfs_symlink(const char *path, const char *target)
Create a symbolic link.
Definition vfs.cpp:658
long vfs_unmount(const char *path)
Unmount a filesystem at a given path.
Definition vfs.cpp:543
PtrResult< void > vfs_mount(const char *device, const char *path, const char *fs, const char *options)
Mount a filesystem at a given existing path.
Definition vfs.cpp:464
long vfs_fstatat(fd_t fd, const char *path, file_stat_t *__restrict stat, FStatAtFlags flags)
Stat a file.
Definition vfs.cpp:596
PtrResult< FsBaseFile > vfs_do_open_dentry(dentry_t *entry, bool created, bool read, bool write, bool exec, bool truncate)
Open an directory dentry.
Definition vfs.cpp:409
ssize_t vfs_getcwd(char *buf, size_t size)
Get the current working directory.
Definition vfs.cpp:806
PtrResult< FsBaseFile > vfs_openat(int fd, mos::string_view path, OpenFlags flags)
Open a file at a given path.
Definition vfs.cpp:585
long vfs_unlinkat(fd_t dirfd, const char *path)
Remove the name of a file, and possibly the file itself.
Definition vfs.cpp:846
PtrResult< void > vfs_mkdir(const char *path)
Create a directory.
Definition vfs.cpp:679
void vfs_register_filesystem(filesystem_t *fs)
Definition vfs.cpp:450
long vfs_fsync(IO *io, bool sync_metadata, off_t start, off_t end)
Synchronize a file with the filesystem.
Definition vfs.cpp:876
PtrResult< void > vfs_rmdir(const char *path)
Definition vfs.cpp:708
long vfs_fchmodat(fd_t fd, const char *path, int perm, int flags)
Change the permissions of a file.
Definition vfs.cpp:829
size_t vfs_readlinkat(fd_t dirfd, const char *path, char *buf, size_t size)
Read a symbolic link.
Definition vfs.cpp:632
size_t vfs_list_dir(IO *io, void *buf, size_t size)
Get the content of a directory.
Definition vfs.cpp:735
static vmap_global_mstat_t stat[_MEM_MAX_TYPES]
Definition mmstat.cpp:22
basic_string_view< char > string_view
size_t size
Definition slab.cpp:32
Definition io.hpp:39
ssize_t off_t
Definition types.h:80
s32 fd_t
Definition types.h:77
signed long ssize_t
Definition types.h:79