williamr@2: // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@4: // under the terms of the License "Eclipse Public License v1.0" williamr@2: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: /** williamr@2: @file williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: williamr@2: #if !defined(__F32FILE_H__) williamr@2: #define __F32FILE_H__ williamr@2: williamr@2: #if !defined(__E32BASE_H__) williamr@2: #include williamr@2: #endif williamr@2: williamr@4: #ifndef SYMBIAN_ENABLE_PUBLIC_PLATFORM_HEADER_SPLIT williamr@4: // Old implementation including platform e32svr.h (which includes the several other platform headers)... williamr@2: #if !defined(__E32SVR_H__) williamr@2: #include williamr@2: #endif williamr@2: #include williamr@4: #else williamr@4: // New implementation including only the public headers needed for f32file.h... williamr@4: #include williamr@4: // And the public headers previously included via e32svr.h but otherwise not needed for f32file.h... williamr@4: #include williamr@4: #include williamr@4: #include williamr@4: #include williamr@4: #endif williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: The session default drive. williamr@2: */ williamr@2: const TInt KDefaultDrive=KMaxTInt; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Indicates a drive letter which is not in use. williamr@2: williamr@2: This is useful when scanning a drive list to find which drives are available. williamr@2: */ williamr@2: const TInt KDriveAbsent=0x00; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: The default value for the number of message slots passed to RFs::Connect(). williamr@2: williamr@2: @see RFs::Connect williamr@2: */ williamr@2: const TInt KFileServerDefaultMessageSlots=-1; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: The size of the array of TEntry items contained in a TEntryArray object. williamr@2: williamr@2: @see TEntryArray williamr@2: @see TEntry williamr@2: */ williamr@2: const TInt KEntryArraySize=(0x200*sizeof(TText)); williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: The character used to separate directories in the path name. williamr@2: */ williamr@2: const TInt KPathDelimiter='\\'; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: The character used to separate the drive letter from the path. williamr@2: */ williamr@2: const TInt KDriveDelimiter=':'; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: The character used to separate the filename from the extension. williamr@2: */ williamr@2: const TInt KExtDelimiter='.'; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: The maximum number of available drives. williamr@2: */ williamr@2: const TInt KMaxDrives=26; williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@4: The maximum number of available proxy drives. williamr@4: */ williamr@4: const TInt KMaxProxyDrives=KMaxDrives-KMaxLocalDrives; williamr@4: williamr@4: williamr@4: /** williamr@4: @publishedAll williamr@4: @released williamr@4: williamr@2: Defines a modifiable buffer descriptor to contain a drive list. williamr@2: williamr@2: The descriptor has maximum length KMaxDrives, sufficient to contain williamr@2: all possible drive letters. williamr@2: williamr@2: @see RFs::DriveList williamr@2: @see KMaxDrives williamr@2: */ williamr@2: typedef TBuf8 TDriveList; williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: The maximum length of a drivename. williamr@2: williamr@2: Sufficient for a drive letter and colon. williamr@2: */ williamr@2: const TInt KMaxDriveName=0x02; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Defines a modifiable buffer descriptor to contain a drive name. williamr@2: williamr@2: A drive name comprises a drive letter (A through Z) and a colon. williamr@2: KMaxDriveName (2 bytes) is sufficient for a drive letter and colon. williamr@2: williamr@2: @see TDriveUnit::Name williamr@2: @see KMaxDriveName williamr@2: */ williamr@2: typedef TBuf TDriveName; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: The maximum length of a file system name or file system sub type name. williamr@2: 32 characters is sufficient for a file system or sub type name. williamr@2: */ williamr@2: const TInt KMaxFSNameLength=0x0020; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Defines a modifiable buffer descriptor to contain a file system or file system sub type name. williamr@2: williamr@2: @see KMaxFSNameLength williamr@2: */ williamr@2: typedef TBuf TFSName; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: File/directory attribute: any file without the hidden or system attribute. williamr@2: */ williamr@2: const TUint KEntryAttNormal=0x0000; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: File/directory attribute: read-only file or directory. williamr@2: */ williamr@2: const TUint KEntryAttReadOnly=0x0001; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: File/directory attribute: hidden file or directory. williamr@2: */ williamr@2: const TUint KEntryAttHidden=0x0002; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: File/directory attribute: system file. williamr@2: */ williamr@2: const TUint KEntryAttSystem=0x0004; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: File/directory attribute: volume name directory. williamr@2: */ williamr@2: const TUint KEntryAttVolume=0x0008; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: File/directory attribute: a directory without the hidden or system attribute. williamr@2: */ williamr@2: const TUint KEntryAttDir=0x0010; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: File/directory attribute: an archive file. williamr@2: */ williamr@2: const TUint KEntryAttArchive=0x0020; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: File/directory attribute: ROM eXecute In Place file williamr@2: */ williamr@2: const TUint KEntryAttXIP=0x0080; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: This file attribute bit is set if the file exists only on a remote file williamr@2: system and is not locally cached. williamr@2: williamr@2: Due to the potential high-latency of remote file systems, applications williamr@2: (or users of applications) may make use of this bit to modify their williamr@2: behaviour when working with remote files. williamr@2: williamr@2: This is a read-only attribute, so any attempt to set this attribute will williamr@2: will be ignored. williamr@2: */ williamr@2: const TUint KEntryAttRemote=0x0100; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: The range of entry attributes reserved for file-system specific meanings. williamr@2: File systems may assign meaning to these bits, but their definition will williamr@2: not be supported nor maintained by Symbian. williamr@2: williamr@2: All other file attribute bits are reserved for use by Symbian. williamr@2: williamr@2: The following table summarises the assignment of attribute bits: williamr@2: williamr@2: 0 - KEntryAttReadOnly williamr@2: 1 - KEntryAttHidden williamr@2: 2 - KEntryAttSystem williamr@2: 3 - KEntryAttVolume williamr@2: williamr@2: 4 - KEntryAttDir williamr@2: 6 - KEntryAttArchive williamr@2: 7 - KEntryAttXIP williamr@2: williamr@2: 8 - KEntryAttRemote williamr@2: 9 - Reserved williamr@2: 10 - Reserved williamr@2: 11 - Reserved williamr@2: williamr@2: 12 - Reserved williamr@2: 13 - Reserved williamr@2: 14 - Reserved williamr@2: 15 - Reserved williamr@2: williamr@2: 16 - File System Specific williamr@2: 17 - File System Specific williamr@2: 18 - File System Specific williamr@2: 19 - File System Specific williamr@2: williamr@2: 20 - File System Specific williamr@2: 22 - File System Specific williamr@2: 22 - File System Specific williamr@2: 23 - File System Specific williamr@2: williamr@4: 24 - KEntryAttPacked williamr@2: 25 - Reserved williamr@2: 26 - Reserved williamr@2: 27 - KEntryAttMatchExclude williamr@2: williamr@2: 28 - KEntryAttAllowUid williamr@2: 29 - Reserved williamr@2: 30 - KEntryAttMatchExclusive williamr@2: 31 - Reserved williamr@2: */ williamr@2: const TUint KEntryAttMaskFileSystemSpecific=0x00FF0000; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Bit mask for matching file and directory entries. williamr@2: williamr@2: This mask ensures that directories and hidden and williamr@2: system files are matched. williamr@2: williamr@2: (Note that KEntryAttNormal matches all entry types except directories, hidden williamr@2: and system entries). williamr@2: williamr@2: @see RFs::GetDir williamr@2: */ williamr@2: const TUint KEntryAttMatchMask=(KEntryAttHidden|KEntryAttSystem|KEntryAttDir); williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Bit mask for matching file and directory entries. williamr@2: williamr@2: This is used when all entry types, including hidden and system files, williamr@2: but excluding the volume entry are to be matched. williamr@2: williamr@2: @see RFs::GetDir williamr@2: */ williamr@2: const TUint KEntryAttMaskSupported=0x3f; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Bit mask for matching file and directory entries. williamr@2: williamr@2: This is used for exclusive matching. When OR'ed with one or more file attribute williamr@2: constants, for example, KEntryAttNormal, it ensures that only the files with williamr@2: those attributes are matched. williamr@2: When OR’ed with KEntryAttDir, directories only (not hidden or system) are matched. williamr@2: williamr@2: @see KEntryAttDir williamr@2: @see KEntryAttNormal williamr@2: @see RFs::GetDir williamr@2: */ williamr@2: const TUint KEntryAttMatchExclusive=0x40000000; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Bit mask for feature manager file entries. williamr@2: williamr@2: It is used in order to identify each ROM feature set data file williamr@2: uniquely in the mount order of ROM sections. williamr@2: williamr@2: */ williamr@2: const TUint KEntryAttUnique=0x01000000; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Bit mask for matching file and directory entries. williamr@2: williamr@2: It is used to exclude files or directories with certain attributes from williamr@2: directory listings. This bitmask has the opposite effect williamr@2: to KEntryAttMatchExclusive. For example: williamr@2: williamr@2: @code williamr@2: KEntryAttMatchExclude|KEntryAttReadOnly williamr@2: @endcode williamr@2: williamr@2: excludes all read only entries from the directory listing. williamr@2: williamr@2: @code williamr@2: KEntryAttMatchExclusive|KEntryAttReadOnly williamr@2: @endcode williamr@2: lists only read only entries. williamr@2: williamr@2: @see KEntryAttMatchExclusive williamr@2: @see RFs::GetDir williamr@2: */ williamr@2: const TUint KEntryAttMatchExclude=0x08000000; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Bit mask for matching file and directory entries. williamr@2: williamr@2: Bit mask flag used when UID information should be included in the directory williamr@2: entry listing. williamr@2: williamr@2: @see RFs::GetDir williamr@2: */ williamr@2: const TUint KEntryAttAllowUid=0x10000000; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@4: @publishedAll williamr@2: @released williamr@2: williamr@4: Indicates that a TEntry (that is generally returned from a TEntryArray) is williamr@4: stored in packed format where the iSizeHigh and iReserved fields follow the williamr@4: valid characters of the name string. Before accessing the aforementioned williamr@4: members, the entry must be unpacked. williamr@4: williamr@2: */ williamr@4: const TUint KEntryAttPacked = 0x01000000; williamr@4: williamr@2: williamr@2: /** williamr@4: @publishedAll williamr@4: @released williamr@2: */ williamr@2: const TUint KMaxMapsPerCall = 0x8; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: enum TNotifyType williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: A set of change notification flags. williamr@2: williamr@2: These flags indicate the kind of change that should result in notification. williamr@2: williamr@2: This is useful for programs that maintain displays of file lists that williamr@2: must be dynamically updated. williamr@2: williamr@2: @see RFs::NotifyChange williamr@2: @see RFs williamr@2: @see RFile williamr@2: @see RRawDisk williamr@2: */ williamr@2: { williamr@2: /** williamr@2: Any change, including mounting and unmounting drives. williamr@2: */ williamr@2: ENotifyAll=0x01, williamr@2: williamr@2: williamr@2: /** williamr@2: Addition or deletion of a directory entry, or changing or formatting a disk. williamr@2: */ williamr@2: ENotifyEntry=0x02, williamr@2: williamr@2: williamr@2: /** williamr@2: Change resulting from file requests: williamr@2: RFile::Create(), RFile::Replace(), RFile::Rename(), RFs::Delete(), williamr@2: RFs::Replace(), and RFs::Rename(). williamr@2: */ williamr@2: ENotifyFile=0x04, williamr@2: williamr@2: williamr@2: /** williamr@2: Change resulting from directory requests: williamr@2: RFs::MkDir(), RFs::RmDir(), and RFs::Rename(). williamr@2: */ williamr@2: ENotifyDir=0x08, williamr@2: williamr@2: williamr@2: /** williamr@2: Change resulting from: RFs::SetEntry(), RFile::Set(), RFile::SetAtt(), williamr@2: RFile::SetModified() and RFile::SetSize() requests. williamr@2: */ williamr@2: ENotifyAttributes=0x10, williamr@2: williamr@2: williamr@2: /** williamr@2: Change resulting from the RFile::Write() request. williamr@2: */ williamr@2: ENotifyWrite=0x20, williamr@2: williamr@2: williamr@2: /** williamr@2: Change resulting from the RRawDisk::Write() request. williamr@2: */ williamr@2: ENotifyDisk=0x40 williamr@2: }; williamr@2: williamr@4: /** williamr@4: @publishedAll williamr@4: @released williamr@4: williamr@4: Notification modes for safe media removal notification API williamr@4: williamr@4: @see RFs::NotifyDismount williamr@4: */ williamr@2: enum TNotifyDismountMode williamr@4: { williamr@4: /** Used by a client to register for notification of pending dismount. This is the default behaviour for RFs::NotifyDismount*/ williamr@4: EFsDismountRegisterClient=0x01, williamr@4: williamr@4: /** williamr@4: Used for graceful file system dismounting with notifying clients of a pending dismount. williamr@4: If all clients have responded by RFs::AllowDismount(), the file system will be dismounted. williamr@4: */ williamr@4: EFsDismountNotifyClients=0x02, williamr@4: williamr@4: /** Used to forcibly dismount the file system without notifying clients. */ williamr@4: EFsDismountForceDismount=0x03, williamr@4: }; williamr@4: williamr@4: williamr@4: enum TFileCacheFlags williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Flags used to enable file server drive-specific caching williamr@2: */ williamr@2: { williamr@2: /** williamr@2: Enable read caching - if file explicitly opened in EFileReadBuffered mode williamr@2: */ williamr@2: EFileCacheReadEnabled = 0x01, williamr@2: williamr@2: /** williamr@2: Enable read caching for all files, regardless of file open mode williamr@2: */ williamr@2: EFileCacheReadOn = 0x02, williamr@2: williamr@2: /** williamr@2: Enable read-ahead caching - if file explicitly opened in EFileReadAheadOn mode williamr@2: */ williamr@2: EFileCacheReadAheadEnabled = 0x04, williamr@2: williamr@2: /** williamr@2: Enable read-ahead caching, regardless of file open mode williamr@2: */ williamr@2: EFileCacheReadAheadOn = 0x08, williamr@2: williamr@2: /** williamr@2: Enable write caching, if file explicitly opened in EFileWriteBuffered mode williamr@2: */ williamr@2: EFileCacheWriteEnabled = 0x10, williamr@2: williamr@2: /** williamr@2: Enable write caching for all files, regardless of file open mode williamr@2: */ williamr@2: EFileCacheWriteOn = 0x20, williamr@2: }; williamr@2: williamr@2: /** williamr@4: @publishedAll williamr@2: @released williamr@2: williamr@2: Commands to query specific volume information. williamr@2: williamr@2: @see TVolumeIOParamInfo williamr@2: */ williamr@2: enum TQueryVolumeInfoExtCmd williamr@2: { williamr@2: /** williamr@2: Queries the sub type of the file system mounted on a specified volume. williamr@2: For example, FAT12, FAT16 or FAT32. williamr@2: */ williamr@2: EFileSystemSubType, williamr@2: williamr@2: /** williamr@2: Queries the I/O parameters of a specificed volume. williamr@2: This includes the block size, the cluster size and the recommended read and write sizes for the media. williamr@2: */ williamr@2: EIOParamInfo, williamr@2: williamr@2: /** williamr@2: This command determines whether the volume is synchronous or asynchronous. williamr@2: A boolean value is returned within the buffer defined as TPckgBuf. williamr@2: ETrue for Synchronous and EFalse for Asynchronous. williamr@2: */ williamr@2: EIsDriveSync, williamr@2: williamr@2: /** williamr@2: Query if the given drive is finalised. See RFs::FinaliseDrive() williamr@2: Not all file systems may support this query. williamr@2: A boolean value is returned within the buffer defined as TPckgBuf. williamr@2: ETrue value means that the drive is finalised williamr@2: */ williamr@2: EIsDriveFinalised, williamr@2: }; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Volume IO parameter information. williamr@2: williamr@2: This class is used to return IO parameter information for a specified volume. williamr@2: williamr@2: The volume parameter information holds recommended buffer sizes for the creation of efficient buffers for williamr@2: reading and writing. williamr@2: williamr@2: @see RFs::VolumeIOParam() williamr@2: */ williamr@2: class TVolumeIOParamInfo williamr@2: { williamr@2: public: williamr@2: /** williamr@2: The size of a block in bytes. williamr@2: williamr@2: Reads and writes that are aligned on block boundaries are up to twice as fast as when williamr@2: mis-aligned. williamr@2: williamr@2: Read and write operations on certain underlying media is done in blocks. williamr@2: A write operation that modifies only part of a block is less efficient, in general, than williamr@2: one that modifies an entire block. Data throughput degrades linearly for reads and writes in smaller williamr@2: sized units. williamr@2: */ williamr@2: TInt iBlockSize; williamr@2: /** williamr@2: The size in bytes of a single disk cluster. williamr@2: williamr@2: Read and write operations that are aligned on cluster boundaries are more efficient. williamr@2: williamr@2: The file system organises and allocates the file data on the disk in clusters where each cluster is williamr@2: one or more blocks. Files that are not zero length occupy at least one cluster of the disk, williamr@2: so large numbers of very small files use up more disk space than expected. williamr@2: */ williamr@2: TInt iClusterSize; williamr@2: /** williamr@2: The recommended buffer size for optimised reading performance. williamr@2: williamr@2: The given buffer size is based on sensible benchmark testing results produced by the mobile device vendor. williamr@2: The buffer size is then added to the estart.txt file williamr@2: williamr@2: The figure is included in the estart.txt file along with the drive number and the variable name. williamr@2: The example below shows the required format: williamr@2: williamr@2: [DriveC] williamr@2: RecReadBufSize 8192 williamr@2: williamr@2: When no value is provided, value KErrNotSupported is returned. williamr@2: */ williamr@2: TInt iRecReadBufSize; williamr@2: /** williamr@2: The recommended buffer size for optimised writing performance. williamr@2: williamr@2: The given buffer size is based on sensible benchmark testing results produced by the mobile device vendor. williamr@2: The buffer size is then added to the estart.txt file williamr@2: williamr@2: The figure is included in the estart.txt file along with the drive number and the variable name. williamr@2: The example below shows the required format: williamr@2: williamr@2: [DriveC] williamr@2: RecWriteBufSize 16384 williamr@2: williamr@2: When no value is provided, value KErrNotSupported is returned. williamr@2: */ williamr@2: TInt iRecWriteBufSize; williamr@2: williamr@4: williamr@4: /** williamr@4: The maximum file size that is supported by the file system mounted on this volume. williamr@4: Not all file system may provide this parameter; The value KMaxTUint64 (0xffffffffffffffff) means that this particular file system hasn't williamr@4: provided this information. williamr@4: */ williamr@4: TUint64 iMaxSupportedFileSize; williamr@4: williamr@2: private: williamr@2: /* williamr@2: Reserved space for future use williamr@2: */ williamr@4: TInt iReserved[2]; williamr@2: }; williamr@2: williamr@2: enum TDriveNumber williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: The drive number enumeration. williamr@2: */ williamr@2: { williamr@2: EDriveA, EDriveB, EDriveC, EDriveD, EDriveE, williamr@2: EDriveF, EDriveG, EDriveH, EDriveI, EDriveJ, williamr@2: EDriveK, EDriveL, EDriveM, EDriveN, EDriveO, williamr@2: EDriveP, EDriveQ, EDriveR, EDriveS, EDriveT, williamr@2: EDriveU, EDriveV, EDriveW, EDriveX, EDriveY, williamr@2: EDriveZ williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: enum TEntryKey williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Flags indicating the order in which directory entries are to be sorted. williamr@2: williamr@2: @see RFs::GetDir williamr@2: @see CDirScan::SetScanDataL williamr@2: @see CDir::Sort williamr@2: */ williamr@2: { williamr@2: /** williamr@2: The default; no sorting takes place williamr@2: */ williamr@2: ESortNone=0, williamr@2: williamr@2: williamr@2: /** williamr@2: Sort according to alphabetic order of file and directory name. williamr@2: williamr@2: This setting is mutually exclusive with ESortByExt, ESortBySize, williamr@2: ESortByDate and ESortByUid. williamr@2: */ williamr@2: ESortByName, williamr@2: williamr@2: williamr@2: /** williamr@2: Sort according to alphabetic order of file extension. williamr@2: williamr@2: Files without an extension take precedence over files with an extension. williamr@2: For files with the same extension or without an extension, the default is williamr@2: to sort by name. williamr@2: williamr@2: This setting is mutually exclusive with ESortByName, ESortBySize, williamr@2: ESortByDate and ESortByUid. williamr@2: */ williamr@2: ESortByExt, williamr@2: williamr@2: williamr@2: /** williamr@2: Sort according to file size. williamr@2: williamr@2: This setting is mutually exclusive with ESortByName, ESortByExt, williamr@2: ESortByDate and ESortByUid. williamr@2: */ williamr@2: ESortBySize, williamr@2: williamr@2: williamr@2: /** williamr@2: Sort according to files' last modified time and date. williamr@2: williamr@2: By default, most recent last. williamr@2: williamr@2: This setting is mutually exclusive with ESortByName, ESortByExt, williamr@2: ESortBySize and ESortByUid. williamr@2: */ williamr@2: ESortByDate, williamr@2: williamr@2: williamr@2: /** williamr@2: Sort according to file UID. williamr@2: williamr@2: This setting is mutually exclusive with ESortByName, ESortByExt, williamr@2: ESortBySize and ESortByDate. williamr@2: */ williamr@2: ESortByUid, williamr@2: williamr@2: williamr@2: /** williamr@2: Qualifies the sort order; if set, directories are listed in the order in williamr@2: which they occur. williamr@2: williamr@2: This is the default. williamr@2: williamr@2: This flag is mutually exclusive with EDirsFirst and EDirslast. williamr@2: */ williamr@2: EDirsAnyOrder=0, williamr@2: williamr@2: williamr@2: /** williamr@2: Qualifies the sort order; if set, directories come before files in sort order. williamr@2: williamr@2: This flag is mutually exclusive with EDirsAnyOrder and EDirsLast. williamr@2: */ williamr@2: EDirsFirst=0x100, williamr@2: williamr@2: williamr@2: /** williamr@2: Qualifies the sort order; if set, files come before directories in sort order. williamr@2: williamr@2: This flag is mutually exclusive with EDirsAnyOrder and EDirsFirst. williamr@2: */ williamr@2: EDirsLast=0x200, williamr@2: williamr@2: williamr@2: /** williamr@2: Qualifies the sort order; files are sorted in ascending order, i.e. from A to Z. williamr@2: This is the default behaviour. williamr@2: williamr@2: This flag is mutually exclusive with EDescending and EDirDescending. williamr@2: */ williamr@2: EAscending=0, williamr@2: williamr@2: williamr@2: /** williamr@2: Qualifies the sort order; files are sorted in descending order, i.e. from Z to A. williamr@2: williamr@2: This flag is mutually exclusive with EAscending and EDirDescending. williamr@2: */ williamr@2: EDescending=0x400, williamr@2: williamr@2: williamr@2: /** williamr@2: Qualifies the sort order; directories are sorted in descending order, i.e. from Z to A. williamr@2: williamr@2: This flag shall be used in combination with either EDirsFirst or EDirsLast. williamr@2: This flag is mutually exclusive with EAscending and EDescending. williamr@2: */ williamr@2: EDirDescending=0x800 williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: enum TFileMode williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Access and share modes available when opening a file. williamr@2: williamr@2: The access mode indicates whether the file is opened just for reading or williamr@2: for writing. williamr@2: williamr@2: The share mode indicates whether other RFile objects can access the williamr@2: open file, and whether this access is read only. williamr@2: williamr@2: Use EFileShareReadersOrWriters if a client does not care whether the file has williamr@2: been previously opened for ReadOnly or Read/Write access. williamr@2: williamr@2: If EFileShareReadersOrWriters is not used, then a client needs to cooperate with williamr@2: other clients in order to open the file with the correct share mode, either williamr@2: EFileShareReadersOnly or EFileShareAny, depending on the share mode used when williamr@2: the file was originally opened. williamr@2: williamr@2: To open a file for reading and writing with read and write shared access, williamr@2: use: williamr@2: williamr@2: @code williamr@2: _LIT(KFilename, "filename.ext"); williamr@2: RFile file; williamr@2: file.Open(theFs, KFilename, EFileShareAny|EFileWrite); williamr@2: @endcode williamr@2: williamr@2: If another instance of RFile tries to open this file in EFileShareExclusive williamr@2: or EFileShareReadersOnly mode, access is denied. However, it can be opened williamr@2: in EFileShareAny mode or EFileShareReadersOrWriters mode. williamr@2: williamr@2: If a file is opened with EFileShareReadersOrWriters, and the file is opened for williamr@2: sharing by another client, then the file share mode is promoted to the new share williamr@2: mode. When the file handle is closed then the share mode is demoted back to williamr@2: EFileShareReadersOrWriters. williamr@2: williamr@2: @code williamr@2: williamr@2: Table of FileShare promotion rules williamr@2: ---------------------------------- williamr@2: williamr@2: Client A Client B Resultant Share Mode williamr@2: -------- -------- -------------------- williamr@2: ReadersOnly ReadersOnly ReadersOnly williamr@2: ReadersOnly ReadersOrWriters|EFileRead ReadersOnly williamr@2: ReadersOnly ReadersOrWriters|EFileWrite INCOMPATIBLE williamr@2: ReadersOnly Any INCOMPATIBLE williamr@2: williamr@2: ReadersOrWriters|EFileRead ReadersOnly ReadersOnly williamr@2: ReadersOrWriters|EFileRead ReadersOrWriters|EFileRead ReadersOrWriters williamr@2: ReadersOrWriters|EFileRead ReadersOrWriters|EFileWrite ReadersOrWriters williamr@2: ReadersOrWriters|EFileRead Any Any williamr@2: williamr@2: ReadersOrWriters|EFileWrite ReadersOnly INCOMPATIBLE williamr@2: ReadersOrWriters|EFileWrite ReadersOrWriters|EFileRead ReadersOrWriters williamr@2: ReadersOrWriters|EFileWrite ReadersOrWriters|EFileWrite ReadersOrWriters williamr@2: ReadersOrWriters|EFileWrite Any Any williamr@2: williamr@2: Any ReadersOnly INCOMPATIBLE williamr@2: Any ReadersOrWriters|EFileRead Any williamr@2: Any ReadersOrWriters|EFileWrite Any williamr@2: Any Any Any williamr@2: @endcode williamr@2: williamr@2: Use the following guidance notes for selecting FileShare mode with shared RFile objects: williamr@2: williamr@2: EFileShareAny williamr@2: - Use this mode to request both read and write access when another client needs williamr@2: to write to the file and respective client access to the file is coordinated. williamr@2: - To open a file for non-exclusive write, use EFileShareAny | EFileWrite. williamr@2: - It is recommended that either EFileShareAny or EFileShareAny | EFileRead are williamr@2: not used. These combinations will block users attempting to use the williamr@2: EFileShareReadersOnly mode even if all the EFileShareAny handles do not have williamr@2: the EFileWrite bit set as the EFileRead and EFileWrite bits have no affect on williamr@2: sharing. Use either EFileShareReadersOnly or EFileShareReadersOrWriters. williamr@2: williamr@2: EFileShareReadersOrWriters williamr@2: - Use this mode when it does not matter if another file writes to the file and williamr@2: file access can not be coordinated as other clients are unknown. williamr@2: - To open a file for shared read access whilst permitting writers, use williamr@2: EFileShareReadersOrWriters | EFileRead. williamr@2: williamr@2: - For write access with unrestricted share mode, williamr@2: EFileShareReadersOrWriters | EFileWrite may be used however williamr@2: EFilesShareAny | EFileWrite is preferred. williamr@2: williamr@2: EFileShareReadersOnly williamr@2: - Use this mode to get read access to the file and deny write access for any williamr@2: other handles on this file. williamr@2: - To open a file for shared read access whilst disallowing writers use williamr@2: EFileShareReadersOnly. williamr@2: williamr@2: williamr@2: Files may be opened in text or binary mode. Native Symbian OS application williamr@2: files are nearly all binary, (so they will usually be opened in binary mode). williamr@2: However, they can be opened in text mode (to support testing, and to make them williamr@2: compatible with text formats on remote systems). williamr@2: Symbian OS native text format uses CR-LF (ASCII 0x0d, 0x0a) to denote the end of williamr@2: a line. When reading, however, any combination of CR, LF, LF-CR or CR-LF is williamr@2: recognised as the end of a line. Where a remote file system uses a different williamr@2: format, it is the responsibility of the installable file system to present williamr@2: an interface for text files which conforms with this format. williamr@2: williamr@2: The share mode may be OR’ed with either EFileStream or EFileStreamText. williamr@2: williamr@2: Additionally, it may be OR’ed with either EFileRead or EFileWrite. williamr@2: */ williamr@2: { williamr@2: /** williamr@2: Exclusive access for the program opening the file. williamr@2: williamr@2: No other program can access the file until it is closed. williamr@2: If another program is already accessing the file in any share mode, then williamr@2: an attempt to open it with an EFileShareExclusive will fail. williamr@2: */ williamr@2: EFileShareExclusive, williamr@2: williamr@2: williamr@2: /** williamr@2: Read-only sharing. williamr@2: williamr@2: This means that the file may only be accessed for reading. williamr@2: A file cannot be opened using a share mode of EFileShareReadersOnly with williamr@2: an EFileWrite flag. williamr@2: */ williamr@2: EFileShareReadersOnly, williamr@2: williamr@2: williamr@2: /** williamr@2: Shared access for reading and writing. williamr@2: williamr@2: This means that other programs may share access to the file for reading williamr@2: and writing with the program which opened the file. williamr@2: williamr@2: When using this mode, the program is expecting another program to be able williamr@2: to write to the file, so is not compatible with EFileShareReadersOnly. williamr@2: */ williamr@2: EFileShareAny, williamr@2: williamr@2: williamr@2: /** williamr@2: Shared access for reading and writing. williamr@2: williamr@2: This means that other programs may share access to the file for reading williamr@2: and writing with the program which opened the file. williamr@2: williamr@2: When using this mode, the program does not care if another program has williamr@2: the file open for read or write access. williamr@2: */ williamr@2: EFileShareReadersOrWriters, williamr@2: williamr@2: williamr@2: /** williamr@2: For files to be opened in binary mode. williamr@2: */ williamr@2: EFileStream=0, williamr@2: williamr@2: williamr@2: /** williamr@2: For files to be opened in text mode. williamr@2: */ williamr@2: EFileStreamText=0x100, williamr@2: williamr@2: williamr@2: /** williamr@2: The file may be read from but not written to. williamr@2: */ williamr@2: EFileRead=0, williamr@2: williamr@2: williamr@2: /** williamr@2: The file may be read from and written to williamr@2: williamr@2: Cannot be combined with a share mode of EFileShareReadersOnly. williamr@2: */ williamr@2: EFileWrite=0x200, williamr@2: williamr@2: /** williamr@2: Specifies that an asynchronous read request should not be completed williamr@2: until all requested data becomes available. williamr@2: williamr@2: Cannot be combined with the EFileShareExclusive or EFileShareReadersOnly williamr@2: share modes as this will prohibit a writer from updating the file. williamr@2: */ williamr@2: EFileReadAsyncAll=0x400, williamr@2: williamr@2: /** williamr@2: Enables write buffering williamr@2: */ williamr@2: EFileWriteBuffered =0x00000800, williamr@2: williamr@2: /** williamr@2: Disables write buffering williamr@2: */ williamr@2: EFileWriteDirectIO =0x00001000, williamr@2: williamr@2: /** williamr@2: Enables read buffering williamr@2: */ williamr@2: EFileReadBuffered =0x00002000, williamr@2: williamr@2: /** williamr@2: Disables read buffering williamr@2: */ williamr@2: EFileReadDirectIO =0x00004000, williamr@2: williamr@2: /** williamr@2: Enables read ahead. williamr@2: */ williamr@2: EFileReadAheadOn =0x00008000, williamr@2: williamr@2: /** williamr@2: Disables read ahead. williamr@2: */ williamr@4: EFileReadAheadOff =0x00010000, williamr@4: williamr@4: /** williamr@4: Enable delete on close williamr@4: */ williamr@4: EDeleteOnClose =0x00020000, williamr@4: williamr@4: /** williamr@4: Enables operations on large files. williamr@4: williamr@4: @internalTechnology williamr@4: williamr@4: */ williamr@4: EFileBigFile =0x00040000 williamr@4: williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Bit mask provided for retrieving a file's share mode. williamr@2: williamr@2: @see TFileMode williamr@2: */ williamr@2: const TUint KFileShareMask=0xff; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: enum TFormatMode williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: The format method. williamr@2: */ williamr@2: { williamr@2: /** williamr@2: Indicates a high density floppy disk to be formatted. williamr@4: williamr@4: Obsolete. williamr@4: williamr@4: Can be ORed with EFullFormat or EQuickFormat, but does not williamr@4: have any effect. williamr@2: */ williamr@2: EHighDensity, williamr@2: williamr@2: williamr@2: /** williamr@4: Indicates a low density floppy disk to be formatted. williamr@4: williamr@4: Obsolete. williamr@4: williamr@4: Can be ORed with EFullFormat or EQuickFormat, but does not williamr@4: have any effect. williamr@2: */ williamr@2: ELowDensity, williamr@2: williamr@2: williamr@2: /** williamr@4: Performs a full format, erasing whole media content and creating williamr@4: new file system layout. williamr@2: williamr@4: This is the default mode. williamr@2: */ williamr@2: EFullFormat=0, williamr@2: williamr@2: williamr@2: /** williamr@4: Performs a quick media format, erasing only required minimum media content. williamr@4: For example, for FAT file system it resets FAT and root directory content. williamr@4: Also preserves bad sectors if there are some on the volume. williamr@2: */ williamr@2: EQuickFormat=0x100, williamr@2: williamr@2: williamr@2: /** williamr@4: Indicates a custom formatting mode. In this mode some optional file system williamr@4: specific parameters may be passed to RFormat::Open(). williamr@4: williamr@4: @see TLDFormatInfo williamr@4: @see TInt RFormat::Open(RFs &aFs, const TDesC &aName, TUint aFormatMode, TInt &aCount, const TDesC8 &anInfo); williamr@2: */ williamr@2: ESpecialFormat=0x200, williamr@2: williamr@2: /** williamr@2: Forced erase of locked media williamr@2: */ williamr@4: EForceErase=0x400, williamr@4: williamr@4: /** williamr@4: This flag enables formatting the volume even if it has files or directories opened on it. williamr@4: If this flag is specified, the volume will be forcedly dismounted before performing media formatting. williamr@4: williamr@4: Even with this flag the RFormat::Open() can fail with KErrInUse in following cases: williamr@4: 1. if there are clamped files on the volume. williamr@4: 2. there are opened "disk access" objects, like RFormat or RRawDisk on the volume. williamr@4: */ williamr@4: EForceFormat = 0x800, williamr@4: williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: enum TSeek williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Flags indicating the destination of a seek operation. williamr@2: williamr@2: File locations are specified as a 32-bit signed integer, williamr@2: allowing offsets of ?GB from the origin of the seek. williamr@2: williamr@2: @see RFile::Seek williamr@2: */ williamr@2: { williamr@2: /** williamr@2: This can only be used for file systems with execute-in-place facilities, williamr@2: such as the ROM file system: the offset specifies the absolute address of williamr@2: the data. williamr@2: */ williamr@2: ESeekAddress, williamr@2: williamr@2: williamr@2: /** williamr@2: Destination is the start of file. williamr@2: */ williamr@2: ESeekStart, williamr@2: williamr@2: williamr@2: /** williamr@2: Destination is the current position in file. williamr@2: */ williamr@2: ESeekCurrent, williamr@2: williamr@2: williamr@2: /** williamr@2: Destination is the end of file. williamr@2: */ williamr@2: ESeekEnd williamr@2: }; williamr@2: williamr@2: /** williamr@4: @publishedAll williamr@4: @released williamr@2: williamr@2: */ williamr@2: class TBlockMapEntry : public TBlockMapEntryBase williamr@2: { williamr@2: public: williamr@2: IMPORT_C TBlockMapEntry(); williamr@2: IMPORT_C void SetNumberOfBlocks( TUint aNumberOfBlocks ); williamr@2: IMPORT_C void SetStartBlock( TUint aStartBlock ); williamr@2: }; williamr@2: williamr@2: /** williamr@4: @publishedAll williamr@4: @released williamr@4: williamr@2: */ williamr@2: typedef TBuf8 TBlockArrayDes; williamr@2: williamr@2: struct SBlockMapInfo : public SBlockMapInfoBase williamr@2: { williamr@2: TBlockArrayDes iMap; williamr@2: }; williamr@2: williamr@2: /** williamr@4: @publishedAll williamr@4: @released williamr@2: */ williamr@2: enum TBlockMapUsage williamr@2: { williamr@2: /* */ williamr@2: EBlockMapUsagePaging, williamr@2: /* */ williamr@2: ETestDebug williamr@2: }; williamr@2: williamr@2: class TEntry williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Encapsulates an entry in a directory, which can be another (nested) directory, williamr@2: a file or a volume label. williamr@2: williamr@2: Each directory entry has a name which is relative to its owning directory williamr@2: and a type, which is indicated by its unique identifier (UID). williamr@2: williamr@2: An entry can be interrogated for the following properties: williamr@2: williamr@2: 1. the kind of entry: stored in the entry UIDs, stored in iType williamr@2: williamr@2: 2. the entry attributes, stored in iAtt williamr@2: williamr@2: 3. the size of entry williamr@2: williamr@2: 4. the time the entry was last modified. williamr@2: williamr@2: @see RDir williamr@2: @see RFs::Entry williamr@2: @see RFs::SetEntry williamr@2: @see CfileBase::CurrentEntry williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C TEntry(); williamr@2: IMPORT_C TEntry(const TEntry& aEntry); williamr@2: IMPORT_C TEntry& operator=(const TEntry& aEntry); williamr@2: IMPORT_C TBool IsReadOnly() const; williamr@2: IMPORT_C TBool IsHidden() const; williamr@2: IMPORT_C TBool IsSystem() const; williamr@2: IMPORT_C TBool IsDir() const; williamr@2: IMPORT_C TBool IsArchive() const; williamr@2: inline const TUid& operator[](TInt anIndex) const; williamr@2: inline TBool IsUidPresent(TUid aUid) const; williamr@2: inline TBool IsTypeValid() const; williamr@2: inline TUid MostDerivedUid() const; williamr@4: IMPORT_C TInt64 FileSize() const; williamr@4: inline void SetFileSize(TInt64 aFileSize); williamr@4: williamr@4: private: williamr@4: inline void Copy(const TEntry& aEntry); williamr@4: inline void Unpack(); williamr@4: williamr@2: public: williamr@2: /** williamr@2: The individual bits within this byte indicate which attributes williamr@2: have been set. williamr@2: williamr@2: @see KEntryAttNormal williamr@2: @see KEntryAttReadOnly williamr@2: @see KEntryAttHidden williamr@2: @see KEntryAttSystem williamr@2: */ williamr@2: TUint iAtt; williamr@2: williamr@2: williamr@2: /** williamr@2: The size of the file in bytes. williamr@2: For files larger that 2G it must be cast to TUint in order to avoid looking like negative signed. williamr@2: */ williamr@2: TInt iSize; williamr@2: williamr@2: williamr@2: /** williamr@2: The local time of last modification. williamr@2: */ williamr@2: TTime iModified; williamr@2: williamr@2: williamr@2: /** williamr@2: The file's UIDtype williamr@2: */ williamr@2: TUidType iType; williamr@2: williamr@2: williamr@2: /** williamr@2: The name of the file relative to the owning directory, williamr@2: with a maximum of KMaxFileName characters. williamr@2: williamr@2: @see KMaxFileName williamr@2: */ williamr@2: TBufC iName; williamr@2: williamr@2: private: williamr@4: TUint32 iSizeHigh; williamr@2: /** williamr@2: Reserved for future expansion williamr@2: */ williamr@4: TUint32 iReserved; williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: class RDir; williamr@2: class TEntryArray williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Array of directory entries. williamr@2: williamr@2: It contains the results of a call to RDir::Read(): it will contain all williamr@2: the TEntry items in the directory. Thus, a directory can be read in williamr@2: a single call, minimising client/server communication overheads. williamr@2: williamr@2: @see TEntry williamr@2: @see RDir::Read williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C TEntryArray(); williamr@2: IMPORT_C TInt Count() const; williamr@2: IMPORT_C const TEntry& operator[](TInt anIndex) const; williamr@2: private: williamr@2: TInt iCount; williamr@2: TInt iIndex; williamr@2: const TEntry* iPos; williamr@2: TBuf8 iBuf; williamr@2: friend class RDir; williamr@2: friend class RFs; williamr@4: friend class TRawEntryArray; williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: class TDriveInfo williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Contains drive information. williamr@2: williamr@2: @see RFs::Drive williamr@2: */ williamr@2: { williamr@2: public: williamr@2: /** williamr@2: The type of media mounted on the drive. williamr@2: */ williamr@2: TMediaType iType; williamr@4: williamr@4: williamr@2: /** williamr@2: Indicates whether the drive supports a battery, and if so, its state. williamr@2: */ williamr@2: TBatteryState iBattery; williamr@4: williamr@4: williamr@2: /** williamr@2: The drive attributes. williamr@2: williamr@2: @see KDriveAttLocal williamr@2: @see KDriveAttRom williamr@2: @see KDriveAttRedirected williamr@2: @see KDriveAttSubsted williamr@2: @see KDriveAttInternal williamr@4: @see KDriveAttRemovable williamr@4: @see KDriveAttExternal williamr@2: */ williamr@2: TUint iDriveAtt; williamr@2: williamr@2: williamr@2: /** williamr@2: The attributes of the media mounted on the drive. williamr@2: williamr@2: @see KMediaAttVariableSize williamr@2: @see KMediaAttDualDensity williamr@2: @see KMediaAttFormattable williamr@2: @see KMediaAttWriteProtected williamr@2: @see KMediaAttLockable williamr@2: @see KMediaAttLocked williamr@2: */ williamr@2: TUint iMediaAtt; williamr@4: williamr@4: williamr@2: /** williamr@4: The type of interface used to connect to the media. williamr@2: */ williamr@4: TConnectionBusType iConnectionBusType; williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: class TVolumeInfo williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Contains information about a volume mounted on a drive. Use RFs::Drive() if only williamr@2: the drive information is required. williamr@2: williamr@2: If a drive supports removable media it may contain different volumes over time. williamr@2: williamr@2: Volume information is made up of information concerning the drive on which it is mounted, williamr@2: which can also be accessed through RFs::Drive(), and the volume information, this is made williamr@2: up of the size of the volume, the free space, its unique identifying number and a name. williamr@2: williamr@2: TVolumeInfo is initialised by RFs::Volume(). williamr@2: williamr@2: @see RFs::Volume() williamr@2: @see RFs::Drive() williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C TVolumeInfo(); williamr@2: williamr@2: /** williamr@2: Information about the drive on which the volume is mounted. williamr@2: williamr@2: @see TDriveInfo williamr@2: */ williamr@2: TDriveInfo iDrive; williamr@2: williamr@2: williamr@2: /** williamr@2: The volume’s unique identifying number. williamr@2: */ williamr@2: TUint iUniqueID; williamr@2: williamr@2: williamr@2: /** williamr@2: The maximum size of the volume in bytes. The current amount of memory williamr@2: in use plus the amount of free memory. williamr@2: */ williamr@2: TInt64 iSize; williamr@2: williamr@2: williamr@2: /** williamr@2: The amount of free space on the volume in bytes. williamr@2: */ williamr@2: TInt64 iFree; williamr@2: williamr@2: williamr@2: /** williamr@2: Name of the volume, with a maximum of KMaxFileName characters. williamr@2: williamr@2: This field is optional. williamr@2: williamr@2: @see KMaxFileName williamr@2: */ williamr@2: TBufC iName; williamr@2: williamr@2: /** williamr@2: Flags which define the default file-caching behaviour for this volume williamr@2: williamr@2: @see TFileCacheFlags williamr@2: */ williamr@2: TFileCacheFlags iFileCacheFlags; williamr@4: williamr@2: /** williamr@2: @prototype williamr@2: @internalTechnology williamr@2: Internal flag, used in the case of non-blocking getting volume information. williamr@2: @see RFs::Volume(TVolumeInfo& aVol,TInt aDrive, TRequestStatus& aStat) williamr@2: williamr@2: If this flag is set, it means that the volume information will be obtained williamr@2: asynchronously. More specific, on return iFree will reflect the _current_ amount of free space on volume at the moment of williamr@2: RFs::Volume() call, not the exact final value. This is because in this case getting volume information will be asynchronous, williamr@2: and the client will not be suspended until the mount finish calculating free space. At present appicable to FAT32 file system only. williamr@2: */ williamr@2: TUint8 iVolSizeAsync : 1; williamr@2: williamr@2: private: williamr@2: /** williamr@2: Reserved for future expansion williamr@2: */ williamr@2: TUint8 i8Reserved1; williamr@2: TUint16 i16Reserved1; williamr@2: TUint32 i32Reserved1; williamr@2: TUint32 i32Reserved2; williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: class TDriveUnit williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Drive numbers and letters. williamr@2: williamr@2: A drive may be represented by either an integer between zero and twenty five williamr@2: inclusive, or by a buffer descriptor containing a character between "A" and "Z" williamr@2: inclusive, followed by a colon. williamr@2: This class encapsulates both representations. williamr@2: An instance of this class is constructed specifying either the drive number williamr@2: or the drive letter and may be converted between the two representations. williamr@2: */ williamr@2: { williamr@2: public: williamr@2: inline TDriveUnit() {}; williamr@2: IMPORT_C TDriveUnit(TInt aDrive); williamr@2: IMPORT_C TDriveUnit(const TDesC& aDrive); williamr@2: IMPORT_C TDriveUnit& operator=(TInt aDrive); williamr@2: IMPORT_C TDriveUnit& operator=(const TDesC& aDrive); williamr@2: inline operator TInt() const; williamr@2: IMPORT_C TDriveName Name() const; williamr@2: private: williamr@2: TInt iDrive; williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: class RFs; williamr@2: // williamr@2: class TParseBase williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Base class for file name parsing. williamr@2: williamr@2: You first need to set up the path to be parsed using either a TParse, TParsePtr williamr@2: or TParsePtrC object. williamr@2: williamr@2: The interrogation and extraction functions in this class allow you to test williamr@2: whether a component has been specified in the pathname, and if so, williamr@2: to extract it. If a component is not present in the pathname, williamr@2: the extraction function returns an empty string. williamr@2: williamr@2: This class also allows directories to be added to, and popped from the path. williamr@2: williamr@2: Notes: williamr@2: williamr@2: 1. the filename modification functions cannot be used by the TParsePtrC class. williamr@2: williamr@2: 2. navigation using .. and . is not supported. williamr@2: williamr@2: @see TParse williamr@2: @see TParsePtr williamr@2: @see TParsePtrC williamr@2: */ williamr@2: { williamr@2: private: williamr@2: struct SField {TUint8 pos;TUint8 len;TUint8 present;TUint8 filler;}; williamr@2: enum TField {EDrive,EPath,EName,EExt,EMaxFields}; williamr@2: enum TWild {EWildName=0x01,EWildExt=0x02,EWildEither=0x04,EIsRoot=0x08,EWildIsKMatchOne=0x10,EWildIsKMatchAny=0x20}; williamr@2: public: williamr@2: IMPORT_C TParseBase(); williamr@2: IMPORT_C TInt PopDir(); williamr@2: IMPORT_C TInt AddDir(const TDesC& aName); williamr@2: IMPORT_C const TDesC& FullName() const; williamr@2: IMPORT_C TPtrC Drive() const; williamr@2: IMPORT_C TPtrC Path() const; williamr@2: IMPORT_C TPtrC DriveAndPath() const; williamr@2: IMPORT_C TPtrC Name() const; williamr@2: IMPORT_C TPtrC Ext() const; williamr@2: IMPORT_C TPtrC NameAndExt() const; williamr@2: IMPORT_C TBool DrivePresent() const; williamr@2: IMPORT_C TBool PathPresent() const; williamr@2: IMPORT_C TBool NamePresent() const; williamr@2: IMPORT_C TBool ExtPresent() const; williamr@2: IMPORT_C TBool NameOrExtPresent() const; williamr@2: IMPORT_C TBool IsRoot() const; williamr@2: IMPORT_C TBool IsWild() const; williamr@2: IMPORT_C TBool IsKMatchOne() const; williamr@2: IMPORT_C TBool IsKMatchAny() const; williamr@2: IMPORT_C TBool IsNameWild() const; williamr@2: IMPORT_C TBool IsExtWild() const; williamr@2: protected: williamr@2: virtual TDes& NameBuf() = 0; // Reference to derived class descriptor containing the filename. williamr@2: virtual const TDesC& NameBufC() const = 0; // const reference to derived class descriptor containing the filename. williamr@2: TInt Set(const TDesC* aName,const TDesC* aRelated,const TDesC* aDefault,TBool allowWild); williamr@2: private: williamr@2: TInt ParseDrive(TLex& aName,TBool& aDone); williamr@2: TInt ParsePath(TLex& aName,TBool& aDone); williamr@2: TInt ParseName(TLex& aName,TBool& aDone); williamr@2: TInt ParseExt(TLex& aName,TBool& aDone); williamr@2: protected: williamr@2: TInt16 iMod; // Non-zero indicates File name modification functionality is enabled. williamr@2: private: williamr@2: TInt16 iWild; williamr@2: SField iField[EMaxFields]; williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: class TParsePtr : public TParseBase williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Parses filenames using less space on the stack than TParse. williamr@2: williamr@2: Stores a reference to a filename, unlike TParse, which uses williamr@2: a 512 byte TFileName object as an internal buffer to store williamr@2: a copy of the filename. williamr@2: The filename's components (drive, path, etc.) can be retrieved using williamr@2: the functions provided by the base class, TParseBase. williamr@2: This class should be used in preference to TParse when minimising stack williamr@2: usage is a priority. williamr@2: williamr@2: @see TParse williamr@2: @see TFileName williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C TParsePtr(TDes& aName); williamr@2: protected: williamr@2: IMPORT_C TDes& NameBuf(); williamr@2: IMPORT_C const TDesC& NameBufC() const; williamr@2: private: williamr@2: TPtr iNameBuf; williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: class TParsePtrC : public TParseBase williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Parses, but cannot modify, filenames using less space on the stack than TParse. williamr@2: williamr@2: Stores a reference to a filename, unlike TParse, which uses williamr@2: a 512 byte TFileName object as an internal buffer to store williamr@2: a copy of the filename. williamr@2: The filename's components (drive, path, etc.) can be retrieved using williamr@2: the functions provided by the base class, TParseBase. williamr@2: Note that because the filename cannot be modified through this class, williamr@2: the base class functions PopDir() and AddDir() cannot be called, because williamr@2: a panic will be raised. williamr@2: williamr@2: @see TParse williamr@2: @see TFileName williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C TParsePtrC(const TDesC& aName); williamr@2: protected: williamr@2: IMPORT_C TDes& NameBuf(); williamr@2: IMPORT_C const TDesC& NameBufC() const; williamr@2: private: williamr@2: TPtrC iNameBuf; williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: class TParse : public TParseBase williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Parses filenames. williamr@2: williamr@2: The class uses the full filename structure supported by Symbian OS. williamr@2: williamr@2: TParse works by using the Set() function to set up the filename to be parsed. williamr@2: Then, various getter functions defined in the base class, TParseBase, such as: williamr@2: FullName(), Drive(), Path(), DriveAndPath(), Name(), Ext() and NameAndExt() williamr@2: may be used to retrieve path components. williamr@2: williamr@2: There are a number of restrictions to valid path components, which are williamr@2: described in guide documentation. williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C TParse(); williamr@2: IMPORT_C TInt Set(const TDesC& aName,const TDesC* aRelated,const TDesC* aDefault); williamr@2: IMPORT_C TInt SetNoWild(const TDesC& aName,const TDesC* aRelated,const TDesC* aDefault); williamr@2: protected: williamr@2: IMPORT_C TDes& NameBuf(); williamr@2: IMPORT_C const TDesC& NameBufC() const; williamr@2: private: williamr@2: TFileName iNameBuf; williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: class CDir : public CBase williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Array of directory entries that has been read into memory from the file system. williamr@2: williamr@2: It can be read and sorted by user programs, but cannot be created by them. williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C virtual ~CDir(); williamr@2: IMPORT_C TInt Count() const; williamr@2: IMPORT_C const TEntry& operator[](TInt anIndex) const; williamr@2: IMPORT_C TInt Sort(TUint aEntrySortKey); williamr@2: protected: williamr@2: IMPORT_C CDir(); williamr@2: IMPORT_C static CDir* NewL(); williamr@2: IMPORT_C void AddL(const TEntry& anEntry); williamr@2: IMPORT_C void ExtractL(TBool aRemove,CDir*& aDir); williamr@2: IMPORT_C void Compress(); williamr@2: protected: williamr@2: CArrayPakFlat* iArray; williamr@2: friend class RFs; williamr@2: friend class TOpenFileScan; williamr@2: }; williamr@2: williamr@2: williamr@4: #if defined SYMBIAN_PRIVATE_EFSRV williamr@4: #define EFSRV_EXPORT_C williamr@4: #define EFSRV_IMPORT_C williamr@4: #else williamr@4: #define EFSRV_EXPORT_C EXPORT_C williamr@4: #define EFSRV_IMPORT_C IMPORT_C williamr@4: #endif williamr@2: williamr@4: // forward declarations from e32ldr_private.h williamr@4: class RFileClamp; williamr@2: williamr@2: class RFs : public RSessionBase williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: A handle to a file server session. williamr@2: williamr@2: A program or thread may have arbitrarily many sessions open simultaneously. williamr@2: williamr@2: Use this class for all file system manipulation, including: williamr@2: williamr@2: 1. adding, removing, moving and renaming files and directories williamr@2: williamr@2: 2. inspecting and changing file attributes and directory entry details. williamr@2: These include the time and date when the file or directory was last williamr@2: written to, its size and various attribute flags such as read-only, williamr@2: hidden, archive or system. williamr@2: williamr@2: 3. finding a file’s real name; if the file system on which it is stored williamr@2: has to "mangle" the name into a shorter format williamr@2: williamr@2: 4. getting directory listings williamr@2: williamr@2: 5. maintaining a default path; unlike some other systems, there is a single williamr@2: system default path, rather than one for each drive: the default path williamr@2: consists of a drive and a path specification. williamr@2: williamr@2: 6. performing context-sensitive parses using TParse objects, and williamr@2: the session path williamr@2: williamr@2: 7. obtaining information on drives and volumes williamr@2: williamr@2: 8. formatting and labelling volumes williamr@2: williamr@2: 9. obtaining a list of valid drives williamr@2: williamr@2: 10. emulating the DOS subst command, which allows any directory to appear williamr@2: as if it were a separate drive williamr@2: williamr@2: 11. requesting notification of when significant change occurs. williamr@2: This can be used for programs which maintain file lists, but must williamr@2: update those lists when change occurs. williamr@2: williamr@2: 12. finding the version number of the file server williamr@2: williamr@2: 13. resource counting to ensure that all resources are closed when williamr@2: the session terminates. williamr@2: williamr@2: This class is not intended for user derivation. williamr@2: williamr@2: The following restrictions apply when a path is specified: williamr@2: williamr@2: 1. its total length must not exceed 256 characters williamr@2: williamr@2: 2. wildcards cannot be used in the drive or in any directory name, williamr@2: although they may be allowed in the filename and extension. williamr@2: williamr@2: 3. double backslashes are not allowed in the path. williamr@2: williamr@2: 4. the following characters must not be included anywhere in the path: < > " / | williamr@2: williamr@2: 5. a colon may only be included between the drive and path williamr@2: williamr@2: 6. no directory name or filename plus extension may consist solely williamr@2: of space characters, or of a single or double dot. williamr@2: williamr@2: 7. spaces between the drive, if specified, and the first directory in williamr@2: the path are illegal, although there may be spaces between other williamr@2: path components, for instance between directories. williamr@2: */ williamr@2: { williamr@2: public: williamr@4: EFSRV_IMPORT_C TInt Connect(TInt aMessageSlots=KFileServerDefaultMessageSlots); williamr@4: EFSRV_IMPORT_C void Close(); williamr@4: EFSRV_IMPORT_C TVersion Version() const; williamr@4: EFSRV_IMPORT_C TInt AddFileSystem(const TDesC& aFileName) const; williamr@4: EFSRV_IMPORT_C TInt MountFileSystem(const TDesC& aFileSystemName,TInt aDrive) const; williamr@4: EFSRV_IMPORT_C TInt MountFileSystem(const TDesC& aFileSystemName,TInt aDrive, TBool aIsSync) const; williamr@4: EFSRV_IMPORT_C TInt MountFileSystemAndScan(const TDesC& aFileSystemName,TInt aDrive,TBool& aIsMountSuccess) const; williamr@4: EFSRV_IMPORT_C TInt MountFileSystem(const TDesC& aFileSystemName,const TDesC& aExtensionName,TInt aDrive); williamr@4: EFSRV_IMPORT_C TInt MountFileSystem(const TDesC& aFileSystemName,const TDesC& aExtensionName,TInt aDrive, TBool aIsSync); williamr@4: EFSRV_IMPORT_C TInt MountFileSystemAndScan(const TDesC& aFileSystemName,const TDesC& aExtensionName,TInt aDrive,TBool& aIsMountSuccess) const; williamr@4: EFSRV_IMPORT_C TInt DismountFileSystem(const TDesC& aFileSystemName,TInt aDrive) const; williamr@4: EFSRV_IMPORT_C TInt RemoveFileSystem(const TDesC& aFileSystemName) const; williamr@4: EFSRV_IMPORT_C TInt FileSystemName(TDes& aName,TInt aDrive) const; williamr@4: EFSRV_IMPORT_C TInt AddExtension(const TDesC& aFileName); williamr@4: EFSRV_IMPORT_C TInt MountExtension(const TDesC& aExtensionName,TInt aDrive); williamr@4: EFSRV_IMPORT_C TInt DismountExtension(const TDesC& aExtensionName,TInt aDrive); williamr@4: EFSRV_IMPORT_C TInt RemoveExtension(const TDesC& aExtensionName); williamr@4: EFSRV_IMPORT_C TInt ExtensionName(TDes& aExtensionName,TInt aDrive,TInt aPos); williamr@4: EFSRV_IMPORT_C TInt RemountDrive(TInt aDrive,const TDesC8* aMountInfo=NULL,TUint aFlags=0); williamr@4: EFSRV_IMPORT_C void NotifyChange(TNotifyType aType,TRequestStatus& aStat); williamr@4: EFSRV_IMPORT_C void NotifyChange(TNotifyType aType,TRequestStatus& aStat,const TDesC& aPathName); williamr@4: EFSRV_IMPORT_C void NotifyChangeCancel(); williamr@4: EFSRV_IMPORT_C void NotifyChangeCancel(TRequestStatus& aStat); williamr@4: EFSRV_IMPORT_C void NotifyDiskSpace(TInt64 aThreshold,TInt aDrive,TRequestStatus& aStat); williamr@4: EFSRV_IMPORT_C void NotifyDiskSpaceCancel(TRequestStatus& aStat); williamr@4: EFSRV_IMPORT_C void NotifyDiskSpaceCancel(); williamr@4: EFSRV_IMPORT_C TInt DriveList(TDriveList& aList) const; williamr@4: EFSRV_IMPORT_C TInt DriveList(TDriveList& aList, TUint aFlags) const; williamr@4: EFSRV_IMPORT_C TInt Drive(TDriveInfo& anInfo,TInt aDrive=KDefaultDrive) const; williamr@4: EFSRV_IMPORT_C TInt Volume(TVolumeInfo& aVol,TInt aDrive=KDefaultDrive) const; williamr@4: EFSRV_IMPORT_C void Volume(TVolumeInfo& aVol,TInt aDrive, TRequestStatus& aStat) const; williamr@4: EFSRV_IMPORT_C TInt SetVolumeLabel(const TDesC& aName,TInt aDrive=KDefaultDrive); williamr@4: EFSRV_IMPORT_C TInt Subst(TDes& aPath,TInt aDrive=KDefaultDrive) const; williamr@4: EFSRV_IMPORT_C TInt SetSubst(const TDesC& aPath,TInt aDrive=KDefaultDrive); williamr@4: EFSRV_IMPORT_C TInt RealName(const TDesC& aName,TDes& aResult) const; williamr@4: EFSRV_IMPORT_C TInt GetMediaSerialNumber(TMediaSerialNumber& aSerialNum, TInt aDrive); williamr@4: EFSRV_IMPORT_C TInt SessionPath(TDes& aPath) const; williamr@4: EFSRV_IMPORT_C TInt SetSessionPath(const TDesC& aPath); williamr@4: EFSRV_IMPORT_C TInt Parse(const TDesC& aName,TParse& aParse) const; williamr@4: EFSRV_IMPORT_C TInt Parse(const TDesC& aName,const TDesC& aRelated,TParse& aParse) const; williamr@4: EFSRV_IMPORT_C TInt MkDir(const TDesC& aPath); williamr@4: EFSRV_IMPORT_C TInt MkDirAll(const TDesC& aPath); williamr@4: EFSRV_IMPORT_C TInt RmDir(const TDesC& aPath); williamr@4: EFSRV_IMPORT_C TInt GetDir(const TDesC& aName,TUint anEntryAttMask,TUint anEntrySortKey,CDir*& anEntryList) const; williamr@4: EFSRV_IMPORT_C TInt GetDir(const TDesC& aName,TUint anEntryAttMask,TUint anEntrySortKey,CDir*& anEntryList,CDir*& aDirList) const; williamr@4: EFSRV_IMPORT_C TInt GetDir(const TDesC& aName,const TUidType& anEntryUid,TUint anEntrySortKey,CDir*& aFileList) const; williamr@4: EFSRV_IMPORT_C TInt Delete(const TDesC& aName); williamr@4: EFSRV_IMPORT_C TInt Rename(const TDesC& anOldName,const TDesC& aNewName); williamr@4: EFSRV_IMPORT_C TInt Replace(const TDesC& anOldName,const TDesC& aNewName); williamr@4: EFSRV_IMPORT_C TInt Att(const TDesC& aName,TUint& aAttValue) const; williamr@4: EFSRV_IMPORT_C TInt SetAtt(const TDesC& aName,TUint aSetAttMask,TUint aClearAttMask); williamr@4: EFSRV_IMPORT_C TInt Modified(const TDesC& aName,TTime& aTime) const; williamr@4: EFSRV_IMPORT_C TInt SetModified(const TDesC& aName,const TTime& aTime); williamr@4: EFSRV_IMPORT_C TInt Entry(const TDesC& aName,TEntry& anEntry) const; williamr@4: EFSRV_IMPORT_C TInt SetEntry(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask); williamr@4: private: williamr@4: EFSRV_IMPORT_C TInt ReadFileSection_RESERVED(const TDesC& aName,TInt aPos,TDes8& aDes,TInt aLength) const; williamr@4: public: williamr@4: EFSRV_IMPORT_C static TBool IsValidDrive(TInt aDrive); williamr@4: EFSRV_IMPORT_C static TInt CharToDrive(TChar aChar,TInt& aDrive); williamr@4: EFSRV_IMPORT_C static TInt DriveToChar(TInt aDrive,TChar& aChar); williamr@4: EFSRV_IMPORT_C static TBool IsRomAddress(TAny* aAny); williamr@4: EFSRV_IMPORT_C static TDriveNumber GetSystemDrive(); williamr@4: EFSRV_IMPORT_C static TChar GetSystemDriveChar(); williamr@4: EFSRV_IMPORT_C TInt SetSystemDrive(TDriveNumber aSystemDrive); williamr@4: EFSRV_IMPORT_C void ResourceCountMarkStart() const; williamr@4: EFSRV_IMPORT_C void ResourceCountMarkEnd() const; williamr@4: EFSRV_IMPORT_C TInt ResourceCount() const; williamr@4: EFSRV_IMPORT_C TInt IsFileOpen(const TDesC& aFile,TBool& anAnswer) const; williamr@4: EFSRV_IMPORT_C TInt CheckDisk(const TDesC& aDrive) const; williamr@4: EFSRV_IMPORT_C TInt ScanDrive(const TDesC& aDrive) const; williamr@4: EFSRV_IMPORT_C TInt GetShortName(const TDesC& aLongName,TDes& aShortName) const; williamr@4: EFSRV_IMPORT_C TInt GetLongName(const TDesC& aShortName,TDes& aLongName) const; williamr@4: EFSRV_IMPORT_C TBool GetNotifyUser(); williamr@4: EFSRV_IMPORT_C void SetNotifyUser(TBool aValue); williamr@4: EFSRV_IMPORT_C TUint8* IsFileInRom(const TDesC& aFileName) const; williamr@4: EFSRV_IMPORT_C TBool IsValidName(const TDesC& anEntryName) const; williamr@4: EFSRV_IMPORT_C TBool IsValidName(const TDesC& aFileName,TText& aBadChar) const; williamr@4: EFSRV_IMPORT_C TInt GetDriveName(TInt aDrive,TDes& aDriveName) const; williamr@4: EFSRV_IMPORT_C TInt SetDriveName(TInt aDrive,const TDesC& aDriveName); williamr@4: EFSRV_IMPORT_C TInt LoaderHeapFunction(TInt aFunction, TAny *aArg1=NULL, TAny *aArg2=NULL); williamr@2: IMPORT_C TInt SetErrorCondition(TInt anError,TInt aCount=0); williamr@4: EFSRV_IMPORT_C TInt SetDebugRegister(TInt aVal); williamr@4: EFSRV_IMPORT_C TInt SetAllocFailure(TInt aAllocNum); williamr@4: EFSRV_IMPORT_C void DebugNotify(TInt aDrive,TUint aNotifyType,TRequestStatus& aStat); williamr@4: EFSRV_IMPORT_C TInt ControlIo(TInt aDrive,TInt aCommand); williamr@4: EFSRV_IMPORT_C TInt ControlIo(TInt aDrive,TInt aCommand,TDes8& aParam1); williamr@4: EFSRV_IMPORT_C TInt ControlIo(TInt aDrive,TInt aCommand,TDes8& aParam1,TDes8& aParam2); williamr@4: EFSRV_IMPORT_C TInt ControlIo(TInt aDrive,TInt aCommand,TAny* aParam1,TAny* aParam2); williamr@4: EFSRV_IMPORT_C TInt LockDrive(TInt aDrv, const TMediaPassword &aOld, const TMediaPassword &aNew, TBool aStr); williamr@4: EFSRV_IMPORT_C TInt UnlockDrive(TInt aDrv, const TMediaPassword &Pswd, TBool aStr); williamr@4: EFSRV_IMPORT_C TInt ClearPassword(TInt aDrv, const TMediaPassword &aPswd); williamr@4: EFSRV_IMPORT_C TInt ErasePassword(TInt aDrv); williamr@4: EFSRV_IMPORT_C TInt SetSessionToPrivate(TInt aDrive); williamr@4: EFSRV_IMPORT_C TInt PrivatePath(TDes& aPath); williamr@4: EFSRV_IMPORT_C TInt CreatePrivatePath(TInt aDrive); williamr@4: EFSRV_IMPORT_C void StartupInitComplete(TRequestStatus& aStat); williamr@4: EFSRV_IMPORT_C TInt SetLocalDriveMapping(const TDesC8& aMapping); williamr@4: williamr@4: EFSRV_IMPORT_C TInt FinaliseDrives(); williamr@2: williamr@2: /** specifies drive finalisation modes */ williamr@2: enum TFinaliseDrvMode williamr@2: { williamr@2: EFinal_RW, ///< after successful finalisation the drive remains writable and will become "not finalised" after the first write operation. williamr@2: EFinal_RO, ///< after successful finalisation the drive becomes read-only williamr@2: EForceUnfinalise///< @internalComponent mark the drive as "not finalised" can result in KErrAbort if the dive is in inconsistent state. williamr@2: }; williamr@2: williamr@4: EFSRV_IMPORT_C TInt FinaliseDrive(TInt aDriveNo, TFinaliseDrvMode aMode) const; williamr@4: williamr@4: EFSRV_IMPORT_C TInt SwapFileSystem(const TDesC& aOldFileSystemName,const TDesC& aNewFileSystemName,TInt aDrive) const; williamr@4: EFSRV_IMPORT_C TInt ReserveDriveSpace(TInt aDriveNo, TInt aSpace); williamr@4: EFSRV_IMPORT_C TInt GetReserveAccess(TInt aDriveNo); williamr@4: EFSRV_IMPORT_C TInt ReleaseReserveAccess(TInt aDriveNo); williamr@4: williamr@4: EFSRV_IMPORT_C TInt AddPlugin(const TDesC& aFileName) const; williamr@4: EFSRV_IMPORT_C TInt RemovePlugin(const TDesC& aPluginName) const; williamr@4: EFSRV_IMPORT_C TInt PluginName(TDes& aPluginName,TInt aDrive,TInt aPos); williamr@4: williamr@4: EFSRV_IMPORT_C TInt MountPlugin(const TDesC& aPluginName) const; williamr@4: EFSRV_IMPORT_C TInt MountPlugin(const TDesC& aPluginName,TInt aDrive) const; williamr@4: EFSRV_IMPORT_C TInt MountPlugin(const TDesC& aPluginName,TInt aDrive, TInt aPos) const; williamr@2: williamr@4: EFSRV_IMPORT_C TInt DismountPlugin(const TDesC& aPluginName) const; williamr@4: EFSRV_IMPORT_C TInt DismountPlugin(const TDesC& aPluginName,TInt aDrive) const; williamr@4: EFSRV_IMPORT_C TInt DismountPlugin(const TDesC& aPluginName,TInt aDrive,TInt aPos) const; williamr@4: williamr@4: EFSRV_IMPORT_C void NotifyDismount(TInt aDrive, TRequestStatus& aStat, TNotifyDismountMode aMode=EFsDismountRegisterClient) const; williamr@4: EFSRV_IMPORT_C void NotifyDismountCancel(TRequestStatus& aStat) const; williamr@4: EFSRV_IMPORT_C void NotifyDismountCancel() const; williamr@4: EFSRV_IMPORT_C TInt AllowDismount(TInt aDrive) const; williamr@4: EFSRV_IMPORT_C TInt SetStartupConfiguration(TInt aCommand,TAny* aParam1,TAny* aParam2) const; williamr@4: EFSRV_IMPORT_C TInt AddCompositeMount(const TDesC& aFileSystemName,TInt aLocalDriveToMount,TInt aCompositeDrive, TBool aSync) const; williamr@4: EFSRV_IMPORT_C TInt SetNotifyChange(TBool aNotifyChange); williamr@4: EFSRV_IMPORT_C TInt QueryVolumeInfoExt(TInt aDrive, TQueryVolumeInfoExtCmd aCommand, TDes8& aInfo) const; williamr@4: EFSRV_IMPORT_C TInt VolumeIOParam(TInt aDriveNo, TVolumeIOParamInfo& aParamInfo) const; williamr@4: EFSRV_IMPORT_C TInt FileSystemSubType(TInt aDriveNo, TDes& aName) const; williamr@4: EFSRV_IMPORT_C TInt InitialisePropertiesFile(const TPtrC8& aPtr) const; williamr@4: williamr@4: IMPORT_C TInt AddProxyDrive(const TDesC& aFileName); williamr@4: IMPORT_C TInt RemoveProxyDrive(const TDesC& aDriveName); williamr@4: williamr@4: template inline TInt MountProxyDrive(const TUint aDrive, const TDesC& aName, T0 a0, T1 a1) williamr@4: { return(DoMountProxyDrive(TIpcArgs(aDrive, &aName, a0, a1))); }; williamr@4: IMPORT_C TInt DismountProxyDrive(const TUint aDrive); williamr@4: williamr@2: TInt Unclamp(const RFileClamp& aHandle); williamr@4: williamr@4: EFSRV_IMPORT_C TInt ReadFileSection(const TDesC& aName,TInt64 aPos,TDes8& aDes,TInt aLength) const; williamr@4: williamr@4: /** williamr@4: This class is used to for returning meaningful error code values to users of RFs::IsValidName(const TDesC& ,TNameValidParam& ) williamr@4: @see TError williamr@4: */ williamr@4: class TNameValidParam williamr@4: { williamr@4: public: williamr@4: /** Initialises the members of the class. By default iUseSessionPath is set to EFalse, however one could set it to ETrue.*/ williamr@4: inline TNameValidParam(TBool aUseSessionPath = EFalse); williamr@4: williamr@4: /** possible error codes */ williamr@4: enum TError williamr@4: { williamr@4: ErrNone, ///< no error. williamr@4: ErrBadCharacter, ///< aName contains a bad character; and its position is in iInvalidCharPos. williamr@4: ErrBadName, ///< aName isn't a valid file or directory name. williamr@4: ErrNameTooLong ///< aName length or aName + session path length (see iUseSessionPath) is longer than 256 characters. williamr@4: }; williamr@4: williamr@4: inline TError ErrorCode() const; williamr@4: inline void UseSessionPath(TBool aUseSessionPath); williamr@4: inline TUint InvalidCharPos() const; williamr@4: friend class TFsIsValidName; williamr@4: private: williamr@4: TError iError; ///< the reason why aName is invalid, see TError williamr@4: TBool iUseSessionPath; ///< if ETrue, and if aName isn't fully specified, missing parts will be taken from the session path williamr@4: TUint iInvalidCharPos; ///< may contain invalid character position if error is ErrBadCharacter,else 0. williamr@4: }; williamr@4: EFSRV_IMPORT_C TBool IsValidName(const TDesC& aName, TNameValidParam& aParam ); williamr@4: williamr@4: /** Special enumerator values for the SupportedFileSystemName() API */ williamr@4: enum williamr@4: { williamr@4: KRootFileSystem = 0x00800000, ///< specifies "root" file system. The result will be the same as for FileSystemName() API call williamr@4: KFirstChildFileSystem = 0 ///< specifies the first child file system number, the second will be KFirstChildFileSystem+1 etc. williamr@4: }; williamr@4: williamr@4: EFSRV_IMPORT_C TInt SupportedFileSystemName(TDes& aName, TInt aDrive, TInt aFsEnumerator) const; williamr@4: williamr@4: protected: williamr@4: TInt SendReceive(TInt aFunction,const TIpcArgs& aArgs) const; williamr@2: williamr@2: private: williamr@2: void GetDirL(const TDesC& aMatchName,TUint anEntryAttMask,TUint anEntrySortKey,CDir*& anEntryList,CDir*& aDirList,RDir& aDir) const; williamr@2: void GetDirL(const TDesC& aMatchName,TUint anEntryAttMask,TUint anEntrySortKey,CDir*& anEntryList,RDir& aDir) const; williamr@2: void GetDirL(const TDesC& aMatchName,const TUidType& aUidType,TUint anEntrySortKey,CDir*& anEntryList,RDir& aDir) const; williamr@2: void DoGetDirL(TUint anEntrySortKey,CDir*& anEntryList,RDir& aDir) const; williamr@2: TInt GetOpenFileList(TInt& aSessionNum,TInt& aLocalPos,TThreadId& aThreadId,TEntryArray& anArray) const; williamr@4: williamr@4: IMPORT_C TInt DoMountProxyDrive(const TIpcArgs& ipcArgs); williamr@4: williamr@2: friend class TOpenFileScan; williamr@4: friend class RFsPlugin; williamr@2: }; williamr@2: williamr@2: williamr@4: //------------------------------------------------------------------------------------------------------------------- williamr@4: williamr@4: /** williamr@4: williamr@4: Base class for volume formatting parameters. This class package buffer, TVolFormatParamBuf or williamr@4: packaged buffer of the derived class can be passed to the RFormat::Open() in order to provide williamr@4: file system-specific formatting parameters. williamr@4: Each file system that supports such formatting parameters shall have this class specialisation (e.g. TVolFormatParam_FAT) williamr@4: All classes, derived from this one must have the same size as the base class. williamr@4: In order to use formatting parameters the format mode shall have ESpecialFormat bit flag set. williamr@4: williamr@4: williamr@4: @see RFormat::Open(RFs&,const TDesC&,TUint,TInt& ,const TDesC8& anInfo); williamr@4: @see TVolFormatParamBuf williamr@4: williamr@4: @publishedAll williamr@4: @released williamr@4: */ williamr@4: class TVolFormatParam williamr@4: { williamr@4: public: williamr@4: inline TVolFormatParam(); williamr@4: inline void Init(); williamr@4: williamr@4: inline void SetFileSystemName(const TDesC& aFsName); williamr@4: williamr@4: static inline TUint32 CalcFSNameHash(const TDesC& aFsName); williamr@4: inline TUint32 FSNameHash() const; williamr@4: williamr@4: inline TBool SomeParamsSet() const; williamr@4: williamr@4: williamr@4: protected: williamr@4: williamr@4: williamr@4: enum {KMaxDataSlots = 64}; ///< the size of data array iData williamr@4: williamr@4: inline void SetVal(TUint aIndex, TUint32 aVal); williamr@4: inline TUint32 GetVal(TUint aIndex) const; williamr@4: williamr@4: williamr@4: public: williamr@4: enum {KUId = 0x820116A2}; ///< this value shell be in iUid field to identify this class object williamr@4: williamr@4: /** williamr@4: This class tree UID. Used to distinguish the object of this class from TLDFormatInfo and other possible data structures. williamr@4: For this and derived classes this field must be KUId. This field offset in the class must be 0 williamr@4: */ williamr@4: const TUint32 iUId; williamr@4: williamr@4: private: williamr@4: TUint32 iFSysNameHash; ///< Up-cased file system name hash (crc32) used to designate the file system. 0 means "not set" williamr@4: TBool iParamsSet : 1; ///< ETrue if any parameter was set (SetVal() called). Gets reset to EFalse by Init() williamr@4: TUint32 iData[KMaxDataSlots]; ///< used as a pool for various data. The derived classes are free to use it by SetVal()/GetVal() williamr@4: }; williamr@4: williamr@4: __ASSERT_COMPILE(_FOFF(TVolFormatParam, iUId) == 0); williamr@4: williamr@4: williamr@4: /** package buffer for the objects of class TVolFormatParamBuf */ williamr@4: typedef TPckgBuf TVolFormatParamBuf; williamr@4: williamr@4: williamr@4: williamr@4: williamr@4: #ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Creates and opens a file, and performs all operations on a single open file. williamr@2: williamr@2: These include: williamr@2: williamr@2: - reading from and writing to the file williamr@2: williamr@2: - seeking to a position within the file williamr@2: williamr@2: - locking and unlocking within the file williamr@2: williamr@2: - setting file attributes williamr@2: williamr@2: Before using any of these services, a connection to a file server session must williamr@2: have been made, and the file must be open. williamr@2: williamr@2: Opening Files: williamr@2: williamr@2: - use Open() to open an existing file for reading or writing; an error is williamr@2: returned if it does not already exist. williamr@2: To open an existing file for reading only, use Open() with an access mode of williamr@2: EFileRead, and a share mode of EFileShareReadersOnly. williamr@2: williamr@2: - use Create() to create and open a new file for writing; an error is returned williamr@2: if it already exists. williamr@2: williamr@2: - use Replace() to open a file for writing, replacing any existing file of williamr@2: the same name if one exists, or creating a new file if one does not exist. williamr@2: Note that if a file exists, its length is reset to zero. williamr@2: williamr@2: - use Temp() to create and open a temporary file with a unique name, williamr@2: for writing and reading. williamr@2: williamr@2: When opening a file, you must specify the file server session to use for williamr@2: operations with that file. If you do not close the file explicitly, it is williamr@2: closed when the server session associated with it is closed. williamr@2: williamr@2: Reading and Writing: williamr@2: williamr@2: There are several variants of both Read() and Write(). williamr@2: The basic Read(TDes8& aDes) and Write(const TDesC8& aDes) are supplemented williamr@2: by variants allowing the descriptor length to be overridden, or the seek williamr@2: position of the first byte to be specified, or asynchronous completion, williamr@2: or any combination. williamr@2: williamr@2: Reading transfers data from a file to a descriptor, and writing transfers williamr@2: data from a descriptor to a file. In all cases, the file data is treated williamr@2: as binary and byte descriptors are used (TDes8, TDesC8). williamr@2: williamr@2: @see TDes8 williamr@2: @see TDesC8 williamr@2: */ williamr@4: #else williamr@4: /** williamr@4: @publishedAll williamr@4: @released williamr@4: williamr@4: Creates and opens a file, and performs all operations on a single open file. williamr@4: williamr@4: These include: williamr@4: williamr@4: - reading from and writing to the file williamr@4: williamr@4: - seeking to a position within the file williamr@4: williamr@4: - locking and unlocking within the file williamr@4: williamr@4: - setting file attributes williamr@4: williamr@4: Before using any of these services, a connection to a file server session must williamr@4: have been made, and the file must be open. williamr@4: williamr@4: Opening Files: williamr@4: williamr@4: - use Open() to open an existing file for reading or writing; an error is williamr@4: returned if it does not already exist. williamr@4: To open an existing file for reading only, use Open() with an access mode of williamr@4: EFileRead, and a share mode of EFileShareReadersOnly. williamr@4: williamr@4: - use Create() to create and open a new file for writing; an error is returned williamr@4: if it already exists. williamr@4: williamr@4: - use Replace() to open a file for writing, replacing any existing file of williamr@4: the same name if one exists, or creating a new file if one does not exist. williamr@4: Note that if a file exists, its length is reset to zero. williamr@4: williamr@4: - use Temp() to create and open a temporary file with a unique name, williamr@4: for writing and reading. williamr@4: williamr@4: When opening a file, you must specify the file server session to use for williamr@4: operations with that file. If you do not close the file explicitly, it is williamr@4: closed when the server session associated with it is closed. williamr@4: williamr@4: Reading and Writing: williamr@4: williamr@4: There are several variants of both Read() and Write(). williamr@4: The basic Read(TDes8& aDes) and Write(const TDesC8& aDes) are supplemented williamr@4: by variants allowing the descriptor length to be overridden, or the seek williamr@4: position of the first byte to be specified, or asynchronous completion, williamr@4: or any combination. williamr@4: williamr@4: Reading transfers data from a file to a descriptor, and writing transfers williamr@4: data from a descriptor to a file. In all cases, the file data is treated williamr@4: as binary and byte descriptors are used (TDes8, TDesC8). williamr@4: williamr@4: RFile class supports operations on files of size less than or equal to 2GB - 1. williamr@4: If the file size is greater than 2GB - 1 (large file), use of class RFile64 is williamr@4: recommended for following operations: williamr@4: 1. Opening a large file williamr@4: 2. Creating a file which can grow beyond 2GB - 1 by size williamr@4: 3. Creating a temporary file which can grow beyond 2GB - 1 by size williamr@4: 4. Replacing an existing file after which it can grow beyond 2GB - 1 by size williamr@4: 5. Adopting a large file handle from client williamr@4: 6. Adopting a large file handle from server williamr@4: 7. Adopting a large file handle from another process williamr@4: 8. Read from a position greater than 2GB - 1 williamr@4: 9. Writing to a file by which the size can grow beyond 2GB - 1 williamr@4: 10. Seek to a position greater than 2GB - 1 williamr@4: 11. Setting a size greater than 2GB - 1 williamr@4: 12. Querying the file size (greater than 2GB - 1) williamr@4: 13. Locking and unlocking a position and length that is beyond 2GB - 1 williamr@4: williamr@4: @see TDes8 williamr@4: @see TDesC8 williamr@4: williamr@4: @see RFile64 williamr@4: williamr@4: */ williamr@4: williamr@4: #endif williamr@4: williamr@4: williamr@2: class RFile : public RSubSessionBase williamr@2: { williamr@2: public: williamr@4: EFSRV_IMPORT_C TInt Open(RFs& aFs,const TDesC& aName,TUint aFileMode); williamr@4: EFSRV_IMPORT_C void Close(); williamr@4: EFSRV_IMPORT_C TInt Create(RFs& aFs,const TDesC& aName,TUint aFileMode); williamr@4: EFSRV_IMPORT_C TInt Replace(RFs& aFs,const TDesC& aName,TUint aFileMode); williamr@4: EFSRV_IMPORT_C TInt Temp(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aFileMode); williamr@4: EFSRV_IMPORT_C TInt Read(TDes8& aDes) const; williamr@4: EFSRV_IMPORT_C void Read(TDes8& aDes,TRequestStatus& aStatus) const; williamr@4: EFSRV_IMPORT_C TInt Read(TDes8& aDes,TInt aLength) const; williamr@4: EFSRV_IMPORT_C void Read(TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const; williamr@4: EFSRV_IMPORT_C TInt Read(TInt aPos,TDes8& aDes) const; williamr@4: EFSRV_IMPORT_C void Read(TInt aPos,TDes8& aDes,TRequestStatus& aStatus) const; williamr@4: EFSRV_IMPORT_C TInt Read(TInt aPos,TDes8& aDes,TInt aLength) const; williamr@4: EFSRV_IMPORT_C void Read(TInt aPos,TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const; williamr@4: EFSRV_IMPORT_C void ReadCancel(TRequestStatus& aStatus) const; williamr@4: EFSRV_IMPORT_C void ReadCancel() const; williamr@4: EFSRV_IMPORT_C TInt Write(const TDesC8& aDes); williamr@4: EFSRV_IMPORT_C void Write(const TDesC8& aDes,TRequestStatus& aStatus); williamr@4: EFSRV_IMPORT_C TInt Write(const TDesC8& aDes,TInt aLength); williamr@4: EFSRV_IMPORT_C void Write(const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus); williamr@4: EFSRV_IMPORT_C TInt Write(TInt aPos,const TDesC8& aDes); williamr@4: EFSRV_IMPORT_C void Write(TInt aPos,const TDesC8& aDes,TRequestStatus& aStatus); williamr@4: EFSRV_IMPORT_C TInt Write(TInt aPos,const TDesC8& aDes,TInt aLength); williamr@4: EFSRV_IMPORT_C void Write(TInt aPos,const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus); williamr@4: EFSRV_IMPORT_C TInt Lock(TInt aPos,TInt aLength) const; williamr@4: EFSRV_IMPORT_C TInt UnLock(TInt aPos,TInt aLength) const; williamr@4: EFSRV_IMPORT_C TInt Seek(TSeek aMode,TInt& aPos) const; williamr@4: EFSRV_IMPORT_C TInt Flush(); williamr@4: EFSRV_IMPORT_C void Flush(TRequestStatus& aStatus); williamr@4: EFSRV_IMPORT_C TInt Size(TInt& aSize) const; williamr@4: EFSRV_IMPORT_C TInt SetSize(TInt aSize); williamr@4: EFSRV_IMPORT_C TInt Att(TUint& aAttValue) const; williamr@4: EFSRV_IMPORT_C TInt SetAtt(TUint aSetAttMask,TUint aClearAttMask); williamr@4: EFSRV_IMPORT_C TInt Modified(TTime& aTime) const; williamr@4: EFSRV_IMPORT_C TInt SetModified(const TTime& aTime); williamr@4: EFSRV_IMPORT_C TInt Set(const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask); williamr@4: EFSRV_IMPORT_C TInt ChangeMode(TFileMode aNewMode); williamr@4: EFSRV_IMPORT_C TInt Rename(const TDesC& aNewName); williamr@4: EFSRV_IMPORT_C TInt Drive(TInt &aDriveNumber, TDriveInfo &aDriveInfo) const; williamr@4: EFSRV_IMPORT_C TInt Adopt(RFs& aFs, TInt aHandle); williamr@4: EFSRV_IMPORT_C TInt AdoptFromClient(const RMessage2& aMsg, TInt aFsHandleIndex, TInt aFileHandleIndex); williamr@4: EFSRV_IMPORT_C TInt AdoptFromServer(TInt aFsHandle, TInt aFileHandle); williamr@4: EFSRV_IMPORT_C TInt AdoptFromCreator(TInt aFsIndex, TInt aFileHandleIndex); williamr@4: EFSRV_IMPORT_C TInt Name(TDes& aName) const; williamr@4: EFSRV_IMPORT_C TInt TransferToServer(TIpcArgs& aIpcArgs, TInt aFsHandleIndex, TInt aFileHandleIndex) const; williamr@4: EFSRV_IMPORT_C TInt TransferToClient(const RMessage2& aMsg, TInt aFileHandleIndex) const; williamr@4: EFSRV_IMPORT_C TInt TransferToProcess(RProcess& aProcess, TInt aFsHandleIndex, TInt aFileHandleIndex) const; williamr@4: EFSRV_IMPORT_C TInt Duplicate(const RFile& aFile, TOwnerType aType=EOwnerProcess); williamr@4: EFSRV_IMPORT_C TInt FullName(TDes& aName) const; williamr@4: EFSRV_IMPORT_C TInt BlockMap(SBlockMapInfo& aInfo, TInt64& aStartPos, TInt64 aEndPos=-1, TInt aBlockMapusage=EBlockMapUsagePaging) const; williamr@2: TInt Clamp(RFileClamp& aHandle); williamr@2: williamr@4: protected: williamr@4: // RSubSessionBase overrides williamr@4: TInt CreateSubSession(const RSessionBase& aSession,TInt aFunction,const TIpcArgs& aArgs); williamr@4: void CloseSubSession(TInt aFunction); williamr@4: TInt SendReceive(TInt aFunction,const TIpcArgs& aArgs) const; williamr@4: williamr@2: TInt DuplicateHandle(TInt& aSubSessionHandle) const; williamr@4: williamr@4: friend class RFilePlugin; williamr@2: }; williamr@2: williamr@4: #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API williamr@4: #include williamr@4: #endif williamr@2: williamr@2: class RDir : public RSubSessionBase williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Reads the entries contained in a directory. williamr@2: williamr@2: You must first open the directory, specifying an attribute mask which is used williamr@2: by Read() calls to filter the entry types required. Then, use one of williamr@2: the Read() functions to read the filtered entries. When the operation williamr@2: is complete, the directory should be closed using Close() williamr@2: williamr@2: There are two types of Read(): one works with a single entry at a time, williamr@2: requiring programs to iterate through the entries explicitly. williamr@2: The other works with an entire TEntryArray, allowing multiple entries to be williamr@2: read in one call. williamr@2: As well as making application program logic somewhat simpler, this type williamr@2: uses fewer calls to the server, and is more efficient. williamr@2: williamr@2: Each type of Read() can be performed either synchronously or asynchronously. williamr@2: williamr@2: It may be more convenient to use RFs::GetDir() than the Read() calls supported williamr@2: by this class. williamr@2: RFs::GetDir() has the advantage that it allows a directory’s entries to be williamr@2: sorted in various ways. williamr@2: However, it does not provide asynchronous as well as synchronous variants williamr@2: and does not allow entries to be read individually. williamr@2: williamr@2: @see RFs williamr@2: */ williamr@2: { williamr@2: public: williamr@4: EFSRV_IMPORT_C TInt Open(RFs& aFs,const TDesC& aMatchName,const TUidType& aUidType); williamr@4: EFSRV_IMPORT_C TInt Open(RFs& aFs,const TDesC& aMatchName,TUint anAttMask); williamr@4: EFSRV_IMPORT_C void Close(); williamr@4: EFSRV_IMPORT_C TInt Read(TEntryArray& anArray) const; williamr@4: EFSRV_IMPORT_C void Read(TEntryArray& anArray,TRequestStatus& aStatus) const; williamr@4: EFSRV_IMPORT_C TInt Read(TEntry& anEntry) const; williamr@4: EFSRV_IMPORT_C void Read(TPckg& anEntry,TRequestStatus& aStatus) const; williamr@4: williamr@4: private: williamr@4: // RSubSessionBase overrides williamr@4: TInt SendReceive(TInt aFunction,const TIpcArgs& aArgs) const; williamr@4: williamr@4: friend class RDirPlugin; williamr@2: }; williamr@2: williamr@2: williamr@2: class RFormat : public RSubSessionBase williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Formats a device, one step at a time. williamr@2: williamr@2: RFormat must first be opened on a device before formatting each williamr@2: track using Next(). williamr@2: williamr@2: There is also an asynchronous version of Next() which, if encapsulated into williamr@2: a suitable active object, can be used to implement a williamr@2: user-interruptible formatting process. williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C TInt Open(RFs& aFs,const TDesC& aName,TUint aFormatMode,TInt& aCount); williamr@2: IMPORT_C TInt Open(RFs& aFs,const TDesC& aName,TUint aFormatMode,TInt& aCount,const TDesC8& anInfo); williamr@2: IMPORT_C void Close(); williamr@2: IMPORT_C TInt Next(TInt& aStep); williamr@2: IMPORT_C void Next(TPckgBuf& aStep,TRequestStatus& aStatus); williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: class RRawDisk : public RSubSessionBase williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Enables direct disk access. williamr@2: williamr@2: No other resources can access the disk while direct access to it is in effect. williamr@2: williamr@2: This class is not intended for user derivation. williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C TInt Open(RFs& aFs,TInt aDrive); williamr@2: IMPORT_C void Close(); williamr@2: IMPORT_C TInt Read(TInt64 aPos,TDes8& aDes); williamr@2: IMPORT_C TInt Write(TInt64 aPos,TDesC8& aDes); williamr@2: private: williamr@2: TInt iDrive; williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: class CDirStack; williamr@2: NONSHARABLE_CLASS(CDirScan) : public CBase williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Scans a directory structure. williamr@2: williamr@2: The scan moves from directory to directory through the hierarchy, returning williamr@2: a list of the entries contained in each. The order in which the directories williamr@2: are scanned is determined by a sort key which is specified when setting up williamr@2: the scan. The base directory to be scanned and the entry types of interest williamr@2: must also be specified before performing the scan. williamr@2: williamr@2: This class is not intended for user derivation williamr@2: */ williamr@2: { williamr@2: public: williamr@2: /** williamr@2: Defines the scan direction. williamr@2: */ williamr@2: enum TScanDirection williamr@2: { williamr@2: /** williamr@2: Scan upwards from the lowest level directory in the hierarchy to williamr@2: the top level directory. williamr@2: */ williamr@2: EScanUpTree, williamr@2: williamr@2: /** williamr@2: Scan downwards from the top level directory in the hierarchy to williamr@2: the bottom level directory. williamr@2: */ williamr@2: EScanDownTree williamr@2: }; williamr@2: public: williamr@2: IMPORT_C static CDirScan* NewL(RFs& aFs); williamr@2: IMPORT_C static CDirScan* NewLC(RFs& aFs); williamr@2: IMPORT_C ~CDirScan(); williamr@2: IMPORT_C void SetScanDataL(const TDesC& aMatchName,TUint anEntryAttMask,TUint anEntrySortMask,TScanDirection aScanDir=EScanDownTree); williamr@2: IMPORT_C void NextL(CDir*& aDirEntries); williamr@2: IMPORT_C TPtrC AbbreviatedPath(); williamr@2: IMPORT_C TPtrC FullPath(); williamr@2: protected: williamr@2: CDirScan(RFs& aFs); williamr@2: private: williamr@2: inline RFs& Fs(); williamr@2: void UpdateAbbreviatedPath(); williamr@2: void ScanUpTreeL(CDir*& aDirEntries); williamr@2: void ScanDownTreeL(CDir*& aDirEntries); williamr@2: void GetDirEntriesL(CDir*& aDirEntries); williamr@2: private: williamr@2: RFs* const iFs; williamr@2: TParse iFullPath; williamr@2: TPtrC iAbbreviatedPath; williamr@2: TInt iAbbreviatedPathPos; williamr@2: TUint iEntryAttMask; williamr@2: TUint iEntrySortMask; williamr@2: TBool iScanning; williamr@2: TScanDirection iScanDir; williamr@2: CDirStack* iStack; williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: enum TFileManError williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: A list of CFileMan error codes. williamr@2: williamr@2: @see CFileMan williamr@2: */ williamr@2: { williamr@2: /** williamr@2: No additional error information is available, either because williamr@2: the latest CFileMan operation did not return an error, or if it did, williamr@2: the error was not one for which additional information is available. williamr@2: */ williamr@2: ENoExtraInformation, williamr@2: williamr@2: williamr@2: /** williamr@2: A leave occurred while setting up the initial scan. williamr@2: williamr@2: This indicates that the operation did not begin. williamr@2: williamr@2: @see CDirScan. williamr@2: */ williamr@2: EInitializationFailed, williamr@2: williamr@2: williamr@2: /** williamr@2: A leave occurred while scanning the next directory in the course of a file williamr@2: management function. williamr@2: williamr@2: This indicates that the operation did begin. williamr@2: williamr@2: @see CDirScan. williamr@2: */ williamr@2: EScanNextDirectoryFailed, williamr@2: williamr@2: williamr@2: /** williamr@2: Error occurred when attempting to open the source file for a file copy williamr@2: or move. williamr@2: */ williamr@2: ESrcOpenFailed, williamr@2: williamr@2: williamr@2: /** williamr@2: Error occurred while attempting to create, or, if overwriting is in effect, williamr@2: replace the target file for a file copy or move. williamr@2: */ williamr@2: ETrgOpenFailed, williamr@2: williamr@2: williamr@2: /** williamr@2: The operation completed without processing any files because no matching williamr@2: files were found. williamr@2: */ williamr@2: ENoFilesProcessed williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: class MFileManObserver williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Provides notification of the progress of synchronous or asynchronous williamr@2: file management operations. williamr@2: williamr@2: It should be inherited by classes which implement this protocol. williamr@2: williamr@2: The enquiry functions provided by CFileBase and CFileMan may be used by williamr@2: the observer to display information about the progress of the operation williamr@2: such as error messages, the names of the target and destination files, williamr@2: and the number of bytes transferred during a copy operation. williamr@2: Notification may take place before or after an entry has been processed, williamr@2: or during a file copy or move. williamr@2: Each notification function returns a value which can be used to enable williamr@2: the user to control the progress of the operation, for example to cancel williamr@2: a long-running multiple file copy. williamr@2: To use this class, pass a pointer to an instance of the class to williamr@2: the CFileMan constructor, or use SetObserver(), defined in CFileBase. williamr@2: */ williamr@2: { williamr@2: public: williamr@2: /** williamr@2: Control for the current CFileMan operation. williamr@2: */ williamr@2: enum TControl williamr@2: { williamr@2: /** williamr@2: Proceed with the current or the next entry. williamr@2: */ williamr@2: EContinue, williamr@2: williamr@2: williamr@2: /** williamr@2: Retry processing the previous entry. williamr@2: */ williamr@2: ERetry, williamr@2: williamr@2: williamr@2: /** williamr@2: Abort operation, causes function to return KErrCancel. williamr@2: */ williamr@2: EAbort, williamr@2: williamr@2: williamr@2: /** williamr@2: Cancel processing the current entry. williamr@2: */ williamr@2: ECancel williamr@2: }; williamr@2: public: williamr@2: IMPORT_C virtual TControl NotifyFileManStarted(); williamr@2: IMPORT_C virtual TControl NotifyFileManOperation(); williamr@2: IMPORT_C virtual TControl NotifyFileManEnded(); williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: class CFileBase : public CBase williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Abstract base class for file management. williamr@2: williamr@2: It provides functions to set an observer for the derived class williamr@2: CFileMan, and to get information about the entry being processed. williamr@2: williamr@2: @see CFileMan williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C void SetObserver(MFileManObserver* anObserver); williamr@2: public: williamr@2: IMPORT_C const TEntry& CurrentEntry(); williamr@2: IMPORT_C TPtrC AbbreviatedPath(); williamr@2: IMPORT_C TPtrC FullPath(); williamr@2: IMPORT_C TInt GetLastError(); williamr@2: IMPORT_C TFileManError GetMoreInfoAboutError(); williamr@2: protected: williamr@2: IMPORT_C CFileBase(RFs& anFs); williamr@2: IMPORT_C void ConstructL(); williamr@2: IMPORT_C ~CFileBase(); williamr@2: IMPORT_C void RunL(); williamr@2: IMPORT_C void RunInSeparateThreadL(TThreadFunction aThreadFunction); williamr@2: // virtual williamr@2: /** williamr@2: Called from RunL to perform tidy up after an operation. williamr@2: williamr@2: @see CFileMan williamr@2: @see CFileBase::RunL williamr@2: */ williamr@2: virtual void CompleteOperationL() {}; williamr@2: williamr@2: //pure virtual williamr@2: /** williamr@2: Called from RunL to perform the requested operation. williamr@2: williamr@2: @see CFileMan williamr@2: @see CFileBase::RunL williamr@2: */ williamr@2: virtual void DoOperationL() = 0; williamr@2: protected: williamr@2: RFs iFs; williamr@2: RFs iFsOld; williamr@2: RThread iFManThread; williamr@2: RSemaphore iSynchronizer; williamr@2: CDirScan* iScanner; williamr@2: CDir* iDirList; williamr@2: TInt iCurrentEntry; williamr@2: TUint iMatchEntry; williamr@2: TUint iSwitches; williamr@2: TParse iSrcFile; williamr@2: MFileManObserver* iObserver; williamr@2: TInt iLastError; williamr@2: TFileManError iErrorInfo; williamr@2: TRequestStatus* iStatus; williamr@2: HBufC* iSessionPath; williamr@2: TInt iNumberOfFilesProcessed; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: friend void DoFManBaseOperationL(TAny* aPtr); williamr@2: friend TInt FManBaseThreadFunction(TAny* aPtr); williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: NONSHARABLE_CLASS(CFileMan) : public CFileBase williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Offers file management services which accept the use of wildcards; williamr@2: synchronous and asynchronous. williamr@2: williamr@2: It also provides enquiry functions, which, like those provided by williamr@2: the base class CFileBase, may be used by an observer class object williamr@2: to provide the user with information about the progress of the operation. williamr@2: williamr@2: All of the file management functions provided by this class accept the use of williamr@2: wildcards, and may operate either synchronously or asynchronously. williamr@2: When CFileMan is operating asynchronously, the operation takes place in williamr@2: a separate thread from the calling code. williamr@2: williamr@2: A file notification observer (an instance of a class deriving williamr@2: from MFileManObserver) may optionally be used by CFileMan when operating williamr@2: synchronously or asynchronously. If provided, the appropriate notification williamr@2: function is called before or after each entry has been processed, williamr@2: or during a file copy or move. williamr@2: This notification can be used to provide information about the state of williamr@2: the operation, such as the number of bytes transferred during a williamr@2: large-scale file copy. It can also be used to allow the user to cancel, williamr@2: retry or continue processing an entry, or to abort the whole operation. williamr@2: If such notification is required, specify an object deriving from williamr@2: MFileManObserver class in the constructor, or call SetObserver(), williamr@2: defined in the base class, CFileBase. williamr@2: williamr@2: All of the file manipulation functions except Rename() may operate recursively, williamr@2: and all can operate non-recursively. When operating recursively, williamr@2: these functions will act on all matching files located throughout williamr@2: the source directory’s hierarchy. When operating non-recursively, williamr@2: these functions act upon files contained in the single top level source williamr@2: directory only. Recursion is set or unset using the switch parameter to williamr@2: these functions. williamr@2: williamr@2: This class is not intended for user derivation. williamr@2: williamr@4: Note: williamr@4: williamr@4: To support wildcard, CFileMan needs to store the entire directory entry williamr@4: information. Therefore, in a extreme condition, if a directory contains williamr@4: a huge number of files (e.g. more than 15000 files with 10 characters' long file williamr@4: names), user may encounter KErrNoMemory errors. Developers who have a need to handle williamr@4: this rare case should increase the heap size limitation of their applications. williamr@4: williamr@4: For more information about heap size configuration, please refer following williamr@4: section in Symbian Developer Library: williamr@4: Symbian OS build guide >> Build Tools Reference >> MMP file syntax >> epocheapsize williamr@4: williamr@2: @see MFileManObserver williamr@2: */ williamr@2: { williamr@2: public: williamr@2: /** williamr@2: An enumeration that identifies CFileMan tasks. This enumeration is used williamr@2: by CurrentAction() to identify which task currently being carried out. williamr@2: williamr@2: @see CFileMan::CurrentAction williamr@2: */ williamr@2: enum TAction williamr@2: { williamr@2: /** williamr@2: Inactive williamr@2: */ williamr@2: ENone, williamr@2: williamr@2: williamr@2: /** williamr@2: Setting attributes williamr@2: */ williamr@2: EAttribs, williamr@2: williamr@2: williamr@2: /** williamr@2: Copying files williamr@2: */ williamr@2: ECopy, williamr@2: williamr@2: williamr@2: /** williamr@2: Deleting files williamr@2: */ williamr@2: EDelete, williamr@2: williamr@2: williamr@2: /** williamr@2: Moving files williamr@2: */ williamr@2: EMove, williamr@2: williamr@2: williamr@2: /** williamr@2: Renaming files williamr@2: */ williamr@2: ERename, williamr@2: williamr@2: williamr@2: /** williamr@2: Deleting a directory and all contents williamr@2: */ williamr@2: ERmDir, williamr@2: williamr@2: williamr@2: /** williamr@2: Renaming component to VFAT short name (guaranteed to be unique) williamr@2: */ williamr@2: ERenameInvalidEntry, williamr@2: williamr@2: /** williamr@2: Copying file from open file handle williamr@2: */ williamr@2: ECopyFromHandle, williamr@2: }; williamr@2: williamr@2: williamr@2: /** williamr@2: Overwriting and recursion switch. williamr@2: williamr@2: Used in CFileMan functions to set whether operations are applied to williamr@2: the specified directory and all directories below it, or williamr@2: the specified directory only. williamr@2: */ williamr@2: enum TSwitch williamr@2: { williamr@2: /** williamr@2: Any files in the destination directory that have the same name as williamr@2: the source files in a rename, move or copy operation, will williamr@2: be overwritten. williamr@2: */ williamr@2: EOverWrite=1, williamr@2: williamr@2: williamr@2: /** williamr@2: Recursive operation. williamr@2: */ williamr@2: ERecurse=2 williamr@2: }; williamr@2: public: williamr@2: IMPORT_C static CFileMan* NewL(RFs& aFs); williamr@2: IMPORT_C static CFileMan* NewL(RFs& aFs,MFileManObserver* anObserver); williamr@2: ~CFileMan(); williamr@2: IMPORT_C TAction CurrentAction(); williamr@2: IMPORT_C void GetCurrentTarget(TFileName& aFile); williamr@2: IMPORT_C void GetCurrentSource(TFileName& aFile); williamr@2: IMPORT_C TInt BytesTransferredByCopyStep(); williamr@2: public: williamr@2: IMPORT_C TInt Attribs(const TDesC& aName,TUint aSetMask,TUint aClearMask,const TTime& aTime,TUint aSwitch=0); williamr@2: IMPORT_C TInt Attribs(const TDesC& aName,TUint aSetMask,TUint aClearMask,const TTime& aTime,TUint aSwitch,TRequestStatus& aStatus); williamr@2: IMPORT_C TInt Copy(const TDesC& anOld,const TDesC& aNew,TUint aSwitch=EOverWrite); williamr@2: IMPORT_C TInt Copy(const TDesC& anOld,const TDesC& aNew,TUint aSwitch,TRequestStatus& aStatus); williamr@2: IMPORT_C TInt Delete(const TDesC& aName,TUint aSwitch=0); williamr@2: IMPORT_C TInt Delete(const TDesC& aName,TUint aSwitch,TRequestStatus& aStatus); williamr@2: IMPORT_C TInt Move(const TDesC& anOld,const TDesC& aNew,TUint aSwitch=EOverWrite); williamr@2: IMPORT_C TInt Move(const TDesC& anOld,const TDesC& aNew,TUint aSwitch,TRequestStatus& aStatus); williamr@2: IMPORT_C TInt Rename(const TDesC& anOld,const TDesC& aNew,TUint aSwitch=EOverWrite); williamr@2: IMPORT_C TInt Rename(const TDesC& anOld,const TDesC& aNew,TUint aSwitch,TRequestStatus& aStatus); williamr@2: IMPORT_C TInt RmDir(const TDesC& aDirName); williamr@2: IMPORT_C TInt RmDir(const TDesC& aDirName,TRequestStatus& aStatus); williamr@2: IMPORT_C TInt Copy(const RFile& anOld,const TDesC& aNew,TUint aSwitches=EOverWrite); williamr@2: IMPORT_C TInt Copy(const RFile& anOld,const TDesC& aNew,TUint aSwitches,TRequestStatus& aStatus); williamr@2: protected: williamr@2: CFileMan(RFs& aFs); williamr@2: TInt RenameInvalidEntry(const TDesC& anOld,const TDesC& aNew,TUint aSwitch=EOverWrite); williamr@2: private: williamr@2: /** williamr@2: This is an internal enumeration for CFileMan implementation. williamr@2: THis enumeration is mapped into TAction when user wants to identify the current williamr@2: task of CFileMan by CurrentAction(). williamr@2: williamr@2: @see CFileMan::TAction williamr@2: @see CFileMan::CurrentAction williamr@2: */ williamr@2: enum TInternalAction williamr@2: { williamr@2: /** williamr@2: Internal indicator for None operation. williamr@2: This is mapped to CFileMan::ENone. williamr@2: */ williamr@2: EInternalNone, williamr@2: williamr@2: /** williamr@2: Internal indicator for Attribs() operation. williamr@2: This is mapped to CFileMan::EAttribs. williamr@2: */ williamr@2: EInternalAttribs, williamr@2: williamr@2: /** williamr@2: Internal indicator for Copy() operation. williamr@2: This is mapped to CFileMan::ECopy. williamr@2: */ williamr@2: EInternalCopy, williamr@2: williamr@2: /** williamr@2: Internal indicator for Delete() operation. williamr@2: This is mapped to CFileMan::EDelete. williamr@2: */ williamr@2: EInternalDelete, williamr@2: williamr@2: /** williamr@2: Internal indicator for Move() operation on different drives. williamr@2: This is mapped to CFileMan::Move. williamr@2: */ williamr@2: EInternalCopyForMove, williamr@2: williamr@2: /** williamr@2: Internal indicator for Move() operation on the same drive. williamr@2: This is mapped to CFileMan::Rename. williamr@2: Note for compatibility reasons, it is not mapped to CFileMan::Move. williamr@2: */ williamr@2: EInternalRenameForMove, williamr@2: williamr@2: /** williamr@2: Internal indicator for Rename() operation. williamr@2: This is mapped to CFileMan::ERename. williamr@2: */ williamr@2: EInternalRename, williamr@2: williamr@2: /** williamr@2: Internal indicator for RmDir() operation. williamr@2: This is mapped to CFileMan::ERmDir. williamr@2: */ williamr@2: EInternalRmDir, williamr@2: williamr@2: /** williamr@2: Internal indicator for RenameInvalidEntry() operation. williamr@2: This is mapped to CFileMan::ERenameInvalidEntry. williamr@2: */ williamr@2: EInternalRenameInvalidEntry, williamr@2: williamr@2: /** williamr@2: Internal indicator for CopyFromHandle() operation. williamr@2: This is mapped to CFileMan::ECopyFromHandle. williamr@2: */ williamr@2: EInternalCopyFromHandle, williamr@2: }; williamr@2: williamr@2: void CompleteOperationL(); williamr@2: void DoOperationL(); williamr@2: void CheckForDirectory(); williamr@2: void SetFlags(TBool aOverWrite,TBool aRecurse,TBool aScanDirection,TBool aMoveRename); williamr@2: void GetSrcAndTrg(TParse& aSrcName,TFileName& aTrgName); williamr@2: void DoSynchronize(TInt aRetVal); williamr@2: TInt CheckRenameAllowed(const TDesC& aSrcName,const TDesC& aTrgName); williamr@2: TInt SetupMoveOnSameDrive(TUint aSwitches, TBool& aComplete); williamr@2: TInt SetupMoveAcrossDrives(TUint aSwitches); williamr@2: TInt SetupTargetDirectory(TBool aOverWrite, TBool& aComplete); williamr@2: TBool SrcTrgDrivesIdentical(); williamr@4: TInt SetupDirectoryForMove(TBool& aSrcIsDir); williamr@2: private: williamr@2: void DoAttribsL(); williamr@2: void DoCopyOrMoveL(); williamr@2: void DoDeleteL(); williamr@2: void DoRenameL(); williamr@2: void DoRmDirL(); williamr@2: void DoCopyFromHandleL(); williamr@4: #ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API williamr@2: TInt DoCopy(const RFile& aSrcFile, RFile& aDstFile, TInt& aRet); williamr@4: #else williamr@4: TInt DoCopy(const RFile64& aSrcFile, RFile64& aDstFile, TInt& aRet); williamr@4: #endif williamr@2: private: williamr@2: TParse iTrgFile; williamr@2: TInternalAction iAction; williamr@2: TUint iSetMask; williamr@2: TUint iClearMask; williamr@2: TTime iTime; williamr@2: TInt iBytesTransferred; williamr@4: #ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API williamr@2: RFile iSrcFileHandle; williamr@4: #else williamr@4: RFile64 iSrcFileHandle; williamr@4: #endif williamr@2: TBool iMovingContents; williamr@2: TEntry iTmpEntry; williamr@2: TParse iTmpParse; williamr@2: TFileName iTmpName1; williamr@2: TFileName iTmpName2; williamr@2: williamr@2: friend void RenameInvalidEntryL(RFs& aFs,TParse& aSrcFile); williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: class TFindFile williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Searches for files and directories. williamr@2: williamr@2: Each function has a variant which searches for multiple files/directories, williamr@2: using one or more wildcard characters in the filename. williamr@2: If an initial search is successful, further searches can be carried out williamr@2: using Find() or FindWild(). williamr@2: You can also retrieve the fully qualified file specification, williamr@2: and manipulate and interrogate it using the TParse class (or related classes). williamr@2: williamr@2: Note that when specifying the path of a directory to search, the path should williamr@2: always end with a backslash character.When trailing backslash is not present williamr@2: then it is considered as file. And path will be taken till last backslash. williamr@2: The client must have appropriate capabilities for the directory to be searched. williamr@2: For example without ALL FILES Capability, it is not possible to successfully williamr@2: find any files under \sys\bin directory. williamr@2: williamr@2: By default if the file is not found in the current drive the rest of the drives, williamr@2: excluding the remote ones, will be searched. Using function SetFindMask it is williamr@2: possible to specify a combination of drive attributes(aMask) that the drives to williamr@2: be searched must match. williamr@2: williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C TFindFile(RFs& aFs); williamr@2: IMPORT_C TInt FindByPath(const TDesC& aFileName,const TDesC* aPathList); williamr@2: IMPORT_C TInt FindByDir(const TDesC& aFileName,const TDesC& aDirPath); williamr@2: IMPORT_C TInt Find(); williamr@2: IMPORT_C TInt FindWildByPath(const TDesC& aFileName,const TDesC* aPathList,CDir*& aDirList); williamr@2: IMPORT_C TInt FindWildByDir(const TDesC& aFileName,const TDesC& aDirPath,CDir*& aDir); williamr@2: IMPORT_C TInt FindWild(CDir*& aDirList); williamr@2: IMPORT_C TInt SetFindMask(TUint aMask); williamr@2: inline const TDesC& File() const; williamr@2: private: williamr@2: TInt DoFind(); williamr@2: TInt DoFindByPath(const TDesC& aFileName,const TDesC* aPathList); williamr@2: TInt DoFindByDir(const TDesC& aFileName,const TDesC& aDir); williamr@2: TInt DoFindInDir(); williamr@2: TInt DoFindNextInPath(); williamr@2: TInt DoFindNextInDriveList(); williamr@2: private: williamr@2: RFs* const iFs; williamr@2: TParse iFile; williamr@2: TInt iPathPos; williamr@2: TInt iCurrentDrive; williamr@2: TInt iMode; williamr@2: const TDesC* iPath; williamr@2: TDriveList iDrvList; williamr@2: CDir** iDir; williamr@2: TUint32 iMatchMask; williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Contains a list of entries for the files which were opened in williamr@2: a file server session. williamr@2: williamr@2: @see CDir williamr@2: */ williamr@2: typedef CDir CFileList; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: class TOpenFileScan williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Scans open files to get a list of the entries for all files which are currently williamr@2: open in a particular file server session. williamr@2: williamr@2: NextL() creates a list of the files opened by the session. williamr@2: The ID of the thread which opened the files listed may be obtained by calling ThreadId(). williamr@2: If multiple sessions are in use, repeatedly calling NextL() will return a list williamr@2: of open files in each session. williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C TOpenFileScan(RFs& aFs); williamr@2: IMPORT_C void NextL(CFileList*& aFileList); williamr@2: IMPORT_C TThreadId ThreadId() const; williamr@2: private: williamr@2: RFs* iFs; williamr@2: TThreadId iThreadId; williamr@2: TInt iScanPos; williamr@2: TInt iEntryListPos; williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: class TFileText williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Reads and writes single lines of text to or from a Unicode file. williamr@2: */ williamr@2: { williamr@4: private: williamr@2: enum TFileState williamr@2: { williamr@2: EStartOfFile, williamr@2: ENormal, williamr@2: EReverse williamr@2: }; williamr@2: public: williamr@2: IMPORT_C TFileText(); williamr@2: IMPORT_C void Set(RFile& aFile); williamr@2: IMPORT_C TInt Read(TDes& aDes); williamr@2: IMPORT_C TInt Write(const TDesC& aDes); williamr@2: IMPORT_C TInt Seek(TSeek aMode); williamr@2: private: williamr@2: void NextRecord(); williamr@2: TInt CheckForTerminator(TBool& anAnswer); williamr@2: TInt FillBuffer(); williamr@2: private: williamr@2: const TText* iNext; williamr@2: const TText* iEnd; williamr@2: TFileState iState; williamr@4: #ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API williamr@2: RFile iFile; williamr@4: #else williamr@4: RFile64 iFile; williamr@4: #endif williamr@2: TBuf8<0x100> iReadBuf; williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: IMPORT_C TBool FileNamesIdentical(const TDesC& aFileName1,const TDesC& aFileName2); williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: The UID of the File Server process williamr@2: */ williamr@2: const TInt KFileServerUidValue = 0x100039e3; williamr@2: williamr@4: williamr@4: #include williamr@4: #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API williamr@4: #include williamr@2: #endif williamr@4: williamr@4: #ifdef SYMBIAN_F32_ENHANCED_CHANGE_NOTIFICATION williamr@4: #include williamr@4: #endif williamr@4: williamr@4: #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS williamr@4: #include williamr@4: #endif williamr@4: williamr@4: #endif