Main Page   Data Structures   File List   Data Fields   Globals   Related Pages  

fs.c File Reference

File system. More...

#include <config.h>
#include <sw.h>
#include <fs.h>
#include <hal.h>
#include <log.h>
#include <string.h>
#include <transaction.h>
#include <types.h>

Functions

bool fs_init (void)
 Initialize file system variables. More...

bool fs_seek (iu16 fid, S_FSTREAM *fs, S_FINFO *fi, iu8 type)
 Look for a file in a stream. More...

bool fs_seekEnd (S_FSTREAM *fs)
 Look for the end of files in the stream. More...

bool fs_getData (S_FPATH *fp, S_FSTREAM *fs, S_FINFO *fi)
 Get stream and info for a file specified as a path. More...

bool fs_getFPath (iu16 fid, S_FPATH *fp, S_FSTREAM *fs, S_FINFO *fi)
 Get path, stream and info for a file specified as a FID. More...

bool fs_delete (iu16 fid)
 Delete file specified as fid. More...

bool fs_create (S_FINFO *fi)
 The function creates a file. More...


Variables

iu16 fsstart
 Start address of the MF file header. More...

iu16 fssize
 Size of the content area of the MF. More...

S_FPATH selected
 Path specified of the currently selected file. More...


Detailed Description

File system.

Id:
fs.c,v 1.23 2002/12/22 15:42:55 m Exp


Function Documentation

bool fs_create S_FINFO   fi
 

The function creates a file.

The functions creates a file with the data in fi. The current file must be a MF or DF. In case the current file is a DF, the file, which should be created, can't be a DF.

Parameters:
fi  Pointer to S_FINFO, which contains the data of the file to create.
Return values:
TRUE  on success.
FALSE  on failure. Error code given in sw.

bool fs_delete iu16    fid
 

Delete file specified as fid.

The function looks for the fid in the current file, which must be a MF or DF. The file, which should be deleted must be the last one in the current MF or DF.

Parameters:
fid  ID of the file to delete.
Return values:
TRUE  on success.
FALSE  on failure. Error code given in sw.

bool fs_getData S_FPATH   fp,
S_FSTREAM   fs,
S_FINFO   fi
 

Get stream and info for a file specified as a path.

Parameters:
fp  Pointer to S_FPATH, which is used to supply the information about the file wanted.
fs  Pointer to S_FSTREAM, which will be filled with data on success.
fi  Pointer to S_FINFO, which will be filled with data on success.
Return values:
TRUE  on success.
FALSE  on failure. Error code given in sw.

bool fs_getFPath iu16    fid,
S_FPATH   fp,
S_FSTREAM   fs,
S_FINFO   fi
 

Get path, stream and info for a file specified as a FID.

The file is searched for in the order described in the SELECT FILE documentation on the main page.

Parameters:
fid  File ID to look for.
fp  Pointer to S_FPATH, which will be filled with data on success.
fs  Pointer to S_FSTREAM, which will be filled with data on success. This can be NULL when no data is wanted.
fi  Pointer to S_FINFO, which will be filled with data on success. This can be NULL when no data is wanted.
Return values:
TRUE  on success.
FALSE  on failure. Error code given in sw.

bool fs_init void   
 

Initialize file system variables.

This looks e.g. for the start of the file system and it's size. It must be called after each reset.

Return values:
TRUE  on success.
FALSE  on failure. Error code given in sw.

bool fs_seek iu16    fid,
S_FSTREAM   fs,
S_FINFO   fi,
iu8    type
 

Look for a file in a stream.

Parameters:
fid  File ID to look for.
fs  Pointer to S_FSTREAM, where the FID is searched for. It returns on success a stream on the file found.
fi  Pointer to S_FINFO, which will be filled with data on success.
type  Type of file wanted.
Return values:
TRUE  on success.
FALSE  on failure. Error code given in sw.
Todo:
There is probably a potential for simplification, when the file type is not handled so rigid.

bool fs_seekEnd S_FSTREAM   fs
 

Look for the end of files in the stream.

Parameters:
fs  Pointer to S_FSTREAM, which supplies a directory stream and which will be used to return the end position on success.
Return values:
TRUE  on success.
FALSE  on failure. Error code given in sw.


Variable Documentation

iu16 fssize
 

Size of the content area of the MF.

iu16 fsstart
 

Start address of the MF file header.

S_FPATH selected
 

Path specified of the currently selected file.

Todo:
Saving here a S_FINFO and/or S_FSTREAM of the selected file might reduce the code size.


Copyright 2002 by Matthias Bruestle. This is licensed under the GNU General Public License.