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