UbixOS  2.0
fat_filelib.h File Reference
#include "fat_opts.h"
#include "fat_access.h"
#include "fat_list.h"
Include dependency graph for fat_filelib.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  cluster_lookup
 
struct  sFL_FILE
 

Macros

#define EOF   (-1)
 
#define FILE_APPEND   (1 << 2)
 
#define FILE_BINARY   (1 << 3)
 
#define FILE_CREATE   (1 << 5)
 
#define FILE_ERASE   (1 << 4)
 
#define FILE_READ   (1 << 0)
 
#define FILE_WRITE   (1 << 1)
 
#define SEEK_CUR   1
 
#define SEEK_END   2
 
#define SEEK_SET   0
 

Typedefs

typedef struct fs_dir_list_status FL_DIR
 
typedef struct fs_dir_ent fl_dirent
 
typedef struct sFL_FILE FL_FILE
 

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 *file)
 
int fl_feof (void *f)
 
int fl_fflush (void *file)
 
int fl_fgetc (void *file)
 
int fl_fgetpos (void *file, uint32 *position)
 
char * fl_fgets (char *s, int n, void *f)
 
void * fl_fopen (const char *path, const char *modifiers)
 
int fl_format (uint32 volume_sectors, const char *name)
 
int fl_fputc (int c, void *file)
 
int fl_fputs (const char *str, void *file)
 
int fl_fread (void *data, int size, int count, void *file)
 
int fl_fseek (void *file, long offset, int origin)
 
long fl_ftell (void *f)
 
int fl_fwrite (const void *data, int size, int count, void *file)
 
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

◆ EOF

#define EOF   (-1)

Definition at line 24 of file fat_filelib.h.

◆ FILE_APPEND

#define FILE_APPEND   (1 << 2)

Definition at line 66 of file fat_filelib.h.

◆ FILE_BINARY

#define FILE_BINARY   (1 << 3)

Definition at line 67 of file fat_filelib.h.

◆ FILE_CREATE

#define FILE_CREATE   (1 << 5)

Definition at line 69 of file fat_filelib.h.

◆ FILE_ERASE

#define FILE_ERASE   (1 << 4)

Definition at line 68 of file fat_filelib.h.

◆ FILE_READ

#define FILE_READ   (1 << 0)

Definition at line 64 of file fat_filelib.h.

◆ FILE_WRITE

#define FILE_WRITE   (1 << 1)

Definition at line 65 of file fat_filelib.h.

◆ SEEK_CUR

#define SEEK_CUR   1

Definition at line 12 of file fat_filelib.h.

◆ SEEK_END

#define SEEK_END   2

Definition at line 16 of file fat_filelib.h.

◆ SEEK_SET

#define SEEK_SET   0

Definition at line 20 of file fat_filelib.h.

Typedef Documentation

◆ FL_DIR

typedef struct fs_dir_list_status FL_DIR

Definition at line 101 of file fat_filelib.h.

◆ fl_dirent

typedef struct fs_dir_ent fl_dirent

Definition at line 102 of file fat_filelib.h.

◆ FL_FILE

typedef struct sFL_FILE FL_FILE

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 *  file)

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 *  file)

Definition at line 831 of file fat_filelib.c.

References CHECK_FL_INIT, and FL_LOCK.

◆ fl_fgetc()

int fl_fgetc ( void *  file)

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 *  file,
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 *  modifiers 
)

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 *  file 
)

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 *  file 
)

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 *  data,
int  size,
int  count,
void *  file 
)

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 *  file,
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 *  file 
)

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().