| Home · All Classes · Grouped Classes · Annotated · Functions |
Qtopia identifies and defines storage locations in the Storage.conf configuration file. Devices are mapped to human-readable names and the Removable variable defines whether or not a given device is removable.
For example:
[MountPoint0]
Name[] = Internal Storage
Removable = 0
The device can be anything that appears in the first column of /proc/mounts, for example, //server/path/to/nfsmount is a valid device.
Storage.conf refers to devices but Qtopia uses path names and /proc/mounts is consulted to determine which device a given path is on. There is special case code for $HOME and the non-removable storage location should be located at $HOME. Removing the special case status of $HOME also removes the requirement to have only one non-removable location.
Storage.conf must:
An example Storage.conf is available at: <qtopia-root-dir>/devices/greenphone/Storage.conf.
| Parameter | Purpose | Value Type | Example |
|---|---|---|---|
| Applications | indicates if the location hold applications | boolean | 1 |
| ApplicationsDefault | indicates the content source name to use when searching for Applications | string | HOME |
| ApplicationsPath | indicates the subdirectory under this content source to use when searching for Applications | string | /Applications |
| ContentDatabase | indicates the content source used to stored the content database | boolean | 1 |
| Documents | indicates if the location hold documents | boolean | 1 |
| DocumentsDefault | indicates the content source name to use when searching for Documents | string | HOME |
| DocumentsPath | indicates the subdirectory under this content source to use when searching for Documents | string | /Documents |
| Options | indicates the options to use instead of the mount options in /proc/mounts. | string | rw |
| MountPoints | a comma separated list of content source names to search for | string | MountPoint0, MountPont1 |
| Name[] | the translatable name shown to the user | string | MyDocuments |
| Path | indicates device path for this content source | string | /dev/mmca1 |
| Removable | indicates if the location is removable | boolean | 1 |
| MountTable | |
|---|---|
| Purpose | Lists what content sources to search for in Storage.conf |
| Valid Attributes | ApplicationsDefault, DocumentsDefault, MountPoints |
| Notes: | |
| HOME | |
| Purpose | Specify the content stored in the HOME content source. If your HOME is on a partition specified by Storage.conf and it does not contain Applications or Documents you might want to hide it by setting "Path = HIDE" |
| Valid Attributes | Applications, ApplicationsPath, Documents, DocumentsPath, Options, Name[], Removable |
| Notes: | Set "Path = HIDE" to hide it and your HOME is on a partition that is specified by Storage.conf and it does not contain Applications or Documents o Set "Path = HOME" to use a value of Qtopia::homePath() |
| <A content source name list in MountPoints> : e.g. MountPoint0 | |
| Purpose | Specify the details of a content source declared in the MountTable. |
| Valid Attributes | Applications, ApplicationsPath, ContentDatabase, Documents, DocumentsPath, Options, Name[], Removable |
| Notes: | |
| PREFIX | |
| Purpose | Allow customization of the prefix directory. |
| Valid Attributes | Applications, ApplicationsPath, ContentDatabase, Documents, DocumentsPath, Options, Name[], Removable |
| Notes: | Commercial customers please contact support before using this group. |
The HOME location defaults to rw for its Options value. Qtopia assumes a location is writable only if Options contains rw. A location's Options might need to be overwritten if they don't include rw but are writable. For example, SMB mounts on a machine have Options of 0 or if they are overly complex; cardInfoString() and installLocationsString() encode the Options as part of a ; delimited string.
The StorageInfo::filesytems() function provide filtering functionality.
For example, to extend the Documents file systems use the following:
FileSystemFilter fsf;
fsf.documents == FileSystemFilter::Set;
QList<FileSystem*> filesystems = storage->filesystems( &fsf );
The FileSystemFilter is then easily extended as follows:
class WriteableFileSystemFilter : public FileSystemFilter
{
public:
WriteableFileSystemFilter()
: writable( Either )
{
}
bool filter( FileSystem *fs )
{
if ( (writable == Set && !fs->isWritable()) ||
(writable == NotSet && fs->isWritable()) )
return false;
return FileSystemFilter::filter();
}
FileSystemFilter::FilterOption writable;
};
This is a simple example however more complex rules can be incorporated. So, putting it all together:
Application data is stored in the non-removable location, however documents can be stored in any location. Removable locations are re-scanned on insertion and removal.
Note: Removable media must be Lazy unmounted for Qtopia to correctly take in to account removed media; see also the umount man page.
The scanning is triggered when the Qtopia library receives one of the following messages via the QPE/Card QCOP channel:
Using read-only file systems have a number of benefits:
| Copyright © 2007 Trolltech | Trademarks | Qtopia 4.2.5 |