Skip to content

Loviisa File System

Konstantin Khait edited this page Jul 22, 2026 · 1 revision

Initialize the file system

LVS_ERROR_T lvsFS_Init(LVS_BANK_T* bank);

Create new file in the given directory

LVSFS_FD lvsFS_CreateFile(LVSFS_FD* dir, char* name);

Read data from the file

int lvsFS_ReadFile(LVSFS_FD* fd, unsigned long offset, unsigned char* data, int size);

Write data to the file

int lvsFS_WriteFile(LVSFS_FD* fd, unsigned long offset, unsigned char* data, int size);

Get file size in bytes

int lvsFS_GetFileSize(LVSFS_FD* fd);

Format entire memory bank

LVS_ERROR_T lvsFS_Format(LVS_BANK_T* bank);

Open high level directory (get descriptor)

LVSFS_FD lvsFS_OpenGlobalDir(LVS_BANK_T* bank);

Set file attributes

void lvsFS_SetAttr(LVSFS_FD* fd, unsigned short attrs);

Get file attributes

unsigned short lvsFS_GetAttr(LVSFS_FD* fd);

Open file (find in the directory)

LVSFS_FD lvsFS_OpenFile(LVSFS_FD* dir, char* name);

Close file (actually do nothing) LVS_ERROR_T lvsFS_CloseFile(LVSFS_FD* fd);

Truncate file and potentially free memory

void lvsFS_TruncateFile(LVSFS_FD* fd, int size);

Remove file from the directory and memory

LVS_ERROR_T lvsFS_RemoveFile(LVSFS_FD* dir, char* name);

Change file name

LVS_ERROR_T lvsFS_RenameFile(LVSFS_FD* dir, char* old_name, char* new_name);

Get name by descriptor

char* lvsFS_GetFileName(LVSFS_FD* fd);

Create directory

LVSFS_FD lvsFS_MakeDirectory(LVSFS_FD* dir, char* name);

Get number of items in the directory

int lvsFS_GetNumberOfItems(LVSFS_FD* dir);

Get descriptor by the item number

LVSFS_FD lvsFS_GetItem(LVSFS_FD* dir, int index);

Clone this wiki locally