|
Voxia OS v0.0.1
Hobby Project Operating System Targeting x86-64
|
#include "llist.h"#include "vfs/cache.h"#include "vfs/rcu.h"#include <string.h>#include <type.h>#include <vector.h>Go to the source code of this file.
Data Structures | |
| struct | dentry |
Macros | |
| #define | DENTRY_PINNED (1 << 0) |
| #define | DENTRY_NEGATIVE (1 << 1) |
| #define | DENTRY_MOUNTPOINT (1 << 2) |
Typedefs | |
| typedef struct dentry | dentry_t |
| typedef struct dentry * | dentry_ptr |
| typedef struct vnode * | vnode_ptr_t |
Enumerations | |
| enum | { RESOLVE_LAST_ENTRY = (1 << 1) , CREATE_MISSING_ENTRY = (1 << 2) } |
Functions | |
| struct dentry | __attribute__ ((aligned(64))) |
| int | vxnamei (const char *path, dentry_ptr *out) |
| Resolves a file path to a directory entry (dentry). | |
| dentry_ptr | __attribute__ ((used, visibility("default"), section(".export"))) create_dentry(kstring name |
| This function handles memory allocation for a new dentry using the slab allocator. | |
| void | vxSetDentryAsRoot (dentry_ptr dentry) |
| dentry_ptr | get_root_dentry () |
| int | resolve_dentry (char *path, dentry_ptr parent, dentry_ptr *out, uint8_t flag) |
| Resolves a path to a directory entry (dentry) with configurable start point and strictness. | |
| void | vxFreeDentry (dentry_ptr dentry) |
| void | vxFreeDentryWithChildren (dentry_ptr dentry) |
| void | vxAttachDentryToVnode (dentry_ptr dentry, vnode_ptr_t vnode) |
| uint32_t | hash_dentry (const char *name, dentry_ptr parent) |
| void | dentry_put (dentry_ptr dentry) |
| void | dentry_get (dentry_ptr dentry) |
| void | delete_dentry (dentry_t *node) |
| int | get_reffcount (dentry_ptr dentry) |
| void | print_dentry_tree (dentry_t *node, int depth) |
| kstring | get_full_path_from_dentry (dentry_ptr dentry) |
Variables | |
| struct llist_head | child_list |
| atomic_t | refcount |
| uint32_t | hash |
| uint32_t | flags |
| kstring | name |
| struct vnode * | vnode |
| dentry_ptr | parent |
| struct hlist_node | hash_node |
| struct rcu_head | rcu |
| enum { ... } | __attribute__ |
| typedef struct dentry* dentry_ptr |
| typedef struct vnode* vnode_ptr_t |
| anonymous enum |
| dentry_ptr __attribute__ | ( | (used, visibility("default"), section(".export")) | ) |
This function handles memory allocation for a new dentry using the slab allocator.
It also links the dentry to its corresponding VNode (if provided).
| name | The name of the file or directory. |
| vnode | Pointer to the associated VNode (inode data). Pass NULL if the VNode is not yet available. |
References KERNEL_API, name, and parent.
| void delete_dentry | ( | dentry_t * | node | ) |
Definition at line 268 of file dentry.c.
References cache_remove(), dentry::child_list, container_of, delete_dentry(), dentry_put(), get_root_cache(), kalloc(), kfree(), llist_head::next, NULL, and pos.
Referenced by delete_dentry().
| void dentry_get | ( | dentry_ptr | dentry | ) |
Definition at line 68 of file dentry.c.
References atomic_t::counter, and dentry::refcount.
Referenced by vfs_umount().
| void dentry_put | ( | dentry_ptr | dentry | ) |
Definition at line 72 of file dentry.c.
References call_rcu(), atomic_t::counter, dentry_free_rcu(), dentry::rcu, and dentry::refcount.
Referenced by __attribute__(), delete_dentry(), execve(), vfs_umount(), vfs_umount_recursive(), and vxVoxmoInstall().
| kstring get_full_path_from_dentry | ( | dentry_ptr | dentry | ) |
Definition at line 356 of file dentry.c.
References kstring::c_str, dentry::name, NULL, dentry::parent, str(), str_concat(), str_concat_prefix(), and str_release().
Referenced by __attribute__(), and print_dentry_tree().
| int get_reffcount | ( | dentry_ptr | dentry | ) |
Definition at line 352 of file dentry.c.
References atomic_t::counter, and dentry::refcount.
Referenced by vfs_umount_recursive().
| dentry_ptr get_root_dentry | ( | ) |
Referenced by execve().
|
inline |
Definition at line 24 of file dentry.c.
References h, hash32(), name, and parent.
Referenced by __attribute__(), and cache_lookup().
| void print_dentry_tree | ( | dentry_t * | node, |
| int | depth ) |
Definition at line 300 of file dentry.c.
References fs_instance::block_dentry, kstring::c_str, dentry::child_list, container_of, atomic_t::counter, vnode::device, fs_instance::fs, vnode::fs_instance, get_full_path_from_dentry(), dentry::hash, device_id::major, device_id::minor, vnode::mountedhere, dentry::name, filesystem::name, llist_head::next, vnode::permission, pos, print_dentry_tree(), dentry::refcount, serial2_printf(), str_release(), vnode::type, dentry::vnode, VNODE_TYPE_BLK, and VNODE_TYPE_CHR.
Referenced by __attribute__(), execve(), and print_dentry_tree().
| int resolve_dentry | ( | char * | path, |
| dentry_ptr | parent, | ||
| dentry_ptr * | out, | ||
| uint8_t | flag ) |
Resolves a path to a directory entry (dentry) with configurable start point and strictness.
This function traverses the filesystem path. It differs from vxNamei by allowing a specific parent dentry to start from, and it can handle cases where the final component of the path does not exist yet (controlled by flags).
| path | The file path to resolve (can be relative or absolute). |
| parent | The dentry to start the search from. If NULL, starts from root_dentry. |
| out | Double pointer to store the resulting dentry. |
| flag | Bitmask to modify behavior.
|
RESOLVE_LAST_ENTRY was set and the target was missing, returns the index of the missing component in the path. Referenced by __attribute__(), __attribute__(), create_process(), execve(), INIT(), library_register(), and vxVoxmoInstall().
| void vxAttachDentryToVnode | ( | dentry_ptr | dentry, |
| vnode_ptr_t | vnode ) |
| void vxFreeDentry | ( | dentry_ptr | dentry | ) |
| void vxFreeDentryWithChildren | ( | dentry_ptr | dentry | ) |
| int vxnamei | ( | const char * | path, |
| dentry_ptr * | out ) |
Resolves a file path to a directory entry (dentry).
This function traverses the filesystem tree starting from the root dentry. It tokenizes the input path and iterates through the directory structure.
Behavior:
| path | The null-terminated string representing the absolute path to resolve. |
| out | A pointer to a dentry pointer. On success, this will be updated to point to the resolved (or newly created) dentry. |
References path.
Referenced by __attribute__(), configure_tty(), ATAPIModule::identify(), INIT(), and INIT().
| void vxSetDentryAsRoot | ( | dentry_ptr | dentry | ) |
| enum { ... } __attribute__ |
| struct llist_head child_list |
| uint32_t hash |
Definition at line 3 of file dentry.h.
Referenced by create_netdev(), elf_dyn_map_all(), elf_gnu_lookup(), elf_gnu_maybe_present(), find_dev(), lookup_netdev(), and notify_dev_create().
| struct hlist_node hash_node |
Definition at line 8 of file dentry.h.
Referenced by cache_lookup().
| kstring name |
Definition at line 5 of file dentry.h.
Referenced by __attribute__(), __attribute__(), cache_lookup(), IOForgeBlock::create(), create_filesystem(), create_netdev(), create_process(), elf_find_symbol(), elf_gnu_lookup(), elf_relocate_rel(), elf_resolve_external_symbol(), find_dev(), get_filesystem(), hash_dentry(), INIT(), initrd_load(), ioforge_find_by_name(), IOforgeNICFindByName(), iso9660_lookup(), kernel_resolve_symbol(), library_load(), lookup_netdev(), notify_call(), notify_dev_create(), notify_dev_destroy(), notify_register(), notify_unregister(), registerBlockDevice(), retrieve_filesystem(), sb16_play(), ssfn_select(), symbols_register(), vfs_cache_insert(), vxAttachDentryToVnode(), vxCreateSlabCache(), vxGetVoxmoModule(), vxVoxmoProbe(), and wait_until_receive_notify().
| dentry_ptr struct vnode dentry_ptr parent |
Definition at line 7 of file dentry.h.
Referenced by __attribute__(), __attribute__(), cache_lookup(), hash_dentry(), ioforge_attach(), iso9660_lookup(), rbt_insert_node(), resolve_dentry(), vfs_cache_insert(), and vxAttachDentryToVnode().
| struct rcu_head rcu |
Definition at line 9 of file dentry.h.
Referenced by dentry_free_rcu().
| dentry_ptr struct vnode * vnode |