kernel
Loading...
Searching...
No Matches
fat32.c File Reference
#include "fat32.h"
#include "../../drivers/blk/block.h"
#include "../../assert.h"
#include "../../time.h"
#include "../../intrinsics/atomic.h"
#include "../../includes/mg.h"
#include "../../includes/mm.h"
#include "../../includes/fs.h"
#include "../../includes/ob.h"

Go to the source code of this file.

Data Structures

struct  LFN_ENTRY_BUFFER

Macros

#define WRITE_MODE_APPEND_EXISTING   0
#define WRITE_MODE_CREATE_OR_REPLACE   1
#define le32toh(x)
#define MAX_LFN_ENTRIES   20
#define MAX_LFN_LEN   260
#define FAT32_READ_ERROR   0xFFFFFFFFu
#define BPB_SECTOR_START   2048

Functions

MTSTATUS fat32_init (int disk_index)
void fat32_list_root (void)
MTSTATUS fat32_read_file (IN PFILE_OBJECT FileObject, IN uint64_t FileOffset, OUT void *Buffer, IN size_t BufferSize, _Out_Opt size_t *BytesRead)
MTSTATUS fat32_create_directory (const char *path)
 Creates a new directory (/testdir/ or /testdir are both allowed to create 'testdir' inside of 'root')
MTSTATUS fat32_write_file (IN PFILE_OBJECT FileObject, IN uint64_t FileOffset, IN void *Buffer, IN size_t BufferSize, _Out_Opt size_t *BytesWritten)
MTSTATUS fat32_create_file (IN const char *path, OUT PFILE_OBJECT *FileObjectOut)
MTSTATUS fat32_list_directory (const char *path, char *listings, size_t max_len)
 Lists the directory given.
bool fat32_directory_is_empty (const char *path)
 This function returns if the directory given to the function is empty (e.g, has only '.' and '..' entries / deleted / nonexistent)
MTSTATUS fat32_delete_directory (const char *path)
 This function deletes the directory given to the function from the system.
MTSTATUS fat32_delete_file (const char *path)
 This function deletes the file given to the function from the system.
void fat32_deletion_routine (void *Object)

Variables

GOP_PARAMS gop_local
void * fat_cache_buf2 = NULL
volatile int32_t fat32_called_from_scanner = 0

Macro Definition Documentation

◆ BPB_SECTOR_START

#define BPB_SECTOR_START   2048

Definition at line 850 of file fat32.c.

◆ FAT32_READ_ERROR

#define FAT32_READ_ERROR   0xFFFFFFFFu

Definition at line 43 of file fat32.c.

◆ le32toh

#define le32toh ( x)
Value:
(x)

Definition at line 23 of file fat32.c.

◆ MAX_LFN_ENTRIES

#define MAX_LFN_ENTRIES   20

Definition at line 37 of file fat32.c.

◆ MAX_LFN_LEN

#define MAX_LFN_LEN   260

Definition at line 38 of file fat32.c.

◆ WRITE_MODE_APPEND_EXISTING

#define WRITE_MODE_APPEND_EXISTING   0

Definition at line 17 of file fat32.c.

◆ WRITE_MODE_CREATE_OR_REPLACE

#define WRITE_MODE_CREATE_OR_REPLACE   1

Definition at line 18 of file fat32.c.

Function Documentation

◆ fat32_create_directory()

MTSTATUS fat32_create_directory ( const char * path)

Creates a new directory (/testdir/ or /testdir are both allowed to create 'testdir' inside of 'root')

Parameters
pathThe full path to the new directory
Returns
MTSTATUS Status code.

Definition at line 1136 of file fat32.c.

◆ fat32_create_file()

MTSTATUS fat32_create_file ( IN const char * path,
OUT PFILE_OBJECT * FileObjectOut )

Definition at line 1525 of file fat32.c.

◆ fat32_delete_directory()

MTSTATUS fat32_delete_directory ( const char * path)

This function deletes the directory given to the function from the system.

Parameters
pathFull path to delete directory.
Returns
MTSTATUS Status code.

Definition at line 2037 of file fat32.c.

◆ fat32_delete_file()

MTSTATUS fat32_delete_file ( const char * path)

This function deletes the file given to the function from the system.

Parameters
pathFull path to delete file.
Returns
MTSTATUS Status code.

Definition at line 2069 of file fat32.c.

◆ fat32_deletion_routine()

void fat32_deletion_routine ( void * Object)

Definition at line 2146 of file fat32.c.

◆ fat32_directory_is_empty()

bool fat32_directory_is_empty ( const char * path)

This function returns if the directory given to the function is empty (e.g, has only '.' and '..' entries / deleted / nonexistent)

Parameters
pathFull path to dir
Returns
True or false based if empty or not.

Definition at line 1778 of file fat32.c.

◆ fat32_init()

MTSTATUS fat32_init ( int disk_index)

Definition at line 853 of file fat32.c.

◆ fat32_list_directory()

MTSTATUS fat32_list_directory ( const char * path,
char * listings,
size_t max_len )

Lists the directory given.

Parameters
pathPath to directory, e.g "mydir/"
listings[OUT] Pointer to directory listing. (each seperated with a newline character)
max_len[IN] Max size of listings buffer.
Returns
MTSTATUS Status code.

Definition at line 1694 of file fat32.c.

◆ fat32_list_root()

void fat32_list_root ( void )

Definition at line 877 of file fat32.c.

◆ fat32_read_file()

MTSTATUS fat32_read_file ( IN PFILE_OBJECT FileObject,
IN uint64_t FileOffset,
OUT void * Buffer,
IN size_t BufferSize,
_Out_Opt size_t * BytesRead )

Definition at line 1029 of file fat32.c.

◆ fat32_write_file()

MTSTATUS fat32_write_file ( IN PFILE_OBJECT FileObject,
IN uint64_t FileOffset,
IN void * Buffer,
IN size_t BufferSize,
_Out_Opt size_t * BytesWritten )

Definition at line 1364 of file fat32.c.

Variable Documentation

◆ fat32_called_from_scanner

volatile int32_t fat32_called_from_scanner = 0

Definition at line 40 of file fat32.c.

◆ fat_cache_buf2

void* fat_cache_buf2 = NULL

Definition at line 34 of file fat32.c.

◆ gop_local

GOP_PARAMS gop_local
extern

Definition at line 26 of file kernel.c.