Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]


File services in Symbian OS

In common with all software systems, Symbian OS can persist data, i.e. store data permanently, between powering down and re-starting a handset. This is the common concept of the file.

On PCs, a file is kept on magnetic disk or optical media such as CD or DVD. On older generations of personal organisers, a file was often kept in RAM, needing a permanent power supply, and a backup battery to guarantee this. On the most recent telephone handsets, files are normally stored in flash memory, either NOR flash or NAND flash, and also on removable devices such as MultiMediaCard (MMC), Secure Digital card (SD card), Memory Stick or Compact flash (CF).

There are more sophisticated services for persisting data such as streams, stores, central repository etc. that applications can use, but they all rely, either directly or indirectly, on the commonly understood idea of the file.

The ROM on a typical handset is located in non-volatile flash memory, allowing it to be upgraded by the handset manufacturer after initial production. The location for user data is almost always flash memory (NAND or NOR), on the grounds of cost, although rotating media devices capable of holding large amounts of data are likely in future handsets.

[Top]


Basic concepts

Symbian OS uses a number of file concepts that are common to most operating systems, for example, drives and directories.


Drives

Symbian OS uses the concept of the drive. This idea is similar to that in other operating systems, i.e. it corresponds to a logical device. A media device such as a MultiMediaCard can be logically split into partitions, and each partition is treated as a separate drive. Symbian OS adopts a DOS-like convention where each drive is identified by a single letter. This means that there can be up to 26 drives on a handset, identified by the letters A: through to Z:. In practice, there are far fewer than this, and the number depends on the individual manufacturer's handset

Internally, Symbian OS uses the idea of a drive number instead of a letter, and some legacy API items take a drive number as input, or return a drive number as output. However, there are functions that can translate drive numbers to and from drive letters: RFs::DriveToChar() and RFs::CharToDrive().

The main ROM on a handset is always identified as the Z: drive. Other drives may be in use: sixteen of the drives C: to R: are usually reserved as local drives, i.e. for media devices located within the handset. A common convention is to adopt C: as the main user data drive. and to designate D: or E: as drives for removable media. Be aware, however, that this is a convention that some handset manufacturers may not follow, so you are always advised to check the full SDK that applies to a specific handset for guidance. Indeed, as a matter of principle, you should always use the system drive for user data.


Volume

The concept of the volume applies to removable media. As users insert and remove individual devices, so different volumes are said to be mounted and demounted. For media types that can be split into partitions, each partition corresponds to a separate volume.


File names and directory structures

Files have names, and Symbian OS uses a hierarchical directory structure in which to organise them; this is similar to schemes adopted by other operating systems. For example:

C:\AAA\BBB\CCC\DDD.EXT

There are four main parts to the structure:

You will find that the whole structure is sometimes referred to as the full file name or the full path name. The maximum length of a full file name is limited to 256 characters. Symbian OS does not use the extension to identify the software or application that can access the data. Instead, files have UIDs embedded within them, and the mapping of files to applications is done through these UIDs. See Application registration information.

The case of full path names is always preserved, but operations on names are case insensitive. This means that two files that have the same name but differ only in case are considered to refer to the same file.

Full file names are normally manipulated programmatically. Extracting drive names, filenames, file extensions, and changing the names of a directory structure are typical activities. Symbian OS provides you with the TParse, TParsePtr, and TParsePtrC classes to help you do this manipulation.

See parsing paths and filenames .

[Top]


Accessing file services

On Symbian OS, file services are a common resource. Like other common or shared resources on Symbian OS, file sevices are handled by a server - the file server. Applications and other software that require access to files, directories and drives are clients of the file server, and send file-related requests using the file server client-side API.

The file server is multithreaded, which allows each logical drive to be accessed concurrently. More than one request can be issued for the same drive, but these requests are handled sequentially. For example, a request to read or write data to a MultiMediaCard can be handled at the same time as a request to read or write data to the main user drive.

The file server has a main thread that initially handles all requests. Short requests, such as those that require access to the ROM drive, and those that do not require access to any media, run in the file server.

The services provided by the file server can be divided into two types:

Like most other servers, the client API allows you to make file requests synchronously or asynchronously.

See also client-server.

[Top]


Security issues

Security considerations restrict the parts of a handset's directory structure that an application is allowed to access. The concept is referred to as data caging.

There are a number of principles involved:

It is possible to pass an open file to another process, or between a client and server, so that the target can access the file without knowing the full path name. The only information that is passed to the target is the filename and extension.

You can find more detailed information in the Symbian OS v9 Security Architecture document in Platform security.

[Top]


File systems and mounting a drive

The varying characteristics of media types can mean that different media types require different formats. A common format is VFAT, and typically, this is used for removable media to maintain compatibility with other systems. This also means that long file names are supported.

In Symbian OS, format schemes are implemented by what are called file systems; they are constructed as plugins to the file server. This means that the file server itself is independent of the format scheme, and also means that a phone manufacturer is free to add new file systems to a handset. The ROM is an exception - it has its own file system built into the main file server code.

A file system must be associated with a drive before the drive can be used. This is known as mounting the drive, and is typically done at system boot time.

In practice, an application does not need to concern itself with the format scheme.