epoc32/include/f32fsys.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
permissions -rw-r--r--
Final list of Symbian^2 public API header files
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@2
     4
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
williamr@2
     5
// which accompanies this distribution, and is available
williamr@2
     6
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.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
// f32\inc\f32fsys.h
williamr@2
    15
// 
williamr@2
    16
//
williamr@2
    17
williamr@2
    18
williamr@2
    19
williamr@2
    20
/**
williamr@2
    21
 @file
williamr@2
    22
 @publishedPartner
williamr@2
    23
 @released
williamr@2
    24
*/
williamr@2
    25
williamr@2
    26
#if !defined(__F32FSYS_H__)
williamr@2
    27
#define __F32FSYS_H__
williamr@2
    28
#if !defined(__F32FILE_H__)
williamr@2
    29
#include <f32file.h>
williamr@2
    30
#endif
williamr@2
    31
//
williamr@2
    32
#if defined(_UNICODE)
williamr@2
    33
#define KFileSystemUidValue KFileSystemUidValue16
williamr@2
    34
#define KFileServerUidValue KFileServerUidValue16
williamr@2
    35
#define KFileServerDllUidValue KFileServerDllUidValue16
williamr@2
    36
#else
williamr@2
    37
#define KFileSystemUidValue KFileSystemUidValue8
williamr@2
    38
#define KFileServerUidValueKFileServerUidValue8
williamr@2
    39
#define KFileServerDllUidValueKFileServerDllUidValue8
williamr@2
    40
#endif
williamr@2
    41
williamr@2
    42
williamr@2
    43
/**
williamr@2
    44
Filesystem error code 1 : indicates an item cannot be found,
williamr@2
    45
because it has been hidden.
williamr@2
    46
*/
williamr@2
    47
const TInt KErrHidden=(1);
williamr@2
    48
williamr@2
    49
/**
williamr@2
    50
Filesystem error code 2 : in the context of file operations, a path
williamr@2
    51
was not found, because it has been hidden.
williamr@2
    52
*/
williamr@2
    53
const TInt KErrPathHidden=(2);
williamr@2
    54
williamr@2
    55
williamr@2
    56
const TInt KFileShareLockGranularity=2;
williamr@2
    57
const TInt KAsyncRequestArrayGranularity=2;
williamr@2
    58
williamr@2
    59
/**
williamr@2
    60
@publishedPartner
williamr@2
    61
@released
williamr@2
    62
williamr@2
    63
File system UID value 16.
williamr@2
    64
*/
williamr@2
    65
const TInt KFileSystemUidValue16=0x100039df;
williamr@2
    66
williamr@2
    67
williamr@2
    68
williamr@2
    69
williamr@2
    70
/**
williamr@2
    71
@publishedPartner
williamr@2
    72
@released
williamr@2
    73
williamr@2
    74
File system UID value 8.
williamr@2
    75
*/
williamr@2
    76
const TInt KFileSystemUidValue8=0x1000008f;
williamr@2
    77
williamr@2
    78
williamr@2
    79
williamr@2
    80
williamr@2
    81
/**
williamr@2
    82
@publishedPartner
williamr@2
    83
@released
williamr@2
    84
williamr@2
    85
File server UID value 16.
williamr@2
    86
*/
williamr@2
    87
const TInt KFileServerUidValue16=0x100039e3;
williamr@2
    88
williamr@2
    89
williamr@2
    90
williamr@2
    91
williamr@2
    92
/**
williamr@2
    93
@publishedPartner
williamr@2
    94
@released
williamr@2
    95
williamr@2
    96
File server UID value 8.
williamr@2
    97
*/
williamr@2
    98
const TInt KFileServerUidValue8=0x100000bb;
williamr@2
    99
williamr@2
   100
williamr@2
   101
williamr@2
   102
williamr@2
   103
/**
williamr@2
   104
@publishedPartner
williamr@2
   105
@released
williamr@2
   106
williamr@2
   107
File server DLL UID value 16.
williamr@2
   108
*/
williamr@2
   109
const TInt KFileServerDllUidValue16=0x100039e4;
williamr@2
   110
williamr@2
   111
williamr@2
   112
williamr@2
   113
williamr@2
   114
/**
williamr@2
   115
@publishedPartner
williamr@2
   116
@released
williamr@2
   117
williamr@2
   118
File server DLL UID value 8.
williamr@2
   119
*/
williamr@2
   120
const TInt KFileServerDllUidValue8=0x100000bd;
williamr@2
   121
williamr@2
   122
williamr@2
   123
williamr@2
   124
williamr@2
   125
/**
williamr@2
   126
@publishedPartner
williamr@2
   127
@released
williamr@2
   128
williamr@2
   129
Local file system UID value.
williamr@2
   130
*/
williamr@2
   131
const TInt KLocalFileSystemUidValue=0x100000d6;
williamr@2
   132
williamr@2
   133
williamr@2
   134
williamr@2
   135
williamr@2
   136
/**
williamr@2
   137
@publishedPartner
williamr@2
   138
@released
williamr@2
   139
williamr@2
   140
Estart component UID value.
williamr@2
   141
*/
williamr@2
   142
const TInt KEstartUidValue=0x10272C04;
williamr@2
   143
williamr@2
   144
williamr@2
   145
williamr@2
   146
/**
williamr@2
   147
@publishedPartner
williamr@2
   148
@released
williamr@2
   149
Maximum length of a volume name.
williamr@2
   150
*/
williamr@2
   151
const TInt KMaxVolumeNameLength=11;
williamr@2
   152
williamr@2
   153
williamr@2
   154
williamr@2
   155
williamr@2
   156
/**
williamr@2
   157
@publishedPartner
williamr@2
   158
@released
williamr@2
   159
williamr@2
   160
First local drive indicator.
williamr@2
   161
*/
williamr@2
   162
const TInt KFirstLocalDrive=EDriveC;
williamr@2
   163
williamr@2
   164
williamr@2
   165
const TInt KMaxExtensionCount=2;
williamr@2
   166
//
williamr@2
   167
const TInt KDriveInvalid=-1;
williamr@2
   168
//
williamr@2
   169
_LIT(KMediaPWrdFile, "?:\\sys\\data\\mmcstore");
williamr@2
   170
//
williamr@2
   171
williamr@2
   172
/** 
williamr@2
   173
@internalTechnology
williamr@2
   174
*/
williamr@2
   175
const TUint KSystemDriveKey = 0x10283049;
williamr@2
   176
williamr@2
   177
williamr@2
   178
/**
williamr@2
   179
@publishedPartner
williamr@2
   180
@released
williamr@2
   181
williamr@2
   182
Enumeration that specifies whether, on opening a file:
williamr@2
   183
- an existing file is opened
williamr@2
   184
- a new file is created 
williamr@2
   185
- an existing file is replaced.
williamr@2
   186
*/
williamr@2
   187
enum TFileOpen {EFileOpen,EFileCreate,EFileReplace};
williamr@2
   188
williamr@2
   189
williamr@2
   190
williamr@2
   191
williamr@2
   192
/**
williamr@2
   193
@publishedPartner
williamr@2
   194
@released
williamr@2
   195
williamr@2
   196
The file share mode.
williamr@2
   197
*/
williamr@2
   198
typedef TFileMode TShare;
williamr@2
   199
williamr@2
   200
williamr@2
   201
williamr@2
   202
williamr@2
   203
class CMountCB;
williamr@2
   204
class CFileSystem;
williamr@2
   205
class CFileCB;
williamr@2
   206
class CDirCB;
williamr@2
   207
class CFileShare;
williamr@2
   208
class CSessionFs;
williamr@2
   209
class CFsPlugin;
williamr@2
   210
class CFileBody;
williamr@2
   211
class CMountBody;
williamr@2
   212
class CFsMessageRequest;
williamr@2
   213
williamr@2
   214
//
williamr@2
   215
class CFsObjectCon;
williamr@2
   216
class CFileCache;
williamr@2
   217
williamr@2
   218
/**
williamr@2
   219
@publishedPartner
williamr@2
   220
@released
williamr@2
   221
williamr@2
   222
Implements reference counting to track concurrent references to itself.
williamr@2
   223
 
williamr@2
   224
An object of this type arranges automatic destruction of itself when the final 
williamr@2
   225
reference is removed.
williamr@2
   226
williamr@2
   227
A reference counting object is any object which has CFsObject as its base class. 
williamr@2
   228
Constructing a CFsObject derived type or calling its Open() member function 
williamr@2
   229
adds a reference to that object by adding one to the reference count; calling 
williamr@2
   230
its Close() member function removes a reference by subtracting one from the 
williamr@2
   231
reference count; when the last user of the object calls Close(), the reference 
williamr@2
   232
count becomes zero and the object is automatically destroyed.
williamr@2
   233
*/
williamr@2
   234
class CFsObject : public CBase
williamr@2
   235
williamr@2
   236
	{
williamr@2
   237
public:
williamr@2
   238
	IMPORT_C CFsObject();
williamr@2
   239
	IMPORT_C virtual TInt Open();
williamr@2
   240
	IMPORT_C virtual void Close();
williamr@2
   241
	IMPORT_C TInt SetName(const TDesC* aName);
williamr@2
   242
	IMPORT_C TName Name() const;
williamr@2
   243
	IMPORT_C virtual TBool IsCorrectThread();
williamr@2
   244
	inline CFsObjectCon* Container() const;
williamr@2
   245
protected:
williamr@2
   246
	void DoClose();
williamr@2
   247
	TInt UniqueID() const;
williamr@2
   248
	inline TInt Inc();
williamr@2
   249
	inline TInt Dec();
williamr@2
   250
	IMPORT_C ~CFsObject();
williamr@2
   251
private:
williamr@2
   252
	TInt iAccessCount;
williamr@2
   253
	CFsObjectCon* iContainer;
williamr@2
   254
	HBufC* iName;   
williamr@2
   255
friend class CFsObjectCon;
williamr@2
   256
friend class CFsObjectIx;
williamr@2
   257
	};
williamr@2
   258
williamr@2
   259
williamr@2
   260
williamr@2
   261
williamr@2
   262
class CFsRequest;
williamr@2
   263
class CFsInternalRequest;
williamr@2
   264
williamr@2
   265
/**
williamr@2
   266
Implements a request dispatcher.
williamr@2
   267
 
williamr@2
   268
Base class for file server resources.
williamr@2
   269
for example subsessions that are opened, such as RFile etc, that need closing are closed by 
williamr@2
   270
issuing a subsession close request, handled by this object.
williamr@2
   271
williamr@2
   272
@publishedPartner
williamr@2
   273
@released
williamr@2
   274
*/
williamr@2
   275
class CFsDispatchObject : public CFsObject
williamr@2
   276
	{
williamr@2
   277
public:
williamr@2
   278
	CFsDispatchObject();
williamr@2
   279
	/**
williamr@2
   280
	Returns the drive number.
williamr@2
   281
	@return Drive number.
williamr@2
   282
	*/
williamr@2
   283
	TInt DriveNumber() const {return(iDriveNumber);}
williamr@2
   284
	IMPORT_C void Close();
williamr@2
   285
	IMPORT_C virtual TBool IsCorrectThread();
williamr@2
   286
protected:
williamr@2
   287
	void DoInitL(TInt aDrvNumber);
williamr@2
   288
	void Dispatch();
williamr@2
   289
	~CFsDispatchObject();
williamr@2
   290
private:
williamr@2
   291
	CFsInternalRequest* iRequest;
williamr@2
   292
	TInt iDriveNumber;
williamr@2
   293
friend class TFsCloseObject;
williamr@2
   294
friend class CFileShare;	// needed to override the close operation so that the file cache can be flushed on a close
williamr@2
   295
	};
williamr@2
   296
williamr@2
   297
williamr@2
   298
williamr@2
   299
williamr@2
   300
/**
williamr@2
   301
Notifier class must be unique to each thread so one per drive or threaded plugin should be used
williamr@2
   302
allocated in the file system. No longer global
williamr@2
   303
williamr@2
   304
@publishedPartner
williamr@2
   305
@released
williamr@2
   306
*/
williamr@2
   307
NONSHARABLE_CLASS(CAsyncNotifier) : public CBase
williamr@2
   308
	{
williamr@2
   309
public:
williamr@2
   310
	IMPORT_C static CAsyncNotifier* New();
williamr@2
   311
	IMPORT_C ~CAsyncNotifier();
williamr@2
   312
	IMPORT_C TInt Notify(const TDesC& aLine1,const TDesC& aLine2,const TDesC& aButton1,const TDesC& aButton2,TInt& aButtonVal);
williamr@2
   313
	inline void SetMount(CMountCB* aMount) { iMount = aMount; };
williamr@2
   314
protected:
williamr@2
   315
	CAsyncNotifier();
williamr@2
   316
	TInt Connect(); 
williamr@2
   317
private:
williamr@2
   318
	RNotifier iNotifier;
williamr@2
   319
	CMountCB* iMount;
williamr@2
   320
	};
williamr@2
   321
williamr@2
   322
williamr@2
   323
williamr@2
   324
williamr@2
   325
class CProxyDriveFactory;
williamr@2
   326
williamr@2
   327
/**
williamr@2
   328
@publishedPartner
williamr@2
   329
@released
williamr@2
   330
williamr@2
   331
Structure containing information related to a single drive extension.
williamr@2
   332
*/
williamr@2
   333
struct TExtensionInfo
williamr@2
   334
	{
williamr@2
   335
	TBool iIsPrimary;            	///< Is the primary drive extension for a given drive  
williamr@2
   336
	CProxyDriveFactory* iFactory;  	///< Pointer to the drive extension's object factory
williamr@2
   337
	};
williamr@2
   338
williamr@2
   339
williamr@2
   340
williamr@2
   341
williamr@2
   342
/**
williamr@2
   343
@publishedPartner
williamr@2
   344
@released
williamr@2
   345
williamr@2
   346
Represents information related to the Drive extension(s) in use for a given drive.
williamr@2
   347
*/
williamr@2
   348
struct TDriveExtInfo
williamr@2
   349
	{
williamr@2
   350
	TDriveExtInfo();
williamr@2
   351
	
williamr@2
   352
	TInt iCount; 								///< Number of drive extensions in use                               
williamr@2
   353
williamr@2
   354
	TExtensionInfo iInfo[KMaxExtensionCount]; 	///< Drive extension related information    
williamr@2
   355
	};
williamr@2
   356
williamr@2
   357
williamr@2
   358
williamr@2
   359
williamr@2
   360
/**
williamr@2
   361
@publishedPartner
williamr@2
   362
@released
williamr@2
   363
williamr@2
   364
Represents a drive in the file server.
williamr@2
   365
williamr@2
   366
Note that drives may act as substitutes for paths on other drives,
williamr@2
   367
in which case any access to this drive letter will be translated into
williamr@2
   368
a reference to the assigned path. In this way drives can act as short
williamr@2
   369
cuts to paths on other drives.
williamr@2
   370
*/
williamr@2
   371
class TDrive
williamr@2
   372
	{
williamr@2
   373
public:
williamr@2
   374
	TDrive();
williamr@2
   375
	void CreateL(TInt aDriveNumber);
williamr@2
   376
	TInt CheckMount();
williamr@2
   377
	TInt CheckMountAndEntryName(const TDesC& aName);
williamr@2
   378
    TInt FinaliseMount();
williamr@2
   379
    TInt FinaliseMount(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL);
williamr@2
   380
    TInt MountControl(TInt aLevel, TInt aOption, TAny* aParam);
williamr@2
   381
williamr@2
   382
    void MountMedia(TBool aForceMount);
williamr@2
   383
	void FlushCachedFileInfoL();
williamr@2
   384
	TInt FlushCachedFileInfo(TBool aPurgeCache = EFalse);
williamr@2
   385
	void PurgeDirty(CMountCB& aMount);
williamr@2
   386
	void DriveInfo(TDriveInfo& anInfo);
williamr@2
   387
	TInt Volume(TVolumeInfo& aVolume);
williamr@2
   388
	TInt SetVolume(const TDesC& aName);
williamr@2
   389
	TInt MkDir(const TDesC& aName);
williamr@2
   390
	TInt RmDir(const TDesC& aName);
williamr@2
   391
	TInt Delete(const TDesC& aName);
williamr@2
   392
	TInt Rename(const TDesC& anOldName,const TDesC& aNewName);
williamr@2
   393
	TInt Replace(const TDesC& anOldName,const TDesC& aNewName);
williamr@2
   394
	TInt Entry(const TDesC& aName,TEntry& anEntry);
williamr@2
   395
	TInt SetEntry(const TDesC& aName,const TTime& aTime,TUint aMask,TUint aVal);
williamr@2
   396
	TInt FileTemp(CFsRequest* aRequest,TInt& aHandle,const TDesC& aPath,TDes& aName,TUint aMode);
williamr@2
   397
	TInt FileOpen(CFsRequest* aRequest,TInt& aHandle,const TDesC& aName,TUint aMode,TFileOpen anOpen);
williamr@2
   398
	TInt DirOpen(CSessionFs* aSession,TInt& aHandle,const TDesC& aName,TUint anAtt,const TUidType& aUidType);
williamr@2
   399
	
williamr@2
   400
    TInt CheckDisk(); 
williamr@2
   401
    TInt CheckDisk(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL);
williamr@2
   402
	
williamr@2
   403
    TInt ScanDrive(); 
williamr@2
   404
	TInt ScanDrive(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL);
williamr@2
   405
williamr@2
   406
    TInt ReadFileSection(const TDesC& aName,TInt aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage);
williamr@2
   407
	TInt GetShortName(const TDesC& aLongName,TDes& aShortName);
williamr@2
   408
	TInt GetLongName(const TDesC& aShortName,TDes& aLongName);
williamr@2
   409
	TInt IsFileOpen(const TDesC& aFileName,CFileCB*& aFileCB);
williamr@2
   410
	TInt IsFileInRom(const TDesC& aFileName,TUint8*& aFileStart);
williamr@2
   411
	TInt LockDevice(TMediaPassword& aOld,TMediaPassword& aNew,TBool aStore);
williamr@2
   412
	TInt UnlockDevice(TMediaPassword& aPassword,TBool aStore);
williamr@2
   413
	TInt ClearDevicePassword(TMediaPassword& aPassword);
williamr@2
   414
	TInt EraseDevicePassword();
williamr@2
   415
	TInt FreeDiskSpace(TInt64& aFreeDiskSpace);
williamr@2
   416
	TInt ForceRemountDrive(const TDesC8* aMountInfo,TInt aMountInfoMessageHandle,TUint aFlags);
williamr@2
   417
	TBool IsWriteProtected();
williamr@2
   418
	TInt MountExtension(CProxyDriveFactory* aFactory,TBool aIsPrimary);
williamr@2
   419
	TInt DismountExtension(CProxyDriveFactory* aFactory,TBool aIsPrimary);
williamr@2
   420
	TInt ExtensionName(TDes& aExtensionName,TInt aPos);
williamr@2
   421
	TInt ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2);	
williamr@2
   422
	void SetAtt(TUint aValue);
williamr@2
   423
	IMPORT_C TUint Att();
williamr@2
   424
	IMPORT_C TBool GetNotifyUser();		
williamr@2
   425
	IMPORT_C void Dismount();		
williamr@2
   426
	IMPORT_C TBool IsWriteableResource() const;	
williamr@2
   427
	IMPORT_C TBool IsCurrentWriteFunction() const; 
williamr@2
   428
	inline TInt GetReason() const;	
williamr@2
   429
	inline void SetChanged(TBool aValue);	
williamr@2
   430
	inline TBool IsChanged() const;
williamr@2
   431
	inline TInt DriveNumber() const;
williamr@2
   432
	inline TBool IsMounted() const;
williamr@2
   433
	inline TBool IsLocal()	const;			
williamr@2
   434
	inline TBool IsRom()	const;			
williamr@2
   435
	inline TBool IsRemovable()	const;		
williamr@2
   436
	inline TBool IsSubsted() 	const;		
williamr@2
   437
	inline CMountCB& CurrentMount() const;
williamr@2
   438
	inline TDrive& SubstedDrive() const;
williamr@2
   439
	inline void SetSubstedDrive(TDrive* aDrive);
williamr@2
   440
	inline HBufC& Subst() const;
williamr@2
   441
	inline void SetSubst(HBufC* aSubst);
williamr@2
   442
	inline CFsObjectCon& Mount() const;	
williamr@2
   443
	inline CFileSystem& FSys();			
williamr@2
   444
	inline CFileSystem*& GetFSys();
williamr@2
   445
	inline TDriveExtInfo& ExtInfo();	
williamr@2
   446
	inline void SetNotifyOn();			
williamr@2
   447
	inline void SetNotifyOff();	
williamr@2
   448
	inline TInt ReservedSpace() const;
williamr@2
   449
	inline void SetReservedSpace(const TInt aReservedSpace);
williamr@2
   450
	
williamr@2
   451
	inline void SetRugged(TBool aIsRugged);
williamr@2
   452
	inline TBool IsRugged() const;
williamr@2
   453
williamr@2
   454
    inline TBool IsSynchronous() const;
williamr@2
   455
    inline void SetSynchronous(TBool aIsSynch);
williamr@2
   456
williamr@2
   457
public:
williamr@2
   458
	void DismountLock();
williamr@2
   459
	TInt DismountUnlock();
williamr@2
   460
	TInt DismountLocked() const;
williamr@2
   461
	void SetDismountPending(TBool aPending);
williamr@2
   462
	TBool DismountPending() const;
williamr@2
   463
	void ForceDismount();
williamr@2
   464
	TInt ActiveMounts() const;
williamr@2
   465
	void ReactivateMounts();
williamr@2
   466
	TInt ClampFile(const TDesC& aName,TAny* aHandle);
williamr@2
   467
	TInt UnclampFile(CMountCB* aMount, RFileClamp* aHandle);
williamr@2
   468
	TInt ClampsOnDrive(TBool aRequestDismount=EFalse, TInt (*aFunc)(TAny*)=NULL,TAny* aParamList=NULL);
williamr@2
   469
	TInt SetCallbackRequired(TInt (*aFunc)(TAny*),TAny* aParamList);
williamr@2
   470
	IMPORT_C void FlushOutstandingDismount(TBool *aDismountRequired);
williamr@2
   471
	TInt ClearDeferredDismount();
williamr@2
   472
	IMPORT_C void SetClampFlag(TBool aClamped);
williamr@2
   473
	IMPORT_C TBool ClampFlag();
williamr@2
   474
	inline void Lock();
williamr@2
   475
	inline void UnLock();
williamr@2
   476
	TBool ReMount(CMountCB& aMount);
williamr@2
   477
williamr@2
   478
    TBool RequestFreeSpaceOnMount(TUint64 aFreeSpaceRequired); 
williamr@2
   479
    TInt  MountedVolumeSize(TUint64& aSize); 
williamr@2
   480
williamr@2
   481
private:
williamr@2
   482
	void MountMediaL(TBool aForceMount,CMountCB*& aMount);
williamr@2
   483
	void SetVolumeL(const TDesC& aName,HBufC*& aBuf);
williamr@2
   484
	void DirOpenL(CSessionFs* aSession,TInt& aHandle,const TDesC& aName,TUint anAtt,const TUidType& aUidType,CDirCB*& aDir);
williamr@2
   485
	void FileOpenL(CFsRequest* aRequest,TInt& aHandle,const TDesC& aName,TUint aMode,TFileOpen anOpen,CFileCB*& aFileCB,CFileShare*& aFileShare);
williamr@2
   486
	TInt CheckMountAndEntryNames(const TDesC& anOldName,const TDesC& aNewName);
williamr@2
   487
	CFileCB* LocateFileByPath(const TDesC& aPath);
williamr@2
   488
	TInt CheckDirectories(const TDesC& anOldName,const TDesC& aNewName);
williamr@2
   489
	void DoEntryL(const TDesC& aName,TEntry& anEntry);
williamr@2
   490
	void ReadSectionL(const TDesC& aName,TInt aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage);
williamr@2
   491
	TInt ValidateShare(CFileCB& aFile,TShare aReqShare);
williamr@2
   492
	TInt CheckAttributes(const TDesC& aName,TUint& aSetAttMask,TUint& aClearAttMask);
williamr@2
   493
	TBool IsExtensionMounted(CProxyDriveFactory* aFactory);
williamr@2
   494
	CFileCB* LocateFile(const TDesC& aName);
williamr@2
   495
	CFileCache* LocateClosedFile(const TDesC& aName, TBool aResurrect = ETrue);
williamr@2
   496
	TBool ReMount();
williamr@2
   497
	IMPORT_C TBool IsDriveThread() const;
williamr@2
   498
	IMPORT_C TBool IsMainThread() const;
williamr@2
   499
	IMPORT_C void DriveFault(TBool aDriveError) const;
williamr@2
   500
    void DoDismount();
williamr@2
   501
williamr@2
   502
private:
williamr@2
   503
	
williamr@2
   504
    //-- intrinsic TDrive flags. Used in iDriveFlags.
williamr@2
   505
    enum 
williamr@2
   506
    { 
williamr@2
   507
        ENotifyOff       = 0x01, 
williamr@2
   508
        EDismountPending = 0x02, 
williamr@2
   509
        ENotRugged       = 0x04, 
williamr@2
   510
        EClampPresent    = 0x08,
williamr@2
   511
        EDriveIsSynch    = 0x10, //-- is set on mount when the drive is synchronous (doesn't have its own thread)
williamr@2
   512
    };	
williamr@2
   513
williamr@2
   514
private:
williamr@2
   515
	TInt iDriveNumber;
williamr@2
   516
	TUint iAtt;
williamr@2
   517
	TBool iChanged;
williamr@2
   518
	TInt iReason;
williamr@2
   519
	TInt iMountNumber;
williamr@2
   520
	CFileSystem* iFSys;
williamr@2
   521
	CMountCB* iCurrentMount;
williamr@2
   522
	TDrive* iSubstedDrive;
williamr@2
   523
	HBufC* iSubst;
williamr@2
   524
	CFsObjectCon* iMount;
williamr@2
   525
	RFastLock iLock;
williamr@2
   526
	TDriveExtInfo iExtInfo;	
williamr@2
   527
	TInt iDriveFlags;   ///< intrinsic TDrive flags
williamr@2
   528
	TInt iReservedSpace;
williamr@2
   529
	TInt iDismountLock;
williamr@2
   530
	TInt iMountFailures;		// number of times the mount has failed
williamr@2
   531
	TInt iLastMountError;
williamr@2
   532
friend class LocalDrives;		// for access to iChanged flag
williamr@2
   533
	};
williamr@2
   534
williamr@2
   535
class CFileCB;
williamr@2
   536
class CDirCB;
williamr@2
   537
williamr@2
   538
williamr@2
   539
williamr@2
   540
williamr@2
   541
/**
williamr@2
   542
@publishedPartner
williamr@2
   543
@released
williamr@2
   544
williamr@2
   545
A file server interface class representing a mount.
williamr@2
   546
williamr@2
   547
An instance of this object is referred to as a mount control block.
williamr@2
   548
williamr@2
   549
A mount control block needs to be created for a specific volume (partition) on
williamr@2
   550
a drive in order to be able to access that volume. Volumes may be permanent
williamr@2
   551
or represent removable media. Note that removable media may also be mounted directly onto
williamr@2
   552
a device with no drive. Volumes can be formatted, unlike drives.
williamr@2
   553
williamr@2
   554
The volume represented is either a currently mounted volume in the system or,
williamr@2
   555
in the case of removable volumes, a volume that has been removed but still has
williamr@2
   556
subsession objects open.
williamr@2
   557
williamr@2
   558
A plug-in file system implements this class.
williamr@2
   559
*/
williamr@2
   560
class CMountCB : public CFsDispatchObject
williamr@2
   561
	{
williamr@2
   562
public:
williamr@2
   563
	IMPORT_C CMountCB();
williamr@2
   564
	IMPORT_C ~CMountCB();
williamr@2
   565
	IMPORT_C TBool operator!=(const CMountCB& aMount) const;
williamr@2
   566
	IMPORT_C TBool MatchEntryAtt(TUint anAtt,TUint aMatt) const;
williamr@2
   567
	IMPORT_C void SetDiskSpaceChange(TInt64 aFreeDiskSpace);
williamr@2
   568
	inline TDrive& Drive() const;
williamr@2
   569
	inline void SetDrive(TDrive* aDrive);
williamr@2
   570
	inline HBufC& VolumeName() const; 
williamr@2
   571
	inline void SetVolumeName(HBufC* aName);
williamr@2
   572
	inline TBool GetNotifyUser() const;
williamr@2
   573
	inline void SetNotifyOn();
williamr@2
   574
	inline void SetNotifyOff();
williamr@2
   575
	inline void IncLock();
williamr@2
   576
	inline void DecLock();
williamr@2
   577
	inline TInt LockStatus() const; 
williamr@2
   578
	inline TBool IsCurrentMount() const; 
williamr@2
   579
	inline TBool Locked() const;
williamr@2
   580
	inline TInt64 Size() const; 
williamr@2
   581
	inline TInt LocalDrive(TBusLocalDrive*& aLocalDrive);
williamr@2
   582
	inline TInt LocalBufferSupport(CFileCB* aFile = NULL);
williamr@2
   583
	inline TInt AddToCompositeMount(TInt aMountIndex);
williamr@2
   584
	
williamr@2
   585
// Pure virtual
williamr@2
   586
williamr@2
   587
    /**
williamr@2
   588
    Attempts to set the mount control block properties using
williamr@2
   589
    the current mount (i.e. volume) on the associated drive.
williamr@2
   590
williamr@2
   591
    The function should set the volume name (iVolumeName),
williamr@2
   592
    the unique ID (iUniqueID) and the volume size (iSize)
williamr@2
   593
    by reading and processing the current mount.
williamr@2
   594
williamr@2
   595
    When aForceMount is set to ETrue, the properties of a corrupt volume should
williamr@2
   596
    be forcibly stored. The classic case of when this is desirable is when
williamr@2
   597
    a corrupt volume needs to be formatted.
williamr@2
   598
williamr@2
   599
    The function should leave, on error detection, with an appropriate error code.
williamr@2
   600
williamr@2
   601
    @param aForceMount Indicates whether the properties of a corrupt
williamr@2
   602
                       volume should be stored.
williamr@2
   603
                       
williamr@2
   604
    @leave KErrCorrupt The properties of the current mount on the drive were
williamr@2
   605
           not successfully mounted due to corruption of volume information,
williamr@2
   606
           assuming that aForceMount is not set.
williamr@2
   607
    */
williamr@2
   608
	virtual void MountL(TBool aForceMount) =0;
williamr@2
   609
williamr@2
   610
williamr@2
   611
    /**
williamr@2
   612
    Checks whether the mount control block represents the current mount on
williamr@2
   613
    the associated drive.
williamr@2
   614
williamr@2
   615
    The function should read mount information from the current volume,
williamr@2
   616
    and check it against the mount information from this mount - typically
williamr@2
   617
    iVolumeName and iUniqueID. If the mount information matches, the function
williamr@2
   618
    should return KErrNone, otherwise it should return KErrGeneral.
williamr@2
   619
williamr@2
   620
    Called by the associated TDrive object when the drive has no current mounts,
williamr@2
   621
    which is the case on first access to the drive and following a volume
williamr@2
   622
    change on a drive associated with removable media. In this circumstance,
williamr@2
   623
    this function is called systematically on every mount control block owned
williamr@2
   624
    by the drive. If ReMount() calls for all existing mount
williamr@2
   625
    control blocks fail, the drive creates a new mount control block and calls
williamr@2
   626
    CMountCB::MountL() on that object; the new object is added to the list of
williamr@2
   627
    mount control blocks owned by the drive.
williamr@2
   628
williamr@2
   629
    @return KErrNone if the mount represented by this object is found to be
williamr@2
   630
            the current mount;
williamr@2
   631
            KErrGeneral if this object is found not to represent
williamr@2
   632
            the current mount;
williamr@2
   633
            otherwise one of the other sytem wide error codes.
williamr@2
   634
    */
williamr@2
   635
	virtual TInt ReMount() =0;
williamr@2
   636
williamr@2
   637
williamr@2
   638
    /**
williamr@2
   639
    Carries out any clean-up necessary for a volume dismount. 
williamr@2
   640
williamr@2
   641
    Dismounting a volume will always succeed, so the function does not need
williamr@2
   642
    to return an error value. Any cached information should be discarded and no
williamr@2
   643
    attempt should be made to access the volume. For removable media it may be
williamr@2
   644
    that the media has already been removed. This function is called when
williamr@2
   645
    a media change is detected.
williamr@2
   646
    */
williamr@2
   647
	virtual void Dismounted() =0;
williamr@2
   648
williamr@2
   649
williamr@2
   650
    /**
williamr@2
   651
    Gets volume information.
williamr@2
   652
williamr@2
   653
    The only information that the function has to supply is the free space,
williamr@2
   654
    TVolumeInfo::iFree, since the remaining members have already been set by
williamr@2
   655
    the calling function.
williamr@2
   656
williamr@2
   657
    The function should leave, on error detection, with
williamr@2
   658
    an appropriate error code.
williamr@2
   659
williamr@2
   660
    @param aVolume On return, a reference to the filled volume
williamr@2
   661
                   information object.
williamr@2
   662
    */
williamr@2
   663
	virtual void VolumeL(TVolumeInfo& aVolume) const =0;
williamr@2
   664
williamr@2
   665
williamr@2
   666
    /**
williamr@2
   667
    Sets the volume name for the mount, thus writing the new volume name
williamr@2
   668
    to the corresponding volume.
williamr@2
   669
williamr@2
   670
    This function should leave on error detection.
williamr@2
   671
williamr@2
   672
    @param aName A reference to a descriptor containing the new volume name.
williamr@2
   673
williamr@2
   674
    @leave KErrBadName If the specified volume name is longer than the maximum
williamr@2
   675
           allowed length for a volume name
williamr@2
   676
    */
williamr@2
   677
	virtual void SetVolumeL(TDes& aName) =0;
williamr@2
   678
williamr@2
   679
williamr@2
   680
    /**
williamr@2
   681
    Creates a new directory on the mount.
williamr@2
   682
williamr@2
   683
    The directory to be created is identified through its full name in aName.
williamr@2
   684
    The full name is in the form:
williamr@2
   685
    @code
williamr@2
   686
    \\dirA\\dirB\\dirC\\dirD
williamr@2
   687
    @endcode
williamr@2
   688
    where dirD is the new directory to be created in \\dirA\\dirB\\dirC\\.
williamr@2
   689
    This means that dirC is the leaf directory in which dirD will be created.
williamr@2
   690
williamr@2
   691
    The function should leave, on error detection, with an appropriate
williamr@2
   692
    error code.
williamr@2
   693
williamr@2
   694
    @param aName A reference to a descriptor containing the full name of
williamr@2
   695
                 the directory to be created.
williamr@2
   696
                 
williamr@2
   697
    @leave  KErrPathNotFound Part of the path in aName does not exist.
williamr@2
   698
    @leave  KErrAlreadyExists dirD already exists in \\dirA\\dirB\\dirC\\
williamr@2
   699
    @leave  KErrAccessDenied dirD already exists but is not a directory.
williamr@2
   700
    @leave  KErrDirFull There is no room in \\dirA\\dirB\\dirC\\ for the new entry,
williamr@2
   701
            which is especially applicable to the root directory.
williamr@2
   702
    */
williamr@2
   703
	virtual void MkDirL(const TDesC& aName) =0;
williamr@2
   704
williamr@2
   705
williamr@2
   706
    /**
williamr@2
   707
    Removes the directory specified by aName (its full name) from the volume.
williamr@2
   708
williamr@2
   709
    The directory specified by aName is in the form:
williamr@2
   710
    @code
williamr@2
   711
    \\dirA\\dirB\\dirC\\dirD
williamr@2
   712
    @endcode
williamr@2
   713
    where dirD is the directory to be removed from \\dirA\\dirB\\dirC\\.
williamr@2
   714
    This means that dirC is the leaf directory from which dirD should be removed.
williamr@2
   715
williamr@2
   716
    The function can assume that the directory exists and is not read-only. 
williamr@2
   717
williamr@2
   718
    The function should leave with a suitable error code if it cannot complete
williamr@2
   719
    successfully for any reason. 
williamr@2
   720
    
williamr@2
   721
    @param aName A reference to a descriptor containing the full name of
williamr@2
   722
                 the directory to be removed.
williamr@2
   723
    
williamr@2
   724
    @leave KErrInUse dirD contains entries other than the parent (..)
williamr@2
   725
           and current (.) entries.
williamr@2
   726
    */
williamr@2
   727
	virtual void RmDirL(const TDesC& aName) =0;
williamr@2
   728
williamr@2
   729
williamr@2
   730
    /**
williamr@2
   731
    Deletes the specified file from the mount.
williamr@2
   732
williamr@2
   733
    The function can assume that the file is closed.
williamr@2
   734
williamr@2
   735
    The file name specified by aName is of the form:
williamr@2
   736
    @code
williamr@2
   737
    \\dirA\\dirB\\dirC\\file.ext
williamr@2
   738
    @endcode
williamr@2
   739
    
williamr@2
   740
    The extension is optional.
williamr@2
   741
williamr@2
   742
    The function should leave on error detection, with
williamr@2
   743
    an appropriate error code.
williamr@2
   744
williamr@2
   745
	@param aName A reference to a descriptor containing the full path name
williamr@2
   746
	             of the file that will be removed.
williamr@2
   747
	
williamr@2
   748
	@leave KErrAccessDenied aName specifies a file whose attributes state that
williamr@2
   749
	       the file is read-only or aName specifies a directory.
williamr@2
   750
    */
williamr@2
   751
	virtual void DeleteL(const TDesC& aName) =0;
williamr@2
   752
williamr@2
   753
williamr@2
   754
    /**
williamr@2
   755
    Renames or moves a single file or directory on the mount.
williamr@2
   756
williamr@2
   757
    It can be used to move a file or directory since both
williamr@2
   758
    anOldName and anNewName specify the respective entries with full names;
williamr@2
   759
    for example,
williamr@2
   760
    @code
williamr@2
   761
    \\dirA\\dirB\\dirC\\oldEntryName
williamr@2
   762
    @endcode
williamr@2
   763
    
williamr@2
   764
    and
williamr@2
   765
    
williamr@2
   766
    @code
williamr@2
   767
    \\dirE\\dirF\\dirG\\newEntryName
williamr@2
   768
    @endcode
williamr@2
   769
williamr@2
   770
    If oldEntryName is a file, it can be assumed that it is closed.
williamr@2
   771
    If oldEntryName is a directory, it can be assumed that there are no
williamr@2
   772
    open files in this directory. Furthermore, if newEntryName specifies
williamr@2
   773
    a directory, it can be assumed that it is not a subdirectory of oldEntryName.
williamr@2
   774
williamr@2
   775
    The function should leave with an appropriate error code if it cannot
williamr@2
   776
    complete successfully for any reason. 
williamr@2
   777
williamr@2
   778
	@param anOldName A reference to a descriptor containing the full entry
williamr@2
   779
	                 name of the entry to be renamed.
williamr@2
   780
williamr@2
   781
	@param anNewName A reference to a descriptor containing the new full entry
williamr@2
   782
	                 name for the entry to be renamed.
williamr@2
   783
 
williamr@2
   784
    @leave KErrAlreadyExists The new entry already exists.
williamr@2
   785
    */
williamr@2
   786
	virtual void RenameL(const TDesC& anOldName,const TDesC& anNewName) =0;
williamr@2
   787
williamr@2
   788
williamr@2
   789
    /**
williamr@2
   790
    Replaces one file on the mount with another.
williamr@2
   791
williamr@2
   792
    The function can assume that both anOldName and, if it exists, anNewName
williamr@2
   793
    contain the full file names of files, and that these files are not open.
williamr@2
   794
williamr@2
   795
    If the file aNewName does not exist it should be created.
williamr@2
   796
williamr@2
   797
    The file anOldName should have its contents, attributes, and the universal
williamr@2
   798
    date and time of its last modification, copied to the file aNewName,
williamr@2
   799
    overwriting any existing contents and attribute details.
williamr@2
   800
    Finally anOldName should be deleted.
williamr@2
   801
williamr@2
   802
    The function should leave with an appropriate error code if it cannot
williamr@2
   803
    complete successfully for any reason.
williamr@2
   804
williamr@2
   805
    @param anOldName A reference to a descriptor containing the full file name
williamr@2
   806
                     of the file to replace the file specified by anNewName
williamr@2
   807
    @param anNewName A reference to a descriptor containing the new full file
williamr@2
   808
                     name for the entry to be replaced.
williamr@2
   809
    */
williamr@2
   810
	virtual void ReplaceL(const TDesC& anOldName,const TDesC& anNewName) =0;
williamr@2
   811
williamr@2
   812
williamr@2
   813
    /**
williamr@2
   814
    Gets the entry details for the specified file or directory.
williamr@2
   815
williamr@2
   816
    anEntry should be filled with details from the file or directory with the
williamr@2
   817
    full name aName. aName is of the form
williamr@2
   818
    @code
williamr@2
   819
    \\dirA\\dirB\\dirC\\entry.
williamr@2
   820
    @endcode
williamr@2
   821
    
williamr@2
   822
    Note that anEntry.iType (the entry UID) should only be set for a file whose
williamr@2
   823
    size is greater than or equal to sizeof(TCheckedUid).
williamr@2
   824
williamr@2
   825
    The function should leave with an appropriate error code if it cannot
williamr@2
   826
    complete successfully for any reason.
williamr@2
   827
williamr@2
   828
    @param aName   A reference to a descriptor containing the full name of
williamr@2
   829
                   the entry whose details are required.
williamr@2
   830
    @param anEntry On return, a reference to the filled entry object.
williamr@2
   831
    
williamr@2
   832
    @leave KErrPathNotFound The entry, aName, cannot be found.
williamr@2
   833
    */
williamr@2
   834
	virtual void EntryL(const TDesC& aName,TEntry& anEntry) const =0;
williamr@2
   835
williamr@2
   836
williamr@2
   837
    /**
williamr@2
   838
    Sets entry details for a specified file or directory.
williamr@2
   839
williamr@2
   840
    The entry identfied by the full name descriptor aName should have
williamr@2
   841
    its modification time and its attributes mask updated as required.
williamr@2
   842
williamr@2
   843
    The entry receives a new universal modified time from aTime.
williamr@2
   844
    The entry attributes are set with aSetAttMask and cleared
williamr@2
   845
    with aClearAttMask:
williamr@2
   846
    the bits that are set in aSetAttMask should be set
williamr@2
   847
    in the entry attribute mask;
williamr@2
   848
    the bits that are set in aClearAttMask
williamr@2
   849
    should be cleared from the entry attribute mask.
williamr@2
   850
williamr@2
   851
    The function can assume that aSetAttMask and aClearAttMask do not change
williamr@2
   852
    the type of attribute (i.e. volume or directory). Furthermore, if aName
williamr@2
   853
    specifies a file, it can be assumed that this file is closed.
williamr@2
   854
williamr@2
   855
    The function should leave with an appropriate error code on error detection.
williamr@2
   856
    
williamr@2
   857
    @param aName         A reference to a descriptor containing the full name of
williamr@2
   858
                         the entry to be updated.
williamr@2
   859
    @param aTime         A reference to the time object holding the new universal
williamr@2
   860
                         modified time for aName.
williamr@2
   861
    @param aSetAttMask   Attribute mask for setting the entry's attributes.
williamr@2
   862
    @param aClearAttMask Attribute mask for clearing the entry's attributes.
williamr@2
   863
    */
williamr@2
   864
	virtual void SetEntryL(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask) =0;
williamr@2
   865
williamr@2
   866
williamr@2
   867
    /**
williamr@2
   868
    Customises the opening of a new or existing file on the mount.
williamr@2
   869
williamr@2
   870
    The function is called internally (via TDrive::FileOpen()) as a result of
williamr@2
   871
    a call by the client, and the file is created, if necessary, and opened by
williamr@2
   872
    the calling function. However this function implements any replacement
williamr@2
   873
    functionality, as well as any other behaviour particular to the file system.
williamr@2
   874
williamr@2
   875
    If anOpen specifies EFileReplace (rather than EFileCreate or EFileOpen) then,
williamr@2
   876
    if replacement functionality is required, the data contained in the file
williamr@2
   877
    should be discarded, the archive attribute should be set, and the size of
williamr@2
   878
    the file should be set to zero. Note that it can be assumed that if anOpen
williamr@2
   879
    specifies EFileReplace then the file already exists.
williamr@2
   880
williamr@2
   881
    After successful completion of the function, the file control block pointer
williamr@2
   882
    will be added to the file server's global files container.
williamr@2
   883
williamr@2
   884
    The function should leave with a suitable error code if it cannot be completed
williamr@2
   885
    successfully.
williamr@2
   886
williamr@2
   887
    @param aName  The full name of the file that will be opened.
williamr@2
   888
    @param aMode  The file share mode. The following share modes are available:
williamr@2
   889
                  EFileShareExclusive;
williamr@2
   890
                  EFileShareReadersOnly;
williamr@2
   891
                  EFileShareAny;
williamr@2
   892
                  EFileShareReadersOrWriters;
williamr@2
   893
                  EFileStream;
williamr@2
   894
                  EFileStreamText;
williamr@2
   895
                  EFileRead;
williamr@2
   896
                  EFileWrite.
williamr@2
   897
    @param anOpen IndicatES how the file will be opened. It can be one of
williamr@2
   898
                  the following:
williamr@2
   899
                  EFileOpen;
williamr@2
   900
                  EFileCreate;
williamr@2
   901
                  EFileReplace.
williamr@2
   902
    @param aFile  Pointer to the file control block which will, on success,
williamr@2
   903
                  represent the open file.
williamr@2
   904
                  
williamr@2
   905
    @leave KErrAccessDenied aName may specify a directory, or the function may
williamr@2
   906
           be attempting to open a file on a ROM drive.
williamr@2
   907
    */
williamr@2
   908
	virtual void FileOpenL(const TDesC& aName,TUint aMode,TFileOpen anOpen,CFileCB* aFile) =0;
williamr@2
   909
williamr@2
   910
williamr@2
   911
    /**
williamr@2
   912
    Customises the opening of a directory on the mount.
williamr@2
   913
williamr@2
   914
    The function is called internally, and the directory will have been created
williamr@2
   915
    and initialised by the calling function. Any customisation specific to
williamr@2
   916
    a file system should be implemented in this function.
williamr@2
   917
williamr@2
   918
    Note that aName is of the form
williamr@2
   919
    @code
williamr@2
   920
    \\dirA\\dirB\\dirC\\file.ext
williamr@2
   921
    @endcode
williamr@2
   922
    
williamr@2
   923
    where \\dirA\\dirB\\dirC\\ is the directory to be opened and file.ext is
williamr@2
   924
    an optional entry name and extension.
williamr@2
   925
williamr@2
   926
    After successful completion of the function, the directory control block
williamr@2
   927
    pointer will be added to the file server global directories container.
williamr@2
   928
williamr@2
   929
    The function should leave with a suitable error code if it cannot complete
williamr@2
   930
    successfully for any reason.
williamr@2
   931
williamr@2
   932
    @param aName A reference to a descriptor containing the full name of
williamr@2
   933
                 the directory that will be opened.
williamr@2
   934
    @param aDir  Points to a directory control block which will, on success,
williamr@2
   935
                 represent the open directory.
williamr@2
   936
    */
williamr@2
   937
	virtual void DirOpenL(const TDesC& aName,CDirCB* aDir) =0;
williamr@2
   938
williamr@2
   939
williamr@2
   940
    /**
williamr@2
   941
    Reads the specified length of data from the specified position on
williamr@2
   942
    the volume directly into the client thread.
williamr@2
   943
williamr@2
   944
    It can be assumed that if this function is called,
williamr@2
   945
    then there has been a successful mount.
williamr@2
   946
williamr@2
   947
    This function should leave with an appropriate error code when
williamr@2
   948
    an error is detected.
williamr@2
   949
williamr@2
   950
    @param aPos     Start position in the volume for the read operation,
williamr@2
   951
                    in bytes.
williamr@2
   952
    @param aLength  The number of bytes to be read.
williamr@2
   953
    @param aTrg     A pointer to the buffer into which data is to be read.
williamr@2
   954
    @param anOffset The offset at which to start adding data to the read buffer.
williamr@2
   955
    @param aMessage
williamr@2
   956
    */
williamr@2
   957
	virtual void RawReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt anOffset,const RMessagePtr2& aMessage) const = 0;
williamr@2
   958
williamr@2
   959
williamr@2
   960
    /**
williamr@2
   961
    Writes a specified length of data from the client thread to the volume
williamr@2
   962
    at the specified position.
williamr@2
   963
williamr@2
   964
    It can be assumed that if this function is called, then there has been
williamr@2
   965
    a successful mount.
williamr@2
   966
williamr@2
   967
    This function should leave with an appropriate error code when
williamr@2
   968
    an error is detected.
williamr@2
   969
williamr@2
   970
    @param aPos     Start position in the volume for the write operation,
williamr@2
   971
                    in bytes.
williamr@2
   972
    @param aLength  The number of bytes to be written.
williamr@2
   973
    @param aSrc     Pointer to the buffer from which data will be written.
williamr@2
   974
    @param anOffset The offset in the buffer at which to start writing data.
williamr@2
   975
    @param aMessage
williamr@2
   976
    */
williamr@2
   977
	virtual void RawWriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt anOffset,const RMessagePtr2& aMessage) = 0;
williamr@2
   978
williamr@2
   979
williamr@2
   980
    /**
williamr@2
   981
    Gets the short name of the file or directory with the given full name.
williamr@2
   982
williamr@2
   983
    This function is used in circumstances where a file system mangles
williamr@2
   984
    Symbian OS natural names, in order to be able to store them on
williamr@2
   985
    a file system that is not entirely compatible.
williamr@2
   986
williamr@2
   987
    The function should leave with a suitable error code if it cannot complete
williamr@2
   988
    successfully for any reason.
williamr@2
   989
williamr@2
   990
	@param aLongName  A reference to a descriptor containing the full name
williamr@2
   991
	                  of the entry.
williamr@2
   992
	@param aShortName On return, a reference to a descriptor containing
williamr@2
   993
	                  the short name of the entry.
williamr@2
   994
    
williamr@2
   995
    @leave KErrNotFound The entry specified by its long name cannot be found.
williamr@2
   996
    */
williamr@2
   997
	virtual void GetShortNameL(const TDesC& aLongName,TDes& aShortName) = 0;
williamr@2
   998
williamr@2
   999
williamr@2
  1000
    /**
williamr@2
  1001
    Gets the long name of the file or directory associated with
williamr@2
  1002
    the given short name.
williamr@2
  1003
williamr@2
  1004
    This function is used in circumstances where a file system mangles
williamr@2
  1005
    Symbian OS natural names in order to be able to store them on
williamr@2
  1006
    a file system that is not entirely compatible. 
williamr@2
  1007
williamr@2
  1008
    The function should leave with a suitable error code if it cannot complete
williamr@2
  1009
    successfully for any reason.
williamr@2
  1010
williamr@2
  1011
	@param aShorName  A reference to a descriptor containing the short name
williamr@2
  1012
	                  of the entry.
williamr@2
  1013
williamr@2
  1014
    @param aLongName  On return, a reference to a descriptor containing
williamr@2
  1015
                      the long name of the entry.
williamr@2
  1016
williamr@2
  1017
    @leave KErrNotFound The entry specified by its short name cannot be found.
williamr@2
  1018
    */
williamr@2
  1019
	virtual void GetLongNameL(const TDesC& aShorName,TDes& aLongName) = 0;
williamr@2
  1020
williamr@2
  1021
williamr@2
  1022
    /**
williamr@2
  1023
    Reads a specified section of the file, regardless of the file's lock state.
williamr@2
  1024
williamr@2
  1025
    The function should leave with a suitable error code if it cannot complete
williamr@2
  1026
    successfully for any reason.
williamr@2
  1027
    
williamr@2
  1028
    @param aName   A reference to a descriptor containing the full name of
williamr@2
  1029
                   the file to be read from
williamr@2
  1030
    @param aPos    The byte position to start reading from.
williamr@2
  1031
    @param aTrg    A pointer to the buffer into which data is to be read.
williamr@2
  1032
    @param aLength The length of data to be read, in bytes.
williamr@2
  1033
    @param aMessage
williamr@2
  1034
williamr@2
  1035
	@leave KErrEof aPos is past the end of the file.
williamr@2
  1036
    */
williamr@2
  1037
	virtual void ReadSectionL(const TDesC& aName,TInt aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage)=0;
williamr@2
  1038
williamr@2
  1039
williamr@2
  1040
    /**
williamr@2
  1041
    Checks the integrity of the file system on the volume and returns an appropriate error value. 
williamr@2
  1042
    The default implementation must be overridden by a derived class.
williamr@2
  1043
    
williamr@2
  1044
    @return KErrNone if the file system is stable; otherwise one of the other system wide error codes.
williamr@2
  1045
            The default implementation returns KErrNotSupported.
williamr@2
  1046
    */
williamr@2
  1047
    virtual TInt CheckDisk() {return(KErrNotSupported);}
williamr@2
  1048
    
williamr@2
  1049
    /**
williamr@2
  1050
    The same as original CheckDisk(), but with some parameters.
williamr@2
  1051
    @prototype
williamr@2
  1052
    */
williamr@2
  1053
    virtual TInt CheckDisk(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL);
williamr@2
  1054
williamr@2
  1055
	
williamr@2
  1056
	/**
williamr@2
  1057
    Scans through and corrects errors found in the volume.
williamr@2
  1058
williamr@2
  1059
    The default implementation must be overridden by a derived class.
williamr@2
  1060
    
williamr@2
  1061
    @return KErrNone if no errors are found or all errors are corrected; otherwise one of the other system wide error codes.
williamr@2
  1062
            The default implementation returns KErrNotSupported.
williamr@2
  1063
    */
williamr@2
  1064
	virtual TInt ScanDrive() {return(KErrNotSupported);}
williamr@2
  1065
williamr@2
  1066
    /**
williamr@2
  1067
    The same as original ScanDrive(), but with some parameters.
williamr@2
  1068
    @prototype
williamr@2
  1069
    */
williamr@2
  1070
    virtual TInt ScanDrive(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL);
williamr@2
  1071
    
williamr@2
  1072
    IMPORT_C virtual void IsFileInRom(const TDesC& aFileName,TUint8*& aFileStart);
williamr@2
  1073
	
williamr@2
  1074
	
williamr@2
  1075
	/**
williamr@2
  1076
        Low-level control IO
williamr@2
  1077
    */
williamr@2
  1078
	virtual TInt ControlIO( const RMessagePtr2& /*aMessage*/,TInt /*aCommand*/,TAny* /*aParam1*/,TAny* /*aParam2*/)  {return(KErrNotSupported);}
williamr@2
  1079
williamr@2
  1080
williamr@2
  1081
	/**
williamr@2
  1082
	Locks a media which supports password protection and replaces
williamr@2
  1083
	the old password with a new one. 
williamr@2
  1084
williamr@2
  1085
    If aStore is set to ETrue, then the new password should be saved to
williamr@2
  1086
    the password store file, KMediaPWrdFile, using the exported file server
williamr@2
  1087
    function WriteToDisk(). 
williamr@2
  1088
williamr@2
  1089
    The password file is used to initialise the password store on boot up,
williamr@2
  1090
    so the user does not need to be prompted for the password again if
williamr@2
  1091
    it is saved here.
williamr@2
  1092
williamr@2
  1093
    The default implementation must be overridden in a derived class.
williamr@2
  1094
williamr@2
  1095
    @param aOld   A reference to the old password.
williamr@2
  1096
    @param aNew   A reference to the new password.
williamr@2
  1097
    @param aStore ETrue if the new password is to be saved to 
williamr@2
  1098
                  the password file store; EFalse if not.
williamr@2
  1099
williamr@2
  1100
    @return KErrNone if successful; otherwise another of the system wide
williamr@2
  1101
            error codes. The default implementation returns KErrNotSupported.
williamr@2
  1102
    */
williamr@2
  1103
	virtual TInt Lock(TMediaPassword& /*aOld*/,TMediaPassword& /*aNew*/,TBool /*aStore*/) {return(KErrNotSupported);}
williamr@2
  1104
williamr@2
  1105
williamr@2
  1106
	/**
williamr@2
  1107
	Unlocks a media which supports password protection.
williamr@2
  1108
williamr@2
  1109
    If aStore is set to ETrue then the password should be saved to
williamr@2
  1110
    the password store file specified by KMediaPWrdFile using the exported file
williamr@2
  1111
    server function WriteToDisk().
williamr@2
  1112
williamr@2
  1113
    The password file is used to initialise the password store on boot up,
williamr@2
  1114
    so the user does not need to be prompted for the password again if
williamr@2
  1115
    it is saved here.
williamr@2
  1116
williamr@2
  1117
    The default implementation must be overridden in a derived class.
williamr@2
  1118
williamr@2
  1119
    @param aPassword A reference to the password.
williamr@2
  1120
    @param aStore    ETrue if the password is to be saved to
williamr@2
  1121
                     the password store file; EFalse otherwise.
williamr@2
  1122
                     
williamr@2
  1123
    @return KErrNone if successful; otherwise another of the system wide
williamr@2
  1124
            error codes. The default implementation returns KErrNotSupported.                     
williamr@2
  1125
    */
williamr@2
  1126
	virtual TInt Unlock(TMediaPassword& /*aPassword*/,TBool /*aStore*/) {return(KErrNotSupported);}
williamr@2
  1127
williamr@2
  1128
williamr@2
  1129
	/**
williamr@2
  1130
	Clears a password from a media that supports write protection. 
williamr@2
  1131
williamr@2
  1132
    The default implementation must be overridden in a derived class.
williamr@2
  1133
williamr@2
  1134
    @param aPassword A reference to the password to be cleared.
williamr@2
  1135
williamr@2
  1136
    @return KErrNone if successful; otherwise another of the system wide
williamr@2
  1137
            error codes. The default implementation returns KErrNotSupported.
williamr@2
  1138
    */
williamr@2
  1139
	virtual TInt ClearPassword(TMediaPassword& /*aPassword*/) {return(KErrNotSupported);}
williamr@2
  1140
williamr@2
  1141
williamr@2
  1142
	/**
williamr@2
  1143
    */
williamr@2
  1144
	virtual TInt ForceRemountDrive(const TDesC8* /*aMountInfo*/,TInt /*aMountInfoMessageHandle*/,TUint /*aFlags*/) {return(KErrNotSupported);}
williamr@2
  1145
williamr@2
  1146
    
williamr@2
  1147
    /**
williamr@2
  1148
        Legacy method: finalise the mount and put it to the consistent state.
williamr@2
  1149
    */
williamr@2
  1150
	virtual void FinaliseMountL() {return;}
williamr@2
  1151
    
williamr@2
  1152
    /** 
williamr@2
  1153
        finalise the mount and put it to the consistent state.
williamr@2
  1154
williamr@2
  1155
        @param  aOperation  describes finalisation operation, see RFs::TFinaliseDrvMode
williamr@2
  1156
        @param  aParam1     not used, for future expansion
williamr@2
  1157
        @param  aParam2     not used, for future expansion
williamr@2
  1158
   */
williamr@2
  1159
    virtual	void FinaliseMountL(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL);
williamr@2
  1160
    
williamr@2
  1161
    
williamr@2
  1162
williamr@2
  1163
    /** Mount Control levels or operations to perform */
williamr@2
  1164
    enum TMntCtlLevel 
williamr@2
  1165
        {
williamr@2
  1166
        //-- reserved generic mount (CMountCB) control codes
williamr@2
  1167
        
williamr@2
  1168
        EMountStateQuery, ///< query mount state, see TMntCtlOption, ESQ_IsMountFinalised
williamr@2
  1169
        EMountVolParamQuery,    ///< mount-specific queries for volume parameters. See ESQ_RequestFreeSpace, ESQ_GetCurrentFreeSpace 
williamr@2
  1170
williamr@2
  1171
williamr@2
  1172
        //-- starting from the next code someone may define some specific mount type control codes, like ESpecificMountCtl+17
williamr@2
  1173
        ESpecificMountCtl = 0x40000000,
williamr@2
  1174
williamr@2
  1175
        };
williamr@2
  1176
    
williamr@2
  1177
    /** Mount Control options that makes sense only for certain control codes, see TMntCtlLevel */
williamr@2
  1178
    enum TMntCtlOption
williamr@2
  1179
        {
williamr@2
  1180
        //-- reserved generic mount (CMountCB) control options codes
williamr@2
  1181
        
williamr@2
  1182
        /** 
williamr@2
  1183
        query if the mount is finalised, corresponds to the EMountStateQuery control code only.
williamr@2
  1184
        aParam must be a pointer to TBool that will on return be ETrue if the mount is finalised. 
williamr@2
  1185
        */
williamr@2
  1186
        ESQ_IsMountFinalised, 
williamr@2
  1187
williamr@2
  1188
williamr@2
  1189
        //-----------------------------------------------------------------------------------------------------------------------------
williamr@2
  1190
        
williamr@2
  1191
        //-- starting from the next code someone may define some specific mount type control options
williamr@2
  1192
        ESpecificMountCtlOpt = 0x40000000,
williamr@2
  1193
williamr@2
  1194
        /**
williamr@2
  1195
        Corresponds to EMountVolParamQuery. Request a certain amount of free space on the volume.
williamr@2
  1196
        If _current_ amount of free space is >= than required or it is not being updated in background by the mount, returns immediately;
williamr@2
  1197
        If mount is still counting free space and If _current_ amount of free space is < than required, the caller will be blocked
williamr@2
  1198
        until mount finds enough free space or reports that the _final_ amount of free space is less than required.
williamr@2
  1199
williamr@2
  1200
        aParam must be TUint64* in: number of free bytes on the volume required, out: resulted amount of free space. It can be less than 
williamr@2
  1201
        required if there isn't enough free space on the volume at all.
williamr@2
  1202
        */
williamr@2
  1203
        ESQ_RequestFreeSpace,
williamr@2
  1204
        
williamr@2
  1205
        
williamr@2
  1206
        /**
williamr@2
  1207
        Corresponds to EMountVolParamQuery. A request to obtain the _current_ amount of free space on the volume asynchronously, without blocking.
williamr@2
  1208
        Some mounts implementations can count volume free space in the background. 
williamr@2
  1209
        
williamr@2
  1210
        aParam must be TUint64*  in: none; out: _current_ amount of free space on the volume.
williamr@2
  1211
        */
williamr@2
  1212
        ESQ_GetCurrentFreeSpace,
williamr@2
  1213
        
williamr@2
  1214
        /**
williamr@2
  1215
        Corresponds to EMountVolParamQuery. A request to obtain size of the mounted volume without blocking (CMountCB::VolumeL() can block).
williamr@2
  1216
        aParam must be TUint64*  in: none; out: mounted volume size, same as TVolumeInfo::iSize
williamr@2
  1217
        */
williamr@2
  1218
        ESQ_MountedVolumeSize,
williamr@2
  1219
williamr@2
  1220
        };
williamr@2
  1221
williamr@2
  1222
    /**
williamr@2
  1223
        Generic mount control method.
williamr@2
  1224
        @param  aLevel  specifies the operation to perfrom on the mount
williamr@2
  1225
        @param  aOption specific option for the given operation
williamr@2
  1226
        @param  aParam  pointer to generic parameter, its meaning depends on aLevel and aOption
williamr@2
  1227
williamr@2
  1228
        @return standard error code. Default imlementation returns KErrNotSupported
williamr@2
  1229
    */
williamr@2
  1230
    virtual	TInt MountControl(TInt aLevel, TInt aOption, TAny* aParam);
williamr@2
  1231
williamr@2
  1232
williamr@2
  1233
	/**
williamr@2
  1234
	Erase a password from a media that supports write protection. 
williamr@2
  1235
williamr@2
  1236
    The default implementation must be overridden in a derived class.
williamr@2
  1237
williamr@2
  1238
    @return KErrNone if successful; otherwise another of the system wide
williamr@2
  1239
            error codes. The default implementation returns KErrNotSupported.
williamr@2
  1240
    */
williamr@2
  1241
	virtual TInt ErasePassword() {return(KErrNotSupported);}
williamr@2
  1242
williamr@2
  1243
	/** 
williamr@2
  1244
	An interface class which may optionally be returned by a file system
williamr@2
  1245
	by calling GetInterface(EFileClamp, ...)
williamr@2
  1246
	*/
williamr@2
  1247
	class MFileClamp
williamr@2
  1248
		{
williamr@2
  1249
	public:
williamr@2
  1250
		virtual TInt ClampFile(const TInt aDriveNo,const TDesC& aName,TAny* aHandle) = 0;
williamr@2
  1251
		virtual TInt UnclampFile(RFileClamp* aHandle) = 0;
williamr@2
  1252
		IMPORT_C virtual TInt IsFileClamped(const TInt64 aUniqueId) = 0;
williamr@2
  1253
		virtual TInt NoOfClamps() = 0;
williamr@2
  1254
		virtual TInt SetCallbackRequired(TInt (*aFunc)(TAny*), TAny* aParamList) = 0;
williamr@2
  1255
		virtual TInt GetCallbackInfo(TInt (**aFunc)(TAny*), TAny*& aParamList) = 0;
williamr@2
  1256
		virtual TInt ClearCallbackInfo() = 0;
williamr@2
  1257
		};
williamr@2
  1258
williamr@2
  1259
	/** 
williamr@2
  1260
	An interface class which may optionally be returned by a file system
williamr@2
  1261
	by calling GetInterface(EFileAccessor, ...)
williamr@2
  1262
	*/
williamr@2
  1263
	class MFileAccessor
williamr@2
  1264
		{
williamr@2
  1265
	public:
williamr@2
  1266
		virtual TInt GetFileUniqueId(const TDesC& aName, TInt64& aUniqueId) = 0;
williamr@2
  1267
		virtual TInt Spare3(TInt aVal, TAny* aPtr1, TAny* aPtr2) = 0;
williamr@2
  1268
		virtual TInt Spare2(TInt aVal, TAny* aPtr1, TAny* aPtr2) = 0;
williamr@2
  1269
		virtual TInt Spare1(TInt aVal, TAny* aPtr1, TAny* aPtr2) = 0;
williamr@2
  1270
		};
williamr@2
  1271
williamr@2
  1272
williamr@2
  1273
	/**
williamr@2
  1274
	Enumeration of the aInterfaceIDs used in GetInterface.
williamr@2
  1275
	*/
williamr@2
  1276
	enum TInterfaceIds
williamr@2
  1277
		{
williamr@2
  1278
		EAddFsToCompositeMount = 0,
williamr@2
  1279
		EGetLocalDrive = 1,
williamr@2
  1280
		EFileAccessor = 2,
williamr@2
  1281
		EGetFileSystemSubType = 3,
williamr@2
  1282
		EGetClusterSize = 4,
williamr@2
  1283
		ELocalBufferSupport = 5,
williamr@2
  1284
		EAddToCompositeMount = 6
williamr@2
  1285
		};
williamr@2
  1286
williamr@2
  1287
	// File clamping support
williamr@2
  1288
	TInt ClampFile(const TInt aDriveNo,const TDesC& aName,TAny* aHandle);
williamr@2
  1289
	TInt UnclampFile(RFileClamp* aHandle);
williamr@2
  1290
	IMPORT_C TInt IsFileClamped(const TInt64 aUniqueId);
williamr@2
  1291
	TInt NoOfClamps();
williamr@2
  1292
	TInt SetCallbackRequired(TInt (*aFunc)(TAny*), TAny* aParamList);
williamr@2
  1293
	TInt GetCallbackInfo(TInt (**aFunc)(TAny*), TAny*& aParamList);
williamr@2
  1294
	TInt ClearCallbackInfo();
williamr@2
  1295
williamr@2
  1296
	// File accessor support
williamr@2
  1297
	TInt GetFileUniqueId(const TDesC& aName, TInt64& aUniqueId);
williamr@2
  1298
	TInt Spare3(TInt aVal, TAny* aPtr1, TAny* aPtr2);
williamr@2
  1299
	TInt Spare2(TInt aVal, TAny* aPtr1, TAny* aPtr2);
williamr@2
  1300
	TInt Spare1(TInt aVal, TAny* aPtr1, TAny* aPtr2);
williamr@2
  1301
williamr@2
  1302
	// Extensions of interface
williamr@2
  1303
	TInt FileSystemSubType(TDes& aName);
williamr@2
  1304
	TInt FileSystemClusterSize();
williamr@2
  1305
williamr@2
  1306
protected:
williamr@2
  1307
	inline void SetMountNumber(TInt aMountNumber);
williamr@2
  1308
	inline void SetDismounted(TBool aDismounted=ETrue);
williamr@2
  1309
	inline TInt MountNumber() const;
williamr@2
  1310
	inline TBool IsDismounted() const;
williamr@2
  1311
williamr@2
  1312
	void InitL(TInt aDrvNumber);
williamr@2
  1313
williamr@2
  1314
williamr@2
  1315
	/**
williamr@2
  1316
	Return a pointer to a specified interface extension - to allow future extension of this class without breaking
williamr@2
  1317
	binary compatibility.
williamr@2
  1318
	@param aInterfaceId Interface identifier of the interface to be retrieved.
williamr@2
  1319
	@param aInterface A reference to a pointer that retrieves the specified interface.
williamr@2
  1320
	@param aInput An arbitrary input argument.
williamr@2
  1321
	@return KErrNone If the interface is supported, KErrNotSupported otherwise.
williamr@2
  1322
	*/	
williamr@2
  1323
	IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
williamr@2
  1324
williamr@2
  1325
protected:
williamr@2
  1326
williamr@2
  1327
    /**
williamr@2
  1328
    Unique mount number set by the TDrive object representing the drive on
williamr@2
  1329
    which the object resides.
williamr@2
  1330
    */
williamr@2
  1331
	TInt iMountNumber;
williamr@2
  1332
williamr@2
  1333
williamr@2
  1334
    /**
williamr@2
  1335
    Unique ID from the volume. Set in MountL().
williamr@2
  1336
    
williamr@2
  1337
    @see CMountCB::MountL
williamr@2
  1338
    */
williamr@2
  1339
	TUint iUniqueID;
williamr@2
  1340
williamr@2
  1341
williamr@2
  1342
    /**
williamr@2
  1343
    Size of the volume. First set in MountL().
williamr@2
  1344
williamr@2
  1345
    @see CMountCB::MountL
williamr@2
  1346
    */
williamr@2
  1347
	TInt64 iSize;
williamr@2
  1348
williamr@2
  1349
williamr@2
  1350
    /**
williamr@2
  1351
    A list of all open files on that mount.
williamr@2
  1352
    Set by the TDrive object representing the drive of which the mount resides.
williamr@2
  1353
    */
williamr@2
  1354
	TDblQue<CFileCB> iMountQ;
williamr@2
  1355
	friend class TDrive;
williamr@2
  1356
	friend class TFsAddCompositeMount;
williamr@2
  1357
williamr@2
  1358
private:
williamr@2
  1359
	TInt iLockMount;
williamr@2
  1360
	TDrive* iDrive;
williamr@2
  1361
	HBufC* iVolumeName;
williamr@2
  1362
//
williamr@2
  1363
	CMountBody* iBody;
williamr@2
  1364
	};
williamr@2
  1365
williamr@2
  1366
williamr@2
  1367
/**
williamr@2
  1368
@internalTechnology
williamr@2
  1369
williamr@2
  1370
MFileSystemSubType interface provides extended interface for CMountCB to retrieve sub type
williamr@2
  1371
of mounted file systems.
williamr@2
  1372
williamr@2
  1373
The interface could be retrieved by calling CMountCB::GetInterface() with EGetFileSystemSubType
williamr@2
  1374
as an argument.
williamr@2
  1375
williamr@2
  1376
If the file system does not support sub types, MFileSystemSubType cannot be retieved.
williamr@2
  1377
Sub classes of CMountCB who does support sub types will need to multiple-inherit with
williamr@2
  1378
this class and implement the interface. The implementation of the interface will be 
williamr@2
  1379
retrieved via GetInterface() and provided to user by non-virtual APIs to avoid breaking
williamr@2
  1380
binary compatibility.
williamr@2
  1381
williamr@2
  1382
NOTE: Do not try to delete MFileSystemSubType interface pointer!
williamr@2
  1383
williamr@2
  1384
@see CMountCB::GetInterface()
williamr@2
  1385
*/
williamr@2
  1386
class MFileSystemSubType
williamr@2
  1387
	{
williamr@2
  1388
public:
williamr@2
  1389
	/**
williamr@2
  1390
	Retrieves file system's sub type name (E.g. FAT16), if the file system does not have sub 
williamr@2
  1391
	types (E.g. Rofs), return the file system's name.
williamr@2
  1392
	@param aName Returned descriptor contains file system name or sub type name.
williamr@2
  1393
	@return KErrNone if successful. 
williamr@2
  1394
	*/
williamr@2
  1395
	virtual TInt SubType(TDes& aName) const = 0;
williamr@2
  1396
	};
williamr@2
  1397
williamr@2
  1398
/**
williamr@2
  1399
@internalTechnology
williamr@2
  1400
williamr@2
  1401
MFileSystemClusterSize interface provides extended interface for CMountCB to retrieve cluster size
williamr@2
  1402
of mounted file systems.
williamr@2
  1403
williamr@2
  1404
The interface could be retrieved by calling CMountCB::GetInterface() with EGetClusterSize
williamr@2
  1405
as an argument.
williamr@2
  1406
williamr@2
  1407
If the file system does not support clustering, MFileSystemClusterSize cannot be retieved.
williamr@2
  1408
Sub classes of CMountCB who does support clustering will need to multiple-inherit with
williamr@2
  1409
this class and implement the interface. The implementation of the interface will be 
williamr@2
  1410
retrieved via GetInterface() and provided to user by non-virtual APIs to avoid breaking
williamr@2
  1411
binary compatibility.
williamr@2
  1412
williamr@2
  1413
NOTE: Do not try to delete MFileSystemSubType interface pointer!
williamr@2
  1414
williamr@2
  1415
@see CMountCB::GetInterface()
williamr@2
  1416
*/
williamr@2
  1417
class MFileSystemClusterSize
williamr@2
  1418
	{
williamr@2
  1419
public:
williamr@2
  1420
	/**
williamr@2
  1421
	Retrieves file system's cluster size
williamr@2
  1422
	@return None-zero cluster size if successful.
williamr@2
  1423
	*/
williamr@2
  1424
	virtual TInt ClusterSize() const = 0;
williamr@2
  1425
	};
williamr@2
  1426
williamr@2
  1427
williamr@2
  1428
class CFileShare;
williamr@2
  1429
williamr@2
  1430
/**
williamr@2
  1431
@publishedPartner
williamr@2
  1432
@released
williamr@2
  1433
williamr@2
  1434
File share lock
williamr@2
  1435
williamr@2
  1436
The lock specifies the lowest and highest position in the file to be locked.
williamr@2
  1437
williamr@2
  1438
Note that files may have many locks on it, but overlapping sections cannot
williamr@2
  1439
be locked.
williamr@2
  1440
williamr@2
  1441
This is used by a file control block, a CFileCB object.
williamr@2
  1442
williamr@2
  1443
@see CFileCB
williamr@2
  1444
*/
williamr@2
  1445
struct SFileShareLock
williamr@2
  1446
	{
williamr@2
  1447
	/**
williamr@2
  1448
	The owning file share object.
williamr@2
  1449
    */
williamr@2
  1450
	CFileShare* owner;
williamr@2
  1451
williamr@2
  1452
williamr@2
  1453
	/**
williamr@2
  1454
	The start of the section of the file to be locked.
williamr@2
  1455
	*/
williamr@2
  1456
	TInt posLow;
williamr@2
  1457
williamr@2
  1458
williamr@2
  1459
	/**
williamr@2
  1460
	The end of the section of the file to be locked.
williamr@2
  1461
    */
williamr@2
  1462
	TInt posHigh;
williamr@2
  1463
	};
williamr@2
  1464
williamr@2
  1465
williamr@2
  1466
/**
williamr@2
  1467
@internalTechnology
williamr@2
  1468
*/
williamr@2
  1469
class TAsyncReadRequest
williamr@2
  1470
	{
williamr@2
  1471
public:
williamr@2
  1472
	TAsyncReadRequest(TInt aEndPos, CFileShare* aOwningShareP, CFsRequest* aRequestP);
williamr@2
  1473
	TBool CompleteIfMatching(CFileShare* aOwningShareP, TRequestStatus* aStatusP, TInt aError);
williamr@2
  1474
private:
williamr@2
  1475
	TAsyncReadRequest();
williamr@2
  1476
public:
williamr@2
  1477
	TInt iEndPos;					// The request is completed file length >= iEndPos.
williamr@2
  1478
	CFileShare* iOwningShareP;		// The share that owns this outstanding request.
williamr@2
  1479
	const TRequestStatus* iStatusP;	// Used to identify the request when cancelling.
williamr@2
  1480
	CSessionFs* iSessionP;			// The owning session of the original request.
williamr@2
  1481
	RMessage2 iMessage;				// The message to be completed when data is available.
williamr@2
  1482
	};
williamr@2
  1483
williamr@2
  1484
/**
williamr@2
  1485
@publishedPartner
williamr@2
  1486
@released
williamr@2
  1487
williamr@2
  1488
A file server interface class representing an open file.
williamr@2
  1489
williamr@2
  1490
An instance of this object is referred to as a file control block.
williamr@2
  1491
williamr@2
  1492
A file control block needs to be created for a specific file to be able to
williamr@2
  1493
access that file within a directory.
williamr@2
  1494
williamr@2
  1495
A plug-in file system implements this class.
williamr@2
  1496
*/
williamr@2
  1497
class CFileCB : public CFsDispatchObject
williamr@2
  1498
	{
williamr@2
  1499
public:
williamr@2
  1500
	IMPORT_C CFileCB();
williamr@2
  1501
	IMPORT_C ~CFileCB();
williamr@2
  1502
	IMPORT_C void InitL(TDrive* aDrive,TDrive* aCreatedDrive,HBufC* aName,RArray<SFileShareLock>* aLock);
williamr@2
  1503
	inline void SetMount(CMountCB * aMount);
williamr@2
  1504
	inline TDrive& Drive() const;
williamr@2
  1505
	inline TDrive& CreatedDrive() const;
williamr@2
  1506
	inline CMountCB& Mount() const;
williamr@2
  1507
	inline HBufC& FileName() const;
williamr@2
  1508
	inline HBufC& FileNameF() const;
williamr@2
  1509
	inline RArray<SFileShareLock>& Lock();
williamr@2
  1510
	inline TInt UniqueID() const;
williamr@2
  1511
	TInt FindLock(TInt aPosLow,TInt aPosHigh);
williamr@2
  1512
	TInt AddLock(CFileShare* aFileShare,TInt aPos,TInt aLength);
williamr@2
  1513
	TInt RemoveLock(CFileShare* aFileShare,TInt aPos,TInt aLength);
williamr@2
  1514
	TInt CheckLock(CFileShare* aFileShare,TInt aPos,TInt aLength);
williamr@2
  1515
	void RemoveLocks(CFileShare* aFileShare);
williamr@2
  1516
	inline TShare Share() const;
williamr@2
  1517
	inline void SetShare(TShare aShare);
williamr@2
  1518
	inline TInt Size() const;
williamr@2
  1519
	inline void SetSize(TInt aSize);
williamr@2
  1520
	inline TInt Att() const;
williamr@2
  1521
	inline void SetAtt(TInt aAtt);
williamr@2
  1522
	inline TTime Modified() const;
williamr@2
  1523
	inline void SetModified(TTime aModified);
williamr@2
  1524
	inline TBool FileCorrupt() const;
williamr@2
  1525
	inline void SetFileCorrupt(TBool aFileCorrupt);
williamr@2
  1526
	inline TBool BadPower() const; 
williamr@2
  1527
	inline void SetBadPower(TBool aBadPower);
williamr@2
  1528
	inline TUint32 NameHash() const;
williamr@2
  1529
	TInt CheckMount();
williamr@2
  1530
	inline TInt BlockMap(SBlockMapInfo& aInfo, TInt64& aStartPos, TInt64 aEndPos=-1);
williamr@2
  1531
	inline TInt LocalDrive(TBusLocalDrive*& aLocalDrive);
williamr@2
  1532
williamr@2
  1533
	TBool LocalBufferSupport() const;
williamr@2
  1534
	void SetLocalBufferSupport(TBool aEnabled);
williamr@2
  1535
williamr@2
  1536
	/** File caching support methods */
williamr@2
  1537
williamr@2
  1538
	CFileCache* FileCache() const;
williamr@2
  1539
	TInt FairSchedulingLen() const;
williamr@2
  1540
	TInt CachedSize() const;
williamr@2
  1541
	void SetCachedSize(TInt aSize);
williamr@2
  1542
	void ResetReadAhead();
williamr@2
  1543
williamr@2
  1544
	void SetNotifyAsyncReadersPending(TBool aNotifyAsyncReadersPending);
williamr@2
  1545
	TBool NotifyAsyncReadersPending() const;
williamr@2
  1546
	TInt CancelAsyncReadRequest(CFileShare* aShareP, TRequestStatus* aStatusP);
williamr@2
  1547
williamr@2
  1548
	/** Extended API support methods */
williamr@2
  1549
williamr@2
  1550
	TBool ExtendedFileInterfaceSupported();
williamr@2
  1551
	void ReadL(TInt64 aPos,TInt& aLength,TDes8* aDes,const RMessagePtr2& aMessage, TInt aOffset);
williamr@2
  1552
	void WriteL(TInt64 aPos,TInt& aLength,const TDesC8* aDes,const RMessagePtr2& aMessage, TInt aOffset);
williamr@2
  1553
	void SetSizeL(TInt64 aSize);
williamr@2
  1554
williamr@2
  1555
    /**
williamr@2
  1556
    Renames the file with the full file name provided.
williamr@2
  1557
williamr@2
  1558
    Because the full name of the file includes the path, the function can
williamr@2
  1559
    also be used to move the file.
williamr@2
  1560
williamr@2
  1561
    It can be assumed that no other sub-session has access to the file:
williamr@2
  1562
    i.e. the file has not been opened in EFileShareAny share mode.
williamr@2
  1563
    It can also be assumed that the file has been opened for writing. 
williamr@2
  1564
williamr@2
  1565
    The function should leave with KErrAlreadyExists if aNewName already exists.
williamr@2
  1566
    An appropriate error code should also be generated if the function leaves
williamr@2
  1567
    before completion for any other reason.
williamr@2
  1568
williamr@2
  1569
	@param aNewName The new full name of the file.
williamr@2
  1570
	
williamr@2
  1571
	@see CFileCB::iFileName
williamr@2
  1572
    */
williamr@2
  1573
	virtual void RenameL(const TDesC& aNewName) =0;
williamr@2
  1574
	
williamr@2
  1575
	
williamr@2
  1576
    /**
williamr@2
  1577
    Reads a specified number of bytes from the open file starting at
williamr@2
  1578
    the specified postition, and writes the result into a descriptor.
williamr@2
  1579
williamr@2
  1580
    It can be assumed that aPos is inside the file and aLength > 0.
williamr@2
  1581
    The file should only be read up to its end regardless of
williamr@2
  1582
    the value of aPos + aLength. The number of bytes read should be stored
williamr@2
  1583
    in aLength on return.
williamr@2
  1584
williamr@2
  1585
    If the function leaves before completion for any reason it should generate
williamr@2
  1586
    an appropriate error code, and in this situation,
williamr@2
  1587
    the arguments are not valid on return.
williamr@2
  1588
williamr@2
  1589
	@param aPos     Represents a position relative to the start of the file
williamr@2
  1590
	                where ReadL() should start to read.
williamr@2
  1591
	@param aLength  On entry, specifies the number of bytes to be read
williamr@2
  1592
	                from the file. On return, this should contain the number
williamr@2
  1593
	                of bytes read, but this is not valid if the function leaves.
williamr@2
  1594
	@param aDes     Pointer to a descriptor into which the data should be written.
williamr@2
  1595
	@param aMessage
williamr@2
  1596
    */
williamr@2
  1597
    virtual void ReadL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage) =0;
williamr@2
  1598
	
williamr@2
  1599
	
williamr@2
  1600
    /**
williamr@2
  1601
    Writes data to the open file.
williamr@2
  1602
williamr@2
  1603
    iModified and iSize are set by the file server after this function
williamr@2
  1604
    has completed successfully.
williamr@2
  1605
williamr@2
  1606
    It can be assumed that aPos is within the file range and aLength > 0.
williamr@2
  1607
    When aPos + aLength is greater than the file size then the file should
williamr@2
  1608
    be enlarged using SetSizeL(). The number of bytes written should be
williamr@2
  1609
    returned through the argument aLength. 
williamr@2
  1610
williamr@2
  1611
    If the function leaves before completion for any reason it should generate
williamr@2
  1612
    an appropriate error code, and in this situation the arguments are
williamr@2
  1613
    not valid on return.
williamr@2
  1614
williamr@2
  1615
   	@param aPos     Represents a position relative to the start of the file
williamr@2
  1616
   	                where WriteL() should start to write.
williamr@2
  1617
	@param aLength  Specifies the number of bytes to be written to the file.
williamr@2
  1618
	                On return, the number of bytes written, but this is not
williamr@2
  1619
	                valid if the function leaves.
williamr@2
  1620
	@param aDes     Pointer to a descriptor containing the data to be written
williamr@2
  1621
	                to the file.
williamr@2
  1622
	@param aMessage 
williamr@2
  1623
	
williamr@2
  1624
	@see CFileCB::iModified
williamr@2
  1625
	@see CFileCB::iSize
williamr@2
  1626
	@see CFileCB::SetSizeL
williamr@2
  1627
	
williamr@2
  1628
    @leave KErrDiskFull The operation cannot be completed because the disk is full.
williamr@2
  1629
    */
williamr@2
  1630
	virtual void WriteL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage) =0;
williamr@2
  1631
	
williamr@2
  1632
	
williamr@2
  1633
    /**
williamr@2
  1634
    Extends or truncates the file by re-setting the file size.
williamr@2
  1635
williamr@2
  1636
    The function should not change iModified and iSize attributes of
williamr@2
  1637
    the file object: this is done by the file server.
williamr@2
  1638
    If the file is extended, nothing should be written in the extended area.
williamr@2
  1639
williamr@2
  1640
    The function should leave with a suitable error code on error detection.
williamr@2
  1641
williamr@2
  1642
    @param aSize The new file size in number of bytes.
williamr@2
  1643
    
williamr@2
  1644
    @leave KErrDiskFull The operation cannot be completed because the disk is full.
williamr@2
  1645
    
williamr@2
  1646
    @see CFileCB::iModified
williamr@2
  1647
	@see CFileCB::iSize
williamr@2
  1648
    */
williamr@2
  1649
	virtual void SetSizeL(TInt aSize) =0;
williamr@2
  1650
	
williamr@2
  1651
	
williamr@2
  1652
    /**
williamr@2
  1653
    Sets the attribute mask, iAtt, and the modified time of the file, iModified.
williamr@2
  1654
williamr@2
  1655
    If aMask|aVal does not equal zero, then aMask should be OR'ed with iAtt,
williamr@2
  1656
    whilst the inverse of aVal should be AND'ed with iAtt.
williamr@2
  1657
    If the modified flag is set in aMask then iModified should be set to aTime.
williamr@2
  1658
williamr@2
  1659
    The function should leave with a suitable error code on error detection.
williamr@2
  1660
williamr@2
  1661
	@param aTime The new modified time, if the modified flag is set in aMask.
williamr@2
  1662
	@param aMask Bit mask containing bits set (to 1) that are to be set (to 1)
williamr@2
  1663
	             in iAtt.
williamr@2
  1664
	@param aVal  Bitmask containing bits set (to 1) that are to be unset (to 0)
williamr@2
  1665
	             in iAtt.
williamr@2
  1666
	
williamr@2
  1667
    @see CFileCB::iModified
williamr@2
  1668
	@see CFileCB::iAtt
williamr@2
  1669
    */
williamr@2
  1670
    virtual void SetEntryL(const TTime& aTime,TUint aMask,TUint aVal) =0;
williamr@2
  1671
	
williamr@2
  1672
	
williamr@2
  1673
    /**
williamr@2
  1674
    Flushes, to disk, the cached information necessary for the integrity
williamr@2
  1675
    of recently written data, such as the file size.
williamr@2
  1676
williamr@2
  1677
    The function should leave with a suitable error code on error detection.
williamr@2
  1678
    */
williamr@2
  1679
	virtual void FlushDataL() =0;
williamr@2
  1680
	
williamr@2
  1681
	
williamr@2
  1682
    /**
williamr@2
  1683
    Flushes, to disk, all cached file data (e.g. attributes, modification time,
williamr@2
  1684
    file size). 
williamr@2
  1685
williamr@2
  1686
    The modified bit in the file attributes mask should be cleared if
williamr@2
  1687
    the flush was successful.
williamr@2
  1688
williamr@2
  1689
    The function should leave with a suitable error code on error detection.
williamr@2
  1690
    */
williamr@2
  1691
	virtual void FlushAllL() =0;
williamr@2
  1692
	IMPORT_C virtual TInt Address(TInt& aPos) const;
williamr@2
  1693
	IMPORT_C void SetArchiveAttribute();
williamr@2
  1694
williamr@2
  1695
	/**
williamr@2
  1696
	Block Map API interface 
williamr@2
  1697
	*/
williamr@2
  1698
	class MBlockMapInterface
williamr@2
  1699
		{
williamr@2
  1700
	public:
williamr@2
  1701
		virtual TInt BlockMap(SBlockMapInfo& aInfo, TInt64& aStartPos, TInt64 aEndPos)=0;
williamr@2
  1702
		};
williamr@2
  1703
		
williamr@2
  1704
	/** 
williamr@2
  1705
	An interface class which may optionally be returned by a file system
williamr@2
  1706
	by calling GetInterface(EExtendedFileInterface, ...)
williamr@2
  1707
	The purpose of this interface is twofold:
williamr@2
  1708
	- to support fair scheduling (by use of the aOffset parameter)
williamr@2
  1709
	- to enable large file support
williamr@2
  1710
	*/
williamr@2
  1711
	class MExtendedFileInterface
williamr@2
  1712
		{
williamr@2
  1713
	public:
williamr@2
  1714
		/** 
williamr@2
  1715
		Functionally equivalent to CFileCB::ReadL(), but supports large files and fair scheduling
williamr@2
  1716
williamr@2
  1717
		Reads a specified number of bytes from the open file starting at
williamr@2
  1718
		the specified postition, and writes the result into a descriptor.
williamr@2
  1719
williamr@2
  1720
		@param aPos     Represents a position relative to the start of the file
williamr@2
  1721
						where ReadL() should start to read. 
williamr@2
  1722
						Note that the filesystem may not support positions above KMaxTInt,
williamr@2
  1723
						in which case it leaves with KErrNotSupported.
williamr@2
  1724
		@param aLength  On entry, specifies the number of bytes to be read
williamr@2
  1725
						from the file. On return, this contains the number
williamr@2
  1726
						of bytes read, this value is not valid if the function leaves.
williamr@2
  1727
		@param aDes     Pointer to a descriptor into which the data is written.
williamr@2
  1728
		@param aMessage A reference to a client message or an RLocalMessage.
williamr@2
  1729
		@param aOffset	The offset into the descriptor where the data is to be written.
williamr@2
  1730
						This is non-zero if the read was fair-scheduled
williamr@2
  1731
						
williamr@2
  1732
		@see CFileCB::ReadL		
williamr@2
  1733
		@see RLocalMessage				
williamr@2
  1734
		*/
williamr@2
  1735
		virtual void ReadL(TInt64 aPos,TInt& aLength,TDes8* aDes,const RMessagePtr2& aMessage, TInt aOffset) = 0;
williamr@2
  1736
		
williamr@2
  1737
		/** 
williamr@2
  1738
		Functionally equivalent to CFileCB::WriteL(), but supports large files and fair scheduling
williamr@2
  1739
williamr@2
  1740
	    Writes data to the open file.
williamr@2
  1741
williamr@2
  1742
   		@param aPos     Represents a position relative to the start of the file
williamr@2
  1743
   						where WriteL() starts to write.
williamr@2
  1744
						Note that the filesystem may not support positions above KMaxTInt,
williamr@2
  1745
						in which case it leaves with KErrNotSupported.
williamr@2
  1746
		@param aLength  Specifies the number of bytes to be written to the file.
williamr@2
  1747
						On return this is the number of bytes written, this value is not
williamr@2
  1748
						valid if the function leaves.
williamr@2
  1749
		@param aDes     Pointer to a descriptor containing the data to be written
williamr@2
  1750
						to the file.
williamr@2
  1751
		@param aMessage A reference to a client message or an RLocalMessage
williamr@2
  1752
		@param aOffset	The offset into the descriptor where the data is to be read from.
williamr@2
  1753
						This is non-zero if the read was fair-scheduled
williamr@2
  1754
						
williamr@2
  1755
		@see CFileCB::WriteL
williamr@2
  1756
		@see RLocalMessage						
williamr@2
  1757
		*/
williamr@2
  1758
		virtual void WriteL(TInt64 aPos,TInt& aLength,const TDesC8* aDes,const RMessagePtr2& aMessage, TInt aOffset) = 0;
williamr@2
  1759
williamr@2
  1760
		/** 
williamr@2
  1761
		Functionally equivalent to CFileCB::SetSizeL(), but supports large files
williamr@2
  1762
williamr@2
  1763
		Extends or truncates the file by re-setting the file size.
williamr@2
  1764
williamr@2
  1765
		The function does not change the iModified and iSize attributes of
williamr@2
  1766
		the file object: this is done by the file server.
williamr@2
  1767
		If the file is extended, nothing is written in the extended area.
williamr@2
  1768
williamr@2
  1769
		The function leaves with a suitable error code when an error is to detected.
williamr@2
  1770
williamr@2
  1771
		@param aSize The new file size in bytes.
williamr@2
  1772
    
williamr@2
  1773
		@leave KErrDiskFull The operation cannot be completed because the disk is full.
williamr@2
  1774
    		
williamr@2
  1775
    	@see CFileCB::SetSizeL
williamr@2
  1776
		@see CFileCB::iModified
williamr@2
  1777
		@see CFileCB::iSize
williamr@2
  1778
		*/
williamr@2
  1779
		virtual void SetSizeL(TInt64 aSize) = 0;
williamr@2
  1780
		};
williamr@2
  1781
williamr@2
  1782
williamr@2
  1783
protected:
williamr@2
  1784
	
williamr@2
  1785
	/**
williamr@2
  1786
	Return a pointer to a specified interface extension - to allow future extension of this class without breaking
williamr@2
  1787
	binary compatibility.
williamr@2
  1788
	@param aInterfaceId Interface identifier of the interface to be retrieved.
williamr@2
  1789
	@param aInterface A reference to a pointer that retrieves the specified interface.
williamr@2
  1790
	@param aInput An arbitrary input argument.
williamr@2
  1791
	@return KErrNone If the interface is supported, KErrNotSupported otherwise.
williamr@2
  1792
	*/	
williamr@2
  1793
	IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
williamr@2
  1794
williamr@2
  1795
   	enum TInterfaceIds
williamr@2
  1796
   		{
williamr@2
  1797
		EBlockMapInterface = 0,
williamr@2
  1798
		EGetLocalDrive = 1,
williamr@2
  1799
		EExtendedFileInterface = 2
williamr@2
  1800
   		};
williamr@2
  1801
	
williamr@2
  1802
private:
williamr@2
  1803
williamr@2
  1804
	void DemoteShare(CFileShare* aFileShare);
williamr@2
  1805
	void PromoteShare(CFileShare* aFileShare);
williamr@2
  1806
williamr@2
  1807
	RArray<TAsyncReadRequest>& AsyncReadRequests();
williamr@2
  1808
	TInt AddAsyncReadRequest(CFileShare* aFileShareP, TInt aPos, TInt aLength, CFsRequest* aRequestP);
williamr@2
  1809
	void NotifyAsyncReaders();
williamr@2
  1810
williamr@2
  1811
protected:
williamr@2
  1812
williamr@2
  1813
    /**
williamr@2
  1814
    Inititally, the mode that the file was opened with, which defines the level
williamr@2
  1815
    of access allowed to the file. Set by the TDrive object
williamr@2
  1816
    (representing the drive on which the file resides) when the file
williamr@2
  1817
    control block is created.
williamr@2
  1818
    */
williamr@2
  1819
	TShare iShare;
williamr@2
  1820
williamr@2
  1821
williamr@2
  1822
    /**
williamr@2
  1823
    The size of the file.
williamr@2
  1824
    */
williamr@2
  1825
    TInt iSize;
williamr@2
  1826
williamr@2
  1827
williamr@2
  1828
    /**
williamr@2
  1829
    The attributes of the file.
williamr@2
  1830
    */
williamr@2
  1831
	TInt iAtt;
williamr@2
  1832
williamr@2
  1833
williamr@2
  1834
    /**
williamr@2
  1835
    The universal time at which the file was last modified.
williamr@2
  1836
    */
williamr@2
  1837
	TTime iModified;
williamr@2
  1838
williamr@2
  1839
williamr@2
  1840
    /**
williamr@2
  1841
    Indicates whether the file that the object represents is corrupt:
williamr@2
  1842
    true if it is corrupt, false otherwise.
williamr@2
  1843
    */
williamr@2
  1844
	TBool iFileCorrupt;
williamr@2
  1845
williamr@2
  1846
williamr@2
  1847
    /**
williamr@2
  1848
    Indicates whether a recent access to the file that the object represents
williamr@2
  1849
    failed due to KErrBadPower.
williamr@2
  1850
    */
williamr@2
  1851
	TBool iBadPower;
williamr@2
  1852
williamr@2
  1853
public:
williamr@2
  1854
williamr@2
  1855
	/**
williamr@2
  1856
	The full name of the file, including drive and extensions.
williamr@2
  1857
	*/
williamr@2
  1858
	HBufC* iFileName;
williamr@2
  1859
williamr@2
  1860
	/**
williamr@2
  1861
	The full name of the file, including drive and extensions - Folded.
williamr@2
  1862
	*/
williamr@2
  1863
	HBufC* iFileNameF;
williamr@2
  1864
williamr@2
  1865
private:
williamr@2
  1866
	TUint32	iNameHash;
williamr@2
  1867
	TDrive* iCreatedDrive;
williamr@2
  1868
	TDrive* iDrive;
williamr@2
  1869
	CMountCB* iMount;
williamr@2
  1870
	RArray<SFileShareLock>* iLock;
williamr@2
  1871
	TDblQueLink iMountLink;
williamr@2
  1872
	
williamr@2
  1873
private:
williamr@2
  1874
	CFileBody* iBody;
williamr@2
  1875
williamr@2
  1876
	friend class TDrive;
williamr@2
  1877
	friend class CMountCB;
williamr@2
  1878
	friend class CFileShare;
williamr@2
  1879
	friend class TFsFileRead;
williamr@2
  1880
	friend class TFsFileWrite;
williamr@2
  1881
	friend class TFsFileSetSize;
williamr@2
  1882
	friend class TFsFileReadCancel;
williamr@2
  1883
	friend class TFsFileDuplicate;
williamr@2
  1884
	friend class CCompFileCB;
williamr@2
  1885
	friend class CFileCache;
williamr@2
  1886
	};
williamr@2
  1887
williamr@2
  1888
williamr@2
  1889
/**
williamr@2
  1890
Helper class to construct a dummy RMessage2 object. This allows the file server to 
williamr@2
  1891
read and write local buffers to a file system's CFileCB-derived interface.
williamr@2
  1892
williamr@2
  1893
@internalTechnology
williamr@2
  1894
*/
williamr@2
  1895
class RLocalMessage : public RMessage2
williamr@2
  1896
	{
williamr@2
  1897
public:
williamr@2
  1898
	inline RLocalMessage();
williamr@2
  1899
	};
williamr@2
  1900
williamr@2
  1901
williamr@2
  1902
/**
williamr@2
  1903
@publishedPartner
williamr@2
  1904
@released
williamr@2
  1905
williamr@2
  1906
A file server interface class representing an open file that is being shared.
williamr@2
  1907
For example multiple reading of the same file.
williamr@2
  1908
williamr@2
  1909
@see CFileCB
williamr@2
  1910
@see TFileMode
williamr@2
  1911
*/
williamr@2
  1912
NONSHARABLE_CLASS(CFileShare) : public CFsDispatchObject
williamr@2
  1913
	{
williamr@2
  1914
public:
williamr@2
  1915
	CFileShare(CFileCB* aFileCB);
williamr@2
  1916
	~CFileShare();
williamr@2
  1917
	TInt CheckMount();
williamr@2
  1918
	void InitL();
williamr@2
  1919
	inline CFileCB& File();
williamr@2
  1920
williamr@2
  1921
	// For serialising aync requests 
williamr@2
  1922
	TBool RequestStart(CFsMessageRequest* aRequest);
williamr@2
  1923
	void RequestEnd(CFsMessageRequest* aRequest);
williamr@2
  1924
	TBool RequestInProgress() const;
williamr@2
  1925
williamr@2
  1926
williamr@2
  1927
public:
williamr@2
  1928
	/**
williamr@2
  1929
	File share mode. The mode in which the file was opened first.
williamr@2
  1930
	@see TFileMode.
williamr@2
  1931
	*/
williamr@2
  1932
	TUint iMode;   
williamr@2
  1933
	/**
williamr@2
  1934
	Current file position. This is the position at which reading and writing takes place.
williamr@2
  1935
	*/
williamr@2
  1936
	TInt iPos;     
williamr@2
  1937
	/**
williamr@2
  1938
	Error condition due to flush.
williamr@2
  1939
	*/
williamr@2
  1940
	TInt iFlushError;
williamr@2
  1941
private:
williamr@2
  1942
	CFileCB* iFile;
williamr@2
  1943
williamr@2
  1944
	// A pointer to the current request. Used for serializing client 
williamr@2
  1945
	// async read/write requests which might otherwise be processed out
williamr@2
  1946
	// of order due to fair scheduling
williamr@2
  1947
	CFsMessageRequest* iCurrentRequest;	
williamr@2
  1948
	};
williamr@2
  1949
williamr@2
  1950
williamr@2
  1951
williamr@2
  1952
williamr@2
  1953
/**
williamr@2
  1954
@publishedPartner
williamr@2
  1955
@released
williamr@2
  1956
williamr@2
  1957
A file server interface class representing an open directory
williamr@2
  1958
williamr@2
  1959
An instance of this object is referred to as a directory control block.
williamr@2
  1960
williamr@2
  1961
A directory control block must be created for a specific directory to access
williamr@2
  1962
that directory within a volume.
williamr@2
  1963
williamr@2
  1964
A plug-in file system implements this class.
williamr@2
  1965
*/
williamr@2
  1966
class CDirCB : public CFsDispatchObject
williamr@2
  1967
	{
williamr@2
  1968
public:
williamr@2
  1969
	IMPORT_C CDirCB();
williamr@2
  1970
	IMPORT_C ~CDirCB();
williamr@2
  1971
	TInt CheckMount();
williamr@2
  1972
	IMPORT_C void InitL(TDrive* aDrive);
williamr@2
  1973
	inline void SetMount(CMountCB * aMount){iMount=aMount;};
williamr@2
  1974
	inline TDrive& Drive() const;
williamr@2
  1975
	inline CMountCB& Mount() const;
williamr@2
  1976
	inline TBool Pending() const; 
williamr@2
  1977
	inline void SetPending(TBool aPending);
williamr@2
  1978
	
williamr@2
  1979
williamr@2
  1980
    /**
williamr@2
  1981
    Gets information from the first suitable entry in the directory,
williamr@2
  1982
    starting from the current read position.
williamr@2
  1983
williamr@2
  1984
    The function should read successive entries until a suitable entry is found.
williamr@2
  1985
    An entry is suitable if the entry attributes match the criteria set by this
williamr@2
  1986
    object's attributes, which are set on initialisation.
williamr@2
  1987
    For example, if the directory control block has the attribute
williamr@2
  1988
    KEntryAttMaskSupported, and the file has the attribute KEntryAttVolume,
williamr@2
  1989
    then the entry will be deemed unsuitable and the next entry will be read.
williamr@2
  1990
williamr@2
  1991
    This function is called by the file server.
williamr@2
  1992
williamr@2
  1993
    If, on return, the entry's full file name, TEntry::iName, is longer than
williamr@2
  1994
    the maximum buffer size, then the entry cannot be returned to the client.
williamr@2
  1995
    In this case the file server will set iPending to true and will call
williamr@2
  1996
    StoreLongEntryName() before calling this function again.
williamr@2
  1997
    In this case (when iPending is true), the function should re-read
williamr@2
  1998
    the last entry to be read; it should also set iPending to false and
williamr@2
  1999
    should not advance the current read position.
williamr@2
  2000
williamr@2
  2001
    The time stored in the iModified member of anEntry should not be converted,
williamr@2
  2002
    but left as UTC time.
williamr@2
  2003
williamr@2
  2004
    When storing the iName member of anEntry, the current (.),
williamr@2
  2005
    or parent marker (..) in the directory should not be returned.
williamr@2
  2006
williamr@2
  2007
    If the KEntryAttAllowUid flag is set in the iAtt member of anEntry, then
williamr@2
  2008
    the entry UID type of an entry will be read. If, on reading the UID from
williamr@2
  2009
    a file, KErrCorrupt is generated, because the file is corrupt,
williamr@2
  2010
    ReadL() should not leave with this error message, but should return
williamr@2
  2011
    as normal.
williamr@2
  2012
    If any other errors are raised the function should leave.
williamr@2
  2013
williamr@2
  2014
    All of the properties of a TEntry, other than the UID types, are always read.
williamr@2
  2015
williamr@2
  2016
    ReadL() should leave with a suitable error code if it cannot complete
williamr@2
  2017
    successfully for any reason. 
williamr@2
  2018
williamr@2
  2019
    @param anEntry Entry information object.
williamr@2
  2020
    */
williamr@2
  2021
	virtual void ReadL(TEntry& anEntry) =0;
williamr@2
  2022
	
williamr@2
  2023
public:
williamr@2
  2024
	IMPORT_C virtual void StoreLongEntryNameL(const TDesC& aName);
williamr@2
  2025
	
williamr@2
  2026
protected:
williamr@2
  2027
	/**
williamr@2
  2028
	Return a pointer to a specified interface extension - to allow future extension of this class without breaking
williamr@2
  2029
	binary compatibility.
williamr@2
  2030
	@param aInterfaceId Interface identifier of the interface to be retrieved.
williamr@2
  2031
	@param aInterface A reference to a pointer that retrieves the specified interface.
williamr@2
  2032
	@param aInput An arbitrary input argument.
williamr@2
  2033
	@return KErrNone If the interface is supported, KErrNotSupported otherwise.
williamr@2
  2034
	*/	
williamr@2
  2035
	IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
williamr@2
  2036
	
williamr@2
  2037
protected:
williamr@2
  2038
    /**
williamr@2
  2039
    Bitmask of the attributes of interest.
williamr@2
  2040
williamr@2
  2041
    Set using the the TDrive friend class instance representing
williamr@2
  2042
    the directory's drive after the object is made.
williamr@2
  2043
    */
williamr@2
  2044
	TUint iAtt;
williamr@2
  2045
	
williamr@2
  2046
	
williamr@2
  2047
	/**
williamr@2
  2048
	Set after construction using the TDrive friend class instance representing
williamr@2
  2049
	the directory's drive.
williamr@2
  2050
	*/
williamr@2
  2051
	TUidType iUidType;
williamr@2
  2052
williamr@2
  2053
williamr@2
  2054
    /**
williamr@2
  2055
    Flag to indicate whether preceding entry details should be returned when
williamr@2
  2056
    multiple entries are being read.
williamr@2
  2057
    */
williamr@2
  2058
	TBool iPending;
williamr@2
  2059
	friend class TDrive;
williamr@2
  2060
private:
williamr@2
  2061
	TDrive* iDrive;
williamr@2
  2062
	CMountCB* iMount;
williamr@2
  2063
	TUint32 iReserved;				// Reserved for future expansion
williamr@2
  2064
	};
williamr@2
  2065
williamr@2
  2066
williamr@2
  2067
williamr@2
  2068
williamr@2
  2069
/**
williamr@2
  2070
@publishedPartner
williamr@2
  2071
@released
williamr@2
  2072
williamr@2
  2073
A file server interface class representing a format operation on a disk.
williamr@2
  2074
williamr@2
  2075
An instance of this object is referred to as a format control block.
williamr@2
  2076
williamr@2
  2077
The type of format operation to be applied depends on the type of disk,
williamr@2
  2078
and is stored in iMode. Each format operation has a number of steps and
williamr@2
  2079
is kept track of using iCurrentStep.
williamr@2
  2080
williamr@2
  2081
A format control block needs to be created for a specific mount control block
williamr@2
  2082
for the disk controlled via that mount to be formatted.
williamr@2
  2083
williamr@2
  2084
A plug-in file system provides an implementation of this class.
williamr@2
  2085
*/
williamr@2
  2086
class CFormatCB : public CFsDispatchObject
williamr@2
  2087
	{
williamr@2
  2088
public:
williamr@2
  2089
	IMPORT_C CFormatCB();
williamr@2
  2090
	IMPORT_C ~CFormatCB();
williamr@2
  2091
	IMPORT_C TInt CheckMount();
williamr@2
  2092
	void InitL(TDrive* aDrive,TFormatMode aMode);
williamr@2
  2093
    void SetSpecialInfo(const TDesC8& aInfo);
williamr@2
  2094
	inline TDrive& Drive() const;
williamr@2
  2095
	inline CMountCB& Mount()  const;
williamr@2
  2096
	inline TFormatMode Mode()  const; 
williamr@2
  2097
	inline TInt& CurrentStep();
williamr@2
  2098
williamr@2
  2099
    /**
williamr@2
  2100
    Performs a formatting step on the drive.
williamr@2
  2101
williamr@2
  2102
    The step performed should depend on the values of iMode and iCurrentStep. 
williamr@2
  2103
williamr@2
  2104
    It can be assumed that there are no resources open on the mount,
williamr@2
  2105
    that the media is formattable, and that the media is not write protected.
williamr@2
  2106
williamr@2
  2107
    If iMode == EQuickFormat, then only meta data is to be written.
williamr@2
  2108
    This should be carried out in a single step, with iCurrentStep set
williamr@2
  2109
    to zero on completion.
williamr@2
  2110
williamr@2
  2111
    If iMode != EQuickFormat, then the format step performed by
williamr@2
  2112
    this function should depend on iCurrentStep. When the function
williamr@2
  2113
    returns with iCurrentStep set to zero, the formatting of the drive is complete.
williamr@2
  2114
williamr@2
  2115
    On error detection, the function should leave with an appropriate error code.
williamr@2
  2116
williamr@2
  2117
    @see CFormatCB::iMode
williamr@2
  2118
    @see CFormatCB::iCurrentStep
williamr@2
  2119
    */
williamr@2
  2120
	virtual void DoFormatStepL() =0;
williamr@2
  2121
	
williamr@2
  2122
protected:
williamr@2
  2123
	/**
williamr@2
  2124
	Return a pointer to a specified interface extension - to allow future extension of this class without breaking
williamr@2
  2125
	binary compatibility.
williamr@2
  2126
	@param aInterfaceId Interface identifier of the interface to be retrieved.
williamr@2
  2127
	@param aInterface A reference to a pointer that retrieves the specified interface.
williamr@2
  2128
	@param aInput An arbitrary input argument.
williamr@2
  2129
	@return KErrNone If the interface is supported, KErrNotSupported otherwise.
williamr@2
  2130
	*/	
williamr@2
  2131
	IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
williamr@2
  2132
		
williamr@2
  2133
protected:
williamr@2
  2134
williamr@2
  2135
    /**
williamr@2
  2136
    The stage the current format operation has reached.
williamr@2
  2137
    */
williamr@2
  2138
	TInt iCurrentStep;
williamr@2
  2139
	
williamr@2
  2140
	
williamr@2
  2141
	/**
williamr@2
  2142
	The mode of the format operation.
williamr@2
  2143
	
williamr@2
  2144
	This is set by the file server when the format control block is created.
williamr@2
  2145
	*/
williamr@2
  2146
	TFormatMode iMode;
williamr@2
  2147
williamr@2
  2148
    /**
williamr@2
  2149
    Buffer containing user-specified format parameters.
williamr@2
  2150
    */
williamr@2
  2151
    TSpecialFormatInfoBuf iSpecialInfo;
williamr@2
  2152
private:
williamr@2
  2153
	TDrive* iDrive;
williamr@2
  2154
	CMountCB* iMount;
williamr@2
  2155
	TUint32 iReserved;				// Reserved for future expansion
williamr@2
  2156
	};
williamr@2
  2157
williamr@2
  2158
williamr@2
  2159
williamr@2
  2160
williamr@2
  2161
/**
williamr@2
  2162
@publishedPartner
williamr@2
  2163
@released
williamr@2
  2164
williamr@2
  2165
A file server interface class representing a raw disk.
williamr@2
  2166
williamr@2
  2167
An instance of this object is referred to as a raw disk control block.
williamr@2
  2168
williamr@2
  2169
This is not an abstract base class and does not need to be derived from
williamr@2
  2170
when implementing a file system. This is because direct disk access is
williamr@2
  2171
implemented by the file server directly calling RawReadL() and RawWriteL()
williamr@2
  2172
from the derived CMountCB object of the file system.
williamr@2
  2173
*/
williamr@2
  2174
NONSHARABLE_CLASS(CRawDiskCB) : public CFsDispatchObject
williamr@2
  2175
	{
williamr@2
  2176
public:
williamr@2
  2177
	CRawDiskCB();
williamr@2
  2178
	~CRawDiskCB();
williamr@2
  2179
	void InitL(CMountCB* aMount,TBool aIsWriteProtected);
williamr@2
  2180
	inline CMountCB& Mount();
williamr@2
  2181
	inline TDrive& Drive();
williamr@2
  2182
	inline TBool IsWriteProtected() const;
williamr@2
  2183
	inline void SetChanged();
williamr@2
  2184
private:
williamr@2
  2185
	enum { EWriteProtected = 1, EChanged = 2 };
williamr@2
  2186
	inline void SetWriteProtected();
williamr@2
  2187
	inline TBool IsChanged() const;
williamr@2
  2188
private:
williamr@2
  2189
	CMountCB* iMount;
williamr@2
  2190
	TUint32 iFlags;
williamr@2
  2191
	};
williamr@2
  2192
williamr@2
  2193
williamr@2
  2194
williamr@2
  2195
williamr@2
  2196
/**
williamr@2
  2197
@publishedPartner
williamr@2
  2198
@released
williamr@2
  2199
williamr@2
  2200
A file server interface class, representing the factory class for a file system.
williamr@2
  2201
williamr@2
  2202
A plug-in file system implements this class.
williamr@2
  2203
williamr@2
  2204
Creates objects derived from CMountCB, CFileCB, CDirCB and CFormatCB.
williamr@2
  2205
williamr@2
  2206
@see CMountCB
williamr@2
  2207
@see CFileCB
williamr@2
  2208
@see CDirCB
williamr@2
  2209
@see CFormatCB
williamr@2
  2210
*/
williamr@2
  2211
class CFileSystem : public CFsObject
williamr@2
  2212
	{
williamr@2
  2213
public:
williamr@2
  2214
	IMPORT_C CFileSystem();
williamr@2
  2215
	IMPORT_C ~CFileSystem();
williamr@2
  2216
	IMPORT_C virtual TInt Remove();
williamr@2
  2217
	IMPORT_C virtual TBool QueryVersionSupported(const TVersion& aVer) const;
williamr@2
  2218
	IMPORT_C virtual TBool IsExtensionSupported() const;
williamr@2
  2219
	IMPORT_C void SetLibrary(RLibrary aLib);
williamr@2
  2220
	IMPORT_C RLibrary Library() const;
williamr@2
  2221
// Pure virtual
williamr@2
  2222
    
williamr@2
  2223
    
williamr@2
  2224
    /**
williamr@2
  2225
    Installs the file system.
williamr@2
  2226
williamr@2
  2227
    The function should set the name of the file system object through a call
williamr@2
  2228
    to CObject::SetName(), thus making it accessible, internally, 
williamr@2
  2229
    using FileSystems->FindByFullName(). This enables the file server
williamr@2
  2230
    to find and handle installed file systems. 
williamr@2
  2231
    The function should also set the file system version.
williamr@2
  2232
    The version is determined by the file system implementation.
williamr@2
  2233
    It is used in calls to CFileSystem::QueryVersionSupported().
williamr@2
  2234
williamr@2
  2235
    This function is called as a result of a call to RFs::AddFileSystem().
williamr@2
  2236
    
williamr@2
  2237
    @return KErrNone if succesful; otherwise one of the other  system-wide error
williamr@2
  2238
    codes.
williamr@2
  2239
    
williamr@2
  2240
    @see RFs::AddFileSystem
williamr@2
  2241
    @see CObject::SetName
williamr@2
  2242
    @see RFs
williamr@2
  2243
    @see CObject
williamr@2
  2244
    */
williamr@2
  2245
	virtual TInt Install() =0;
williamr@2
  2246
	
williamr@2
  2247
		
williamr@2
  2248
	/**
williamr@2
  2249
	Creates a new mount control block, a CMountCB derived object. 
williamr@2
  2250
williamr@2
  2251
    On success, a pointer to the new mount object should be returned,
williamr@2
  2252
    otherwise the function should leave.
williamr@2
  2253
williamr@2
  2254
	@return A pointer to the new mount object.
williamr@2
  2255
williamr@2
  2256
    @see CMountCB
williamr@2
  2257
	*/
williamr@2
  2258
	virtual CMountCB* NewMountL() const =0;
williamr@2
  2259
	
williamr@2
  2260
	
williamr@2
  2261
	/**
williamr@2
  2262
	Creates a new file control block, i.e. a CFileCB derived object.
williamr@2
  2263
williamr@2
  2264
    On success, a pointer to the new file object should be returned,
williamr@2
  2265
    otherwise the function should leave.
williamr@2
  2266
williamr@2
  2267
    @return A pointer to the new file object.
williamr@2
  2268
    
williamr@2
  2269
    @see CFileCB
williamr@2
  2270
	*/
williamr@2
  2271
	virtual CFileCB* NewFileL() const =0;
williamr@2
  2272
	
williamr@2
  2273
	
williamr@2
  2274
	/**
williamr@2
  2275
	Creates a new directory control block, i.e. a CDirCB derived object.
williamr@2
  2276
williamr@2
  2277
    On success, a pointer to the new directory control block should be returned,
williamr@2
  2278
    otherwise the function should leave.
williamr@2
  2279
williamr@2
  2280
    @return A pointer to the new directory object.
williamr@2
  2281
    
williamr@2
  2282
    @see CDirCB
williamr@2
  2283
	*/
williamr@2
  2284
	virtual CDirCB* NewDirL() const =0;
williamr@2
  2285
	
williamr@2
  2286
	
williamr@2
  2287
	/**
williamr@2
  2288
	Creates a new volume format control block, i.e. a CFormatCB derived object.
williamr@2
  2289
williamr@2
  2290
    On success, a pointer to the new volume format control block should be returned,
williamr@2
  2291
    otherwise the function should leave.
williamr@2
  2292
williamr@2
  2293
    @return A pointer to the new volume format object.
williamr@2
  2294
    
williamr@2
  2295
    @see CFormatCB
williamr@2
  2296
	*/
williamr@2
  2297
	virtual CFormatCB* NewFormatL() const =0;
williamr@2
  2298
	
williamr@2
  2299
	
williamr@2
  2300
	/**
williamr@2
  2301
	Retrieves drive information.
williamr@2
  2302
williamr@2
  2303
    The function should set anInfo.iMediaAtt and anInfo.iType according to
williamr@2
  2304
    the specified drive number.
williamr@2
  2305
williamr@2
  2306
    Note that anInfo.iDriveAtt and anInfo.iBatteryState will already have been
williamr@2
  2307
    set by the calling function.
williamr@2
  2308
williamr@2
  2309
    The function can obtain the necessary information by calling
williamr@2
  2310
    the appropriate TBusLocalDrive::Caps() function using the argument aDriveNumber.
williamr@2
  2311
williamr@2
  2312
	@param anInfo       On return, contains the drive information.
williamr@2
  2313
	@param aDriveNumber The drive number.
williamr@2
  2314
	*/
williamr@2
  2315
	virtual void DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const =0;
williamr@2
  2316
		
williamr@2
  2317
//#ifndef __DATA_CAGING__
williamr@2
  2318
    virtual TInt DefaultPath(TDes& aPath) const;
williamr@2
  2319
//#endif
williamr@2
  2320
williamr@2
  2321
protected:	
williamr@2
  2322
	/**
williamr@2
  2323
	Return a pointer to a specified interface extension - to allow future extension of this class without breaking
williamr@2
  2324
	binary compatibility.
williamr@2
  2325
	@param aInterfaceId Interface identifier of the interface to be retrieved.
williamr@2
  2326
	@param aInterface A reference to a pointer that retrieves the specified interface.
williamr@2
  2327
	@param aInput An arbitrary input argument.
williamr@2
  2328
	@return KErrNone If the interface is supported, KErrNotSupported otherwise.
williamr@2
  2329
	*/	
williamr@2
  2330
	IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
williamr@2
  2331
	
williamr@2
  2332
protected:
williamr@2
  2333
	TVersion iVersion;
williamr@2
  2334
private:
williamr@2
  2335
	RLibrary iLibrary;
williamr@2
  2336
	TUint32 iReserved;				// Reserved for future expansion
williamr@2
  2337
	};
williamr@2
  2338
williamr@2
  2339
williamr@2
  2340
williamr@2
  2341
williamr@2
  2342
/**
williamr@2
  2343
@publishedPartner
williamr@2
  2344
@released
williamr@2
  2345
williamr@2
  2346
Base abstract class.
williamr@2
  2347
Interface between a local plugin file system and a media subsystem.
williamr@2
  2348
williamr@2
  2349
@see CLocalProxyDrive
williamr@2
  2350
@see CBaseExtProxyDrive
williamr@2
  2351
*/
williamr@2
  2352
class CProxyDrive : public CBase	
williamr@2
  2353
	{
williamr@2
  2354
public:
williamr@2
  2355
	CProxyDrive(CMountCB* aMount);
williamr@2
  2356
	~CProxyDrive();		
williamr@2
  2357
	inline CMountCB* Mount() const;
williamr@2
  2358
// virtual
williamr@2
  2359
	IMPORT_C virtual TInt ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2);
williamr@2
  2360
	IMPORT_C virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt aOffset,TInt aFlags);
williamr@2
  2361
	IMPORT_C virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset,TInt aFlags);
williamr@2
  2362
	IMPORT_C virtual TInt DeleteNotify(TInt64 aPos, TInt aLength);
williamr@2
  2363
	IMPORT_C virtual TInt GetLastErrorInfo(TDes8& aErrorInfo);
williamr@2
  2364
	inline TInt LocalBufferSupport();
williamr@2
  2365
	
williamr@2
  2366
// pure virtual
williamr@2
  2367
williamr@2
  2368
	/**
williamr@2
  2369
	Initialise the proxy drive. 
williamr@2
  2370
	
williamr@2
  2371
	Derived class must provide an implementation for it.
williamr@2
  2372
	
williamr@2
  2373
	@return KErrNone if successful, otherwise one of the system-wide error codes.
williamr@2
  2374
	*/
williamr@2
  2375
	virtual TInt Initialise()=0;
williamr@2
  2376
	
williamr@2
  2377
	/**
williamr@2
  2378
	It invokes Dismounted() on the proxy drive.
williamr@2
  2379
	
williamr@2
  2380
	Derived class must provide an implementation for it. 
williamr@2
  2381
	
williamr@2
  2382
	@return KErrNone if successful, otherwise one of the system-wide error codes.
williamr@2
  2383
	*/
williamr@2
  2384
	virtual TInt Dismounted()=0;
williamr@2
  2385
	
williamr@2
  2386
	/**
williamr@2
  2387
	Increase the size of the proxy drive by the specified length (in bytes).
williamr@2
  2388
	
williamr@2
  2389
	Derived class must provide an implementation for it. 
williamr@2
  2390
williamr@2
  2391
	@param aLength The length (in bytes) of which the drive is to be increased by.
williamr@2
  2392
	
williamr@2
  2393
	@return KErrNone if successful, otherwise one of the system-wide error codes.
williamr@2
  2394
	*/
williamr@2
  2395
	virtual TInt Enlarge(TInt aLength)=0;
williamr@2
  2396
	
williamr@2
  2397
	/**
williamr@2
  2398
	Reduce the size of the proxy drive by removing the specified length
williamr@2
  2399
	(in bytes) starting at the specified position.
williamr@2
  2400
williamr@2
  2401
	Derived class must provide an implementation for it.
williamr@2
  2402
williamr@2
  2403
	@param aPos    The start position of area to be removed.
williamr@2
  2404
	@param aLength The length/size (in bytes) by which the drive is to be reduced.
williamr@2
  2405
	
williamr@2
  2406
	@return System-wide error codes based on the status of the operation.
williamr@2
  2407
	*/	
williamr@2
  2408
	virtual TInt ReduceSize(TInt aPos, TInt aLength)=0;
williamr@2
  2409
	
williamr@2
  2410
	/**
williamr@2
  2411
	Read from the proxy drive.
williamr@2
  2412
williamr@2
  2413
	Derived class must provide an implementation for it.
williamr@2
  2414
williamr@2
  2415
	@param aPos    The address from where the read begins.
williamr@2
  2416
	@param aLength The length of the read.
williamr@2
  2417
	@param aTrg    A descriptor of the memory buffer from which to read.
williamr@2
  2418
	@param aThreadHandle The handle-number representing the drive thread.
williamr@2
  2419
	@param aOffset Offset into aTrg to read the data from.
williamr@2
  2420
	
williamr@2
  2421
	@return System-wide error codes based on the status of the operation.
williamr@2
  2422
	*/
williamr@2
  2423
	virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset)=0;
williamr@2
  2424
	
williamr@2
  2425
	/**
williamr@2
  2426
	Read from the proxy drive.
williamr@2
  2427
williamr@2
  2428
	Derived class must provide an implementation for it.
williamr@2
  2429
	
williamr@2
  2430
	@param aPos    The address from where the read begins.
williamr@2
  2431
	@param aLength The length of the read.
williamr@2
  2432
	@param aTrg    A descriptor of the memory buffer from which to read.
williamr@2
  2433
	
williamr@2
  2434
	@return System-wide error codes based on the status of the operation.
williamr@2
  2435
	*/
williamr@2
  2436
	virtual TInt Read(TInt64 aPos,TInt aLength,TDes8& aTrg)=0;
williamr@2
  2437
	
williamr@2
  2438
	/**
williamr@2
  2439
	Write to the proxy drive.
williamr@2
  2440
williamr@2
  2441
	Derived class must provide an implementation for it.
williamr@2
  2442
	
williamr@2
  2443
	@param aPos    The address from where the write begins.
williamr@2
  2444
	@param aLength The length of the write.
williamr@2
  2445
	@param aSrc    A descriptor of the memory buffer from which to write.
williamr@2
  2446
	@param aThreadHandle The handle-number representing the drive thread.
williamr@2
  2447
	@param aOffset Offset into aSrc to write the data to.
williamr@2
  2448
	
williamr@2
  2449
	@return System-wide error codes based on the status of the operation.
williamr@2
  2450
	*/
williamr@2
  2451
	virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset)=0;
williamr@2
  2452
	
williamr@2
  2453
	/**
williamr@2
  2454
	Write to the proxy drive.
williamr@2
  2455
	
williamr@2
  2456
	Derived class must provide an implementation for it.
williamr@2
  2457
	
williamr@2
  2458
	@param aPos    The address from where the write begins.
williamr@2
  2459
	@param aSrc    A descriptor of the memory buffer from which to write.
williamr@2
  2460
	
williamr@2
  2461
	@return System-wide error codes based on the status of the operation.
williamr@2
  2462
	*/
williamr@2
  2463
	virtual TInt Write(TInt64 aPos,const TDesC8& aSrc)=0;
williamr@2
  2464
	
williamr@2
  2465
	/**
williamr@2
  2466
	Get the proxy drive's capabilities information.
williamr@2
  2467
	
williamr@2
  2468
	Derived class must provide an implementation for it.
williamr@2
  2469
williamr@2
  2470
	@param anInfo A descriptor of the connected drives capabilities.
williamr@2
  2471
	
williamr@2
  2472
	@return System-wide error codes based on the status of the operation.
williamr@2
  2473
	*/
williamr@2
  2474
	virtual TInt Caps(TDes8& anInfo)=0;
williamr@2
  2475
	
williamr@2
  2476
	/**
williamr@2
  2477
	Format the connected drive.
williamr@2
  2478
	
williamr@2
  2479
	Derived class must provide an implementation for it.
williamr@2
  2480
	
williamr@2
  2481
	@param anInfo Device specific format information.
williamr@2
  2482
	
williamr@2
  2483
	@return System-wide error codes based on the status of the operation.
williamr@2
  2484
	*/
williamr@2
  2485
	virtual TInt Format(TFormatInfo& anInfo)=0;
williamr@2
  2486
	
williamr@2
  2487
	/**
williamr@2
  2488
	Format the proxy drive.
williamr@2
  2489
williamr@2
  2490
	Derived class must provide an implementation for it.
williamr@2
  2491
	
williamr@2
  2492
	@param aPos    The position of the data which is being formatted.
williamr@2
  2493
	@param aLength The length of the data which is being formatted.
williamr@2
  2494
	
williamr@2
  2495
	@return System-wide error codes based on the status of the operation.
williamr@2
  2496
	*/
williamr@2
  2497
	virtual TInt Format(TInt64 aPos,TInt aLength)=0;
williamr@2
  2498
	
williamr@2
  2499
	/**
williamr@2
  2500
	Set the mount information on the proxy drive.
williamr@2
  2501
	
williamr@2
  2502
	Derived class must provide an implementation for it.
williamr@2
  2503
	
williamr@2
  2504
	@param aMountInfo Information passed down to the media driver. 
williamr@2
  2505
					  The meaning of this information depends on the media driver.
williamr@2
  2506
	@param aMountInfoThreadHandle  Message thread handle number.
williamr@2
  2507
	
williamr@2
  2508
	@return System-wide error codes based on the status of the operation.
williamr@2
  2509
	*/
williamr@2
  2510
	virtual TInt SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle=KCurrentThreadHandle)=0;
williamr@2
  2511
	
williamr@2
  2512
	/**
williamr@2
  2513
	Forces a remount on the proxy drive
williamr@2
  2514
	
williamr@2
  2515
	Derived class must provide an implementation for it.
williamr@2
  2516
	
williamr@2
  2517
	@param aFlags Flags to be passed into the driver.
williamr@2
  2518
	
williamr@2
  2519
	@return System-wide error codes based on the status of the operation.
williamr@2
  2520
	*/
williamr@2
  2521
	virtual TInt ForceRemount(TUint aFlags=0)=0;
williamr@2
  2522
	
williamr@2
  2523
	/**
williamr@2
  2524
	Unlocks a password-enabled proxy drive.
williamr@2
  2525
williamr@2
  2526
	Derived class must provide an implementation for it.
williamr@2
  2527
williamr@2
  2528
	@param aPassword A descriptor containing the existing password.
williamr@2
  2529
	@param aStorePassword If ETrue, the password is added to the password store.
williamr@2
  2530
	
williamr@2
  2531
	@return System-wide error codes based on the status of the operation.
williamr@2
  2532
	*/
williamr@2
  2533
	virtual TInt Unlock(TMediaPassword &aPassword, TBool aStorePassword)=0;
williamr@2
  2534
	
williamr@2
  2535
	/**
williamr@2
  2536
	Locks a password-enabled proxy drive with the new password.
williamr@2
  2537
	
williamr@2
  2538
	Derived class must provide an implementation for it.
williamr@2
  2539
williamr@2
  2540
	@param aOldPassword A descriptor containing the existing password.
williamr@2
  2541
	@param aNewPassword A descriptor containing the new password.
williamr@2
  2542
	@param aStorePassword If ETrue, the password is added to the password store.
williamr@2
  2543
	
williamr@2
  2544
	@return System-wide error codes based on the status of the operation.
williamr@2
  2545
	*/
williamr@2
  2546
	virtual TInt Lock(TMediaPassword &aOldPassword, TMediaPassword &aNewPassword, TBool aStorePassword)=0;
williamr@2
  2547
	
williamr@2
  2548
	/**
williamr@2
  2549
	Clears a password from a proxy drive - controller sets password to null.
williamr@2
  2550
williamr@2
  2551
	Derived class must provide an implementation for it.
williamr@2
  2552
williamr@2
  2553
	@param aPassword A descriptor containing the password.
williamr@2
  2554
	
williamr@2
  2555
	@return System-wide error codes based on the status of the operation.
williamr@2
  2556
	*/
williamr@2
  2557
	virtual TInt Clear(TMediaPassword &aPassword)=0;
williamr@2
  2558
	
williamr@2
  2559
	/**
williamr@2
  2560
	Forcibly unlock a password-enabled proxy drive.
williamr@2
  2561
	
williamr@2
  2562
	Derived class must provide an implementation for it.
williamr@2
  2563
	
williamr@2
  2564
	@return System-wide error codes based on the status of the operation.
williamr@2
  2565
	*/
williamr@2
  2566
	virtual TInt ErasePassword()=0;
williamr@2
  2567
williamr@2
  2568
// implementation using GetInterface(..)
williamr@2
  2569
	enum TInterfaceIds
williamr@2
  2570
		{
williamr@2
  2571
		EGetLocalDrive,
williamr@2
  2572
		ELocalBufferSupport
williamr@2
  2573
		};
williamr@2
  2574
williamr@2
  2575
	/**
williamr@2
  2576
	Retrieves TBusLocalDrive object associated with the file.
williamr@2
  2577
	
williamr@2
  2578
	@return System-wide error codes based on the status of the operation.
williamr@2
  2579
	*/
williamr@2
  2580
	IMPORT_C TInt GetLocalDrive(TBusLocalDrive*& aLocDrv);
williamr@2
  2581
	
williamr@2
  2582
protected:
williamr@2
  2583
	/**
williamr@2
  2584
	Return a pointer to a specified interface extension - to allow future extension of this class without breaking
williamr@2
  2585
	binary compatibility.
williamr@2
  2586
	
williamr@2
  2587
	@param aInterfaceId Interface identifier of the interface to be retrieved.
williamr@2
  2588
	@param aInterface A reference to a pointer that retrieves the specified interface.
williamr@2
  2589
	@param aInput An arbitrary input argument.
williamr@2
  2590
	
williamr@2
  2591
	@return KErrNone If the interface is supported, KErrNotSupported otherwise.
williamr@2
  2592
	*/	
williamr@2
  2593
	IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
williamr@2
  2594
		
williamr@2
  2595
private:
williamr@2
  2596
	CMountCB* iMount;
williamr@2
  2597
	TUint32 iReserved;				// Reserved for future expansion
williamr@2
  2598
	};
williamr@2
  2599
williamr@2
  2600
williamr@2
  2601
williamr@2
  2602
williamr@2
  2603
/**
williamr@2
  2604
@publishedPartner
williamr@2
  2605
@released
williamr@2
  2606
williamr@2
  2607
Local drive specific mount control block.
williamr@2
  2608
*/
williamr@2
  2609
class CLocDrvMountCB : public CMountCB
williamr@2
  2610
	{
williamr@2
  2611
public:
williamr@2
  2612
	IMPORT_C CLocDrvMountCB();
williamr@2
  2613
	IMPORT_C ~CLocDrvMountCB();			
williamr@2
  2614
	IMPORT_C TInt CreateLocalDrive(TBusLocalDrive& aLocDrv);
williamr@2
  2615
	IMPORT_C TInt InitLocalDrive();
williamr@2
  2616
	IMPORT_C void DismountedLocalDrive();
williamr@2
  2617
	inline CProxyDrive* LocalDrive() const;	
williamr@2
  2618
williamr@2
  2619
private:
williamr@2
  2620
	CProxyDrive* iProxyDrive;
williamr@2
  2621
	};
williamr@2
  2622
williamr@2
  2623
williamr@2
  2624
williamr@2
  2625
williamr@2
  2626
williamr@2
  2627
/**
williamr@2
  2628
@publishedPartner
williamr@2
  2629
@released
williamr@2
  2630
williamr@2
  2631
Local drive specific proxy drive interface.
williamr@2
  2632
Class passes commands directly to TBusLocalDrive.
williamr@2
  2633
williamr@2
  2634
@see CProxyDrive   
williamr@2
  2635
*/
williamr@2
  2636
NONSHARABLE_CLASS(CLocalProxyDrive) : public CProxyDrive
williamr@2
  2637
	{
williamr@2
  2638
public:	
williamr@2
  2639
	static CLocalProxyDrive* New(CMountCB* aMount,TBusLocalDrive& aLocDrv);
williamr@2
  2640
// virtual
williamr@2
  2641
	virtual TInt Initialise();	
williamr@2
  2642
	virtual TInt Dismounted();
williamr@2
  2643
	virtual TInt Enlarge(TInt aLength);
williamr@2
  2644
	virtual TInt ReduceSize(TInt aPos, TInt aLength);
williamr@2
  2645
	virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt aOffset, TInt aFlags);
williamr@2
  2646
	virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset);
williamr@2
  2647
	virtual TInt Read(TInt64 aPos,TInt aLength,TDes8& aTrg);
williamr@2
  2648
	virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt aOffset,TInt aFlags);
williamr@2
  2649
	virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset);
williamr@2
  2650
	virtual TInt Write(TInt64 aPos,const TDesC8& aSrc);
williamr@2
  2651
	virtual TInt Caps(TDes8& anInfo);
williamr@2
  2652
	virtual TInt Format(TFormatInfo& anInfo);
williamr@2
  2653
	virtual TInt Format(TInt64 aPos,TInt aLength);
williamr@2
  2654
	virtual TInt SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle=KCurrentThreadHandle);
williamr@2
  2655
	virtual TInt ForceRemount(TUint aFlags=0);
williamr@2
  2656
	virtual TInt ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2);
williamr@2
  2657
	virtual TInt Unlock(TMediaPassword &aPassword, TBool aStorePassword);
williamr@2
  2658
	virtual TInt Lock(TMediaPassword &aOldPassword, TMediaPassword &aNewPassword, TBool aStorePassword);
williamr@2
  2659
	virtual TInt Clear(TMediaPassword &aPassword);
williamr@2
  2660
	virtual TInt ErasePassword();
williamr@2
  2661
	virtual TInt DeleteNotify(TInt64 aPos, TInt aLength);
williamr@2
  2662
	virtual TInt GetLastErrorInfo(TDes8& aErrorInfo);
williamr@2
  2663
protected:
williamr@2
  2664
	virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);	
williamr@2
  2665
private:
williamr@2
  2666
	CLocalProxyDrive(CMountCB* aMount,TBusLocalDrive& aLocDrv);
williamr@2
  2667
private:
williamr@2
  2668
	TBusLocalDrive& iLocDrv;
williamr@2
  2669
	};
williamr@2
  2670
williamr@2
  2671
williamr@2
  2672
williamr@2
  2673
williamr@2
  2674
/**
williamr@2
  2675
@publishedPartner
williamr@2
  2676
@released
williamr@2
  2677
williamr@2
  2678
Media subsystem extensions must be derived from this specific class interface.
williamr@2
  2679
Objects of this type should be created through use of a derived CProxyDriveFactory class.
williamr@2
  2680
williamr@2
  2681
Class passes commands directly to CProxyDrive.
williamr@2
  2682
williamr@2
  2683
@see CProxyDrive
williamr@2
  2684
@see CProxyDriveFactory
williamr@2
  2685
*/
williamr@2
  2686
class CBaseExtProxyDrive : public CProxyDrive
williamr@2
  2687
	{
williamr@2
  2688
public:
williamr@2
  2689
	IMPORT_C CBaseExtProxyDrive(CProxyDrive* aProxyDrive, CMountCB* aMount);
williamr@2
  2690
	IMPORT_C ~CBaseExtProxyDrive();
williamr@2
  2691
	IMPORT_C virtual TInt Initialise();
williamr@2
  2692
	IMPORT_C virtual TInt Dismounted();
williamr@2
  2693
	IMPORT_C virtual TInt Enlarge(TInt aLength);
williamr@2
  2694
	IMPORT_C virtual TInt ReduceSize(TInt aPos, TInt aLength);
williamr@2
  2695
	IMPORT_C virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt aOffset,TInt aFlags);
williamr@2
  2696
	IMPORT_C virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset);
williamr@2
  2697
	IMPORT_C virtual TInt Read(TInt64 aPos,TInt aLength,TDes8& aTrg);
williamr@2
  2698
	IMPORT_C virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt aOffset,TInt aFlags);
williamr@2
  2699
	IMPORT_C virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset);
williamr@2
  2700
	IMPORT_C virtual TInt Write(TInt64 aPos,const TDesC8& aSrc);
williamr@2
  2701
	IMPORT_C virtual TInt Caps(TDes8& anInfo);
williamr@2
  2702
	IMPORT_C virtual TInt Format(TFormatInfo& anInfo);
williamr@2
  2703
	IMPORT_C virtual TInt Format(TInt64 aPos,TInt aLength);
williamr@2
  2704
	IMPORT_C virtual TInt SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle=KCurrentThreadHandle);
williamr@2
  2705
	IMPORT_C virtual TInt ForceRemount(TUint aFlags=0);
williamr@2
  2706
	IMPORT_C virtual TInt Unlock(TMediaPassword &aPassword, TBool aStorePassword);
williamr@2
  2707
	IMPORT_C virtual TInt Lock(TMediaPassword &aOldPassword, TMediaPassword &aNewPassword, TBool aStorePassword);
williamr@2
  2708
	IMPORT_C virtual TInt Clear(TMediaPassword &aPassword);
williamr@2
  2709
	IMPORT_C virtual TInt ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2);
williamr@2
  2710
	IMPORT_C virtual TInt ErasePassword();
williamr@2
  2711
	IMPORT_C virtual TInt GetLastErrorInfo(TDes8& aErrorInfo);
williamr@2
  2712
    IMPORT_C virtual TInt DeleteNotify(TInt64 aPos, TInt aLength);
williamr@2
  2713
	inline TInt LocalBufferSupport();
williamr@2
  2714
williamr@2
  2715
protected:
williamr@2
  2716
	/**
williamr@2
  2717
	Return a pointer to a specified interface extension - to allow future extension of this class without breaking
williamr@2
  2718
	binary compatibility.
williamr@2
  2719
	@param aInterfaceId Interface identifier of the interface to be retrieved.
williamr@2
  2720
	@param aInterface A reference to a pointer that retrieves the specified interface.
williamr@2
  2721
	@param aInput An arbitrary input argument.
williamr@2
  2722
	@return KErrNone If the interface is supported, KErrNotSupported otherwise.
williamr@2
  2723
	*/	
williamr@2
  2724
	IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);	
williamr@2
  2725
private:
williamr@2
  2726
	CProxyDrive* iProxy;
williamr@2
  2727
	};
williamr@2
  2728
williamr@2
  2729
williamr@2
  2730
williamr@2
  2731
williamr@2
  2732
/**
williamr@2
  2733
@publishedPartner
williamr@2
  2734
@released
williamr@2
  2735
williamr@2
  2736
Abstract base class for Proxy drive factory classes.
williamr@2
  2737
williamr@2
  2738
Class is used for the creation of media subsystem extensions CBaseExtProxyDrive.
williamr@2
  2739
williamr@2
  2740
@see CBaseExtProxyDrive
williamr@2
  2741
*/
williamr@2
  2742
class CProxyDriveFactory : public CFsObject
williamr@2
  2743
	{
williamr@2
  2744
public:
williamr@2
  2745
	IMPORT_C CProxyDriveFactory();
williamr@2
  2746
	IMPORT_C virtual TInt Remove();
williamr@2
  2747
	inline void SetLibrary(RLibrary aLib);
williamr@2
  2748
	inline RLibrary Library() const;
williamr@2
  2749
williamr@2
  2750
    /**
williamr@2
  2751
    Installation of the factory object.
williamr@2
  2752
    @return system wide error code
williamr@2
  2753
    */
williamr@2
  2754
	virtual TInt Install() =0;	
williamr@2
  2755
	/**
williamr@2
  2756
	Instantiates a CProxyDrive object.
williamr@2
  2757
	@param aProxy Proxy drive to be used.
williamr@2
  2758
	@param aMount Mount control block.
williamr@2
  2759
	
williamr@2
  2760
	@return pointer to Instantiated CProxyDrive object.
williamr@2
  2761
	*/		
williamr@2
  2762
	virtual CProxyDrive* NewProxyDriveL(CProxyDrive* aProxy,CMountCB* aMount)=0;
williamr@2
  2763
private:
williamr@2
  2764
	RLibrary iLibrary;
williamr@2
  2765
	};
williamr@2
  2766
williamr@2
  2767
williamr@2
  2768
williamr@2
  2769
williamr@2
  2770
/**
williamr@2
  2771
@publishedPartner
williamr@2
  2772
@released
williamr@2
  2773
williamr@2
  2774
Gets the local bus drive.
williamr@2
  2775
williamr@2
  2776
@param aLocalDrive The local drive number.
williamr@2
  2777
williamr@2
  2778
@return The local bus drive.
williamr@2
  2779
*/
williamr@2
  2780
IMPORT_C TBusLocalDrive& GetLocalDrive(TInt aLocalDrive);
williamr@2
  2781
williamr@2
  2782
williamr@2
  2783
williamr@2
  2784
williamr@2
  2785
/**
williamr@2
  2786
@publishedPartner
williamr@2
  2787
@released
williamr@2
  2788
williamr@2
  2789
Checks a given drive number is mapped to a local drive.
williamr@2
  2790
williamr@2
  2791
@param aDrive The local drive number.
williamr@2
  2792
williamr@2
  2793
@return specified drive number is mapped to a local drive.
williamr@2
  2794
*/
williamr@2
  2795
IMPORT_C TBool IsValidLocalDriveMapping(TInt aDrive);
williamr@2
  2796
williamr@2
  2797
williamr@2
  2798
williamr@2
  2799
williamr@2
  2800
/**
williamr@2
  2801
@publishedPartner
williamr@2
  2802
@released
williamr@2
  2803
williamr@2
  2804
Returns the local drive number for a given drive number.
williamr@2
  2805
williamr@2
  2806
@param aDrive The drive number.
williamr@2
  2807
williamr@2
  2808
@return KDriveInvalid if drive is not mapped to a local drive.
williamr@2
  2809
        otherwise the local drive number.
williamr@2
  2810
*/
williamr@2
  2811
IMPORT_C TInt DriveNumberToLocalDriveNumber(TInt aDrive);
williamr@2
  2812
williamr@2
  2813
/**
williamr@2
  2814
*/
williamr@2
  2815
IMPORT_C TInt GetLocalDriveNumber(TBusLocalDrive* aLocDrv);
williamr@2
  2816
williamr@2
  2817
williamr@2
  2818
struct TFatUtilityFunctions;
williamr@2
  2819
/**
williamr@2
  2820
@internalTechnology
williamr@2
  2821
*/
williamr@2
  2822
IMPORT_C const TFatUtilityFunctions* GetFatUtilityFunctions();
williamr@2
  2823
williamr@2
  2824
williamr@2
  2825
williamr@2
  2826
williamr@2
  2827
/**
williamr@2
  2828
@publishedPartner
williamr@2
  2829
@released
williamr@2
  2830
williamr@2
  2831
Copies data to a buffer.
williamr@2
  2832
williamr@2
  2833
If necessary, the buffer, a heap descriptor, is allocated or re-allocated
williamr@2
  2834
before copying takes place.
williamr@2
  2835
williamr@2
  2836
@param aBuf A reference to a pointer to heap descriptor forming the buffer.
williamr@2
  2837
            This will be allocated if it does not already exist,
williamr@2
  2838
            or re-allocated if the existing buffer is not large enough.
williamr@2
  2839
@param aDes The data to be copied.
williamr@2
  2840
*/
williamr@2
  2841
IMPORT_C void AllocBufferL(HBufC*& aBuf,const TDesC& aDes);
williamr@2
  2842
williamr@2
  2843
williamr@2
  2844
williamr@2
  2845
williamr@2
  2846
williamr@2
  2847
/**
williamr@2
  2848
@publishedPartner
williamr@2
  2849
@released
williamr@2
  2850
williamr@2
  2851
Notifies sessions of a debug event if aFunction has the KDebugNotifyMask set.
williamr@2
  2852
williamr@2
  2853
This function can only be used in debug builds or if _DEBUG
williamr@2
  2854
or _DEBUG_RELEASE is defined.
williamr@2
  2855
williamr@2
  2856
@param aFunction A function.
williamr@2
  2857
@param aDrive    A drive.
williamr@2
  2858
*/
williamr@2
  2859
IMPORT_C void DebugNotifySessions(TInt aFunction,TInt aDrive);
williamr@2
  2860
williamr@2
  2861
williamr@2
  2862
williamr@2
  2863
williamr@2
  2864
/**
williamr@2
  2865
@publishedPartner
williamr@2
  2866
@released
williamr@2
  2867
williamr@2
  2868
Writes data from a buffer to a file.
williamr@2
  2869
williamr@2
  2870
Called by the mount control block lock and the unlock functions.
williamr@2
  2871
williamr@2
  2872
@param aFileName The file to be written to.
williamr@2
  2873
@param aBuf      The data to be written.
williamr@2
  2874
*/
williamr@2
  2875
IMPORT_C void WriteToDisk(const TDesC& aFileName,const TDesC8& aBuf);
williamr@2
  2876
williamr@2
  2877
williamr@2
  2878
williamr@2
  2879
williamr@2
  2880
/**
williamr@2
  2881
Create a proxy drive using the local proxy drive passed in
williamr@2
  2882
and any extensions that have been added to the drive.
williamr@2
  2883
williamr@2
  2884
@param aConcreteDrive local proxy drive
williamr@2
  2885
@param aMount local proxy drive mount control block
williamr@2
  2886
williamr@2
  2887
@return pointer to instantiated CProxyDrive object.
williamr@2
  2888
*/
williamr@2
  2889
IMPORT_C CProxyDrive* CreateProxyDriveL(CProxyDrive* aConcreteDrive,CMountCB* aMount);
williamr@2
  2890
williamr@2
  2891
williamr@2
  2892
class TDismountParams
williamr@2
  2893
	{
williamr@2
  2894
public:
williamr@2
  2895
	inline TDismountParams(TInt aDriveNumber, TDrive* aDrivePointer, TBool aForcedDismount, RMessage2* aForcedMessage);
williamr@2
  2896
public:
williamr@2
  2897
	TInt iDriveNumber;
williamr@2
  2898
	TDrive* iDrivePointer;
williamr@2
  2899
	TBool iForcedDismount;
williamr@2
  2900
	RMessage2* iForcedMessage;
williamr@2
  2901
	};
williamr@2
  2902
williamr@2
  2903
williamr@2
  2904
/**
williamr@2
  2905
@deprecated 6.1
williamr@2
  2906
*/
williamr@2
  2907
IMPORT_C TInt CompareFilenames(const TDesC& aFileName1,const TDesC& aFileName2);
williamr@2
  2908
//
williamr@2
  2909
/**
williamr@2
  2910
Lookup a file system by name.
williamr@2
  2911
williamr@2
  2912
@param aName file system name.
williamr@2
  2913
williamr@2
  2914
@return pointer to instantiated CFileSystem object.
williamr@2
  2915
*/
williamr@2
  2916
IMPORT_C CFileSystem* GetFileSystem(const TDesC& aName);
williamr@2
  2917
williamr@2
  2918
williamr@2
  2919
williamr@2
  2920
/**
williamr@2
  2921
@internalTechnology
williamr@2
  2922
williamr@2
  2923
A static class for retrieving F32 properties
williamr@2
  2924
*/
williamr@2
  2925
class F32Properties
williamr@2
  2926
	{
williamr@2
  2927
private:
williamr@2
  2928
	F32Properties();
williamr@2
  2929
public:
williamr@2
  2930
	IMPORT_C static TBool Initialise(TInt aRomAddress, TInt aLength);
williamr@2
  2931
	IMPORT_C static TBool GetString(const TDesC8& aSection, const TDesC8& aProperty, TDes8&  aPropVal);
williamr@2
  2932
	IMPORT_C static TBool GetInt(const TDesC8& aSection,    const TDesC8& aProperty, TInt32& aPropVal);
williamr@2
  2933
	IMPORT_C static TBool GetBool(const TDesC8& aSection,   const TDesC8& aProperty, TBool&  aPropVal);
williamr@2
  2934
private:
williamr@2
  2935
	static TBool iInitialised;
williamr@2
  2936
	static TInt iRomAddress;
williamr@2
  2937
	static TInt iRomLength;
williamr@2
  2938
	};
williamr@2
  2939
williamr@2
  2940
#include <f32fsys.inl>
williamr@2
  2941
#endif