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