XenevaOS
Loading...
Searching...
No Matches
Functions
Ext2.c File Reference
#include <Fs/vfs.h>
#include <Fs/vdisk.h>
#include <Mm/kmalloc.h>
#include <Mm/pmmngr.h>
#include <Drivers/uart.h>
#include <string.h>
#include <aucon.h>
#include <Fs/Ext2/ext2.h>
#include <_null.h>
Include dependency graph for Ext2.c:

Functions

int Ext2FreeBlock (Ext2Fs *fs, uint32_t block_num)
 
int Ext2FreeInode (Ext2Fs *fs, uint32_t inode_num)
 
uint32_t Ext2FindEntry (Ext2Fs *fs, Ext2Inode *dir_inode, const char *name)
 
int Ext2ReadInode (Ext2Fs *fs, uint32_t inode_num, Ext2Inode *out_inode)
 
uint32_t Ext2ReadBlockIndex (Ext2Fs *fs, uint32_t block_id, uint32_t index)
 
size_t Ext2Read (AuVFSNode *node, AuVFSNode *file, uint64_t *buffer, uint32_t length)
 
AuVFSNodeExt2Open (AuVFSNode *fsys, char *path)
 
AuVFSNodeExt2Initialise (AuVDisk *vdisk, char *mountname)
 

Detailed Description

BSD 2-Clause License

Copyright (c) 2022-2023, Manas Kamal Choudhury All rights reserved.

Author: Pranav Bisht, Prana.nosp@m.v0bi.nosp@m.sht@g.nosp@m.mail.nosp@m..com

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Function Documentation

◆ Ext2FindEntry()

uint32_t Ext2FindEntry ( Ext2Fs fs,
Ext2Inode dir_inode,
const char *  name 
)

Ext2FindEntry – scans the directory data block for matching name string

Parameters
fs– file system
dir_inode– parsed inode structure we are searching inside
name– the target string we are matching

◆ Ext2FreeBlock()

int Ext2FreeBlock ( Ext2Fs fs,
uint32_t  block_num 
)

◆ Ext2FreeInode()

int Ext2FreeInode ( Ext2Fs fs,
uint32_t  inode_num 
)

◆ Ext2Initialise()

AuVFSNode * Ext2Initialise ( AuVDisk vdisk,
char *  mountname 
)

Ext2Initialise – initialize the ext2 file system

Parameters
vdisk– Pointer to vdisk structure
mountname– mount file system name

◆ Ext2Open()

AuVFSNode * Ext2Open ( AuVFSNode fsys,
char *  path 
)

Ext2Open – acting internal path crawler

Parameters
fsys– pointer to the file system
path– path to the file

◆ Ext2Read()

size_t Ext2Read ( AuVFSNode node,
AuVFSNode file,
uint64_t buffer,
uint32_t  length 
)

Ext2Read – reads data from a file in the ext2 filesystem

Parameters
node– the filesystem node
file– the file node to read from
buffer– the buffer to store read data
length– the number of bytes to read

◆ Ext2ReadBlockIndex()

uint32_t Ext2ReadBlockIndex ( Ext2Fs fs,
uint32_t  block_id,
uint32_t  index 
)

Ext2ReadBlockIndex – reads the block index from a given block

Parameters
fs– the filesystem
block_id– the block id to read from
index– the index within the block to read

◆ Ext2ReadInode()

int Ext2ReadInode ( Ext2Fs fs,
uint32_t  inode_num,
Ext2Inode out_inode 
)

Ext2ReadInode – reads the inode and updates the provided new inode

Parameters
fs– the filesystem
inode_num– inode number to read
out_inode– inode to place the readings