XenevaOS
Loading...
Searching...
No Matches
Functions | Variables
vfs.c File Reference
#include <Fs/vfs.h>
#include <Fs/Dev/devfs.h>
#include <_null.h>
#include <Mm/kmalloc.h>
#include <Drivers/uart.h>
#include <Fs/vdisk.h>
#include <string.h>
#include <Ipc/postbox.h>
#include <Fs/pipe.h>
#include <Board/RPI3bp/rpi3bp.h>
#include <Hal/AA64/aa64lowlevel.h>
Include dependency graph for vfs.c:

Functions

void AuVFSInitialise ()
 AuVFSInitialise – initialise the virtual file system.
 
AuVFSNodeAuVFSFind (char *path)
 AuVFSFind – Searches a filesystem an return it to the caller.
 
AU_EXTERN AU_EXPORT void AuVFSAddFileSystem (AuVFSNode *node)
 AuVFSAddFileSystem – adds a file system to the vfs list.
 
void AuVFSRegisterRoot (AuVFSNode *fs)
 AuVFSRegisterRoot – register the root file system.
 
uint64_t read_sp ()
 
AU_EXTERN AU_EXPORT AuVFSNodeAuVFSOpen (char *path)
 AuVFSOpen – Opens a file.
 
AU_EXTERN AU_EXPORT int AuVFSNodeIOControl (AuVFSNode *node, int code, void *arg)
 AuVFSNodeIOControl – Calls node's iocontrol pointer.
 
AU_EXTERN AU_EXPORT size_t AuVFSNodeRead (AuVFSNode *node, AuVFSNode *file, uint64_t *buffer, uint32_t length)
 AuVFSNodeRead – read from file system.
 
AU_EXTERN AU_EXPORT void AuVFSNodeWrite (AuVFSNode *node, AuVFSNode *file, uint64_t *buffer, uint32_t length)
 AuVFSNodeWrite – write to file system.
 
AU_EXTERN AU_EXPORT size_t AuVFSNodeReadBlock (AuVFSNode *node, AuVFSNode *file, uint64_t *buffer)
 AuVFSNodeReadBlock – read a block size data from file system.
 
AU_EXTERN AU_EXPORT AuVFSNodeAuVFSCreateDir (AuVFSNode *fsys, char *dirname)
 AuVFSCreateDir – creates a new dir.
 
AU_EXTERN AU_EXPORT AuVFSNodeAuVFSCreateFile (AuVFSNode *fsys, char *filename)
 AuVFSCreateFile – create a new file.
 
int AuVFSRemoveFile (AuVFSNode *fsys, AuVFSNode *file)
 AuVFSRemoveFile –remove a file from a file system.
 
int AuVFSRemoveDir (AuVFSNode *fsys, AuVFSNode *file)
 AuVFSRemoveDir – removes an empty directory.
 
AU_EXTERN AU_EXPORT void AuVFSNodeClose (AuVFSNode *node, AuVFSNode *file)
 AuVFSNodeClose – close a file system or file.
 
AU_EXTERN AU_EXPORT int AuVFSRemoveFileSystem (AuVFSNode *node)
 AuVFSRemoveFileSystem – removes a file system.
 
AU_EXTERN AU_EXPORT size_t AuVFSGetBlockFor (AuVFSNode *node, AuVFSNode *file, uint64_t offset)
 AuVFSGetBlockFor – returns a block number for certain byte offset of file.
 

Variables

AuVFSContainer__RootContainer
 
AuVFSNode__RootFS
 

Detailed Description

BSD 2-Clause License

Copyright (c) 2022-2023, 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.

Function Documentation

◆ AuVFSAddFileSystem()

AU_EXTERN AU_EXPORT void AuVFSAddFileSystem ( AuVFSNode node)

AuVFSAddFileSystem – adds a file system to the vfs list.

Parameters
node– file system node to add

◆ AuVFSCreateDir()

AU_EXTERN AU_EXPORT AuVFSNode * AuVFSCreateDir ( AuVFSNode fsys,
char *  dirname 
)

AuVFSCreateDir – creates a new dir.

Parameters
fsys– Pointer to file system
dirname– directory name
Returns
pointer to newly created directory node

◆ AuVFSCreateFile()

AU_EXTERN AU_EXPORT AuVFSNode * AuVFSCreateFile ( AuVFSNode fsys,
char *  filename 
)

AuVFSCreateFile – create a new file.

Parameters
fsys– Pointer to file system
filename– filename
Returns
pointer to newly created file node

◆ AuVFSFind()

AuVFSNode * AuVFSFind ( char *  path)

AuVFSFind – Searches a filesystem an return it to the caller.

Parameters
path– path of the file system
Returns
pointer to file system extracted from path

◆ AuVFSGetBlockFor()

AU_EXTERN AU_EXPORT size_t AuVFSGetBlockFor ( AuVFSNode node,
AuVFSNode file,
uint64_t  offset 
)

AuVFSGetBlockFor – returns a block number for certain byte offset of file.

Parameters
node– file system node
file– pointer to file structure
offset– byte offset
Returns
block number of that offset

◆ AuVFSInitialise()

void AuVFSInitialise ( )

AuVFSInitialise – initialise the virtual file system.

◆ AuVFSNodeClose()

AU_EXTERN AU_EXPORT void AuVFSNodeClose ( AuVFSNode node,
AuVFSNode file 
)

AuVFSNodeClose – close a file system or file.

Parameters
node– file system node to use
file– file to close

◆ AuVFSNodeIOControl()

AU_EXTERN AU_EXPORT int AuVFSNodeIOControl ( AuVFSNode node,
int  code,
void *  arg 
)

AuVFSNodeIOControl – Calls node's iocontrol pointer.

Parameters
node– pointer to fsnode
code– code to pass
arg– extra arguments
Returns
return value returned by specific iocontrol handler to the caller

◆ AuVFSNodeRead()

AU_EXTERN AU_EXPORT size_t AuVFSNodeRead ( AuVFSNode node,
AuVFSNode file,
uint64_t buffer,
uint32_t  length 
)

AuVFSNodeRead – read from file system.

Parameters
node– file system node to use
file– file information to use
buffer– buffer to write to
length– length of the file
Returns
amount of data being read in bytes

◆ AuVFSNodeReadBlock()

AU_EXTERN AU_EXPORT size_t AuVFSNodeReadBlock ( AuVFSNode node,
AuVFSNode file,
uint64_t buffer 
)

AuVFSNodeReadBlock – read a block size data from file system.

Parameters
node– file system node to use
file– file node to use
buffer– buffer area to read to
Returns
always <= 4kib

◆ AuVFSNodeWrite()

AU_EXTERN AU_EXPORT void AuVFSNodeWrite ( AuVFSNode node,
AuVFSNode file,
uint64_t buffer,
uint32_t  length 
)

AuVFSNodeWrite – write to file system.

Parameters
node– file system node to use
file– file node to use
buffer– buffer to write
length– length of the data

◆ AuVFSOpen()

AU_EXTERN AU_EXPORT AuVFSNode * AuVFSOpen ( char *  path)

AuVFSOpen – Opens a file.

Parameters
path– path to open
Returns
pointer to file node, on success

◆ AuVFSRegisterRoot()

void AuVFSRegisterRoot ( AuVFSNode fs)

AuVFSRegisterRoot – register the root file system.

Parameters
fs– fsnode to add

◆ AuVFSRemoveDir()

int AuVFSRemoveDir ( AuVFSNode fsys,
AuVFSNode file 
)

AuVFSRemoveDir – removes an empty directory.

AuVFSRemoveFile –remove a file from a file system.

Parameters
fsys– Pointer to file system
file– Pointer to directory needs to be deleted
Returns
0 on success, -1 on failure

◆ AuVFSRemoveFile()

int AuVFSRemoveFile ( AuVFSNode fsys,
AuVFSNode file 
)

AuVFSRemoveFile –remove a file from a file system.

Parameters
fsys– Pointer to file system
file– Pointer to file to remove
Returns
0 on success, -1 on failure

◆ AuVFSRemoveFileSystem()

AU_EXTERN AU_EXPORT int AuVFSRemoveFileSystem ( AuVFSNode node)

AuVFSRemoveFileSystem – removes a file system.

Parameters
node– file system node to remove

◆ read_sp()

uint64_t read_sp ( )
extern

Variable Documentation

◆ __RootContainer

AuVFSContainer* __RootContainer

◆ __RootFS

AuVFSNode* __RootFS