Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages   Examples  

Flashfsadds


Data Structures

struct  _FATINMEMORY
struct  _FILE
struct  _FILENODE
struct  _FILENODEINFS
struct  _FLASHFS

Defines

#define TYPE_DIRECTORY   1
#define TYPE_FILE   2
#define TYPE_NULL   0
#define MAX_FILE_NAME   50
#define NUMBER_OF_FILES   50
#define EOF   0

Typedefs

typedef _FILE FILE

Functions

int InitFlashFs (void)
FILEfileOpen (char *name, char type)
int fileWrite (FILE *file, void *data, u_int size)
int fileClose (FILE *file)
int fileRead (FILE *file, void *data, u_int size)
u_long fileSize (FILE *file)
int fileSeek (FILE *file, u_long pos)
int remove (char *name)
char * ls (char *dir, char *ret, char *param)
int format (void)

Detailed Description

This module provides flash filesystem. Read and write files from/to flash and display filesystem information. \TODO
Note:

Define Documentation

#define EOF   0
 

End of file mark.

#define FIRST_FILE_PAGE
 

Value:

(ROOT_PAGE \
        + ((sizeof(FILENODEINFS)*NUMBER_OF_FILES+sizeof(FLASHFS))/PAGE_SIZE + 1) \
        + MAX_PAGE_NUMBER/(PAGE_SIZE*8) + 1 \
        + 1)

#define MAX_FILE_NAME   50
 

Number of character in filename.

#define NUMBER_OF_FILES   50
 

Max number of stored files in filessystem.

#define TYPE_DIRECTORY   1
 

Filesystem file type.

#define TYPE_FILE   2
 

Filesystem file type.

#define TYPE_NULL   0
 

Filesystem file type.


Typedef Documentation

typedef struct _FILE FILE
 

File descriptor used by read and write function. Created when file is open.


Function Documentation

int fileClose FILE   file
 

Closes opened file. When file was opened for write this method finish write operations and update information in flash.

Parameters:
file  - file descriptor.

FILE* fileOpen char *    name,
char    type
 

Opens file. File must be open before read/write operations. When file dosn't exist this method create it.

Parameters:
name  - file name.
type  - operation type (read - r or write - w).
Returns:
file descriptor on succes NULL on fail.

int fileRead FILE   file,
void *    data,
u_int    size
 

Reads data from file.

Parameters:
file  - file descriptor obteined by fileOpen.
data  - pointer to buffer where data will be stored.
size  - size of data to read.
Returns:
number of written bytes on success -1 on fail.

int fileSeek FILE   file,
u_long    pos
 

Moves file read or write pointer to specified position.

Parameters:
file  - file descriptor.
pos  - pointer position.
Returns:
0 on succes - 1 on fail.

u_long fileSize FILE   file
 

Reads file size.

Parameters:
file  - file descriptor.
Returns:
file size in bytes.

int fileWrite FILE   file,
void *    data,
u_int    size
 

Writes data to file.

Parameters:
file  - file descriptor obteined from fileOpen.
data  - pointer to buffer with data.
size  - size of data to write.
Returns:
number of written bytes on success -1 on fail.

int format void   
 

Formats filesystem. This method clear all files and all pages in flashfs.

Returns:
0 on succes -1 on fail.

int InitFlashFs void   
 

Inits flash filesystem. Caled it first.

Returns:
-1 on fail, 0 on success.

char* ls char *    dir,
char *    ret,
char *    param
 

Print content of filesystem in specified directory.

Parameters:
dir  - pointer to buffer containing directory path.
ret  - pointer to buffer where output will be stored.
param  - formating type (not implemented).
Returns:
pointer to buffor where output will be stored.

int remove char *    name
 

Removes file from filesystem.

Parameters:
name  - file name.
Returns:
0 on succes -1 on fail.


Generated on Thu Jan 30 22:30:57 2003 for EduNet by doxygen1.2.18