PatchworkOS  19e446b
A non-POSIX operating system.
Loading...
Searching...
No Matches
dentry.h File Reference
#include <kernel/fs/path.h>
#include <kernel/fs/vnode.h>
#include <kernel/sync/mutex.h>
#include <kernel/sync/rcu.h>
#include <kernel/sync/seqlock.h>
#include <kernel/utils/map.h>
#include <kernel/utils/ref.h>
#include <stdatomic.h>
#include <stdint.h>
#include <sys/fs.h>
#include <sys/list.h>
Include dependency graph for dentry.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dir_ctx_t
 Directory context used to iterate over directory entries. More...
 
struct  dentry_ops_t
 Dentry operations structure. More...
 
struct  dentry_t
 Directory entry structure. More...
 

Macros

#define DENTRY_IS_ROOT(dentry)   ((dentry)->parent == (dentry))
 Macro to check if a dentry is the root entry in its filesystem.
 
#define DENTRY_IS_POSITIVE(dentry)   ((dentry)->vnode != NULL)
 Check if a dentry is positive.
 
#define DENTRY_IS_REGULAR(dentry)   (DENTRY_IS_POSITIVE(dentry) && (dentry)->vnode->type == VREG)
 Check if the vnode associated with a dentry is a regular file.
 
#define DENTRY_IS_DIR(dentry)   (DENTRY_IS_POSITIVE(dentry) && (dentry)->vnode->type == VDIR)
 Check if the vnode associated with a dentry is a directory.
 
#define DENTRY_IS_SYMLINK(dentry)   (DENTRY_IS_POSITIVE(dentry) && (dentry)->vnode->type == VSYMLINK)
 Check if the vnode associated with a dentry is a symbolic link.
 
#define DENTRY_DOTS_AMOUNT   2
 The amount of special entries "." and ".." that dentry_iterate_dots() emits.
 

Typedefs

typedef struct dentry dentry_t
 
typedef struct dentry_ops dentry_ops_t
 
typedef struct vnode vnode_t
 
typedef struct superblock superblock_t
 
typedef struct dir_ctx dir_ctx_t
 
typedef uint64_t dentry_id_t
 Dentry ID type.
 

Functions

dentry_tdentry_new (superblock_t *superblock, dentry_t *parent, const char *name)
 Create a new dentry.
 
void dentry_remove (dentry_t *dentry)
 Remove a dentry from the dentry cache.
 
dentry_tdentry_rcu_get (const dentry_t *parent, const char *name, size_t length)
 Get a dentry from the dentry cache in an RCU read-side critical section without traversing mountpoints.
 
dentry_tdentry_lookup (dentry_t *parent, const char *name, size_t length)
 Lookup a dentry for the given name without traversing mountpoints.
 
void dentry_make_positive (dentry_t *dentry, vnode_t *vnode)
 Make a dentry positive by associating it with an vnode.
 
bool dentry_iterate_dots (dentry_t *dentry, dir_ctx_t *ctx)
 Helper function to iterate over the special entries "." and "..".
 
uint64_t dentry_generic_iterate (dentry_t *dentry, dir_ctx_t *ctx)
 Helper function for a basic iterate.
 

Typedef Documentation

◆ dentry_t

typedef struct dentry dentry_t

Definition at line 16 of file dentry.h.

◆ dentry_ops_t

typedef struct dentry_ops dentry_ops_t

Definition at line 17 of file dentry.h.

◆ vnode_t

typedef struct vnode vnode_t

Definition at line 18 of file dentry.h.

◆ superblock_t

typedef struct superblock superblock_t

Definition at line 19 of file dentry.h.

◆ dir_ctx_t

typedef struct dir_ctx dir_ctx_t

Definition at line 20 of file dentry.h.