Voxia OS v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
initrd.c File Reference
#include "initrd.h"
#include "hal/cpu/paging.h"
#include "init/init.h"
#include "libk/oct2bin.h"
#include <spinlock.h>
#include <vector.h>
#include "type.h"
#include "vfs/cache.h"
#include "vfs/dentry.h"
#include "vfs/enum.h"
#include "vfs/filesystem.h"
#include <vfs/vfs.h>
#include <vfs/vnode.h>
#include <libk/fs/tar.h>
#include <libk/serial.h>
#include <str.h>
#include <memory/kalloc.h>
#include <memory/memory_utils.h>
#include <memory/phys_base_allocator.h>
#include <memory/slab.h>
#include <memory/vm_manager.h>
#include <autoconf.h>

Go to the source code of this file.

Data Structures

struct  initrd_internal_data
 
struct  initrd_internal_vnode_data
 

Functions

static void LoadIntoVfs (dentry_ptr dentry)
 
filesystem_tinitrd_fs_impl ()
 
 INIT (initrd)
 
static int initrd_read (vnode_t *vnode, void *buf, size_t len, size_t offset)
 
 __attribute__ ((used, visibility("default"), section(".export")))
 This function handles memory allocation for a new dentry using the slab allocator.
 

Variables

struct slab_cacheinitrd_internal_vnode_data_cache = 0
 
static struct initrd_internal_data __initrd_data
 

Function Documentation

◆ __attribute__()

__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).

Note
This function performs lazy initialization of the dentry slab cache if it does not exist yet.
Parameters
nameThe name of the file or directory.
vnodePointer to the associated VNode (inode data). Pass NULL if the VNode is not yet available.
Returns
dentry_ptr A pointer to the newly allocated and initialized dentry.

Definition at line 99 of file initrd.c.

References __initrd_data, base, kstring::c_str, create_and_attach_vnode(), CREATE_MISSING_ENTRY, data, header, initrd_read(), kalloc(), KERNEL_API, LOG2_INFO, LOG_DEBUG, LOG_ERROR, LOG_WARN, memcopy(), dentry::name, NULL, offset, vnode::ops, vnode::permission, print_dentry_tree(), vops_file_t::read, resolve_dentry(), size, vnode::size, strncmp(), vnode::type, VFS_OK, dentry::vnode, vnode::vnode_private, VNODE_TYPE_DIR, and VNODE_TYPE_FILE.

◆ INIT()

◆ initrd_fs_impl()

filesystem_t * initrd_fs_impl ( )

◆ initrd_read()

static int initrd_read ( vnode_t * vnode,
void * buf,
size_t len,
size_t offset )
static

Definition at line 88 of file initrd.c.

References __initrd_data, addr, data, len, memcopy(), offset, and vnode::vnode_private.

Referenced by __attribute__().

◆ LoadIntoVfs()

static void LoadIntoVfs ( dentry_ptr dentry)
static

Referenced by INIT().

Variable Documentation

◆ __initrd_data

struct initrd_internal_data __initrd_data
static

Definition at line 41 of file initrd.c.

Referenced by __attribute__(), INIT(), and initrd_read().

◆ initrd_internal_vnode_data_cache

struct slab_cache* initrd_internal_vnode_data_cache = 0

Definition at line 38 of file initrd.c.