PatchworkOS  966e257
A non-POSIX operating system.
Loading...
Searching...
No Matches
inode_ops_t Struct Reference

Inode operations structure. More...

#include <inode.h>

Collaboration diagram for inode_ops_t:

Data Fields

uint64_t(* lookup )(inode_t *dir, dentry_t *target)
 Look up a dentry in a directory inode.
 
uint64_t(* create )(inode_t *dir, dentry_t *target, mode_t mode)
 Handles both directories and files depending on mode.
 
void(* truncate )(inode_t *target)
 Set the inode size to zero.
 
uint64_t(* link )(inode_t *dir, dentry_t *old, dentry_t *new)
 Make the same file inode appear twice in the filesystem.
 
uint64_t(* remove )(inode_t *dir, dentry_t *target, mode_t mode)
 Remove a file or directory.
 
void(* cleanup )(inode_t *inode)
 Cleanup function called when the inode is being freed.
 

Detailed Description

Inode operations structure.

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

Definition at line 81 of file inode.h.

Field Documentation

◆ lookup

uint64_t(* inode_ops_t::lookup) (inode_t *dir, dentry_t *target)

Look up a dentry in a directory inode.

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

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

Definition at line 93 of file inode.h.

◆ create

uint64_t(* inode_ops_t::create) (inode_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 inode to make the dentry positive.

Parameters
dirThe directory inode 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 104 of file inode.h.

◆ truncate

void(* inode_ops_t::truncate) (inode_t *target)

Set the inode size to zero.

Parameters
targetThe inode to truncate.

Definition at line 110 of file inode.h.

◆ link

uint64_t(* inode_ops_t::link) (inode_t *dir, dentry_t *old, dentry_t *new)

Make the same file inode appear twice in the filesystem.

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

Definition at line 119 of file inode.h.

◆ remove

uint64_t(* inode_ops_t::remove) (inode_t *dir, dentry_t *target, mode_t mode)

Remove a file or directory.

Parameters
dirThe directory inode containing the target.
targetThe dentry to remove.
modeThe mode for removal.
Returns
On success, 0. On failure, returns ERR and errno is set.

Definition at line 128 of file inode.h.

◆ cleanup

void(* inode_ops_t::cleanup) (inode_t *inode)

Cleanup function called when the inode is being freed.

Parameters
inodeThe inode being freed.

Definition at line 134 of file inode.h.


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