|
PatchworkOS
19e446b
A non-POSIX operating system.
|
Virtual node. More...
Virtual node.
A vnode represents the actual data and metadata of a file. It is referenced by dentries, which represent the name or "location" of the file but a vnode can appear in multiple dentries due to hardlinks or mounts.
Vnodes have an additional purpose within the Virtual File System (VFS) as they act as the primary means of synchronization. All dentries synchronize upon their vnodes mutex, open files synchronize upon the mutex of the underlying vnode and operations like create, remove, etc synchronize upon the vnode mutex of the parent directory.
Data Structures | |
| struct | vnode_t |
| vnode structure. More... | |
| struct | vnode_ops_t |
| vnode operations structure. More... | |
Functions | |
| vnode_t * | vnode_new (superblock_t *superblock, vtype_t type, const vnode_ops_t *ops, const file_ops_t *fileOps) |
| Create a new vnode. | |
| void | vnode_truncate (vnode_t *vnode) |
| Truncate the vnode. | |
| vnode_t * vnode_new | ( | superblock_t * | superblock, |
| vtype_t | type, | ||
| const vnode_ops_t * | ops, | ||
| const file_ops_t * | fileOps | ||
| ) |
Create a new vnode.
Does not associate the vnode with a dentry, that is done when a dentry is made positive with dentry_make_positive().
There is no vnode_free() instead use UNREF().
| superblock | The superblock the vnode belongs to. |
| type | The vnode type. |
| ops | The vnode operations. |
| fileOps | The file operations for files opened on this vnode. |
NULL and errno is set. Definition at line 51 of file vnode.c.
| void vnode_truncate | ( | vnode_t * | vnode | ) |
Truncate the vnode.
The filesystem should implement the actual truncation in the vnode ops truncate function, this is just a helper to call it.
| vnode | The vnode to truncate. |
Definition at line 75 of file vnode.c.