XenevaOS
Loading...
Searching...
No Matches
Functions
fileserv.cpp File Reference
#include <Fs\vfs.h>
#include <Fs\Fat\Fat.h>
#include <Mm\pmmngr.h>
#include <Mm\vmmngr.h>
#include <Mm\kmalloc.h>
#include <process.h>
#include <Hal\x86_64_sched.h>
#include <Hal\serial.h>
#include <aucon.h>
#include <_null.h>
#include <Hal\x86_64_hal.h>
#include <Fs\pipe.h>
Include dependency graph for fileserv.cpp:

Functions

int OpenFile (char *filename, int mode)
 OpenFile – opens a file for user process.
 
int FileSetOffset (int fd, size_t offset)
 FileSetOffset – set a offset inorder to read the specific position of the file.
 
size_t ReadFile (int fd, void *buffer, size_t length)
 ReadFile – reads a file into given buffer.
 
size_t WriteFile (int fd, void *buffer, size_t length)
 WriteFile – write system call.
 
int CreateDir (char *filename)
 CreateDir – creates a directory.
 
int RemoveFile (char *pathname)
 RemoveFile – remove a directory or file.
 
int CloseFile (int fd)
 CloseFile – closes a general file.
 
int FileIoControl (int fd, int code, void *arg)
 FileIoControl – controls the file through I/O code.
 
int FileStat (int fd, void *buf)
 FileStat – writes information related to file.
 
int OpenDir (char *filename)
 OpenDir – opens a directory.
 
int ReadDir (int dirfd, void *dirent)
 ReadDir – reads a directory entry.
 
int ProcessGetFileDesc (const char *filename)
 ProcessGetFileDesc – Searches all process file descriptor entries for specific filename fd.
 

Function Documentation

◆ CloseFile()

int CloseFile ( int  fd)

CloseFile – closes a general file.

Parameters
fd– file descriptor to close

◆ CreateDir()

int CreateDir ( char *  filename)

CreateDir – creates a directory.

Parameters
filename– name of the directory

◆ FileIoControl()

int FileIoControl ( int  fd,
int  code,
void *  arg 
)

FileIoControl – controls the file through I/O code.

Parameters
fd– file descriptor
code– code to pass
arg– argument to pass

◆ FileSetOffset()

int FileSetOffset ( int  fd,
size_t  offset 
)

FileSetOffset – set a offset inorder to read the specific position of the file.

Parameters
fd– File descriptor
offset– offset in bytes

◆ FileStat()

int FileStat ( int  fd,
void *  buf 
)

FileStat – writes information related to file.

Parameters
fd– file descriptor
buf– Pointer to file structure

◆ OpenDir()

int OpenDir ( char *  filename)

OpenDir – opens a directory.

Parameters
filename– name of the directory

◆ OpenFile()

int OpenFile ( char *  filename,
int  mode 
)

OpenFile – opens a file for user process.

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.

◆ ProcessGetFileDesc()

int ProcessGetFileDesc ( const char *  filename)

ProcessGetFileDesc – Searches all process file descriptor entries for specific filename fd.

◆ ReadDir()

int ReadDir ( int  dirfd,
void *  dirent 
)

ReadDir – reads a directory entry.

Parameters
dirfd– directory file descriptor
dirent– aurora directory entry struct

◆ ReadFile()

size_t ReadFile ( int  fd,
void *  buffer,
size_t  length 
)

ReadFile – reads a file into given buffer.

Parameters
fd– file descriptor
buffer– buffer where to put the data
length– length in bytes

◆ RemoveFile()

int RemoveFile ( char *  pathname)

RemoveFile – remove a directory or file.

Parameters
dirname– directory name

◆ WriteFile()

size_t WriteFile ( int  fd,
void *  buffer,
size_t  length 
)

WriteFile – write system call.

Parameters
fd– file descriptor
buffer– buffer to write
length– length in bytes