XenevaOS
Loading...
Searching...
No Matches
Functions | Variables
Fat.cpp File Reference
#include <Fs/Fat/Fat.h>
#include <Fs/Fat/FatFile.h>
#include <Fs/Fat/FatDir.h>
#include <Fs/vdisk.h>
#include <Fs/vfs.h>
#include <Mm/pmmngr.h>
#include <Mm/vmmngr.h>
#include <string.h>
#include <aucon.h>
#include <ctype.h>
#include <_null.h>
#include <Hal/serial.h>
#include <Mm/kmalloc.h>
#include <Sync/spinlock.h>
#include <pe.h>
#include <Drivers\rtc.h>
#include <Sync/mutex.h>
Include dependency graph for Fat.cpp:

Functions

uint64_t FatClusterToSector32 (FatFS *fs, uint64_t cluster)
 
void FatToDOSFilename (const char *filename, char *fname, unsigned int fname_length)
 
uint8_t FatCalculateCheckSum (uint8_t *filename)
 
uint8_t FatCheckDotCount (char *filename)
 
void FatFromDosToFilename (char *filename, char *dirfname)
 
uint32_t FatReadFAT (AuVFSNode *node, uint64_t cluster_index)
 
uint32_t FatFindFreeCluster (AuVFSNode *node)
 
void FatAllocCluster (AuVFSNode *fsys, int position, uint32_t n_value)
 
void FatClearCluster (AuVFSNode *node, uint32_t cluster)
 
size_t FatRead (AuVFSNode *fsys, AuVFSNode *file, uint64_t *buf)
 
size_t FatReadFile (AuVFSNode *fsys, AuVFSNode *file, uint64_t *buffer, uint32_t length)
 
AuVFSNodeFatLocateSubDir (AuVFSNode *fsys, AuVFSNode *kfile, const char *filename)
 
AuVFSNodeFatLocateDir (AuVFSNode *fsys, const char *dir)
 
AuVFSNodeFatOpen (AuVFSNode *fsys, char *filename)
 
size_t FatGetClusterFor (AuVFSNode *fs, AuVFSNode *file, uint64_t offset)
 
AuVFSNodeFatInitialise (AuVDisk *vdisk, char *mountname)
 
uint16_t FatFormatDate ()
 
uint16_t FatFormatTime ()
 

Variables

bool _vfs_debug_on
 

Function Documentation

◆ FatAllocCluster()

void FatAllocCluster ( AuVFSNode fsys,
int  position,
uint32_t  n_value 
)

◆ FatCalculateCheckSum()

uint8_t FatCalculateCheckSum ( uint8_t filename)

◆ FatCheckDotCount()

uint8_t FatCheckDotCount ( char *  filename)

◆ FatClearCluster()

void FatClearCluster ( AuVFSNode node,
uint32_t  cluster 
)

FatClearCluster – clears a cluster to 0

Parameters
cluster– cluster to clear

◆ FatClusterToSector32()

uint64_t FatClusterToSector32 ( FatFS fs,
uint64_t  cluster 
)

◆ FatFindFreeCluster()

uint32_t FatFindFreeCluster ( AuVFSNode node)

◆ FatFormatDate()

uint16_t FatFormatDate ( )

◆ FatFormatTime()

uint16_t FatFormatTime ( )

◆ FatFromDosToFilename()

void FatFromDosToFilename ( char *  filename,
char *  dirfname 
)

◆ FatGetClusterFor()

size_t FatGetClusterFor ( AuVFSNode fs,
AuVFSNode file,
uint64_t  offset 
)

◆ FatInitialise()

AuVFSNode * FatInitialise ( AuVDisk vdisk,
char *  mountname 
)

◆ FatLocateDir()

AuVFSNode * FatLocateDir ( AuVFSNode fsys,
const char *  dir 
)

◆ FatLocateSubDir()

AuVFSNode * FatLocateSubDir ( AuVFSNode fsys,
AuVFSNode kfile,
const char *  filename 
)

◆ FatOpen()

AuVFSNode * FatOpen ( AuVFSNode fsys,
char *  filename 
)

any '\'s in path ?

nope, must be in root directory, search it

found file ?

unable to find

go to next character after first '\'

get pathname

if another '\' or end of line is reached, we are done

copy character

open subdirectory or file

search root dir – open pathname

search a sub directory instead for pathname

found directory or file?

find next '\'

found file?

unable to find

◆ FatRead()

size_t FatRead ( AuVFSNode fsys,
AuVFSNode file,
uint64_t buf 
)

FatRead – read just 4kb portion of a file

Parameters
file– file structure pointer
buf– pointer to buffer to store the content

◆ FatReadFAT()

uint32_t FatReadFAT ( AuVFSNode node,
uint64_t  cluster_index 
)

◆ FatReadFile()

size_t FatReadFile ( AuVFSNode fsys,
AuVFSNode file,
uint64_t buffer,
uint32_t  length 
)

◆ FatToDOSFilename()

void FatToDOSFilename ( const char *  filename,
char *  fname,
unsigned int  fname_length 
)

FatToDOSFilename – converts a given filename to MSDOS file name format

Parameters
filename– filename for conversion
fname– pointer to the buffer to store the conversion
fname_length– manly 11 buffer[0-8] – filename, buffer[9-11] – file extension

Variable Documentation

◆ _vfs_debug_on

bool _vfs_debug_on
extern

BSD 2-Clause License

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

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.