epoc32/include/f32file.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
     1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 
    17 
    18 /**
    19  @file
    20  @publishedAll
    21  @released
    22 */
    23 
    24 #if !defined(__F32FILE_H__)
    25 #define __F32FILE_H__
    26 
    27 #if !defined(__E32BASE_H__)
    28 #include <e32base.h>
    29 #endif
    30 
    31 #if !defined(__E32SVR_H__)
    32 #include <e32svr.h>
    33 #endif
    34 
    35 #include <e32ldr.h>
    36 
    37 
    38 /**
    39 @publishedAll
    40 @released
    41 
    42 The session default drive.
    43 */
    44 const TInt KDefaultDrive=KMaxTInt;
    45 
    46 
    47 
    48 
    49 /**
    50 @publishedAll
    51 @released
    52 
    53 Indicates a drive letter which is not in use. 
    54 
    55 This is useful when scanning a drive list to find which drives are available.
    56 */
    57 const TInt KDriveAbsent=0x00;
    58 
    59 
    60 
    61 
    62 /**
    63 @publishedAll
    64 @released
    65 
    66 The default value for the number of message slots passed to RFs::Connect().
    67 
    68 @see RFs::Connect
    69 */
    70 const TInt KFileServerDefaultMessageSlots=-1;
    71 
    72 
    73 
    74 
    75 /**
    76 @publishedAll
    77 @released
    78 
    79 The size of the array of TEntry items contained in a TEntryArray object.
    80 
    81 @see TEntryArray
    82 @see TEntry
    83 */
    84 const TInt KEntryArraySize=(0x200*sizeof(TText));
    85 
    86 
    87 
    88 
    89 /**
    90 @publishedAll
    91 @released
    92 
    93 The character used to separate directories in the path name.
    94 */
    95 const TInt KPathDelimiter='\\';
    96 
    97 
    98 
    99 
   100 /**
   101 @publishedAll
   102 @released
   103 
   104 The character used to separate the drive letter from the path.
   105 */
   106 const TInt KDriveDelimiter=':';
   107 
   108 
   109 
   110 
   111 /**
   112 @publishedAll
   113 @released
   114 
   115 The character used to separate the filename from the extension.
   116 */
   117 const TInt KExtDelimiter='.';
   118 
   119 
   120 
   121 
   122 /**
   123 @publishedAll
   124 @released
   125 
   126 The maximum number of available drives.
   127 */
   128 const TInt KMaxDrives=26;
   129 
   130 
   131 /**
   132 @publishedAll
   133 @released
   134 
   135 Defines a modifiable buffer descriptor to contain a drive list.
   136 
   137 The descriptor has maximum length KMaxDrives, sufficient to contain
   138 all possible drive letters.
   139 
   140 @see RFs::DriveList
   141 @see KMaxDrives
   142 */
   143 typedef TBuf8<KMaxDrives> TDriveList;
   144 
   145 
   146 
   147 /**
   148 @publishedAll
   149 @released
   150 
   151 The maximum length of a drivename.
   152 
   153 Sufficient for a drive letter and colon.
   154 */
   155 const TInt KMaxDriveName=0x02;
   156 
   157 
   158 
   159 
   160 /**
   161 @publishedAll
   162 @released
   163 
   164 Defines a modifiable buffer descriptor to contain a drive name.
   165 
   166 A drive name comprises a drive letter (A through Z) and a colon.
   167 KMaxDriveName (2 bytes) is sufficient for a drive letter and colon.
   168 
   169 @see TDriveUnit::Name
   170 @see KMaxDriveName
   171 */
   172 typedef TBuf<KMaxDriveName> TDriveName;
   173 
   174 
   175 
   176 
   177 /**
   178 @publishedAll
   179 @released
   180 
   181 The maximum length of a file system name or file system sub type name.
   182 32 characters is sufficient for a file system or sub type name.
   183 */
   184 const TInt KMaxFSNameLength=0x0020;
   185 
   186 
   187 
   188 
   189 /**
   190 @publishedAll
   191 @released
   192 
   193 Defines a modifiable buffer descriptor to contain a file system or file system sub type name.
   194 
   195 @see KMaxFSNameLength
   196 */
   197 typedef TBuf<KMaxFSNameLength> TFSName;
   198 
   199 
   200 
   201 
   202 /**
   203 @publishedAll
   204 @released
   205 
   206 File/directory attribute: any file without the hidden or system attribute.
   207 */
   208 const TUint KEntryAttNormal=0x0000;
   209 
   210 
   211 
   212 
   213 /**
   214 @publishedAll
   215 @released
   216 
   217 File/directory attribute: read-only file or directory.
   218 */
   219 const TUint KEntryAttReadOnly=0x0001;
   220 
   221 
   222 
   223 
   224 /**
   225 @publishedAll
   226 @released
   227 
   228 File/directory attribute: hidden file or directory.
   229 */
   230 const TUint KEntryAttHidden=0x0002;
   231 
   232 
   233 
   234 
   235 /**
   236 @publishedAll
   237 @released
   238 
   239 File/directory attribute: system file.
   240 */
   241 const TUint KEntryAttSystem=0x0004;
   242 
   243 
   244 
   245 
   246 /**
   247 @publishedAll
   248 @released
   249 
   250 File/directory attribute: volume name directory.
   251 */
   252 const TUint KEntryAttVolume=0x0008;
   253 
   254 
   255 
   256 
   257 /**
   258 @publishedAll
   259 @released
   260 
   261 File/directory attribute: a directory without the hidden or system attribute.
   262 */
   263 const TUint KEntryAttDir=0x0010;
   264 
   265 
   266 
   267 
   268 /**
   269 @publishedAll
   270 @released
   271 
   272 File/directory attribute: an archive file.
   273 */
   274 const TUint KEntryAttArchive=0x0020;
   275 
   276 
   277 
   278 
   279 /**
   280 @publishedAll
   281 @released
   282 
   283 File/directory attribute: ROM eXecute In Place file
   284 */
   285 const TUint KEntryAttXIP=0x0080;
   286 
   287 
   288 
   289 
   290 /**
   291 @publishedAll
   292 @released
   293 
   294 This file attribute bit is set if the file exists only on a remote file 
   295 system and is not locally cached.
   296 
   297 Due to the potential high-latency of remote file systems, applications 
   298 (or users of applications) may make use of this bit to modify their 
   299 behaviour when working with remote files.
   300 
   301 This is a read-only attribute, so any attempt to set this attribute will
   302 will be ignored.
   303 */
   304 const TUint KEntryAttRemote=0x0100;
   305 
   306 
   307 
   308 
   309 /**
   310 @publishedAll
   311 @released
   312 
   313 The range of entry attributes reserved for file-system specific meanings.
   314 File systems may assign meaning to these bits, but their definition will
   315 not be supported nor maintained by Symbian.
   316 
   317 All other file attribute bits are reserved for use by Symbian.
   318 
   319 The following table summarises the assignment of attribute bits:
   320 
   321 	 0 - KEntryAttReadOnly
   322 	 1 - KEntryAttHidden
   323 	 2 - KEntryAttSystem
   324 	 3 - KEntryAttVolume
   325 	
   326 	 4 - KEntryAttDir
   327 	 6 - KEntryAttArchive
   328 	 7 - KEntryAttXIP
   329 
   330 	 8 - KEntryAttRemote
   331 	 9 - Reserved
   332 	10 - Reserved
   333 	11 - Reserved
   334 	
   335 	12 - Reserved
   336 	13 - Reserved
   337 	14 - Reserved
   338 	15 - Reserved
   339 	
   340 	16 - File System Specific
   341 	17 - File System Specific
   342 	18 - File System Specific
   343 	19 - File System Specific
   344 	
   345 	20 - File System Specific
   346 	22 - File System Specific
   347 	22 - File System Specific
   348 	23 - File System Specific
   349 	
   350 	24 - Reserved
   351 	25 - Reserved
   352 	26 - Reserved
   353 	27 - KEntryAttMatchExclude
   354 	
   355 	28 - KEntryAttAllowUid
   356 	29 - Reserved
   357 	30 - KEntryAttMatchExclusive
   358 	31 - Reserved
   359 */
   360 const TUint KEntryAttMaskFileSystemSpecific=0x00FF0000;
   361 
   362 
   363 
   364 
   365 /**
   366 @publishedAll
   367 @released
   368 
   369 Bit mask for matching file and directory entries.
   370 
   371 This mask ensures that directories and hidden and
   372 system files are matched.
   373 
   374 (Note that KEntryAttNormal matches all entry types except directories, hidden
   375 and system entries).
   376 
   377 @see RFs::GetDir
   378 */
   379 const TUint KEntryAttMatchMask=(KEntryAttHidden|KEntryAttSystem|KEntryAttDir);
   380 
   381 
   382 
   383 
   384 
   385 /**
   386 @publishedAll
   387 @released
   388 
   389 Bit mask for matching file and directory entries.
   390 
   391 This is used when all entry types, including hidden and system files,
   392 but excluding the volume entry are to be matched.
   393 
   394 @see RFs::GetDir
   395 */
   396 const TUint KEntryAttMaskSupported=0x3f;
   397 
   398 
   399 
   400 
   401 /**
   402 @publishedAll
   403 @released
   404 
   405 Bit mask for matching file and directory entries.
   406 
   407 This is used for exclusive matching. When OR'ed with one or more file attribute
   408 constants, for example, KEntryAttNormal, it ensures that only the files with
   409 those attributes are matched.
   410 When OR’ed with KEntryAttDir, directories only (not hidden or system) are matched.
   411 
   412 @see KEntryAttDir
   413 @see KEntryAttNormal
   414 @see RFs::GetDir
   415 */
   416 const TUint KEntryAttMatchExclusive=0x40000000;
   417 
   418 
   419 
   420 
   421 /**
   422 @publishedAll
   423 @released
   424 
   425 Bit mask for feature manager file entries.
   426 
   427 It is used in order to identify each ROM feature set data file 
   428 uniquely in the mount order of ROM sections.
   429 
   430 */
   431 const TUint KEntryAttUnique=0x01000000;
   432 
   433 
   434 
   435 
   436 /**
   437 @publishedAll
   438 @released
   439 
   440 Bit mask for matching file and directory entries.
   441 
   442 It is used to exclude files or directories with certain attributes from
   443 directory listings. This bitmask has the opposite effect
   444 to KEntryAttMatchExclusive. For example:
   445 
   446 @code
   447 KEntryAttMatchExclude|KEntryAttReadOnly
   448 @endcode
   449 
   450 excludes all read only entries from the directory listing.
   451 
   452 @code
   453 KEntryAttMatchExclusive|KEntryAttReadOnly
   454 @endcode
   455 lists only read only entries.
   456 
   457 @see KEntryAttMatchExclusive
   458 @see RFs::GetDir
   459 */
   460 const TUint KEntryAttMatchExclude=0x08000000;
   461 
   462 
   463 
   464 
   465 /**
   466 @publishedAll
   467 @released
   468 
   469 Bit mask for matching file and directory entries.
   470 
   471 Bit mask flag used when UID information should be included in the directory
   472 entry listing.
   473 
   474 @see RFs::GetDir
   475 */
   476 const TUint KEntryAttAllowUid=0x10000000;
   477 
   478 
   479 
   480 
   481 /**
   482 @publishedPartner
   483 @released
   484 
   485 Bit mask used when evaluating whether or not a session gets notified of a 
   486 debug event.
   487 
   488 @see DebugNotifySessions
   489 */
   490 const TUint KDebugNotifyMask=0xFF000000; // Reserved for debug notification
   491 
   492 /**
   493    
   494 */
   495 const TUint KMaxMapsPerCall = 0x8;
   496 
   497 
   498 
   499 
   500 /** 
   501 @publishedPartner 
   502 @released 
   503 
   504 The default blocksize value.
   505 
   506 This value is returned when you query the blocksize for a media type that does not 
   507 support the concept of 'block' (e.g. NOR flash media).
   508 
   509 @see TVolumeIOParamInfo 
   510 */
   511 const TUint KDefaultVolumeBlockSize = 512;
   512 
   513 
   514 
   515 
   516 enum TNotifyType
   517 /**
   518 @publishedAll
   519 @released
   520 
   521 A set of change notification flags.
   522 
   523 These flags indicate the kind of change that should result in notification.
   524 
   525 This is useful for programs that maintain displays of file lists that
   526 must be dynamically updated.
   527 
   528 @see RFs::NotifyChange
   529 @see RFs
   530 @see RFile
   531 @see RRawDisk
   532 */
   533 	{
   534 	/**
   535 	Any change, including mounting and unmounting drives.
   536 	*/
   537 	ENotifyAll=0x01,
   538 	
   539 	
   540 	/**
   541 	Addition or deletion of a directory entry, or changing or formatting a disk.
   542 	*/
   543 	ENotifyEntry=0x02,
   544 	
   545 	
   546 	/**
   547 	Change resulting from file requests:
   548 	RFile::Create(), RFile::Replace(), RFile::Rename(), RFs::Delete(),
   549 	RFs::Replace(), and RFs::Rename().
   550 	*/
   551 	ENotifyFile=0x04,
   552 	
   553 	
   554 	/**
   555 	Change resulting from directory requests:
   556 	RFs::MkDir(), RFs::RmDir(), and RFs::Rename().
   557 	*/
   558 	ENotifyDir=0x08,
   559 	
   560 	
   561 	/**
   562 	Change resulting from: RFs::SetEntry(), RFile::Set(), RFile::SetAtt(),
   563 	RFile::SetModified() and RFile::SetSize() requests.
   564 	*/
   565 	ENotifyAttributes=0x10,
   566 	
   567 	
   568 	/**
   569 	Change resulting from the RFile::Write() request.
   570 	*/
   571 	ENotifyWrite=0x20,
   572 	
   573 	
   574 	/**
   575 	Change resulting from the RRawDisk::Write() request.
   576 	*/
   577 	ENotifyDisk=0x40
   578 	};
   579 
   580 enum TNotifyDismountMode
   581 /**
   582 @publishedAll
   583 @released
   584 
   585 Notification modes for safe media removal notification API
   586 
   587 @see RFs::NotifyDismount
   588 */
   589 	{
   590 	/**
   591 	Used by a client to register for notification of pending dismount.
   592 		- This is the default behaviour for RFs::NotifyDismount
   593 	*/
   594 	EFsDismountRegisterClient=0x01,
   595 	
   596 	/**
   597 	Used to notify clients of a pending dismount.
   598 	*/
   599 	EFsDismountNotifyClients=0x02,
   600 	
   601 	/**
   602 	Used to forcibly dismount the file system without notifying clients.
   603 	*/
   604 	EFsDismountForceDismount=0x03,
   605 	};
   606 
   607 
   608 enum TFileCacheFlags
   609 /**
   610 @publishedPartner
   611 @released
   612 
   613 Flags used to enable file server drive-specific caching 
   614 */
   615 	{
   616 	/**
   617 	Enable read caching - if file explicitly opened in EFileReadBuffered mode
   618 	*/
   619 	EFileCacheReadEnabled = 0x01,
   620 
   621 	/**
   622 	Enable read caching for all files, regardless of file open mode
   623 	*/
   624 	EFileCacheReadOn = 0x02,
   625 
   626 	/**
   627 	Enable read-ahead caching - if file explicitly opened in EFileReadAheadOn mode
   628 	*/
   629 	EFileCacheReadAheadEnabled = 0x04,	
   630 
   631 	/**
   632 	Enable read-ahead caching, regardless of file open mode
   633 	*/
   634 	EFileCacheReadAheadOn = 0x08,	
   635 
   636 	/**
   637 	Enable write caching, if file explicitly opened in EFileWriteBuffered mode
   638 	*/
   639 	EFileCacheWriteEnabled = 0x10,	
   640 
   641 	/**
   642 	Enable write caching for all files, regardless of file open mode
   643 	*/
   644 	EFileCacheWriteOn = 0x20,	
   645 	};
   646 
   647 
   648 enum TStartupConfigurationCmd
   649 /**
   650 @publishedPartner
   651 @released
   652 
   653 Command used to set file server configuration at startup.
   654 
   655 @see RFs::SetStartupConfiguration()
   656 */
   657     {
   658     /**
   659     Set loader thread priority
   660     */
   661     ELoaderPriority,
   662 
   663     /**
   664     Set TDrive flags. Value should be ETrue or EFalse
   665     */
   666     ESetRugged,
   667     /**
   668     Command upper boundary
   669     */
   670     EMaxStartupConfigurationCmd
   671     };
   672 
   673 /**
   674 @publishedPartner
   675 @released
   676 
   677 Commands to query specific volume information.
   678 
   679 @see TVolumeIOParamInfo
   680 */
   681 enum TQueryVolumeInfoExtCmd
   682 	{
   683 	/**
   684     Queries the sub type of the file system mounted on a specified volume.
   685     For example, FAT12, FAT16 or FAT32.
   686     */
   687     EFileSystemSubType,
   688 	
   689     /**
   690     Queries the I/O parameters of a specificed volume.
   691     This includes the block size, the cluster size and the recommended read and write sizes for the media.    
   692     */
   693     EIOParamInfo,
   694 
   695     /** 
   696     This command determines whether the volume is synchronous or asynchronous.
   697     A boolean value is returned within the buffer defined as TPckgBuf<TBool>. 
   698     ETrue for Synchronous and EFalse for Asynchronous.
   699     */
   700     EIsDriveSync,
   701 
   702     /**
   703     Query if the given drive is finalised. See RFs::FinaliseDrive() 
   704     Not all file systems may support this query.
   705     A boolean value is returned within the buffer defined as TPckgBuf<TBool>. 
   706     ETrue value means that the drive is finalised
   707     */
   708     EIsDriveFinalised,
   709 	};
   710 
   711 /**
   712 @publishedAll
   713 @released
   714 
   715 Volume IO parameter information.
   716 
   717 This class is used to return IO parameter information for a specified volume.
   718 
   719 The volume parameter information holds recommended buffer sizes for the creation of efficient buffers for
   720 reading and writing.
   721 
   722 @see RFs::VolumeIOParam()
   723 */
   724 class TVolumeIOParamInfo
   725 	{
   726 public:
   727 	/**
   728 	The size of a block in bytes.
   729 	
   730 	Reads and writes that are aligned on block boundaries are up to twice as fast as when 
   731 	mis-aligned.	
   732 	
   733 	Read and write operations on certain underlying media is done in blocks.
   734 	A write operation that modifies only part of a block is less efficient, in general, than
   735 	one that modifies an entire block. Data throughput degrades linearly for reads and writes in smaller
   736 	sized units. 
   737 	*/
   738 	TInt iBlockSize;
   739 	/**
   740 	The size in bytes of a single disk cluster.
   741 	
   742 	Read and write operations that are aligned on cluster boundaries are more efficient.
   743 	
   744 	The file system organises and allocates the file data on the disk in clusters where each cluster is
   745 	one or more blocks. Files that are not zero length occupy at least one cluster of the disk, 
   746 	so large numbers of very small files use up more disk space than expected. 
   747 	*/
   748 	TInt iClusterSize;
   749 	/**
   750 	The recommended buffer size for optimised reading performance. 
   751 	
   752 	The given buffer size is based on sensible benchmark testing results produced by the mobile device vendor.
   753 	The buffer size is then added to the estart.txt file
   754 	
   755 	The figure is included in the estart.txt file along with the drive number and the variable name. 
   756 	The example below shows the required format:
   757 
   758 	[DriveC]
   759 	RecReadBufSize 8192
   760 
   761 	When no value is provided, value KErrNotSupported is returned.
   762 	*/
   763 	TInt iRecReadBufSize;
   764 	/**
   765 	The recommended buffer size for optimised writing performance. 
   766 	
   767 	The given buffer size is based on sensible benchmark testing results produced by the mobile device vendor.
   768 	The buffer size is then added to the estart.txt file
   769 	
   770 	The figure is included in the estart.txt file along with the drive number and the variable name. 
   771 	The example below shows the required format:
   772 
   773 	[DriveC]
   774 	RecWriteBufSize 16384
   775 	
   776 	When no value is provided, value KErrNotSupported is returned.
   777 	*/
   778 	TInt iRecWriteBufSize;
   779 
   780 private:
   781 	/*
   782 	Reserved space for future use
   783 	*/
   784 	TInt iReserved[4];
   785 	};
   786 
   787 enum TDriveNumber
   788 /**
   789 @publishedAll
   790 @released
   791 
   792 The drive number enumeration.
   793 */
   794 	{
   795 	EDriveA,   EDriveB,   EDriveC,   EDriveD,   EDriveE,
   796 	EDriveF,   EDriveG,   EDriveH,   EDriveI,   EDriveJ,
   797 	EDriveK,   EDriveL,   EDriveM,   EDriveN,   EDriveO, 
   798 	EDriveP,   EDriveQ,   EDriveR,   EDriveS,   EDriveT,
   799 	EDriveU,   EDriveV,   EDriveW,   EDriveX,   EDriveY,
   800 	EDriveZ
   801 	};
   802 
   803 
   804 
   805 
   806 enum TEntryKey
   807 /**
   808 @publishedAll
   809 @released
   810 
   811 Flags indicating the order in which directory entries are to be sorted.
   812 
   813 @see RFs::GetDir
   814 @see CDirScan::SetScanDataL
   815 @see CDir::Sort
   816 */
   817 	{
   818 	/**
   819 	The default; no sorting takes place
   820 	*/
   821 	ESortNone=0,
   822 
   823 
   824 	/**
   825 	Sort according to alphabetic order of file and directory name.
   826 
   827     This setting is mutually exclusive with ESortByExt, ESortBySize,
   828     ESortByDate and ESortByUid.
   829 	*/
   830 	ESortByName,
   831 	
   832 	
   833 	/**
   834 	Sort according to alphabetic order of file extension.
   835 	
   836 	Files without an extension take precedence over files with an extension.
   837 	For files with the same extension or without an extension, the default is
   838 	to sort by name.
   839 
   840     This setting is mutually exclusive with ESortByName, ESortBySize,
   841     ESortByDate and ESortByUid.
   842 	*/
   843 	ESortByExt,
   844 	
   845 	
   846 	/**
   847 	Sort according to file size.
   848 
   849     This setting is mutually exclusive with ESortByName, ESortByExt,
   850     ESortByDate and ESortByUid.
   851 	*/
   852 	ESortBySize,
   853 	
   854 	
   855 	/**
   856 	Sort according to files' last modified time and date.
   857 	
   858 	By default, most recent last.
   859 
   860     This setting is mutually exclusive with ESortByName, ESortByExt,
   861     ESortBySize and ESortByUid.
   862 	*/
   863 	ESortByDate,
   864 	
   865 	
   866 	/**
   867 	Sort according to file UID.
   868  
   869     This setting is mutually exclusive with ESortByName, ESortByExt,
   870     ESortBySize and ESortByDate.
   871 	*/
   872 	ESortByUid,
   873 	
   874 	
   875 	/**
   876 	Qualifies the sort order; if set, directories are listed in the order in
   877 	which they occur. 
   878 	
   879 	This is the default.
   880 
   881     This flag is mutually exclusive with EDirsFirst and EDirslast.
   882 	*/
   883 	EDirsAnyOrder=0,
   884 	
   885 	
   886 	/**
   887 	Qualifies the sort order; if set, directories come before files in sort order.
   888 
   889     This flag is mutually exclusive with EDirsAnyOrder and EDirsLast.
   890 	*/
   891 	EDirsFirst=0x100,
   892 	
   893 	
   894 	/**
   895 	Qualifies the sort order; if set, files come before directories in sort order.
   896  
   897     This flag is mutually exclusive with EDirsAnyOrder and EDirsFirst.
   898 	*/
   899 	EDirsLast=0x200,
   900 	
   901 	
   902 	/**
   903 	Qualifies the sort order; files are sorted in ascending order, i.e. from A to Z.
   904 	This is the default behaviour.
   905 
   906     This flag is mutually exclusive with EDescending and EDirDescending.
   907 	*/
   908 	EAscending=0,
   909 	
   910 	
   911 	/**
   912 	Qualifies the sort order; files are sorted in descending order, i.e. from Z to A.
   913     
   914     This flag is mutually exclusive with EAscending and EDirDescending.
   915 	*/
   916 	EDescending=0x400,
   917 	
   918 	
   919 	/**
   920 	Qualifies the sort order; directories are sorted in descending order, i.e. from Z to A.
   921     
   922     This flag shall be used in combination with either EDirsFirst or EDirsLast.
   923     This flag is mutually exclusive with EAscending and EDescending.
   924 	*/
   925 	EDirDescending=0x800
   926 	};
   927 
   928 
   929 
   930 
   931 enum TFileMode
   932 /**
   933 @publishedAll
   934 @released
   935 
   936 Access and share modes available when opening a file.
   937 
   938 The access mode indicates whether the file is opened just for reading or
   939 for writing.
   940 
   941 The share mode indicates whether other RFile objects can access the
   942 open file, and whether this access is read only.
   943 
   944 Use EFileShareReadersOrWriters if a client does not care whether the file has
   945 been previously opened for ReadOnly or Read/Write access.
   946 
   947 If EFileShareReadersOrWriters is not used, then a client needs to cooperate with 
   948 other clients in order to open the file with the correct share mode, either
   949 EFileShareReadersOnly or EFileShareAny, depending on the share mode used when
   950 the file was originally opened.
   951 
   952 To open a file for reading and writing with read and write shared access, 
   953 use:
   954 
   955 @code
   956 _LIT(KFilename, "filename.ext");
   957 RFile file;
   958 file.Open(theFs, KFilename, EFileShareAny|EFileWrite);
   959 @endcode
   960 
   961 If another instance of RFile tries to open this file in EFileShareExclusive
   962 or EFileShareReadersOnly mode, access is denied. However, it can be opened
   963 in EFileShareAny mode or EFileShareReadersOrWriters mode.
   964 
   965 If a file is opened with EFileShareReadersOrWriters, and the file is opened for
   966 sharing by another client, then the file share mode is promoted to the new share 
   967 mode. When the file handle is closed then the share mode is demoted back to 
   968 EFileShareReadersOrWriters.
   969 
   970 @code
   971 
   972 Table of FileShare promotion rules
   973 ----------------------------------
   974 
   975 Client A					Client B							Resultant Share Mode 
   976 --------					--------							--------------------
   977 ReadersOnly					ReadersOnly						ReadersOnly
   978 ReadersOnly					ReadersOrWriters|EFileRead			ReadersOnly
   979 ReadersOnly					ReadersOrWriters|EFileWrite		INCOMPATIBLE
   980 ReadersOnly					Any								INCOMPATIBLE
   981 
   982 ReadersOrWriters|EFileRead	ReadersOnly						ReadersOnly
   983 ReadersOrWriters|EFileRead	ReadersOrWriters|EFileRead		ReadersOrWriters
   984 ReadersOrWriters|EFileRead	ReadersOrWriters|EFileWrite		ReadersOrWriters
   985 ReadersOrWriters|EFileRead	Any								Any
   986 
   987 ReadersOrWriters|EFileWrite	ReadersOnly						INCOMPATIBLE
   988 ReadersOrWriters|EFileWrite	ReadersOrWriters|EFileRead			ReadersOrWriters
   989 ReadersOrWriters|EFileWrite	ReadersOrWriters|EFileWrite		ReadersOrWriters
   990 ReadersOrWriters|EFileWrite	Any								Any
   991 
   992 Any							ReadersOnly						INCOMPATIBLE
   993 Any							ReadersOrWriters|EFileRead			Any
   994 Any							ReadersOrWriters|EFileWrite		Any
   995 Any							Any								Any
   996 @endcode
   997 
   998 Use the following guidance notes for selecting FileShare mode with shared RFile objects:
   999 
  1000 EFileShareAny
  1001 - Use this mode to request both read and write access when another client needs
  1002 to write to the file and respective client access to the file is coordinated.
  1003 - To open a file for non-exclusive write, use EFileShareAny | EFileWrite. 
  1004 - It is recommended that either EFileShareAny or EFileShareAny | EFileRead are
  1005 not used. These combinations will block users attempting to use the 
  1006 EFileShareReadersOnly mode even if all the EFileShareAny handles do not have
  1007 the EFileWrite bit set as the EFileRead and EFileWrite bits have no affect on 
  1008 sharing. Use either EFileShareReadersOnly or EFileShareReadersOrWriters.
  1009 
  1010 EFileShareReadersOrWriters 
  1011 - Use this mode when it does not matter if another file writes to the file and
  1012 file access can not be coordinated as other clients are unknown.
  1013 - To open a file for shared read access whilst permitting writers, use 
  1014 EFileShareReadersOrWriters | EFileRead.
  1015 
  1016 - For write access with unrestricted share mode, 
  1017 EFileShareReadersOrWriters | EFileWrite may be used however 
  1018 EFilesShareAny | EFileWrite is preferred.
  1019 
  1020 EFileShareReadersOnly
  1021 - Use this mode to get read access to the file and deny write access for any 
  1022 other handles on this file. 
  1023 - To open a file for shared read access whilst disallowing writers use 
  1024 EFileShareReadersOnly.
  1025 
  1026 
  1027 Files may be opened in text or binary mode. Native Symbian OS application 
  1028 files are nearly all binary, (so they will usually be opened in binary mode).
  1029 However, they can be opened in text mode (to support testing, and to make them
  1030 compatible with text formats on remote systems).
  1031 Symbian OS native text format uses CR-LF (ASCII 0x0d, 0x0a) to denote the end of
  1032 a line. When reading, however, any combination of CR, LF, LF-CR or CR-LF is
  1033 recognised as the end of a line. Where a remote file system uses a different
  1034 format, it is the responsibility of the installable file system to present
  1035 an interface for text files which conforms with this format.
  1036 
  1037 The share mode may be OR’ed with either EFileStream or EFileStreamText.
  1038 
  1039 Additionally, it may be OR’ed with either EFileRead or EFileWrite.
  1040 */
  1041 	{
  1042 	/**
  1043 	Exclusive access for the program opening the file.
  1044 	
  1045 	No other program can access the file until it is closed.
  1046     If another program is already accessing the file in any share mode, then
  1047     an attempt to open it with an EFileShareExclusive will fail.
  1048 	*/
  1049 	EFileShareExclusive,
  1050 
  1051 
  1052 	/**
  1053 	Read-only sharing.
  1054 	
  1055 	This means that the file may only be accessed for reading.
  1056     A file cannot be opened using a share mode of EFileShareReadersOnly with
  1057     an EFileWrite flag.
  1058 	*/
  1059 	EFileShareReadersOnly,
  1060 
  1061 
  1062 	/**
  1063 	Shared access for reading and writing.
  1064 	
  1065 	This means that other programs may share access to the file for reading
  1066 	and writing with the program which opened the file.
  1067 
  1068 	When using this mode, the program is expecting another program to be able
  1069 	to write to the file, so is not compatible with EFileShareReadersOnly.
  1070 	*/
  1071 	EFileShareAny,
  1072 
  1073 
  1074 	/**
  1075 	Shared access for reading and writing.
  1076 	
  1077 	This means that other programs may share access to the file for reading
  1078 	and writing with the program which opened the file.  
  1079 	
  1080 	When using this mode, the program does not care if another program has
  1081 	the file open for read or write access.
  1082 	*/
  1083 	EFileShareReadersOrWriters,
  1084 
  1085 
  1086 	/**
  1087 	For files to be opened in binary mode.
  1088 	*/
  1089 	EFileStream=0,
  1090 
  1091 
  1092 	/**
  1093 	For files to be opened in text mode.
  1094 	*/
  1095 	EFileStreamText=0x100,
  1096 
  1097 
  1098 	/**
  1099 	The file may be read from but not written to.
  1100 	*/
  1101 	EFileRead=0,
  1102 
  1103 
  1104 	/**
  1105 	The file may be read from and written to
  1106 	
  1107 	Cannot be combined with a share mode of EFileShareReadersOnly.
  1108 	*/
  1109 	EFileWrite=0x200,
  1110 
  1111 	/**
  1112 	Specifies that an asynchronous read request should not be completed 
  1113 	until all requested data becomes available.
  1114 	
  1115 	Cannot be combined with the EFileShareExclusive or EFileShareReadersOnly
  1116 	share modes as this will prohibit a writer from updating the file.
  1117 	*/
  1118 	EFileReadAsyncAll=0x400,
  1119 
  1120 	/**
  1121 	Enables write buffering
  1122 	*/
  1123 	EFileWriteBuffered	=0x00000800,
  1124 
  1125 	/**
  1126 	Disables write buffering
  1127 	*/
  1128 	EFileWriteDirectIO	=0x00001000,
  1129 
  1130 	/**
  1131 	Enables read buffering
  1132 	*/
  1133 	EFileReadBuffered	=0x00002000,
  1134 
  1135 	/**
  1136 	Disables read buffering
  1137 	*/
  1138 	EFileReadDirectIO	=0x00004000,
  1139 
  1140 	/**
  1141 	Enables read ahead. 
  1142 	*/
  1143 	EFileReadAheadOn	=0x00008000,
  1144 
  1145 	/**
  1146 	Disables read ahead.
  1147 	*/
  1148 	EFileReadAheadOff	=0x00010000
  1149 	};
  1150 
  1151 
  1152 
  1153 
  1154 /**
  1155 @publishedAll
  1156 @released
  1157 
  1158 Bit mask provided for retrieving a file's share mode.
  1159 
  1160 @see TFileMode
  1161 */
  1162 const TUint KFileShareMask=0xff;
  1163 
  1164 
  1165 
  1166 
  1167 enum TFormatMode 
  1168 /**
  1169 @publishedAll
  1170 @released
  1171 
  1172 The format method.
  1173 */
  1174 	{
  1175 	/**
  1176 	Indicates a high density floppy disk to be formatted.
  1177 	*/
  1178 	EHighDensity,
  1179     
  1180     
  1181     /**
  1182     Indicates a standard floppy disk to be formatted.
  1183 	*/
  1184 	ELowDensity,
  1185 
  1186 
  1187 	/**
  1188 	Performs a full format, erasing existing content and resetting the FAT
  1189 	and root directory.
  1190 	
  1191 	This is the default, and can be ORed with bit EHighDensity or ELowDensity.
  1192 	*/
  1193 	EFullFormat=0,
  1194 
  1195 
  1196     /**
  1197     Does the minimum required to format the device, only resetting the FAT
  1198     and root directory.
  1199     
  1200     This is the default, and can be ORed with bit EHighDensity or ELowDensity.
  1201 	*/
  1202 	EQuickFormat=0x100,
  1203 	
  1204 	
  1205 	/**
  1206 	Indicates a custom formatting mode.
  1207 	*/
  1208 	ESpecialFormat=0x200,
  1209 
  1210 	/**
  1211 	Forced erase of locked media
  1212 	*/
  1213 	EForceErase=0x400
  1214 	};
  1215 
  1216 
  1217 
  1218 
  1219 enum TSeek
  1220 /**
  1221 @publishedAll
  1222 @released
  1223 
  1224 Flags indicating the destination of a seek operation.
  1225 
  1226 File locations are specified as a 32-bit signed integer,
  1227 allowing offsets of ?GB from the origin of the seek.
  1228 
  1229 @see RFile::Seek
  1230 */
  1231 	{
  1232 	/**
  1233 	This can only be used for file systems with execute-in-place facilities,
  1234 	such as the ROM file system: the offset specifies the absolute address of
  1235 	the data.
  1236 	*/
  1237 	ESeekAddress,
  1238 
  1239 
  1240 	/**
  1241 	Destination is the start of file.
  1242 	*/
  1243 	ESeekStart,
  1244 
  1245 
  1246 	/**
  1247 	Destination is the current position in file.
  1248 	*/
  1249 	ESeekCurrent,
  1250 
  1251 
  1252 	/**
  1253 	Destination is the end of file.
  1254 	*/
  1255 	ESeekEnd
  1256 	};
  1257 
  1258 /**
  1259 
  1260 */
  1261 class TBlockMapEntry : public TBlockMapEntryBase
  1262 	{
  1263 public:
  1264 	IMPORT_C TBlockMapEntry();
  1265 	IMPORT_C void SetNumberOfBlocks( TUint aNumberOfBlocks );
  1266 	IMPORT_C void SetStartBlock( TUint aStartBlock );
  1267 	};
  1268 
  1269 /**
  1270    
  1271 */
  1272 typedef TBuf8<KMaxMapsPerCall*sizeof(TBlockMapEntry)> TBlockArrayDes;
  1273 
  1274 struct SBlockMapInfo : public SBlockMapInfoBase
  1275 	{
  1276 	TBlockArrayDes iMap;
  1277 	};
  1278 
  1279 /**
  1280 
  1281 */
  1282 enum TBlockMapUsage
  1283 	{
  1284 	/* */
  1285 	EBlockMapUsagePaging,
  1286 	/* */
  1287 	ETestDebug
  1288 	};
  1289 
  1290 class TEntry
  1291 /**
  1292 @publishedAll
  1293 @released
  1294 
  1295 Encapsulates an entry in a directory, which can be another (nested) directory,
  1296 a file or a volume label.
  1297 
  1298 Each directory entry has a name which is relative to its owning directory
  1299 and a type, which is indicated by its unique identifier (UID).
  1300 
  1301 An entry can be interrogated for the following properties:
  1302 
  1303 1. the kind of entry: stored in the entry UIDs, stored in iType
  1304 
  1305 2. the entry attributes, stored in iAtt
  1306 
  1307 3. the size of entry
  1308 
  1309 4. the time the entry was last modified.
  1310 
  1311 @see RDir
  1312 @see RFs::Entry
  1313 @see RFs::SetEntry
  1314 @see CfileBase::CurrentEntry
  1315 */
  1316 	{
  1317 public:
  1318 	IMPORT_C TEntry();
  1319 	IMPORT_C TEntry(const TEntry& aEntry);
  1320 	IMPORT_C TEntry& operator=(const TEntry& aEntry);
  1321 	IMPORT_C TBool IsReadOnly() const;
  1322 	IMPORT_C TBool IsHidden() const;
  1323 	IMPORT_C TBool IsSystem() const;
  1324 	IMPORT_C TBool IsDir() const;
  1325 	IMPORT_C TBool IsArchive() const;
  1326 	inline const TUid& operator[](TInt anIndex) const;
  1327 	inline TBool IsUidPresent(TUid aUid) const;
  1328 	inline TBool IsTypeValid() const;
  1329 	inline TUid MostDerivedUid() const;
  1330 public:
  1331     /**
  1332     The individual bits within this byte indicate which attributes
  1333     have been set.
  1334 
  1335     @see KEntryAttNormal
  1336 	@see KEntryAttReadOnly
  1337 	@see KEntryAttHidden
  1338     @see KEntryAttSystem
  1339     */
  1340 	TUint iAtt;
  1341 
  1342 
  1343     /**
  1344     The size of the file in bytes.
  1345     For files larger that 2G it must be cast to TUint in order to avoid looking like negative signed.
  1346     */
  1347 	TInt iSize;
  1348 	
  1349 	
  1350 	/**
  1351 	The local time of last modification.
  1352 	*/
  1353 	TTime iModified;
  1354 	
  1355 	
  1356 	/**
  1357 	The file's UIDtype
  1358 	*/
  1359 	TUidType iType;
  1360 	
  1361 	
  1362 	/**
  1363 	The name of the file relative to the owning directory,
  1364 	with a maximum of KMaxFileName characters.
  1365 	
  1366 	@see KMaxFileName
  1367 	*/
  1368 	TBufC<KMaxFileName> iName;
  1369 	
  1370 private:	
  1371 	/**
  1372 	Reserved for future expansion
  1373 	*/
  1374 	TUint32 iReserved[2];
  1375 	};
  1376 
  1377 
  1378 
  1379 
  1380 class RDir;
  1381 class TEntryArray
  1382 /**
  1383 @publishedAll
  1384 @released
  1385 
  1386 Array of directory entries.
  1387 
  1388 It contains the results of a call to RDir::Read(): it will contain all
  1389 the TEntry items in the directory. Thus, a directory can be read in
  1390 a single call, minimising client/server communication overheads.
  1391 
  1392 @see TEntry
  1393 @see RDir::Read
  1394 */
  1395 	{
  1396 public:
  1397 	IMPORT_C TEntryArray();
  1398 	IMPORT_C TInt Count() const;
  1399 	IMPORT_C const TEntry& operator[](TInt anIndex) const;
  1400 private:
  1401 	TInt iCount;
  1402 	TInt iIndex;
  1403 	const TEntry* iPos;
  1404 	TBuf8<KEntryArraySize> iBuf;
  1405 	friend class RDir;
  1406 	friend class RFs;
  1407 	};
  1408 
  1409 
  1410 
  1411 
  1412 class TDriveInfo
  1413 /**
  1414 @publishedAll
  1415 @released
  1416 
  1417 Contains drive information.
  1418 
  1419 @see RFs::Drive
  1420 */
  1421 	{
  1422 public:
  1423     /**
  1424     The type of media mounted on the drive.
  1425     */
  1426 	TMediaType iType;
  1427  
  1428  
  1429     /**
  1430     Indicates whether the drive supports a battery, and if so, its state.
  1431     */
  1432     TBatteryState iBattery;
  1433  
  1434  
  1435     /**
  1436     The drive attributes.
  1437     
  1438     @see KDriveAttLocal
  1439     @see KDriveAttRom
  1440     @see KDriveAttRedirected
  1441     @see KDriveAttSubsted
  1442     @see KDriveAttInternal
  1443     @see KDriveAttRemovable
  1444     */
  1445 	TUint iDriveAtt;
  1446  
  1447  
  1448     /**
  1449     The attributes of the media mounted on the drive.
  1450     
  1451     @see KMediaAttVariableSize
  1452     @see KMediaAttDualDensity
  1453     @see KMediaAttFormattable
  1454     @see KMediaAttWriteProtected
  1455     @see KMediaAttLockable
  1456     @see KMediaAttLocked
  1457     */
  1458 	TUint iMediaAtt;
  1459 private:	
  1460 	/**
  1461 	Reserved for future expansion
  1462 	*/
  1463 	TUint32 iReserved;	
  1464 	};
  1465 
  1466 
  1467 
  1468 
  1469 class TVolumeInfo
  1470 /**
  1471 @publishedAll
  1472 @released
  1473 
  1474 Contains information about a volume mounted on a drive. Use RFs::Drive() if only 
  1475 the drive information is required. 
  1476 
  1477 If a drive supports removable media it may contain different volumes over time.
  1478 
  1479 Volume information is made up of information concerning the drive on which it is mounted, 
  1480 which can also be accessed through RFs::Drive(), and the volume information, this is made 
  1481 up of the size of the volume, the free space, its unique identifying number and a name.
  1482 
  1483 TVolumeInfo is initialised by RFs::Volume().
  1484 
  1485 @see RFs::Volume()
  1486 @see RFs::Drive()
  1487 */
  1488 	{
  1489 public:
  1490 	IMPORT_C TVolumeInfo();
  1491 	
  1492 	/**
  1493 	Information about the drive on which the volume is mounted.
  1494 	
  1495 	@see TDriveInfo
  1496 	*/
  1497 	TDriveInfo iDrive;
  1498 
  1499 
  1500 	/**
  1501 	The volume’s unique identifying number.
  1502 	*/
  1503 	TUint iUniqueID;
  1504 
  1505 
  1506 	/**
  1507 	The maximum size of the volume in bytes. The current amount of memory
  1508 	in use plus the amount of free memory.
  1509 	*/
  1510 	TInt64 iSize;
  1511 
  1512 
  1513 	/**
  1514 	The amount of free space on the volume in bytes.
  1515 	*/
  1516 	TInt64 iFree;
  1517 
  1518 
  1519 	/**
  1520 	Name of the volume, with a maximum of KMaxFileName characters.
  1521 	
  1522 	This field is optional.
  1523 
  1524     @see KMaxFileName
  1525 	*/
  1526 	TBufC<KMaxFileName> iName;
  1527 	
  1528 	/** 
  1529 	Flags which define the default file-caching behaviour for this volume
  1530 
  1531 	@see TFileCacheFlags
  1532 	*/
  1533 	TFileCacheFlags iFileCacheFlags;
  1534 
  1535     /**
  1536     @prototype
  1537     @internalTechnology
  1538     Internal flag, used in the case of non-blocking getting volume information. 
  1539     @see RFs::Volume(TVolumeInfo& aVol,TInt aDrive, TRequestStatus& aStat)
  1540 
  1541     If this flag is set, it means that the volume information will be obtained
  1542     asynchronously. More specific, on return iFree will reflect the _current_ amount of free space on volume at the moment of 
  1543     RFs::Volume() call, not the exact final value. This is because in this case getting volume information will be asynchronous, 
  1544     and the client will not be suspended until the mount finish calculating free space. At present appicable to FAT32 file system only.
  1545     */
  1546     TUint8 iVolSizeAsync : 1;
  1547 
  1548 private:	
  1549 	/**
  1550 	Reserved for future expansion
  1551 	*/
  1552     TUint8  i8Reserved1;	
  1553     TUint16 i16Reserved1;	
  1554     TUint32 i32Reserved1;	
  1555     TUint32 i32Reserved2;	
  1556 	};
  1557 
  1558 
  1559 
  1560 
  1561 class TDriveUnit
  1562 /**
  1563 @publishedAll
  1564 @released
  1565 
  1566 Drive numbers and letters.
  1567 
  1568 A drive may be represented by either an integer between zero and twenty five
  1569 inclusive, or by a buffer descriptor containing a character between "A" and "Z"
  1570 inclusive, followed by a colon.
  1571 This class encapsulates both representations.
  1572 An instance of this class is constructed specifying either the drive number
  1573 or the drive letter and may be converted between the two representations.
  1574 */
  1575 	{
  1576 public:
  1577 	inline TDriveUnit() {};
  1578 	IMPORT_C TDriveUnit(TInt aDrive);
  1579 	IMPORT_C TDriveUnit(const TDesC& aDrive);
  1580 	IMPORT_C TDriveUnit& operator=(TInt aDrive);
  1581 	IMPORT_C TDriveUnit& operator=(const TDesC& aDrive);
  1582 	inline operator TInt() const;
  1583 	IMPORT_C TDriveName Name() const;
  1584 private:
  1585 	TInt iDrive;
  1586 	};
  1587 
  1588 
  1589 
  1590 
  1591 class RFs;
  1592 //
  1593 class TParseBase
  1594 /**
  1595 @publishedAll
  1596 @released
  1597 
  1598 Base class for file name parsing.
  1599 
  1600 You first need to set up the path to be parsed using either a TParse, TParsePtr
  1601 or TParsePtrC object.
  1602 
  1603 The interrogation and extraction functions in this class allow you to test
  1604 whether a component has been specified in the pathname, and if so,
  1605 to extract it. If a component is not present in the pathname,
  1606 the extraction function returns an empty string.
  1607 
  1608 This class also allows directories to be added to, and popped from the path.
  1609 
  1610 Notes:
  1611 
  1612 1. the filename modification functions cannot be used by the TParsePtrC class.
  1613 
  1614 2. navigation using .. and . is not supported.
  1615 
  1616 @see TParse
  1617 @see TParsePtr
  1618 @see TParsePtrC
  1619 */
  1620 	{
  1621 private:
  1622 	struct SField {TUint8 pos;TUint8 len;TUint8 present;TUint8 filler;};
  1623 	enum TField {EDrive,EPath,EName,EExt,EMaxFields};
  1624 	enum TWild {EWildName=0x01,EWildExt=0x02,EWildEither=0x04,EIsRoot=0x08,EWildIsKMatchOne=0x10,EWildIsKMatchAny=0x20};
  1625 public:
  1626 	IMPORT_C TParseBase();
  1627 	IMPORT_C TInt PopDir();
  1628 	IMPORT_C TInt AddDir(const TDesC& aName);
  1629 	IMPORT_C const TDesC& FullName() const;
  1630 	IMPORT_C TPtrC Drive() const;
  1631 	IMPORT_C TPtrC Path() const;
  1632 	IMPORT_C TPtrC DriveAndPath() const;
  1633 	IMPORT_C TPtrC Name() const;
  1634 	IMPORT_C TPtrC Ext() const;
  1635 	IMPORT_C TPtrC NameAndExt() const;
  1636 	IMPORT_C TBool DrivePresent() const;
  1637 	IMPORT_C TBool PathPresent() const;
  1638 	IMPORT_C TBool NamePresent() const;
  1639 	IMPORT_C TBool ExtPresent() const;
  1640 	IMPORT_C TBool NameOrExtPresent() const;
  1641 	IMPORT_C TBool IsRoot() const;
  1642 	IMPORT_C TBool IsWild() const;
  1643 	IMPORT_C TBool IsKMatchOne() const;
  1644 	IMPORT_C TBool IsKMatchAny() const;
  1645 	IMPORT_C TBool IsNameWild() const;
  1646 	IMPORT_C TBool IsExtWild() const;
  1647 protected:
  1648 	virtual TDes& NameBuf() = 0;                // Reference to derived class descriptor containing the filename.
  1649 	virtual const TDesC& NameBufC() const = 0;  // const reference to derived class descriptor containing the filename.
  1650 	TInt Set(const TDesC* aName,const TDesC* aRelated,const TDesC* aDefault,TBool allowWild);
  1651 private:
  1652 	TInt ParseDrive(TLex& aName,TBool& aDone);
  1653 	TInt ParsePath(TLex& aName,TBool& aDone);
  1654 	TInt ParseName(TLex& aName,TBool& aDone);
  1655 	TInt ParseExt(TLex& aName,TBool& aDone);
  1656 protected:
  1657 	TInt16 iMod;        // Non-zero indicates File name modification functionality is enabled.
  1658 private:
  1659 	TInt16 iWild;
  1660 	SField iField[EMaxFields];
  1661 	};
  1662 
  1663 
  1664 
  1665 
  1666 class TParsePtr : public TParseBase
  1667 /**
  1668 @publishedAll
  1669 @released
  1670 
  1671 Parses filenames using less space on the stack than TParse.
  1672 
  1673 Stores a reference to a filename, unlike TParse, which uses
  1674 a 512 byte TFileName object as an internal buffer to store
  1675 a copy of the filename.
  1676 The filename's components (drive, path, etc.) can be retrieved using
  1677 the functions provided by the base class, TParseBase.
  1678 This class should be used in preference to TParse when minimising stack
  1679 usage is a priority.
  1680 
  1681 @see TParse
  1682 @see TFileName
  1683 */
  1684 	{
  1685 public:
  1686 	IMPORT_C TParsePtr(TDes& aName);
  1687 protected:
  1688 	IMPORT_C TDes& NameBuf();
  1689 	IMPORT_C const TDesC& NameBufC() const;
  1690 private:
  1691 	TPtr iNameBuf;
  1692 	};
  1693 
  1694 
  1695 
  1696 
  1697 class TParsePtrC : public TParseBase
  1698 /**
  1699 @publishedAll
  1700 @released
  1701 
  1702 Parses, but cannot modify, filenames using less space on the stack than TParse.
  1703 
  1704 Stores a reference to a filename, unlike TParse, which uses
  1705 a 512 byte TFileName object as an internal buffer to store
  1706 a copy of the filename.
  1707 The filename's components (drive, path, etc.) can be retrieved using
  1708 the functions provided by the base class, TParseBase. 
  1709 Note that because the filename cannot be modified through this class,
  1710 the base class functions PopDir() and AddDir() cannot be called, because
  1711 a panic will be raised.
  1712 
  1713 @see TParse
  1714 @see TFileName
  1715 */
  1716 	{
  1717 public:
  1718 	IMPORT_C TParsePtrC(const TDesC& aName);
  1719 protected:
  1720 	IMPORT_C TDes& NameBuf();
  1721 	IMPORT_C const TDesC& NameBufC() const;
  1722 private:
  1723 	TPtrC iNameBuf;
  1724 	};
  1725 
  1726 
  1727 
  1728 
  1729 class TParse : public TParseBase
  1730 /**
  1731 @publishedAll
  1732 @released
  1733 
  1734 Parses filenames.
  1735 
  1736 The class uses the full filename structure supported by Symbian OS.
  1737 
  1738 TParse works by using the Set() function to set up the filename to be parsed.
  1739 Then, various getter functions defined in the base class, TParseBase, such as:
  1740 FullName(), Drive(), Path(), DriveAndPath(), Name(), Ext() and NameAndExt()
  1741 may be used to retrieve path components.
  1742 
  1743 There are a number of restrictions to valid path components, which are
  1744 described in guide documentation.
  1745 */
  1746 	{
  1747 public:
  1748 	IMPORT_C TParse();
  1749 	IMPORT_C TInt Set(const TDesC& aName,const TDesC* aRelated,const TDesC* aDefault);
  1750 	IMPORT_C TInt SetNoWild(const TDesC& aName,const TDesC* aRelated,const TDesC* aDefault);
  1751 protected:
  1752 	IMPORT_C TDes& NameBuf();
  1753 	IMPORT_C const TDesC& NameBufC() const;
  1754 private:
  1755 	TFileName iNameBuf;
  1756 	};
  1757 	
  1758 	
  1759 	
  1760 
  1761 class CDir : public CBase
  1762 /**
  1763 @publishedAll
  1764 @released
  1765 
  1766 Array of directory entries that has been read into memory from the file system.
  1767 
  1768 It can be read and sorted by user programs, but cannot be created by them. 
  1769 */
  1770 	{
  1771 public:
  1772 	IMPORT_C virtual ~CDir();
  1773 	IMPORT_C TInt Count() const;
  1774 	IMPORT_C const TEntry& operator[](TInt anIndex) const;
  1775 	IMPORT_C TInt Sort(TUint aEntrySortKey);
  1776 protected:
  1777 	IMPORT_C CDir();
  1778 	IMPORT_C static CDir* NewL();
  1779 	IMPORT_C void AddL(const TEntry& anEntry);
  1780 	IMPORT_C void ExtractL(TBool aRemove,CDir*& aDir);
  1781 	IMPORT_C void Compress();
  1782 protected:
  1783 	CArrayPakFlat<TEntry>* iArray;
  1784 	friend class RFs;
  1785 	friend class TOpenFileScan;
  1786 	};
  1787 	
  1788 	
  1789 	
  1790 
  1791 class RFs : public RSessionBase
  1792 /**
  1793 @publishedAll
  1794 @released
  1795 
  1796 A handle to a file server session.
  1797 
  1798 A program or thread may have arbitrarily many sessions open simultaneously.
  1799 
  1800 Use this class for all file system manipulation, including:
  1801 
  1802 1. adding, removing, moving and renaming files and directories
  1803 
  1804 2. inspecting and changing file attributes and directory entry details.
  1805    These include the time and date when the file or directory was last
  1806    written to, its size and various attribute flags such as read-only,
  1807    hidden, archive or system.                                     
  1808 
  1809 3. finding a file’s real name; if the file system on which it is stored
  1810    has to "mangle" the name into a shorter format
  1811 
  1812 4. getting directory listings
  1813 
  1814 5. maintaining a default path; unlike some other systems, there is a single
  1815    system default path, rather than one for each drive: the default path
  1816    consists of a drive and a path specification.
  1817 
  1818 6. performing context-sensitive parses using TParse objects, and
  1819    the session path
  1820 
  1821 7. obtaining information on drives and volumes
  1822 
  1823 8. formatting and labelling volumes
  1824 
  1825 9. obtaining a list of valid drives
  1826 
  1827 10. emulating the DOS subst command, which allows any directory to appear
  1828     as if it were a separate drive
  1829 
  1830 11. requesting notification of when significant change occurs.
  1831     This can be used for programs which maintain file lists, but must
  1832     update those lists when change occurs.
  1833 
  1834 12. finding the version number of the file server
  1835 
  1836 13. resource counting to ensure that all resources are closed when
  1837     the session terminates.
  1838 
  1839 This class is not intended for user derivation.
  1840 
  1841 The following restrictions apply when a path is specified:
  1842 
  1843 1. its total length must not exceed 256 characters
  1844 
  1845 2. wildcards cannot be used in the drive or in any directory name,
  1846    although they may be allowed in the filename and extension.
  1847 
  1848 3. double backslashes are not allowed in the path. 
  1849 
  1850 4. the following characters must not be included anywhere in the path: < > " / |
  1851 
  1852 5. a colon may only be included between the drive and path
  1853 
  1854 6. no directory name or filename plus extension may consist solely
  1855    of space characters, or of a single or double dot.
  1856 
  1857 7. spaces between the drive, if specified, and the first directory in
  1858    the path are illegal, although there may be spaces between other
  1859    path components, for instance between directories.
  1860 */
  1861 	{
  1862 public:
  1863 	IMPORT_C TInt Connect(TInt aMessageSlots=KFileServerDefaultMessageSlots);
  1864 	IMPORT_C TVersion Version() const;
  1865 	IMPORT_C TInt AddFileSystem(const TDesC& aFileName) const;
  1866 	IMPORT_C TInt MountFileSystem(const TDesC& aFileSystemName,TInt aDrive) const;
  1867 	IMPORT_C TInt MountFileSystem(const TDesC& aFileSystemName,TInt aDrive, TBool aIsSync) const;
  1868 	IMPORT_C TInt MountFileSystemAndScan(const TDesC& aFileSystemName,TInt aDrive,TBool& aIsMountSuccess) const;
  1869 	IMPORT_C TInt MountFileSystem(const TDesC& aFileSystemName,const TDesC& aExtensionName,TInt aDrive);
  1870 	IMPORT_C TInt MountFileSystem(const TDesC& aFileSystemName,const TDesC& aExtensionName,TInt aDrive, TBool aIsSync);
  1871 	IMPORT_C TInt MountFileSystemAndScan(const TDesC& aFileSystemName,const TDesC& aExtensionName,TInt aDrive,TBool& aIsMountSuccess) const;
  1872 	IMPORT_C TInt DismountFileSystem(const TDesC& aFileSystemName,TInt aDrive) const;
  1873 	IMPORT_C TInt RemoveFileSystem(const TDesC& aFileSystemName) const;
  1874 	IMPORT_C TInt FileSystemName(TDes& aName,TInt aDrive) const;
  1875 	IMPORT_C TInt AddExtension(const TDesC& aFileName);
  1876 	IMPORT_C TInt MountExtension(const TDesC& aExtensionName,TInt aDrive);
  1877 	IMPORT_C TInt DismountExtension(const TDesC& aExtensionName,TInt aDrive);
  1878 	IMPORT_C TInt RemoveExtension(const TDesC& aExtensionName);
  1879 	IMPORT_C TInt ExtensionName(TDes& aExtensionName,TInt aDrive,TInt aPos);
  1880 	IMPORT_C TInt RemountDrive(TInt aDrive,const TDesC8* aMountInfo=NULL,TUint aFlags=0);
  1881 	IMPORT_C void NotifyChange(TNotifyType aType,TRequestStatus& aStat);
  1882 	IMPORT_C void NotifyChange(TNotifyType aType,TRequestStatus& aStat,const TDesC& aPathName);
  1883 	IMPORT_C void NotifyChangeCancel();
  1884 	IMPORT_C void NotifyChangeCancel(TRequestStatus& aStat);
  1885 	IMPORT_C void NotifyDiskSpace(TInt64 aThreshold,TInt aDrive,TRequestStatus& aStat);
  1886 	IMPORT_C void NotifyDiskSpaceCancel(TRequestStatus& aStat);
  1887 	IMPORT_C void NotifyDiskSpaceCancel();
  1888 	IMPORT_C TInt DriveList(TDriveList& aList) const;
  1889 	IMPORT_C TInt DriveList(TDriveList& aList, TUint aFlags) const;
  1890 	IMPORT_C TInt Drive(TDriveInfo& anInfo,TInt aDrive=KDefaultDrive) const;
  1891 	IMPORT_C TInt Volume(TVolumeInfo& aVol,TInt aDrive=KDefaultDrive) const;
  1892     IMPORT_C void Volume(TVolumeInfo& aVol,TInt aDrive, TRequestStatus& aStat) const;
  1893 	IMPORT_C TInt SetVolumeLabel(const TDesC& aName,TInt aDrive=KDefaultDrive);
  1894 	IMPORT_C TInt Subst(TDes& aPath,TInt aDrive=KDefaultDrive) const;
  1895 	IMPORT_C TInt SetSubst(const TDesC& aPath,TInt aDrive=KDefaultDrive);
  1896 	IMPORT_C TInt RealName(const TDesC& aName,TDes& aResult) const;
  1897     IMPORT_C TInt GetMediaSerialNumber(TMediaSerialNumber& aSerialNum, TInt aDrive);
  1898 	IMPORT_C TInt SessionPath(TDes& aPath) const;
  1899 	IMPORT_C TInt SetSessionPath(const TDesC& aPath);
  1900 	IMPORT_C TInt Parse(const TDesC& aName,TParse& aParse) const;
  1901 	IMPORT_C TInt Parse(const TDesC& aName,const TDesC& aRelated,TParse& aParse) const;
  1902 	IMPORT_C TInt MkDir(const TDesC& aPath);
  1903 	IMPORT_C TInt MkDirAll(const TDesC& aPath);
  1904 	IMPORT_C TInt RmDir(const TDesC& aPath);
  1905 	IMPORT_C TInt GetDir(const TDesC& aName,TUint anEntryAttMask,TUint anEntrySortKey,CDir*& anEntryList) const;
  1906 	IMPORT_C TInt GetDir(const TDesC& aName,TUint anEntryAttMask,TUint anEntrySortKey,CDir*& anEntryList,CDir*& aDirList) const;
  1907 	IMPORT_C TInt GetDir(const TDesC& aName,const TUidType& anEntryUid,TUint anEntrySortKey,CDir*& aFileList) const;
  1908 	IMPORT_C TInt Delete(const TDesC& aName);
  1909 	IMPORT_C TInt Rename(const TDesC& anOldName,const TDesC& aNewName);
  1910 	IMPORT_C TInt Replace(const TDesC& anOldName,const TDesC& aNewName);
  1911 	IMPORT_C TInt Att(const TDesC& aName,TUint& aAttValue) const;
  1912 	IMPORT_C TInt SetAtt(const TDesC& aName,TUint aSetAttMask,TUint aClearAttMask);
  1913 	IMPORT_C TInt Modified(const TDesC& aName,TTime& aTime) const;
  1914 	IMPORT_C TInt SetModified(const TDesC& aName,const TTime& aTime);
  1915 	IMPORT_C TInt Entry(const TDesC& aName,TEntry& anEntry) const;
  1916 	IMPORT_C TInt SetEntry(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask);
  1917 	IMPORT_C TInt ReadFileSection(const TDesC& aName,TInt aPos,TDes8& aDes,TInt aLength) const;
  1918 	IMPORT_C static TBool IsValidDrive(TInt aDrive);
  1919 	IMPORT_C static TInt CharToDrive(TChar aChar,TInt& aDrive);
  1920 	IMPORT_C static TInt DriveToChar(TInt aDrive,TChar& aChar);
  1921 	IMPORT_C static TBool IsRomAddress(TAny* aAny);
  1922 	IMPORT_C static TDriveNumber GetSystemDrive();
  1923 	IMPORT_C static TChar GetSystemDriveChar();
  1924 	IMPORT_C TInt SetSystemDrive(TDriveNumber aSystemDrive);
  1925 	IMPORT_C void ResourceCountMarkStart() const;
  1926 	IMPORT_C void ResourceCountMarkEnd() const;
  1927 	IMPORT_C TInt ResourceCount() const;
  1928 	IMPORT_C TInt IsFileOpen(const TDesC& aFile,TBool& anAnswer) const;
  1929 	IMPORT_C TInt CheckDisk(const TDesC& aDrive) const;
  1930 	IMPORT_C TInt ScanDrive(const TDesC& aDrive) const;
  1931 	IMPORT_C TInt GetShortName(const TDesC& aLongName,TDes& aShortName) const;
  1932 	IMPORT_C TInt GetLongName(const TDesC& aShortName,TDes& aLongName) const;
  1933 	IMPORT_C TBool GetNotifyUser();
  1934 	IMPORT_C void SetNotifyUser(TBool aValue);
  1935 	IMPORT_C TUint8* IsFileInRom(const TDesC& aFileName) const;
  1936 	IMPORT_C TBool IsValidName(const TDesC& anEntryName) const;
  1937 	IMPORT_C TBool IsValidName(const TDesC& aFileName,TText& aBadChar) const;
  1938 	IMPORT_C TInt GetDriveName(TInt aDrive,TDes& aDriveName) const;
  1939 	IMPORT_C TInt SetDriveName(TInt aDrive,const TDesC& aDriveName);
  1940 	IMPORT_C TInt LoaderHeapFunction(TInt aFunction, TAny *aArg1=NULL, TAny *aArg2=NULL);
  1941 	IMPORT_C TInt SetErrorCondition(TInt anError,TInt aCount=0);
  1942 	IMPORT_C TInt SetDebugRegister(TInt aVal);
  1943 	IMPORT_C TInt SetAllocFailure(TInt aAllocNum);
  1944 	IMPORT_C void DebugNotify(TInt aDrive,TUint aNotifyType,TRequestStatus& aStat);
  1945 	IMPORT_C TInt ControlIo(TInt aDrive,TInt aCommand);
  1946 	IMPORT_C TInt ControlIo(TInt aDrive,TInt aCommand,TDes8& aParam1);
  1947 	IMPORT_C TInt ControlIo(TInt aDrive,TInt aCommand,TDes8& aParam1,TDes8& aParam2);
  1948 	IMPORT_C TInt ControlIo(TInt aDrive,TInt aCommand,TAny* aParam1,TAny* aParam2);
  1949 	IMPORT_C TInt LockDrive(TInt aDrv, const TMediaPassword &aOld, const TMediaPassword &aNew, TBool aStr);
  1950 	IMPORT_C TInt UnlockDrive(TInt aDrv, const TMediaPassword &Pswd, TBool aStr);
  1951 	IMPORT_C TInt ClearPassword(TInt aDrv, const TMediaPassword &aPswd);
  1952 	IMPORT_C TInt ErasePassword(TInt aDrv);
  1953 	IMPORT_C TInt SetSessionToPrivate(TInt aDrive);
  1954 	IMPORT_C TInt PrivatePath(TDes& aPath);
  1955 	IMPORT_C TInt CreatePrivatePath(TInt aDrive);	
  1956 	IMPORT_C void StartupInitComplete(TRequestStatus& aStat);
  1957 	IMPORT_C TInt SetLocalDriveMapping(const TDesC8& aMapping);
  1958 
  1959 	IMPORT_C TInt FinaliseDrives();
  1960     
  1961     /** specifies drive finalisation modes */
  1962     enum TFinaliseDrvMode
  1963         {
  1964         EFinal_RW,      ///< after successful finalisation the drive remains writable and will become "not finalised" after the first write operation.
  1965         EFinal_RO,      ///< after successful finalisation the drive becomes read-only
  1966         EForceUnfinalise///< @internalComponent  mark the drive as "not finalised" can result in KErrAbort if the dive is in inconsistent state.
  1967         };
  1968 
  1969     IMPORT_C TInt FinaliseDrive(TInt aDriveNo, TFinaliseDrvMode aMode) const;
  1970 
  1971 	IMPORT_C TInt SwapFileSystem(const TDesC& aOldFileSystemName,const TDesC& aNewFileSystemName,TInt aDrive) const;
  1972 	IMPORT_C TInt ReserveDriveSpace(TInt aDriveNo, TInt aSpace);
  1973 	IMPORT_C TInt GetReserveAccess(TInt aDriveNo);
  1974 	IMPORT_C TInt ReleaseReserveAccess(TInt aDriveNo);
  1975 
  1976 	IMPORT_C TInt AddPlugin(const TDesC& aFileName) const;
  1977 	IMPORT_C TInt RemovePlugin(const TDesC& aPluginName) const;
  1978 	IMPORT_C TInt PluginName(TDes& aPluginName,TInt aDrive,TInt aPos);
  1979 
  1980 	IMPORT_C TInt MountPlugin(const TDesC& aPluginName) const;
  1981 	IMPORT_C TInt MountPlugin(const TDesC& aPluginName,TInt aDrive) const;
  1982 	IMPORT_C TInt MountPlugin(const TDesC& aPluginName,TInt aDrive, TInt aPos) const;
  1983 	
  1984 	IMPORT_C TInt DismountPlugin(const TDesC& aPluginName) const;
  1985 	IMPORT_C TInt DismountPlugin(const TDesC& aPluginName,TInt aDrive) const;
  1986 	IMPORT_C TInt DismountPlugin(const TDesC& aPluginName,TInt aDrive,TInt aPos) const;
  1987 
  1988 	IMPORT_C void NotifyDismount(TInt aDrive, TRequestStatus& aStat, TNotifyDismountMode aMode=EFsDismountRegisterClient) const;
  1989 	IMPORT_C void NotifyDismountCancel(TRequestStatus& aStat) const;
  1990 	IMPORT_C void NotifyDismountCancel() const;
  1991 	IMPORT_C TInt AllowDismount(TInt aDrive) const;
  1992     IMPORT_C TInt SetStartupConfiguration(TInt aCommand,TAny* aParam1,TAny* aParam2) const;
  1993 	IMPORT_C TInt AddCompositeMount(const TDesC& aFileSystemName,TInt aLocalDriveToMount,TInt aCompositeDrive, TBool aSync) const;
  1994 	IMPORT_C TInt SetNotifyChange(TBool aNotifyChange);
  1995 	IMPORT_C TInt QueryVolumeInfoExt(TInt aDrive, TQueryVolumeInfoExtCmd aCommand, TDes8& aInfo) const;
  1996 	IMPORT_C TInt VolumeIOParam(TInt aDriveNo, TVolumeIOParamInfo& aParamInfo) const;
  1997 	IMPORT_C TInt FileSystemSubType(TInt aDriveNo, TDes& aName) const;
  1998 	IMPORT_C TInt InitialisePropertiesFile(const TPtrC8& aPtr) const;
  1999 
  2000 	TInt Unclamp(const RFileClamp& aHandle);
  2001 
  2002 private:
  2003 	void GetDirL(const TDesC& aMatchName,TUint anEntryAttMask,TUint anEntrySortKey,CDir*& anEntryList,CDir*& aDirList,RDir& aDir) const;
  2004 	void GetDirL(const TDesC& aMatchName,TUint anEntryAttMask,TUint anEntrySortKey,CDir*& anEntryList,RDir& aDir) const;
  2005 	void GetDirL(const TDesC& aMatchName,const TUidType& aUidType,TUint anEntrySortKey,CDir*& anEntryList,RDir& aDir) const;
  2006 	void DoGetDirL(TUint anEntrySortKey,CDir*& anEntryList,RDir& aDir) const;
  2007 	TInt GetOpenFileList(TInt& aSessionNum,TInt& aLocalPos,TThreadId& aThreadId,TEntryArray& anArray) const;
  2008 	friend class TOpenFileScan;
  2009 	};
  2010 
  2011 
  2012 
  2013 
  2014 
  2015 
  2016 
  2017 /**
  2018 @publishedAll
  2019 @released
  2020 
  2021 Creates and opens a file, and performs all operations on a single open file.
  2022 
  2023 These include:
  2024 
  2025 - reading from and writing to the file
  2026 
  2027 - seeking to a position within the file
  2028 
  2029 - locking and unlocking within the file
  2030 
  2031 - setting file attributes
  2032 
  2033 Before using any of these services, a connection to a file server session must
  2034 have been made, and the file must be open.
  2035 
  2036 Opening Files:
  2037 
  2038 -  use Open() to open an existing file for reading or writing; an error is
  2039    returned if it does not already exist.
  2040    To open an existing file for reading only, use Open() with an access mode of
  2041    EFileRead, and a share mode of EFileShareReadersOnly.
  2042 
  2043 -  use Create() to create and open a new file for writing; an error is returned
  2044    if it already exists.
  2045 
  2046 -  use Replace() to open a file for writing, replacing any existing file of
  2047    the same name if one exists, or creating a new file if one does not exist.
  2048    Note that if a file exists, its length is reset to zero.
  2049 
  2050 -  use Temp() to create and open a temporary file with a unique name,
  2051    for writing and reading.
  2052 
  2053 When opening a file, you must specify the file server session to use for
  2054 operations with that file. If you do not close the file explicitly, it is
  2055 closed when the server session associated with it is closed.
  2056 
  2057 Reading and Writing:
  2058 
  2059 There are several variants of both Read() and Write().
  2060 The basic Read(TDes8& aDes) and Write(const TDesC8& aDes) are supplemented
  2061 by variants allowing the descriptor length to be overridden, or the seek
  2062 position of the first byte to be specified, or asynchronous completion,
  2063 or any combination.
  2064 
  2065 Reading transfers data from a file to a descriptor, and writing transfers
  2066 data from a descriptor to a file. In all cases, the file data is treated
  2067 as binary and byte descriptors are used (TDes8, TDesC8).
  2068 
  2069 @see TDes8
  2070 @see TDesC8
  2071 */
  2072 class RFile : public RSubSessionBase
  2073 	{
  2074 public:
  2075 	IMPORT_C TInt Open(RFs& aFs,const TDesC& aName,TUint aFileMode);
  2076 	IMPORT_C void Close();
  2077 	IMPORT_C TInt Create(RFs& aFs,const TDesC& aName,TUint aFileMode);
  2078 	IMPORT_C TInt Replace(RFs& aFs,const TDesC& aName,TUint aFileMode);
  2079 	IMPORT_C TInt Temp(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aFileMode);
  2080 	IMPORT_C TInt Read(TDes8& aDes) const;
  2081 	IMPORT_C void Read(TDes8& aDes,TRequestStatus& aStatus) const;
  2082 	IMPORT_C TInt Read(TDes8& aDes,TInt aLength) const;
  2083 	IMPORT_C void Read(TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const;
  2084 	IMPORT_C TInt Read(TInt aPos,TDes8& aDes) const;
  2085 	IMPORT_C void Read(TInt aPos,TDes8& aDes,TRequestStatus& aStatus) const;
  2086 	IMPORT_C TInt Read(TInt aPos,TDes8& aDes,TInt aLength) const;
  2087 	IMPORT_C void Read(TInt aPos,TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const;
  2088 	IMPORT_C void ReadCancel(TRequestStatus& aStatus) const;
  2089 	IMPORT_C void ReadCancel() const;
  2090 	IMPORT_C TInt Write(const TDesC8& aDes);
  2091 	IMPORT_C void Write(const TDesC8& aDes,TRequestStatus& aStatus);
  2092 	IMPORT_C TInt Write(const TDesC8& aDes,TInt aLength);
  2093 	IMPORT_C void Write(const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus);
  2094 	IMPORT_C TInt Write(TInt aPos,const TDesC8& aDes);
  2095 	IMPORT_C void Write(TInt aPos,const TDesC8& aDes,TRequestStatus& aStatus);
  2096 	IMPORT_C TInt Write(TInt aPos,const TDesC8& aDes,TInt aLength);
  2097 	IMPORT_C void Write(TInt aPos,const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus);
  2098 	IMPORT_C TInt Lock(TInt aPos,TInt aLength) const;
  2099 	IMPORT_C TInt UnLock(TInt aPos,TInt aLength) const;
  2100 	IMPORT_C TInt Seek(TSeek aMode,TInt& aPos) const;
  2101 	IMPORT_C TInt Flush();
  2102 	IMPORT_C void Flush(TRequestStatus& aStatus);
  2103 	IMPORT_C TInt Size(TInt& aSize) const;
  2104 	IMPORT_C TInt SetSize(TInt aSize);
  2105 	IMPORT_C TInt Att(TUint& aAttValue) const;
  2106 	IMPORT_C TInt SetAtt(TUint aSetAttMask,TUint aClearAttMask);
  2107 	IMPORT_C TInt Modified(TTime& aTime) const;
  2108 	IMPORT_C TInt SetModified(const TTime& aTime);
  2109 	IMPORT_C TInt Set(const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask);
  2110 	IMPORT_C TInt ChangeMode(TFileMode aNewMode);
  2111 	IMPORT_C TInt Rename(const TDesC& aNewName);
  2112 	IMPORT_C TInt Drive(TInt &aDriveNumber, TDriveInfo &aDriveInfo) const;
  2113 	IMPORT_C TInt Adopt(RFs& aFs, TInt aHandle);
  2114 	IMPORT_C TInt AdoptFromClient(const RMessage2& aMsg, TInt aFsHandleIndex, TInt aFileHandleIndex);
  2115 	IMPORT_C TInt AdoptFromServer(TInt aFsHandle, TInt aFileHandle);
  2116 	IMPORT_C TInt AdoptFromCreator(TInt aFsIndex, TInt aFileHandleIndex);
  2117 	IMPORT_C TInt Name(TDes& aName) const;
  2118 	IMPORT_C TInt TransferToServer(TIpcArgs& aIpcArgs, TInt aFsHandleIndex, TInt aFileHandleIndex) const;
  2119 	IMPORT_C TInt TransferToClient(const RMessage2& aMsg, TInt aFileHandleIndex) const;
  2120 	IMPORT_C TInt TransferToProcess(RProcess& aProcess, TInt aFsHandleIndex, TInt aFileHandleIndex) const;
  2121 	IMPORT_C TInt Duplicate(const RFile& aFile, TOwnerType aType=EOwnerProcess);
  2122 	IMPORT_C TInt FullName(TDes& aName) const;
  2123 	IMPORT_C TInt BlockMap(SBlockMapInfo& aInfo, TInt64& aStartPos, TInt64 aEndPos=-1, TInt aBlockMapusage=EBlockMapUsagePaging) const;
  2124 //	IMPORT_C TInt Clamp(RFileClamp& aHandle);
  2125 	TInt Clamp(RFileClamp& aHandle);
  2126 
  2127 private:
  2128 	TInt DuplicateHandle(TInt& aSubSessionHandle) const;
  2129 	};
  2130 
  2131 
  2132 
  2133 class RDir : public RSubSessionBase
  2134 /**
  2135 @publishedAll
  2136 @released
  2137 
  2138 Reads the entries contained in a directory.
  2139 
  2140 You must first open the directory, specifying an attribute mask which is used
  2141 by Read() calls to filter the entry types required. Then, use one of
  2142 the Read() functions to read the filtered entries. When the operation
  2143 is complete, the directory should be closed using Close()
  2144 
  2145 There are two types of Read(): one works with a single entry at a time,
  2146 requiring programs to iterate through the entries explicitly.
  2147 The other works with an entire TEntryArray, allowing multiple entries to be
  2148 read in one call.
  2149 As well as making application program logic somewhat simpler, this type
  2150 uses fewer calls to the server, and is more efficient.
  2151 
  2152 Each type of Read() can be performed either synchronously or asynchronously.
  2153 
  2154 It may be more convenient to use RFs::GetDir() than the Read() calls supported
  2155 by this class.
  2156 RFs::GetDir() has the advantage that it allows a directory’s entries to be
  2157 sorted in various ways.
  2158 However, it does not provide asynchronous as well as synchronous variants
  2159 and does not allow entries to be read individually.
  2160 
  2161 @see RFs
  2162 */
  2163 	{
  2164 public:
  2165 	IMPORT_C TInt Open(RFs& aFs,const TDesC& aMatchName,const TUidType& aUidType);
  2166 	IMPORT_C TInt Open(RFs& aFs,const TDesC& aMatchName,TUint anAttMask);
  2167 	IMPORT_C void Close();
  2168 	IMPORT_C TInt Read(TEntryArray& anArray) const;
  2169 	IMPORT_C void Read(TEntryArray& anArray,TRequestStatus& aStatus) const;
  2170 	IMPORT_C TInt Read(TEntry& anEntry) const;
  2171 	IMPORT_C void Read(TPckg<TEntry>& anEntry,TRequestStatus& aStatus) const;
  2172 	};
  2173 
  2174 
  2175 class RFormat : public RSubSessionBase
  2176 /**
  2177 @publishedAll
  2178 @released
  2179 
  2180 Formats a device, one step at a time. 
  2181 
  2182 RFormat must first be opened on a device before formatting each
  2183 track using Next().
  2184 
  2185 There is also an asynchronous version of Next() which, if encapsulated into
  2186 a suitable active object, can be used to implement a
  2187 user-interruptible formatting process.
  2188 */
  2189 	{
  2190 public:
  2191 	IMPORT_C TInt Open(RFs& aFs,const TDesC& aName,TUint aFormatMode,TInt& aCount);
  2192 	IMPORT_C TInt Open(RFs& aFs,const TDesC& aName,TUint aFormatMode,TInt& aCount,const TDesC8& anInfo);
  2193 	IMPORT_C void Close();
  2194 	IMPORT_C TInt Next(TInt& aStep);
  2195 	IMPORT_C void Next(TPckgBuf<TInt>& aStep,TRequestStatus& aStatus);
  2196 	};
  2197 
  2198 
  2199 
  2200 
  2201 class RRawDisk : public RSubSessionBase
  2202 /**
  2203 @publishedAll
  2204 @released
  2205 
  2206 Enables direct disk access.
  2207 
  2208 No other resources can access the disk while direct access to it is in effect.
  2209 
  2210 This class is not intended for user derivation.
  2211 */
  2212 	{
  2213 public:
  2214 	IMPORT_C TInt Open(RFs& aFs,TInt aDrive);
  2215 	IMPORT_C void Close();
  2216 	IMPORT_C TInt Read(TInt64 aPos,TDes8& aDes);
  2217 	IMPORT_C TInt Write(TInt64 aPos,TDesC8& aDes);
  2218 private:
  2219 	TInt iDrive;
  2220 	};
  2221 
  2222 
  2223 
  2224 
  2225 class CDirStack;
  2226 NONSHARABLE_CLASS(CDirScan) : public CBase
  2227 /**
  2228 @publishedAll
  2229 @released
  2230 
  2231 Scans a directory structure.
  2232 
  2233 The scan moves from directory to directory through the hierarchy, returning
  2234 a list of the entries contained in each. The order in which the directories
  2235 are scanned is determined by a sort key which is specified when setting up
  2236 the scan. The base directory to be scanned and the entry types of interest
  2237 must also be specified before performing the scan.
  2238 
  2239 This class is not intended for user derivation
  2240 */
  2241     {
  2242 public:
  2243     /**
  2244     Defines the scan direction.
  2245     */
  2246 	enum TScanDirection
  2247 		{
  2248 		/**
  2249 		Scan upwards from the lowest level directory in the hierarchy to
  2250 		the top level directory.
  2251 		*/
  2252 		EScanUpTree,
  2253 		
  2254 		/**
  2255 		Scan downwards from the top level directory in the hierarchy to
  2256 		the bottom level directory.
  2257 		*/
  2258 		EScanDownTree
  2259 		};
  2260 public:
  2261 	IMPORT_C static CDirScan* NewL(RFs& aFs);
  2262 	IMPORT_C static CDirScan* NewLC(RFs& aFs);
  2263 	IMPORT_C ~CDirScan();
  2264 	IMPORT_C void SetScanDataL(const TDesC& aMatchName,TUint anEntryAttMask,TUint anEntrySortMask,TScanDirection aScanDir=EScanDownTree);
  2265 	IMPORT_C void NextL(CDir*& aDirEntries);
  2266 	IMPORT_C TPtrC AbbreviatedPath();
  2267 	IMPORT_C TPtrC FullPath();
  2268 protected:
  2269 	CDirScan(RFs& aFs);
  2270 private:
  2271 	inline RFs& Fs();
  2272 	void UpdateAbbreviatedPath();
  2273 	void ScanUpTreeL(CDir*& aDirEntries);
  2274 	void ScanDownTreeL(CDir*& aDirEntries);
  2275 	void GetDirEntriesL(CDir*& aDirEntries);
  2276 private:
  2277 	RFs* const iFs;
  2278 	TParse iFullPath;
  2279 	TPtrC iAbbreviatedPath;
  2280 	TInt iAbbreviatedPathPos;
  2281 	TUint iEntryAttMask;
  2282 	TUint iEntrySortMask;
  2283 	TBool iScanning;
  2284 	TScanDirection iScanDir;
  2285 	CDirStack* iStack;
  2286 	};
  2287 
  2288 
  2289 
  2290 
  2291 enum TFileManError
  2292 /**
  2293 @publishedAll
  2294 @released
  2295 
  2296 A list of CFileMan error codes.
  2297 
  2298 @see CFileMan
  2299 */
  2300 	{
  2301 	/**
  2302 	No additional error information is available, either because
  2303 	the latest CFileMan operation did not return an error, or if it did,
  2304 	the error was not one for which additional information is available.
  2305 	*/
  2306 	ENoExtraInformation,
  2307 
  2308 
  2309 	/**
  2310 	A leave occurred while setting up the initial scan.
  2311 	
  2312 	This indicates that the operation did not begin.
  2313 	
  2314 	@see CDirScan.
  2315     */
  2316 	EInitializationFailed,
  2317 
  2318 
  2319 	/**
  2320 	A leave occurred while scanning the next directory in the course of a file
  2321 	management function.
  2322 	
  2323 	This indicates that the operation did begin.
  2324 	
  2325 	@see CDirScan.
  2326 	*/
  2327 	EScanNextDirectoryFailed,
  2328 
  2329 
  2330 	/**
  2331 	Error occurred when attempting to open the source file for a file copy
  2332 	or move.
  2333 	*/
  2334 	ESrcOpenFailed,
  2335 
  2336 
  2337 	/**
  2338 	Error occurred while attempting to create, or, if overwriting is in effect,
  2339 	replace the target file for a file copy or move.
  2340 	*/
  2341 	ETrgOpenFailed,
  2342 
  2343 
  2344 	/**
  2345 	The operation completed without processing any files because no matching
  2346 	files were found.
  2347 	*/
  2348 	ENoFilesProcessed
  2349 	};
  2350 
  2351 
  2352 
  2353 
  2354 class MFileManObserver
  2355 /**
  2356 @publishedAll
  2357 @released
  2358 
  2359 Provides notification of the progress of synchronous or asynchronous
  2360 file management operations.
  2361 
  2362 It should be inherited by classes which implement this protocol.
  2363 
  2364 The enquiry functions provided by CFileBase and CFileMan may be used by
  2365 the observer to display information about the progress of the operation
  2366 such as error messages, the names of the target and destination files,
  2367 and the number of bytes transferred during a copy operation.
  2368 Notification may take place before or after an entry has been processed,
  2369 or during a file copy or move.
  2370 Each notification function returns a value which can be used to enable
  2371 the user to control the progress of the operation, for example to cancel
  2372 a long-running multiple file copy.
  2373 To use this class, pass a pointer to an instance of the class to
  2374 the CFileMan constructor, or use SetObserver(), defined in CFileBase.
  2375 */
  2376 	{
  2377 public:
  2378     /**
  2379     Control for the current CFileMan operation.
  2380     */
  2381 	enum TControl
  2382 		{
  2383 		/**
  2384 		Proceed with the current or the next entry.
  2385 		*/
  2386 		EContinue,
  2387 
  2388 
  2389 		/**
  2390 		Retry processing the previous entry.
  2391 		*/
  2392 		ERetry,
  2393 
  2394 
  2395 		/**
  2396 		Abort operation, causes function to return KErrCancel.
  2397 		*/
  2398 		EAbort,
  2399 		
  2400 
  2401 		/**
  2402 		Cancel processing the current entry.
  2403 		*/
  2404 		ECancel
  2405 		};
  2406 public:
  2407 	IMPORT_C virtual TControl NotifyFileManStarted();
  2408 	IMPORT_C virtual TControl NotifyFileManOperation();
  2409 	IMPORT_C virtual TControl NotifyFileManEnded();
  2410 	};
  2411 
  2412 
  2413 
  2414 
  2415 class CFileBase : public CBase
  2416 /**
  2417 @publishedAll
  2418 @released
  2419 
  2420 Abstract base class for file management.
  2421 
  2422 It provides functions to set an observer for the derived class
  2423 CFileMan, and to get information about the entry being processed.
  2424 
  2425 @see CFileMan
  2426 */
  2427 	{
  2428 public:
  2429 	IMPORT_C void SetObserver(MFileManObserver* anObserver);
  2430 public:
  2431 	IMPORT_C const TEntry& CurrentEntry();
  2432 	IMPORT_C TPtrC AbbreviatedPath();
  2433 	IMPORT_C TPtrC FullPath();
  2434 	IMPORT_C TInt GetLastError();
  2435 	IMPORT_C TFileManError GetMoreInfoAboutError();
  2436 protected:
  2437 	IMPORT_C CFileBase(RFs& anFs);
  2438 	IMPORT_C void ConstructL();
  2439 	IMPORT_C ~CFileBase();
  2440 	IMPORT_C void RunL();
  2441 	IMPORT_C void RunInSeparateThreadL(TThreadFunction aThreadFunction);
  2442 // virtual
  2443     /**
  2444     Called from RunL to perform tidy up after an operation.
  2445     
  2446     @see CFileMan
  2447     @see CFileBase::RunL
  2448     */
  2449 	virtual void CompleteOperationL() {};
  2450 	
  2451 //pure virtual
  2452 	/**
  2453 	Called from RunL to perform the requested operation.
  2454 	
  2455 	@see CFileMan
  2456 	@see CFileBase::RunL
  2457 	*/
  2458 	virtual void DoOperationL() = 0;
  2459 protected:
  2460 	RFs iFs;
  2461 	RFs iFsOld;
  2462 	RThread iFManThread;
  2463 	RSemaphore iSynchronizer;
  2464 	CDirScan* iScanner;
  2465 	CDir* iDirList;
  2466 	TInt iCurrentEntry;
  2467 	TUint iMatchEntry;
  2468 	TUint iSwitches;
  2469 	TParse iSrcFile;
  2470 	MFileManObserver* iObserver;
  2471 	TInt iLastError;
  2472 	TFileManError iErrorInfo;
  2473 	TRequestStatus* iStatus;
  2474 	HBufC* iSessionPath;
  2475 	TInt iNumberOfFilesProcessed;
  2476 
  2477 
  2478 
  2479 
  2480 friend void DoFManBaseOperationL(TAny* aPtr);
  2481 friend TInt FManBaseThreadFunction(TAny* aPtr);
  2482 	};
  2483 
  2484 
  2485 
  2486 
  2487 NONSHARABLE_CLASS(CFileMan) : public CFileBase
  2488 /**
  2489 @publishedAll
  2490 @released
  2491 
  2492 Offers file management services which accept the use of wildcards;
  2493 synchronous and asynchronous.
  2494 
  2495 It also provides enquiry functions, which, like those provided by
  2496 the base class CFileBase, may be used by an observer class object
  2497 to provide the user with information about the progress of the operation.
  2498 
  2499 All of the file management functions provided by this class accept the use of
  2500 wildcards, and may operate either synchronously or asynchronously.
  2501 When CFileMan is operating asynchronously, the operation takes place in
  2502 a separate thread from the calling code.
  2503 
  2504 A file notification observer (an instance of a class deriving
  2505 from MFileManObserver) may optionally be used by CFileMan when operating
  2506 synchronously or asynchronously. If provided, the appropriate notification
  2507 function is called before or after each entry has been processed,
  2508 or during a file copy or move.
  2509 This notification can be used to provide information about the state of
  2510 the operation, such as the number of bytes transferred during a
  2511 large-scale file copy. It can also be used to allow the user to cancel,
  2512 retry or continue processing an entry, or to abort the whole operation.
  2513 If such notification is required, specify an object deriving from
  2514 MFileManObserver class in the constructor, or call SetObserver(),
  2515 defined in the base class, CFileBase.
  2516 
  2517 All of the file manipulation functions except Rename() may operate recursively,
  2518 and all can operate non-recursively. When operating recursively,
  2519 these functions will act on all matching files located throughout
  2520 the source directory’s hierarchy. When operating non-recursively,
  2521 these functions act upon files contained in the single top level source
  2522 directory only. Recursion is set or unset using the switch parameter to
  2523 these functions.
  2524 
  2525 This class is not intended for user derivation.
  2526 
  2527 @see MFileManObserver
  2528 */
  2529 	{
  2530 public:
  2531     /**
  2532     An enumeration that identifies CFileMan tasks. This enumeration is used
  2533     by CurrentAction() to identify which task currently being carried out.
  2534 
  2535 	@see CFileMan::CurrentAction
  2536     */
  2537 	enum TAction
  2538 		{
  2539 		/**
  2540 		Inactive
  2541 		*/
  2542 		ENone,
  2543 
  2544 
  2545 		/**
  2546 		Setting attributes
  2547 		*/
  2548 		EAttribs,
  2549 		
  2550 		
  2551 		/**
  2552 		Copying files
  2553 		*/
  2554 		ECopy,
  2555 		
  2556 		
  2557 		/**
  2558 		Deleting files
  2559 		*/
  2560 		EDelete,
  2561 		
  2562 		
  2563 		/**
  2564 		Moving files
  2565 		*/
  2566 		EMove,
  2567 		
  2568 		
  2569 		/**
  2570 		Renaming files
  2571 		*/
  2572 		ERename,
  2573 		
  2574 		
  2575 		/**
  2576 		Deleting a directory and all contents
  2577 		*/
  2578 		ERmDir,
  2579 		
  2580 		
  2581 		/**
  2582 		Renaming component to VFAT short name (guaranteed to be unique)
  2583 		*/
  2584 		ERenameInvalidEntry,
  2585 
  2586 		/**
  2587 		Copying file from open file handle
  2588 		*/
  2589 		ECopyFromHandle,
  2590 		};
  2591 		
  2592 		
  2593 	/**
  2594 	Overwriting and recursion switch.
  2595 	
  2596 	Used in CFileMan functions to set whether operations are applied to
  2597 	the specified directory and all directories below it, or
  2598 	the specified directory only. 
  2599 	*/	
  2600 	enum TSwitch
  2601 		{
  2602 		/**
  2603 		Any files in the destination directory that have the same name as
  2604 		the source files in a rename, move or copy operation, will
  2605 		be overwritten.
  2606 		*/
  2607 		EOverWrite=1,
  2608 		
  2609 		
  2610 		/**
  2611 		Recursive operation.
  2612 		*/
  2613 		ERecurse=2
  2614 		};
  2615 public:
  2616 	IMPORT_C static CFileMan* NewL(RFs& aFs);
  2617 	IMPORT_C static CFileMan* NewL(RFs& aFs,MFileManObserver* anObserver);
  2618 	~CFileMan();
  2619 	IMPORT_C TAction CurrentAction();
  2620 	IMPORT_C void GetCurrentTarget(TFileName& aFile);
  2621 	IMPORT_C void GetCurrentSource(TFileName& aFile);
  2622 	IMPORT_C TInt BytesTransferredByCopyStep();
  2623 public:
  2624 	IMPORT_C TInt Attribs(const TDesC& aName,TUint aSetMask,TUint aClearMask,const TTime& aTime,TUint aSwitch=0);
  2625 	IMPORT_C TInt Attribs(const TDesC& aName,TUint aSetMask,TUint aClearMask,const TTime& aTime,TUint aSwitch,TRequestStatus& aStatus);
  2626 	IMPORT_C TInt Copy(const TDesC& anOld,const TDesC& aNew,TUint aSwitch=EOverWrite);
  2627 	IMPORT_C TInt Copy(const TDesC& anOld,const TDesC& aNew,TUint aSwitch,TRequestStatus& aStatus);
  2628 	IMPORT_C TInt Delete(const TDesC& aName,TUint aSwitch=0);
  2629 	IMPORT_C TInt Delete(const TDesC& aName,TUint aSwitch,TRequestStatus& aStatus);
  2630 	IMPORT_C TInt Move(const TDesC& anOld,const TDesC& aNew,TUint aSwitch=EOverWrite);
  2631 	IMPORT_C TInt Move(const TDesC& anOld,const TDesC& aNew,TUint aSwitch,TRequestStatus& aStatus);
  2632 	IMPORT_C TInt Rename(const TDesC& anOld,const TDesC& aNew,TUint aSwitch=EOverWrite);
  2633 	IMPORT_C TInt Rename(const TDesC& anOld,const TDesC& aNew,TUint aSwitch,TRequestStatus& aStatus);
  2634 	IMPORT_C TInt RmDir(const TDesC& aDirName);
  2635 	IMPORT_C TInt RmDir(const TDesC& aDirName,TRequestStatus& aStatus);
  2636 	IMPORT_C TInt Copy(const RFile& anOld,const TDesC& aNew,TUint aSwitches=EOverWrite);
  2637 	IMPORT_C TInt Copy(const RFile& anOld,const TDesC& aNew,TUint aSwitches,TRequestStatus& aStatus);
  2638 protected:
  2639 	CFileMan(RFs& aFs);
  2640 	TInt RenameInvalidEntry(const TDesC& anOld,const TDesC& aNew,TUint aSwitch=EOverWrite);
  2641 private:
  2642 	/**
  2643 	This is an internal enumeration for CFileMan implementation. 
  2644 	THis enumeration is mapped into TAction when user wants to identify the current
  2645 	task of CFileMan by CurrentAction().
  2646 
  2647 	@see CFileMan::TAction
  2648 	@see CFileMan::CurrentAction
  2649     */	
  2650 	enum TInternalAction
  2651 		{
  2652 		/**
  2653 		Internal indicator for None operation.
  2654 		This is mapped to CFileMan::ENone.
  2655 		*/
  2656 		EInternalNone,
  2657 		
  2658 		/**
  2659 		Internal indicator for Attribs() operation.
  2660 		This is mapped to CFileMan::EAttribs.
  2661 		*/
  2662 		EInternalAttribs,
  2663 		
  2664 		/**
  2665 		Internal indicator for Copy() operation.
  2666 		This is mapped to CFileMan::ECopy.
  2667 		*/
  2668 		EInternalCopy,
  2669 		
  2670 		/**
  2671 		Internal indicator for Delete() operation.
  2672 		This is mapped to CFileMan::EDelete.
  2673 		*/
  2674 		EInternalDelete,
  2675 		
  2676 		/**
  2677 		Internal indicator for Move() operation on different drives.
  2678 		This is mapped to CFileMan::Move.
  2679 		*/
  2680 		EInternalCopyForMove,
  2681 		
  2682 		/**
  2683 		Internal indicator for Move() operation on the same drive.
  2684 		This is mapped to CFileMan::Rename.
  2685 		Note for compatibility reasons, it is not mapped to CFileMan::Move.
  2686 		*/
  2687 		EInternalRenameForMove,
  2688 		
  2689 		/**
  2690 		Internal indicator for Rename() operation.
  2691 		This is mapped to CFileMan::ERename.
  2692 		*/
  2693 		EInternalRename,
  2694 		
  2695 		/**
  2696 		Internal indicator for RmDir() operation.
  2697 		This is mapped to CFileMan::ERmDir.
  2698 		*/
  2699 		EInternalRmDir,
  2700 		
  2701 		/**
  2702 		Internal indicator for RenameInvalidEntry() operation.
  2703 		This is mapped to CFileMan::ERenameInvalidEntry.
  2704 		*/
  2705 		EInternalRenameInvalidEntry,
  2706 		
  2707 		/**
  2708 		Internal indicator for CopyFromHandle() operation.
  2709 		This is mapped to CFileMan::ECopyFromHandle.
  2710 		*/
  2711 		EInternalCopyFromHandle,
  2712 		};
  2713 
  2714 	void CompleteOperationL();
  2715 	void DoOperationL();
  2716 	void CheckForDirectory();
  2717 	void SetFlags(TBool aOverWrite,TBool aRecurse,TBool aScanDirection,TBool aMoveRename);
  2718 	void GetSrcAndTrg(TParse& aSrcName,TFileName& aTrgName);
  2719 	void DoSynchronize(TInt aRetVal);
  2720 	TInt CheckRenameAllowed(const TDesC& aSrcName,const TDesC& aTrgName);
  2721 	TInt SetupMoveOnSameDrive(TUint aSwitches, TBool& aComplete);
  2722 	TInt SetupMoveAcrossDrives(TUint aSwitches);
  2723 	TInt SetupTargetDirectory(TBool aOverWrite, TBool& aComplete);
  2724 	TBool SrcTrgDrivesIdentical();
  2725 	TBool SetupDirectoryForMove();
  2726 private:
  2727 	void DoAttribsL();
  2728 	void DoCopyOrMoveL();
  2729 	void DoDeleteL();
  2730 	void DoRenameL();
  2731 	void DoRmDirL();
  2732 	void DoCopyFromHandleL();
  2733 	TInt DoCopy(const RFile& aSrcFile, RFile& aDstFile, TInt& aRet);
  2734 private:
  2735 	TParse iTrgFile;
  2736 	TInternalAction iAction;
  2737 	TUint iSetMask;
  2738 	TUint iClearMask;
  2739 	TTime iTime;
  2740 	TInt iBytesTransferred;
  2741 	RFile iSrcFileHandle;
  2742 	TBool iMovingContents;
  2743 	TEntry iTmpEntry;
  2744 	TParse iTmpParse;
  2745 	TFileName iTmpName1;
  2746 	TFileName iTmpName2;
  2747 
  2748 friend void RenameInvalidEntryL(RFs& aFs,TParse& aSrcFile);
  2749 	};
  2750 
  2751 
  2752 
  2753 
  2754 class TFindFile
  2755 /**
  2756 @publishedAll
  2757 @released
  2758 
  2759 Searches for files and directories.
  2760 
  2761 Each function has a variant which searches for multiple files/directories,
  2762 using one or more wildcard characters in the filename.
  2763 If an initial search is successful, further searches can be carried out
  2764 using Find() or FindWild().
  2765 You can also retrieve the fully qualified file specification,
  2766 and manipulate and interrogate it using the TParse class (or related classes).
  2767 
  2768 Note that when specifying the path of a directory to search, the path should
  2769 always end with a backslash character.When trailing backslash is not present 
  2770 then it is considered as file. And path will be taken till last backslash.
  2771 The client must have appropriate capabilities for the directory to be searched. 
  2772 For example without ALL FILES Capability, it is not possible to successfully 
  2773 find any files under \sys\bin directory.
  2774 
  2775 By default if the file is not found in the current drive the rest of the drives,
  2776 excluding the remote ones, will be searched. Using function SetFindMask it is 
  2777 possible to specify a combination of drive attributes(aMask) that the drives to 
  2778 be searched must match.  
  2779  
  2780 */
  2781 	{
  2782 public:
  2783 	IMPORT_C TFindFile(RFs& aFs);
  2784 	IMPORT_C TInt FindByPath(const TDesC& aFileName,const TDesC* aPathList);
  2785 	IMPORT_C TInt FindByDir(const TDesC& aFileName,const TDesC& aDirPath);
  2786 	IMPORT_C TInt Find();
  2787 	IMPORT_C TInt FindWildByPath(const TDesC& aFileName,const TDesC* aPathList,CDir*& aDirList);
  2788 	IMPORT_C TInt FindWildByDir(const TDesC& aFileName,const TDesC& aDirPath,CDir*& aDir);
  2789 	IMPORT_C TInt FindWild(CDir*& aDirList);
  2790 	IMPORT_C TInt SetFindMask(TUint aMask);
  2791 	inline const TDesC& File() const;
  2792 private:
  2793 	TInt DoFind();
  2794 	TInt DoFindByPath(const TDesC& aFileName,const TDesC* aPathList);
  2795 	TInt DoFindByDir(const TDesC& aFileName,const TDesC& aDir);
  2796 	TInt DoFindInDir();
  2797 	TInt DoFindNextInPath();
  2798 	TInt DoFindNextInDriveList();
  2799 private:
  2800 	RFs* const iFs;
  2801 	TParse iFile;
  2802 	TInt iPathPos;
  2803 	TInt iCurrentDrive;
  2804 	TInt iMode;
  2805 	const TDesC* iPath;
  2806 	TDriveList iDrvList;
  2807 	CDir** iDir;
  2808 	TUint32 iMatchMask;	
  2809 	};
  2810 
  2811 
  2812 
  2813 
  2814 /**
  2815 @publishedAll
  2816 @released
  2817 
  2818 Contains a list of entries for the files which were opened in
  2819 a file server session.
  2820 
  2821 @see CDir
  2822 */
  2823 typedef CDir CFileList;
  2824 
  2825 
  2826 
  2827 
  2828 class TOpenFileScan
  2829 /**
  2830 @publishedAll
  2831 @released
  2832 
  2833 Scans open files to get a list of the entries for all files which are currently
  2834 open in a particular file server session.
  2835 
  2836 NextL() creates a list of the files opened by the session.
  2837 The ID of the thread which opened the files listed may be obtained by calling ThreadId().
  2838 If multiple sessions are in use, repeatedly calling NextL() will return a list
  2839 of open files in each session.
  2840 */
  2841 	{
  2842 public:
  2843 	IMPORT_C TOpenFileScan(RFs& aFs);
  2844 	IMPORT_C void NextL(CFileList*& aFileList);
  2845 	IMPORT_C TThreadId ThreadId() const;
  2846 private:
  2847 	RFs* iFs;
  2848 	TThreadId iThreadId;
  2849 	TInt iScanPos;
  2850 	TInt iEntryListPos;
  2851 	};
  2852 
  2853 
  2854 
  2855 
  2856 class TFileText
  2857 /**
  2858 @publishedAll
  2859 @released
  2860 
  2861 Reads and writes single lines of text to or from a Unicode file.
  2862 */
  2863 	{
  2864 public:
  2865     /**
  2866     @internalComponent
  2867     */
  2868 	enum TFileState
  2869 		{
  2870 		EStartOfFile,
  2871 		ENormal,
  2872 		EReverse
  2873 		};
  2874 public:
  2875 	IMPORT_C TFileText();
  2876 	IMPORT_C void Set(RFile& aFile);
  2877 	IMPORT_C TInt Read(TDes& aDes);
  2878 	IMPORT_C TInt Write(const TDesC& aDes);
  2879 	IMPORT_C TInt Seek(TSeek aMode);
  2880 private:
  2881 	void NextRecord();
  2882 	TInt CheckForTerminator(TBool& anAnswer);
  2883 	TInt FillBuffer();
  2884 private:
  2885 	const TText* iNext;
  2886 	const TText* iEnd;
  2887 	TFileState iState;
  2888 	RFile iFile;
  2889 	TBuf8<0x100> iReadBuf; 
  2890 	};
  2891 
  2892 
  2893 
  2894 
  2895 /**
  2896 @publishedAll
  2897 @released
  2898 */
  2899 IMPORT_C TBool FileNamesIdentical(const TDesC& aFileName1,const TDesC& aFileName2);
  2900 
  2901 
  2902 
  2903 /**
  2904 Local drive mapping list - passed as argument to RFs::SetLocalDriveMapping().
  2905 
  2906 @publishedPartner
  2907 @released
  2908 */
  2909 class TLocalDriveMappingInfo
  2910 	{
  2911 public:
  2912 	enum TDrvMapOperation {EWriteMappingsAndSet=0,EWriteMappingsNoSet=1,ESwapIntMappingAndSet=2};	
  2913 public:
  2914 	TInt iDriveMapping[KMaxLocalDrives];
  2915 	TDrvMapOperation iOperation;
  2916     };
  2917 typedef TPckgBuf<TLocalDriveMappingInfo> TLocalDriveMappingInfoBuf;
  2918 
  2919 /**
  2920 Client side plugin API.
  2921 
  2922 @publishedPartner
  2923 @released
  2924 */
  2925 class RPlugin : public RSubSessionBase
  2926 	{
  2927 public:
  2928 	IMPORT_C TInt Open(RFs& aFs, TInt aPos);
  2929 	IMPORT_C void Close();
  2930 protected:
  2931 	IMPORT_C void DoRequest(TInt aReqNo,TRequestStatus& aStatus) const;
  2932 	IMPORT_C void DoRequest(TInt aReqNo,TRequestStatus& aStatus,TDes8& a1) const;
  2933 	IMPORT_C void DoRequest(TInt aReqNo,TRequestStatus& aStatus,TDes8& a1,TDes8& a2) const;
  2934 	IMPORT_C TInt DoControl(TInt aFunction) const;
  2935 	IMPORT_C TInt DoControl(TInt aFunction,TDes8& a1) const;
  2936 	IMPORT_C TInt DoControl(TInt aFunction,TDes8& a1,TDes8& a2) const;
  2937 	IMPORT_C void DoCancel(TUint aReqMask) const;
  2938 	};
  2939 
  2940 /**
  2941 @publishedPartner
  2942 @released
  2943 
  2944 Specifies that a plugin should determine for itself which drives it attaches to.
  2945 
  2946 @see RFs::MountPlugin
  2947 @see RFs::DismountPlugin
  2948 */
  2949 const TInt KPluginAutoAttach = 0x19;
  2950 
  2951 /**
  2952 @publishedPartner
  2953 @released
  2954 
  2955 Specifies that a plugin should determine its own position in the plugin stack.
  2956 
  2957 @see RFs::MountPlugin
  2958 @see RFs::DismountPlugin
  2959 */
  2960 const TInt KPluginAutoLocate = 0xC8;
  2961 
  2962 /**
  2963 @publishedAll
  2964 @released
  2965 
  2966 The UID of the File Server process
  2967 */
  2968 const TInt KFileServerUidValue = 0x100039e3;
  2969 
  2970 enum TSessionFlags
  2971 /**
  2972 @internalTechnology
  2973 
  2974 A set of session specific configuration flags.
  2975 */
  2976 	{
  2977 	/**
  2978 	Notify the user or write failures
  2979 	*/
  2980 	EFsSessionNotifyUser	= KBit0,
  2981 	
  2982 	/**
  2983 	Notify clients registered for change notification
  2984 	*/
  2985 	EFsSessionNotifyChange	= KBit1,
  2986 
  2987 	/**	
  2988 	Enables all session flags
  2989 	*/
  2990 	EFsSessionFlagsAll		= KSet32,
  2991 	};
  2992 
  2993 /**
  2994 @internalTechnology
  2995 */
  2996 struct SBlockMapArgs
  2997 	{
  2998 	TInt64 iStartPos;
  2999 	TInt64 iEndPos;
  3000 	};
  3001 	
  3002 	
  3003 /**
  3004 @internalTechnology
  3005 
  3006 Validates the mask used to match drive attributes.
  3007 
  3008 @see RFs::DriveList
  3009 @see TFindFile::SetFindMask
  3010 */	
  3011 TInt ValidateMatchMask( TUint aMask);
  3012 
  3013 
  3014 	
  3015 
  3016 #include "f32file.inl"
  3017 #endif