|
HomeCore 0.1.3 (07b5544)
Bare-metal personal computer firmware for Cortex-M
|
Virtual file system: device nodes, RAM files and directories, mounted filesystems, paths, and descriptors. More...
#include <stdint.h>#include <stddef.h>#include <stdbool.h>Go to the source code of this file.
Data Structures | |
| struct | vfs_ops_t |
| Device operations. More... | |
| struct | vfs_node |
| Named entry in the VFS namespace. More... | |
| struct | vfs_stat_t |
| File type and size reported by vfs_stat() and vfs_fstat(). More... | |
| struct | vfs_fs_ops_t |
| Operations a mounted filesystem provides; every one is required. More... | |
Functions | |
Descriptor operations | |
| int | vfs_open (const char *name, int flags) |
| Open a node and allocate the lowest free descriptor. | |
| int | vfs_close (int fd) |
| Release a descriptor. | |
| int | vfs_read (int fd, void *buf, unsigned len) |
| Read from a descriptor. | |
| int | vfs_write (int fd, const void *buf, unsigned len) |
| Write to a descriptor. | |
| int | vfs_ioctl (int fd, unsigned request, void *arg) |
| Forward a control request to a device. | |
| int | vfs_lseek (int fd, int offset, int whence) |
| Move a descriptor's position. | |
| vfs_node_t * | vfs_fd_node (int fd) |
| Get the node behind an open descriptor. | |
| int | vfs_stat (const char *path, vfs_stat_t *stat) |
| Report the type and size of a path. | |
| int | vfs_fstat (int fd, vfs_stat_t *stat) |
| Report the type and size of an open descriptor. | |
Mounted filesystems | |
A mounted filesystem owns everything below its mount point. Paths passed to its operations are relative to the mount point and always start with | |
| int | vfs_mount (const char *path, const vfs_fs_ops_t *ops, void *fs) |
| Attach a filesystem at a new mount point. | |
Nodes and drivers | |
| typedef struct vfs_node | vfs_node_t |
| VFS node; see struct vfs_node. | |
| void | vfs_init (void) |
| Obsolete initializer; currently does nothing. | |
| void | vfs_register_node (vfs_node_t *node) |
| Add a node to the namespace. | |
| vfs_node_t * | vfs_find_node (const char *name) |
| Look up a node by path. | |
Namespace operations | |
| typedef int(* | vfs_directory_visitor_t) (const char *name, bool is_directory, void *context) |
| Visitor called for each directory entry by vfs_list(). | |
| int | vfs_resolve_path (const char *base, const char *path, char result[VFS_PATH_CAPACITY]) |
| Resolve a path against an explicit base directory. | |
| int | vfs_mkdir (const char *path) |
| Create an empty directory. | |
| int | vfs_rmdir (const char *path) |
| Remove an empty directory created by vfs_mkdir(). | |
| int | vfs_unlink (const char *path) |
| Remove a file: a RAM file, whose contents are freed, or a file on a mounted filesystem. | |
| int | vfs_list (const char *path, vfs_directory_visitor_t visitor, void *context) |
| Visit the direct children of a directory. | |
Virtual file system: device nodes, RAM files and directories, mounted filesystems, paths, and descriptors.