7#define VFS_PATH_MAX 256
286 size_t length,
int prot,
uint64_t offset);
uintptr_t addr_space_t
an address space handle.
Definition arch.h:105
kerr_t
unified kernel error codes.
Definition error.h:14
struct fs_mount fs_mount_t
filesystem operations vtable.
Definition ext2_ops.h:7
struct fs_stat fs_stat_t
Definition fs.h:37
struct fs_dirent fs_dirent_t
Definition fs.h:36
struct fs_file fs_file_t
Definition fs.h:35
uint32_t base
Definition gdt.c:1
unsigned int uint32_t
Definition fb.h:17
unsigned char uint8_t
Definition fb.h:18
__UINT64_TYPE__ uint64_t
Definition stdint.h:17
int int32_t
Definition stdint.h:14
__UINTPTR_TYPE__ uintptr_t
Definition stdint.h:19
__INT64_TYPE__ int64_t
Definition stdint.h:16
an open-file description.
Definition file.h:64
a change of a file's permissions or owner (setattr).
Definition fs.h:49
virtual file system file handle structure representing an open file or directory.
Definition vfs.h:21
fs_file_t file
Definition vfs.h:23
fs_mount_t * mount
Definition vfs.h:22
kerr_t vfs_fstat(vfs_file_t *file, vfs_stat_t *stat_out)
stat an open file or directory.
Definition vfs_ops.c:270
bool vfs_join_root(const char *root, const char *virtual_path, char *out, uint32_t size)
the real path of a path as a process with this root sees it.
Definition vfs_link.c:42
kerr_t vfs_mount(const char *prefix, fs_mount_t *mount)
mount a filesystem at a path prefix.
Definition vfs_mount.c:69
kerr_t vfs_mknod(const char *path, uint32_t mode, uint32_t rdev)
make a named pipe or a device node (fs_ops_t mknod).
Definition vfs_link.c:173
uint8_t vfs_file_type(vfs_file_t *file)
get the type of an open file in the virtual file system.
Definition vfs_ops.c:209
bool vfs_join_path(const char *base, const char *name, char *out, size_t size)
join two path components into an output buffer.
Definition vfs_path.c:230
kerr_t vfs_mount_root(fs_mount_t *mount)
mount a filesystem as the root filesystem.
Definition vfs_mount.c:212
kerr_t vfs_read_entry(vfs_file_t *file, fs_dirent_t *entryOut)
read a directory entry from an open directory in the virtual file system.
Definition vfs_ops.c:185
kerr_t vfs_create(const char *path)
create a regular file by absolute path.
Definition vfs_ops.c:32
kerr_t vfs_fsetattr(vfs_file_t *file, const fs_attr_t *attr)
Definition vfs_ops.c:292
uint32_t vfs_write(vfs_file_t *file, uint32_t size, const void *buffer)
write data to an open file in the virtual file system.
Definition vfs_ops.c:159
kerr_t vfs_truncate(vfs_file_t *file, uint64_t length)
cut or grow an open file to length bytes (growth reads as zeros).
Definition vfs_ops.c:175
kerr_t vfs_follow(char *path, uint32_t size, bool follow_last, const char *root)
replace the symbolic links along a canonical absolute path by their targets (vfs_link....
Definition vfs_link.c:60
kerr_t vfs_symlink(const char *path, const char *target)
make a symbolic link at path to target.
Definition vfs_link.c:150
int32_t vfs_ioctl(vfs_file_t *file, uint32_t request, void *arg)
issue a device-control (ioctl) request on an open file.
Definition vfs_ops.c:220
kerr_t vfs_mkdir(const char *path)
create a directory by absolute path.
Definition vfs_ops.c:49
kerr_t vfs_setattr(const char *path, const fs_attr_t *attr)
change the permission bits and/or owner of a file by path, or of an open file.
Definition vfs_ops.c:279
fs_stat_t vfs_stat_t
Definition vfs.h:14
kerr_t vfs_stat(const char *path, vfs_stat_t *stat_out)
stat a file or directory by absolute path.
Definition vfs_ops.c:126
fs_mount_t * vfs_resolve_mount_path(const char *path, const char **rel_out)
find the mounted filesystem responsible for an absolute path, and the sub-path relative to that mount...
Definition vfs_mount.c:151
kerr_t vfs_rmdir(const char *path)
remove a directory by absolute path.
Definition vfs_ops.c:83
void vfs_close(vfs_file_t *file)
close an open file in the virtual file system.
Definition vfs_ops.c:197
void vfs_seek_end(vfs_file_t *file)
move an open file's offset to its end (O_APPEND writes).
Definition vfs_ops.c:265
kerr_t vfs_readlink(const char *path, char *target, uint32_t size)
read the target of the symbolic link at path, with a NUL.
Definition vfs_link.c:139
kerr_t vfs_link(const char *old_path, const char *new_path)
give a file one more name (both paths on one mount, else KERR_INVAL).
Definition vfs_link.c:161
kerr_t vfs_remove(const char *path)
remove a file by absolute path.
Definition vfs_ops.c:66
int64_t vfs_lseek(vfs_file_t *file, int64_t offset, int whence)
move an open file's offset, as lseek does: through the filesystem's own seek op if it has one (devfs)...
Definition vfs_ops.c:241
const char * vfs_inside_root(const char *path, const char *root)
a real path as a process with this root directory sees it.
Definition vfs_link.c:28
kerr_t vfs_rename(const char *old_path, const char *new_path)
rename a file or directory by absolute paths.
Definition vfs_ops.c:100
uint32_t vfs_read(vfs_file_t *file, uint32_t size, void *buffer)
read data from an open file in the virtual file system.
Definition vfs_ops.c:143
bool vfs_mount_at(uint32_t index, char *prefix_out, uint32_t prefix_size, fs_mount_t **mount_out)
a mounted filesystem, by its place in the mount table (for /proc/mounts).
Definition vfs_mount.c:128
bool vfs_resolve_path(const char *cwd, const char *input, char *output, size_t size)
resolve an input path against the current working directory.
Definition vfs_path.c:120
kerr_t vfs_open(const char *path, vfs_file_t *file)
open a file or directory by absolute path in the virtual file system.
Definition vfs_ops.c:6
kerr_t vfs_umount(const char *prefix)
unmount the filesystem at an exact path prefix.
Definition vfs_mount.c:108
int32_t vfs_mmap(vfs_file_t *file, addr_space_t as, uintptr_t virt, size_t length, int prot, uint64_t offset)
map an open file's memory into a process address space.
Definition vfs_ops.c:230