Home · All Classes · Grouped Classes · Annotated · Functions

Document Storage

Storage.conf

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.

What do we want Storage.conf to do?

Storage.conf must:

  1. identify the various content locations that exist on the device:
  2. indicate if a given area allows documents and/or applications to be placed there.

An example Storage.conf is available at: <qtopia-root-dir>/devices/greenphone/Storage.conf.

Parameters

ParameterPurposeValue TypeExample
Applicationsindicates if the location hold applicationsboolean1
ApplicationsDefaultindicates the content source name to use when searching for ApplicationsstringHOME
ApplicationsPathindicates the subdirectory under this content source to use when searching for Applicationsstring/Applications
ContentDatabaseindicates the content source used to stored the content databaseboolean1
Documentsindicates if the location hold documentsboolean1
DocumentsDefaultindicates the content source name to use when searching for DocumentsstringHOME
DocumentsPathindicates the subdirectory under this content source to use when searching for Documentsstring/Documents
Optionsindicates the options to use instead of the mount options in /proc/mounts.stringrw
MountPointsa comma separated list of content source names to search forstringMountPoint0, MountPont1
Name[]the translatable name shown to the userstringMyDocuments
Pathindicates device path for this content sourcestring/dev/mmca1
Removableindicates if the location is removableboolean1

Groups within Storage.conf

MountTable
PurposeLists what content sources to search for in Storage.conf
Valid AttributesApplicationsDefault, DocumentsDefault, MountPoints
Notes:
HOME
PurposeSpecify 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 AttributesApplications, 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
PurposeSpecify the details of a content source declared in the MountTable.
Valid AttributesApplications, ApplicationsPath, ContentDatabase, Documents, DocumentsPath, Options, Name[], Removable
Notes:
PREFIX
PurposeAllow customization of the prefix directory.
Valid AttributesApplications, 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.

Filtering

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:

  1. cardInfoString() and installLocationsString() are now implemented as a filter and a FileSystem list to the String function
  2. LocationCombo has a new setFilter() function used to limit the types of file systems it shows
  3. all code using StorageInfo::fileSystems() is updated and the filter argument is mandatory.

Non-removable vs Removable Storage

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

Using read-only file systems have a number of benefits:


Copyright © 2007 Trolltech Trademarks
Qtopia 4.2.5