Filesystem


Classes

class  miosix::Directory

Enumerations

enum  miosix::Attrib {
  miosix::READ_ONLY = 0x01, miosix::HIDDEN = 0x02, miosix::SYSTEM = 0x04, miosix::VOLUME_ID = 0x08,
  miosix::DIRECTORY = 0x10, miosix::ARCHIVE = 0x20
}

Functions

char miosix::mount_filesystem ()
void miosix::umount_filesystem ()
bool miosix::is_filesystem_mounted ()

Detailed Description

Filesystem related functions

File handling will not be described here since it is done using the C or C++ standard library (fopen, fprintf, istream, remove, mkdir, ...).
All file related function of the C and C++ standard library should work, except rename() and link() which are not implemented.
The maximum number of files that can be opened at the same time is defined in the constant MAX_OPEN_FILES in miosix_settings.h, and the defaut value is 4 All files are opened in binary mode. Therefore there is no differnce between fopen("file.txt","r") and fopen("file.txt","rb").

Directory listing is not done using the standard opendir() and readdir() functions, but using the Directory class.

is_filesystem_mounted() can be used to see if the filesystem is mounted before using file related functions.

The remaining functions described here are to mount/unmount the filesystem, which are not likely to be used by user code, since filesystem is mounted automatically at boot time, except in case of errors (like no uSD card in the socket).


Enumeration Type Documentation

File attribures, as returned by Directory::next(). More flags can be set at the same time

Enumerator:
READ_ONLY  Entry is read-only.
HIDDEN  Entry is hidden.
SYSTEM  Entry is a system file.
VOLUME_ID  Volume label (?).
DIRECTORY  If this flag is set, entry is a directory, otherwise it's a file.
ARCHIVE  Entry is marked as archive.


Function Documentation

bool miosix::is_filesystem_mounted (  ) 

Returns true if the filesystem is mounted.

char miosix::mount_filesystem (  ) 

Try to mount the flesystem. Might take a long time (~ 1 sec if no errors, up to 3 sec in case of errors)

Returns:
  • 0 = on success
  • 1 = in case of errors
  • 2 = if no uSD card is in the socket
  • 3 = if the filesystem is already mounted

void miosix::umount_filesystem (  ) 

Umounts the filesystem if it is mounted. Please close all files before unmounting filesystem. Allows safely removing the SD card.


Generated on Fri Jun 19 15:19:04 2009 for Miosix by  doxygen 1.5.6