UbixOS  2.0
fat_filelib.c File Reference
#include <string.h>
#include "fat_defs.h"
#include "fat_access.h"
#include "fat_table.h"
#include "fat_write.h"
#include "fat_misc.h"
#include "fat_string.h"
#include "fat_filelib.h"
#include "fat_cache.h"
Include dependency graph for fat_filelib.c:

Go to the source code of this file.

Macros

#define CHECK_FL_INIT()   { if (_filelib_init==0) fl_init(); }
 
#define FL_LOCK(a)   do { if ((a)->fl_lock) (a)->fl_lock(); } while (0)
 
#define FL_UNLOCK(a)   do { if ((a)->fl_unlock) (a)->fl_unlock(); } while (0)
 

Functions

void fl_attach_locks (void(*lock)(void), void(*unlock)(void))
 
int fl_attach_media (fn_diskio_read rd, fn_diskio_write wr)
 
int fl_closedir (FL_DIR *dir)
 
int fl_createdirectory (const char *path)
 
void fl_fclose (void *f)
 
int fl_feof (void *f)
 
int fl_fflush (void *f)
 
int fl_fgetc (void *f)
 
int fl_fgetpos (void *f, uint32 *position)
 
char * fl_fgets (char *s, int n, void *f)
 
void * fl_fopen (const char *path, const char *mode)
 
int fl_format (uint32 volume_sectors, const char *name)
 
int fl_fputc (int c, void *f)
 
int fl_fputs (const char *str, void *f)
 
int fl_fread (void *buffer, int size, int length, void *f)
 
int fl_fseek (void *f, long offset, int origin)
 
long fl_ftell (void *f)
 
int fl_fwrite (const void *data, int size, int count, void *f)
 
void fl_init (void)
 
int fl_is_dir (const char *path)
 
void fl_listdirectory (const char *path)
 
FL_DIRfl_opendir (const char *path, FL_DIR *dir)
 
int fl_readdir (FL_DIR *dirls, fl_dirent *entry)
 
int fl_remove (const char *filename)
 
void fl_shutdown (void)
 

Macro Definition Documentation

◆ CHECK_FL_INIT

#define CHECK_FL_INIT ( )    { if (_filelib_init==0) fl_init(); }

Definition at line 58 of file fat_filelib.c.

◆ FL_LOCK

#define FL_LOCK (   a)    do { if ((a)->fl_lock) (a)->fl_lock(); } while (0)

Definition at line 60 of file fat_filelib.c.

◆ FL_UNLOCK

#define FL_UNLOCK (   a)    do { if ((a)->fl_unlock) (a)->fl_unlock(); } while (0)

Definition at line 61 of file fat_filelib.c.

Function Documentation

◆ fl_attach_locks()

void fl_attach_locks ( void(*)(void)  lock,
void(*)(void)  unlock 
)

Definition at line 599 of file fat_filelib.c.

◆ fl_attach_media()

int fl_attach_media ( fn_diskio_read  rd,
fn_diskio_write  wr 
)

Definition at line 606 of file fat_filelib.c.

References CHECK_FL_INIT.

Referenced by fat_initialize(), and main().

◆ fl_closedir()

int fl_closedir ( FL_DIR dir)

Definition at line 1451 of file fat_filelib.c.

Referenced by fl_is_dir().

◆ fl_createdirectory()

int fl_createdirectory ( const char *  path)

Definition at line 1345 of file fat_filelib.c.

References CHECK_FL_INIT, and FL_LOCK.

◆ fl_fclose()

void fl_fclose ( void *  f)

Definition at line 856 of file fat_filelib.c.

References CHECK_FL_INIT, and FL_LOCK.

Referenced by fat_initialize(), and main().

◆ fl_feof()

int fl_feof ( void *  f)

Definition at line 1125 of file fat_filelib.c.

References FL_LOCK.

◆ fl_fflush()

int fl_fflush ( void *  f)

Definition at line 831 of file fat_filelib.c.

References CHECK_FL_INIT, and FL_LOCK.

◆ fl_fgetc()

int fl_fgetc ( void *  f)

Definition at line 895 of file fat_filelib.c.

References fl_fread().

Referenced by fl_fgets().

Here is the call graph for this function:

◆ fl_fgetpos()

int fl_fgetpos ( void *  f,
uint32 position 
)

Definition at line 1097 of file fat_filelib.c.

References FL_LOCK.

Referenced by fl_ftell().

◆ fl_fgets()

char* fl_fgets ( char *  s,
int  n,
void *  f 
)

Definition at line 908 of file fat_filelib.c.

References fl_fgetc().

Here is the call graph for this function:

◆ fl_fopen()

void* fl_fopen ( const char *  path,
const char *  mode 
)

Definition at line 638 of file fat_filelib.c.

References CHECK_FL_INIT, and file.

Referenced by fat_initialize(), main(), and open_fat().

◆ fl_format()

int fl_format ( uint32  volume_sectors,
const char *  name 
)

Definition at line 1476 of file fat_filelib.c.

References fatfs_format().

Here is the call graph for this function:

◆ fl_fputc()

int fl_fputc ( int  c,
void *  f 
)

Definition at line 1147 of file fat_filelib.c.

References fl_fwrite().

Here is the call graph for this function:

◆ fl_fputs()

int fl_fputs ( const char *  str,
void *  f 
)

Definition at line 1300 of file fat_filelib.c.

References fl_fwrite(), and strlen().

Here is the call graph for this function:

◆ fl_fread()

int fl_fread ( void *  buffer,
int  size,
int  length,
void *  f 
)

Definition at line 938 of file fat_filelib.c.

References buffer, CHECK_FL_INIT, FAT_SECTOR_SIZE, FILE_READ, and NULL.

Referenced by fl_fgetc(), and read_fat().

◆ fl_fseek()

int fl_fseek ( void *  f,
long  offset,
int  origin 
)

Definition at line 1034 of file fat_filelib.c.

References CHECK_FL_INIT, FL_LOCK, and SEEK_END.

Referenced by read_fat().

◆ fl_ftell()

long fl_ftell ( void *  f)

Definition at line 1115 of file fat_filelib.c.

References fl_fgetpos().

Here is the call graph for this function:

◆ fl_fwrite()

int fl_fwrite ( const void *  data,
int  size,
int  count,
void *  f 
)

Definition at line 1162 of file fat_filelib.c.

References buffer, CHECK_FL_INIT, and FL_LOCK.

Referenced by fat_initialize(), fl_fputc(), fl_fputs(), main(), and write_fat().

◆ fl_init()

void fl_init ( void  )

Definition at line 584 of file fat_filelib.c.

Referenced by fat_init(), and main().

◆ fl_is_dir()

int fl_is_dir ( const char *  path)

Definition at line 1460 of file fat_filelib.c.

References fl_closedir(), and fl_opendir().

Here is the call graph for this function:

◆ fl_listdirectory()

void fl_listdirectory ( const char *  path)

Definition at line 1362 of file fat_filelib.c.

References CHECK_FL_INIT, and FL_LOCK.

Referenced by main().

◆ fl_opendir()

FL_DIR* fl_opendir ( const char *  path,
FL_DIR dir 
)

Definition at line 1401 of file fat_filelib.c.

References CHECK_FL_INIT, fs_dir_ent::cluster, FAT32_INVALID_CLUSTER, and FL_LOCK.

Referenced by fl_is_dir().

◆ fl_readdir()

int fl_readdir ( FL_DIR dirls,
fl_dirent entry 
)

Definition at line 1432 of file fat_filelib.c.

References CHECK_FL_INIT, and FL_LOCK.

◆ fl_remove()

int fl_remove ( const char *  filename)

Definition at line 1314 of file fat_filelib.c.

References file, and FL_LOCK.

Referenced by main(), and sys_unlink().

◆ fl_shutdown()

void fl_shutdown ( void  )

Definition at line 627 of file fat_filelib.c.

References CHECK_FL_INIT, and FL_LOCK.

Referenced by main(), and sys_shutdown().