Low Disk Handling

There are two levels defined by the system monitoring the free space available on the Flash File System (FFS, alias the C: drive): Warning Level (WL) and Critical Level (CL). When free disk space meets one of these levels, the system (EikSrvUI) will display a global note, which warns the user about the situation. Applications and servers can therefore ignore the Warning Level and concentrate on the Critical Level.

All operations that create or write to a file on disk with a known file size must first check the Critical Level with that size as a parameter to the FFSSpaceBelowCriticalLevelL method. If the disk space is already below, or going to go below Critical Level, this method will return ETrue. Applications must not write data and should indicate to the user that the disk is full. (Leaving with the KErrDiskFull error code can achieve this.)

All operations that create or write to a file on disk with an unknown file size must check the Critical Level first, passing a good estimate of size or "0" (the default) as a parameter to the FFSSpaceBelowCriticalLevelL method. The zero can be used to check whether you are already below the critical level.

Cases where single items are created in databases (for example, contacts) are difficult. Here, an estimate can be used of the increase in database size the item add would cause.

The Critical Level checking method is available in SysUtil.h/SysUtil.dll. Its API looks like this:

/**
 * Checks if the free FFS (internal Flash File System) storage
 * space is or will fall below Critical Level (CL).
 * The CL and FFS drive letter is defined by this module.
 * @param aFs File server session.
 *  Must be given if available in the caller,
 *  e.g. from EIKON environment.
 *  If NULL this method will create a temporary session for
 *  a check, but then the check is more expensive.
 * @param aBytesToWrite number of bytes the caller is about to add 
 *  FFS, if known by the caller beforehand.
 *  The default value 0 checks if the current
 *  space is already below the CL. 
 * @return ETrue if storage space would go below CL after adding 
 *  aBytes more data, EFalse otherwise.
 *  Leaves on error.
 */

IMPORT_C static TBool FFSSpaceBelowCriticalLevelL( RFs* aFs,
    TInt aBytesToWrite = 0 );