PatchworkOS  19e446b
A non-POSIX operating system.
Loading...
Searching...
No Matches
vnode_ops_t Struct Reference

vnode operations structure. More...

#include <vnode.h>

Collaboration diagram for vnode_ops_t:

Data Fields

uint64_t(* lookup )(vnode_t *dir, dentry_t *target)
 Look up a dentry in a directory vnode.
 
uint64_t(* create )(vnode_t *dir, dentry_t *target, mode_t mode)
 Handles both directories and files depending on mode.
 
void(* truncate )(vnode_t *target)
 Set the vnode size to zero.
 
uint64_t(* link )(vnode_t *dir, dentry_t *old, dentry_t *new)
 Make the same file vnode appear twice in the filesystem.
 
uint64_t(* readlink )(vnode_t *vnode, char *buffer, uint64_t size)
 Retrieve the path of the symbolic link.
 
uint64_t(* symlink )(vnode_t *dir, dentry_t *target, const char *dest)
 Create a symbolic link.
 
uint64_t(* remove )(vnode_t *dir, dentry_t *target)
 Remove a file or directory.
 
void(* cleanup )(vnode_t *vnode)
 Cleanup function called when the vnode is being freed.
 

Detailed Description

vnode operations structure.

Note that the vnodes mutex will be acquired by the vfs.

Definition at line 68 of file vnode.h.

Field Documentation

◆ lookup

uint64_t(* vnode_ops_t::lookup) (vnode_t *dir, dentry_t *target)

Look up a dentry in a directory vnode.

Should set the target dentry to be positive (give it an vnode), if the entry does not exist the operation should still return success but leave the dentry negative.

Parameters
dirThe directory vnode to look in.
targetThe dentry to look up.
Returns
On success, 0. On failure, returns ERR and errno is set.

Definition at line 80 of file vnode.h.

◆ create

uint64_t(* vnode_ops_t::create) (vnode_t *dir, dentry_t *target, mode_t mode)

Handles both directories and files depending on mode.

Takes in a negative dentry and creates the corresponding vnode to make the dentry positive.

Parameters
dirThe directory vnode to create the entry in.
targetThe negative dentry to create.
modeThe mode to create the entry with.
Returns
On success, 0. On failure, returns ERR and errno is set.

Definition at line 91 of file vnode.h.

◆ truncate

void(* vnode_ops_t::truncate) (vnode_t *target)

Set the vnode size to zero.

Parameters
targetThe vnode to truncate.

Definition at line 97 of file vnode.h.

◆ link

uint64_t(* vnode_ops_t::link) (vnode_t *dir, dentry_t *old, dentry_t *new)

Make the same file vnode appear twice in the filesystem.

Parameters
dirThe directory vnode to create the link in.
oldThe existing dentry containing the vnode to link to.
newThe negative dentry to store the same vnode as old.
Returns
On success, 0. On failure, returns ERR and errno is set.

Definition at line 106 of file vnode.h.

◆ readlink

uint64_t(* vnode_ops_t::readlink) (vnode_t *vnode, char *buffer, uint64_t size)

Retrieve the path of the symbolic link.

Parameters
vnodeThe symbolic link vnode.
bufferThe buffer to store the path in.
sizeThe size of the buffer.
Returns
On success, the number of bytes read. On failure, returns ERR and errno is set.

Definition at line 115 of file vnode.h.

◆ symlink

uint64_t(* vnode_ops_t::symlink) (vnode_t *dir, dentry_t *target, const char *dest)

Create a symbolic link.

Parameters
dirThe directory vnode to create the symbolic link in.
targetThe negative dentry to create.
destThe path to which the symbolic link will point.
Returns
On success, 0. On failure, returns ERR and errno is set.

Definition at line 124 of file vnode.h.

◆ remove

uint64_t(* vnode_ops_t::remove) (vnode_t *dir, dentry_t *target)

Remove a file or directory.

Parameters
dirThe directory vnode containing the target.
targetThe dentry to remove.
Returns
On success, 0. On failure, returns ERR and errno is set.

Definition at line 132 of file vnode.h.

◆ cleanup

void(* vnode_ops_t::cleanup) (vnode_t *vnode)

Cleanup function called when the vnode is being freed.

Parameters
vnodeThe vnode being freed.

Definition at line 138 of file vnode.h.


The documentation for this struct was generated from the following file: