kernel vfs
The vfs (virtual filesystem) provide filesystem abstraction and allows opening devices as files.
The prototype of most vfs functions is in <kernel/kheap.h>.
inodes
A vfs_node_t represent an inode. Various operations can be done using an inode.
inodes functions
vfs_get_node_atvfs_get_nodeGet the inode at a specified path.vfs_dup_nodeIncrement ref count of an inode.vfs_close_nodeDecrement ref count of an inode and can destroy it if it reach zero (or keep it as cache).vfs_getattrvfs_setattrGet/set attribute of an inode.vfs_chmodAtomicly change mode of an inode.vfs_chownAtomicly change the owner of an inode.vfs_permvfs_user_permGet the permission of an inode.vfs_linkCreate a hardlink (NOTE : some filesystem does not support this).vfs_unlinkUnlink a file.vfs_symlinkCreate a symlink.vfs_readlinkRead the target of a symlink.vfs_lookupLookup an entry on the inode of a directory.
files context
To read or write a file or a device, a vfs_fd_t (file/device context) is required.
It is possible to get one using various functions such as vfs_open or open_device.
files functions
vfs_openvfs_openatOpen a new context from a path.vfs_open_nodeOpen a new context from an inode.vfs_dupIncrement the ref count of a context.vfs_closeDecrement the ref count of a context and close it if it reach zero.vfs_readRead from a file/device.vfs_writeWrite to the file/device.vfs_ioctlDo some device specific operation.vfs_mmapMemory map the context on avmm_seg_tvfs_truncateTruncate the file/device.
filesystems
File systems are represented by a vfs_filesystem_t.
A file system type can be registered using vfs_register_fs and unregistered using vfs_unregister_fs.