Main Page | Modules | Namespace List | Data Structures | Directories | File List | Namespace Members | Data Fields | Globals

File System Management


Data Structures

struct  T_FS_FUNCTIONS
struct  T_FS_INFO
struct  T_FS_PARTITION

File Open Modes

#define FS_O_BIT_RD   0x1
 file open mode READ
#define FS_O_BIT_WR   0x2
 file open mode WRITE
#define FS_O_BIT_APP   0x4
 file open mode APPEND
#define FS_O_BIT_CR   0x8
 file open mode CREATE
#define FS_O_BIT_TXT   0x10
 file open mode TEXT
#define FS_O_BIT_BIN   0x20
 file open mode BINARY

File Attributes

#define FS_A_DIR   0x1
 file attribute DIRECTORY
#define FS_A_RDONLY   0x2
 file attribute READ ONLY
#define FS_A_HIDDEN   0x4
 file attribute HIDDEN
#define FS_A_SYSTEM   0x8
 file attribute SYSTEM
#define FS_A_ARCHIVE   0x10
 file attribute ARCHIVE
#define FS_A_ALL   0xffff
 file attribute ALL ATTRIBUTES

File System Functions

typedef bool(* FS_FN_FORMAT )(void *hMsd)
typedef void *(* FS_FN_MOUNT )(void *hMsd)
typedef bool(* FS_FN_UNMOUNT )(void *partition)
typedef unsigned long(* FS_FN_PART_SIZE )(void *partition)
typedef unsigned long(* FS_FN_PART_FREE )(void *partition)
typedef int(* FS_FN_DELFILE )(void *partition, const char *filename)
typedef bool(* FS_FN_DIREXISTS )(void *partition, const char *dir)
typedef bool(* FS_FN_DIREMPTY )(void *partition, const char *dir)
typedef int(* FS_FN_RMDIR )(void *partition, const char *dir)
typedef int(* FS_FN_MKDIR )(void *partition, const char *dir)
typedef void *(* FS_FN_OPEN )(void *pPartition, const char *fname, unsigned short modebits)
typedef int(* FS_FN_CLOSE )(void *stream)
typedef int(* FS_FN_EOF )(void *stream)
typedef int(* FS_FN_READ )(void *buffer, size_t size, size_t num, void *stream)
typedef int(* FS_FN_WRITE )(const void *buffer, size_t size, size_t count, void *stream)
typedef int(* FS_FN_PUTC )(int ch, void *stream)
typedef int(* FS_FN_GETC )(void *stream)
typedef int(* FS_FN_SEEK )(void *stream, long offset, int origin)
typedef int(* FS_FN_FIND_FIRST )(void *partition, const char *pathname, T_FF_INFO *ffblk, int attrib)
typedef int(* FS_FN_FIND_NEXT )(void *partition, T_FF_INFO *ffblk)
typedef int(* FS_FN_FIND_CLOSE )(T_FF_INFO *ffblk)

Defines

#define MAX_PARTITION_NAME   10
#define MAX_PATH_NAME   260
#define MAX_FILESYSTEM_NAME   10

Functions

void fs_setup (void)
 have to be called to initialize the file systems manager environment.
void fs_cleanup ()
 have to be called to clean up and free resources of the file system management
void fs_printPartitions (void)
 displays all available partitions
bool fs_mountPartition (const char *pa_acPartitionName, const char *pa_acMsdName, const char *pa_acFileSystem)
 mounts a partitions on a mass storage device (MSD) with a specified filesystem
bool fs_unmountPartition (const char *pa_acPartitionName)
 unmounts a partition
bool fs_formatDevice (const char *pa_acDeviceName, const char *pa_acFilesystem)
 formats the specified device with the specified file system
void fs_register (const char *pa_acName, T_FS_FUNCTIONS *pa_pstFunctions)
 registers a specified filesystem to the file system management
T_FS_PARTITIONfs_getActivePartition (void)
 returns a pointer to the currently active partition struct (0 if none is active)
void fs_setActivePartition (T_FS_PARTITION *pa_pPartition)
 sets the supplied parition as currently active
T_FS_PARTITIONfs_getPartition (const char *pa_acName)
 returns a pointer to a specified partition struct (0 if the name is not valid)
unsigned long fs_partitionSize (T_FS_PARTITION *pa_pPartition)
 returns the overall size of the specified partition in bytes
unsigned long fs_partitionFree (T_FS_PARTITION *pa_pPartition)
 returns the amount of free bytes of the specified partition

Detailed Description

contains file system/partition management support

Define Documentation

#define FS_A_ALL   0xffff
 

file attribute ALL ATTRIBUTES

#define FS_A_ARCHIVE   0x10
 

file attribute ARCHIVE

#define FS_A_DIR   0x1
 

file attribute DIRECTORY

#define FS_A_HIDDEN   0x4
 

file attribute HIDDEN

#define FS_A_RDONLY   0x2
 

file attribute READ ONLY

#define FS_A_SYSTEM   0x8
 

file attribute SYSTEM

#define FS_O_BIT_APP   0x4
 

file open mode APPEND

#define FS_O_BIT_BIN   0x20
 

file open mode BINARY

#define FS_O_BIT_CR   0x8
 

file open mode CREATE

#define FS_O_BIT_RD   0x1
 

file open mode READ

#define FS_O_BIT_TXT   0x10
 

file open mode TEXT

#define FS_O_BIT_WR   0x2
 

file open mode WRITE

#define MAX_FILESYSTEM_NAME   10
 

#define MAX_PARTITION_NAME   10
 

#define MAX_PATH_NAME   260
 


Typedef Documentation

typedef int(* FS_FN_CLOSE)(void *stream)
 

Parameters:
stream file to close
Returns:
0 on success (file closed), otherwise < 0
closes a before opened file

See also:
FS_FN_OPEN

typedef int(* FS_FN_DELFILE)(void *partition, const char *filename)
 

Parameters:
partition pointer to the partition
filename name of the target file
Returns:
0 on success, otherwise < 0
physically deletes the file entry from the partition

typedef bool(* FS_FN_DIREMPTY)(void *partition, const char *dir)
 

Parameters:
partition pointer to the partition
dir name of the target directory
Returns:
true on success (directory is empty), otherwise false
tests whether a given directory is empty

typedef bool(* FS_FN_DIREXISTS)(void *partition, const char *dir)
 

Parameters:
partition pointer to the partition
dir name of the target directory
Returns:
true on success, otherwise false
checks the existance of a given directory

typedef int(* FS_FN_EOF)(void *stream)
 

Parameters:
stream file to close
Returns:
0 on success (end of file), otherwise < 0
tests if a given file is at the end of file (EOF)

typedef int(* FS_FN_FIND_CLOSE)(T_FF_INFO *ffblk)
 

Parameters:
ffblk pointer to findfirst structure
Returns:
0 on success, otherwise < 0
have to be called to cleanup resources needed for the find functions.

See also:
FS_FN_FIND_FIRST

FS_FN_FIND_NEXT

typedef int(* FS_FN_FIND_FIRST)(void *partition, const char *pathname, T_FF_INFO *ffblk, int attrib)
 

Parameters:
partition pointer to partition
pathname 
ffblk pointer to findfirst structure
attrib 
Returns:
0 on success, otherwise < 0
finds the first occurence of a file matching the pathname (wildcards are allowed) and the supplied attributes

See also:
FS_FN_FIND_NEXT

FS_FN_FIND_CLOSE

typedef int(* FS_FN_FIND_NEXT)(void *partition, T_FF_INFO *ffblk)
 

Parameters:
partition pionter to partition
ffblk pointer to findfirst structure
Returns:
0 on success, otherwise < 0
finds the next occurence of a file machting the pattern of the find structure

See also:
FS_FN_FIND_FIRST

FS_FN_FIND_CLOSE

typedef bool(* FS_FN_FORMAT)(void *hMsd)
 

Parameters:
hMsd handle to the mass storage device
Returns:
true if format succeeds, otherwise false
formats the specified device

typedef int(* FS_FN_GETC)(void *stream)
 

Parameters:
stream pointer to file
Returns:
the character read from the file, or EOF on failure
reads a certain character from a file

typedef int(* FS_FN_MKDIR)(void *partition, const char *dir)
 

Parameters:
partition pointer to the partition
dir name of the target directory
Returns:
0 on success (directory created), otherwise < 0
creates a new directory(if it is not already present) on the specified partition

typedef void*(* FS_FN_MOUNT)(void *hMsd)
 

Parameters:
hMsd handle to the mass storage device
Returns:
pointer to the partition on success, otherwise 0
mounts the given mass storage device

typedef void*(* FS_FN_OPEN)(void *pPartition, const char *fname, unsigned short modebits)
 

Parameters:
partition pointer to the partition
fname name of the target file
modebits bitmask consisting of bits from File Open Modes
Returns:
pointer to the file on success (file opened), otherwise < 0
opens a file on the specified partition according to the supplied modebits.

See also:
File Open Modes

FS_FN_CLOSE

typedef unsigned long(* FS_FN_PART_FREE)(void *partition)
 

Parameters:
partition pointer to the partition
Returns:
on success the amount of free bytes of the partition, otherwise 0

typedef unsigned long(* FS_FN_PART_SIZE)(void *partition)
 

Parameters:
partition pointer to the partition
Returns:
on success the partition size in bytes, otherwise 0

typedef int(* FS_FN_PUTC)(int ch, void *stream)
 

Parameters:
ch character to write
stream pointer to file
Returns:
the character actually written to the file, or EOF on failure
writes a certain character to a file

typedef int(* FS_FN_READ)(void *buffer, size_t size, size_t num, void *stream)
 

Parameters:
buffer buffer to store the bytes
size size of one entry
num number of entries
stream pointer to file
Returns:
the number of entries read from the file
reads a certain amount of entries (with the specified size) from a file

typedef int(* FS_FN_RMDIR)(void *partition, const char *dir)
 

Parameters:
partition pointer to the partition
dir name of the target directory
Returns:
0 on success (directory deleted), otherwise < 0
physically deletes the specified directory

typedef int(* FS_FN_SEEK)(void *stream, long offset, int origin)
 

Parameters:
stream pointer to file
offset offset in bytes
origin seek origin (SEEK_SET, SEE_CUR, SEEK_END)
Returns:
0 on success, otherwise < 0
changes the file position to the offset relative to origin

typedef bool(* FS_FN_UNMOUNT)(void *partition)
 

Parameters:
partition pointer to the partition
Returns:
on success true, otherwise false
unmounts the given mass storage device

typedef int(* FS_FN_WRITE)(const void *buffer, size_t size, size_t count, void *stream)
 

Parameters:
buffer buffer to the data
size size of one entry
count number of entries
stream pointer to file
Returns:
the number of entries written to the file
writes a certain amount of entries (with the specified size) to a file


Function Documentation

void fs_cleanup  ) 
 

have to be called to clean up and free resources of the file system management

bool fs_formatDevice const char *  pa_acDeviceName,
const char *  pa_acFilesystem
 

formats the specified device with the specified file system

T_FS_PARTITION* fs_getActivePartition void   ) 
 

returns a pointer to the currently active partition struct (0 if none is active)

T_FS_PARTITION* fs_getPartition const char *  pa_acName  ) 
 

returns a pointer to a specified partition struct (0 if the name is not valid)

bool fs_mountPartition const char *  pa_acPartitionName,
const char *  pa_acMsdName,
const char *  pa_acFileSystem
 

mounts a partitions on a mass storage device (MSD) with a specified filesystem

unsigned long fs_partitionFree T_FS_PARTITION pa_pPartition  ) 
 

returns the amount of free bytes of the specified partition

unsigned long fs_partitionSize T_FS_PARTITION pa_pPartition  ) 
 

returns the overall size of the specified partition in bytes

void fs_printPartitions void   ) 
 

displays all available partitions

void fs_register const char *  pa_acName,
T_FS_FUNCTIONS pa_pstFunctions
 

registers a specified filesystem to the file system management

Parameters:
pa_acName registered name of the file system
pa_pstFunctions pointer to a struct of type T_FS_FUNCTIONS
this method registers a filesystem with the supplied name and the supplied file system functions to the file system management.

See also:
T_FS_FUNCTIONS

void fs_setActivePartition T_FS_PARTITION pa_pPartition  ) 
 

sets the supplied parition as currently active

void fs_setup void   ) 
 

have to be called to initialize the file systems manager environment.

this method has to be called in a thread safe environemnt.

bool fs_unmountPartition const char *  pa_acPartitionName  ) 
 

unmounts a partition


Generated on Thu Mar 2 16:11:31 2006 for VDK Blacksheep by  doxygen 1.4.1