1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/userlibandfileserver/fileserver/inc/f32fsys.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,3399 @@
1.4 +// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// f32\inc\f32fsys.h
1.18 +//
1.19 +// WARNING: This file contains some APIs which are internal and are subject
1.20 +// to change without notice. Such APIs should therefore not be used
1.21 +// outside the Kernel and Hardware Services package.
1.22 +//
1.23 +
1.24 +/**
1.25 + @file
1.26 + @publishedPartner
1.27 + @released
1.28 +*/
1.29 +
1.30 +#if !defined(__F32FSYS_H__)
1.31 +#define __F32FSYS_H__
1.32 +#if !defined(__F32FILE_H__)
1.33 +#include <f32file.h>
1.34 +#endif
1.35 +#include <e32atomics.h>
1.36 +#include <d32locd.h>
1.37 +
1.38 +//
1.39 +#if defined(_UNICODE)
1.40 +#define KFileSystemUidValue KFileSystemUidValue16
1.41 +#define KFileServerUidValue KFileServerUidValue16
1.42 +#define KFileServerDllUidValue KFileServerDllUidValue16
1.43 +#else
1.44 +#define KFileSystemUidValue KFileSystemUidValue8
1.45 +#define KFileServerUidValueKFileServerUidValue8
1.46 +#define KFileServerDllUidValueKFileServerDllUidValue8
1.47 +#endif
1.48 +
1.49 +
1.50 +/**
1.51 +Filesystem error code 1 : indicates an item cannot be found,
1.52 +because it has been hidden.
1.53 +*/
1.54 +const TInt KErrHidden=(1);
1.55 +
1.56 +/**
1.57 +Filesystem error code 2 : in the context of file operations, a path
1.58 +was not found, because it has been hidden.
1.59 +*/
1.60 +const TInt KErrPathHidden=(2);
1.61 +
1.62 +
1.63 +const TInt KFileShareLockGranularity=2;
1.64 +const TInt KAsyncRequestArrayGranularity=2;
1.65 +
1.66 +/**
1.67 +@publishedPartner
1.68 +@released
1.69 +
1.70 +File system UID value 16.
1.71 +*/
1.72 +const TInt KFileSystemUidValue16=0x100039df;
1.73 +
1.74 +
1.75 +
1.76 +
1.77 +/**
1.78 +@publishedPartner
1.79 +@released
1.80 +
1.81 +File system UID value 8.
1.82 +*/
1.83 +const TInt KFileSystemUidValue8=0x1000008f;
1.84 +
1.85 +
1.86 +
1.87 +
1.88 +/**
1.89 +@publishedPartner
1.90 +@released
1.91 +
1.92 +File server UID value 16.
1.93 +*/
1.94 +const TInt KFileServerUidValue16=0x100039e3;
1.95 +
1.96 +
1.97 +
1.98 +
1.99 +/**
1.100 +@publishedPartner
1.101 +@released
1.102 +
1.103 +File server UID value 8.
1.104 +*/
1.105 +const TInt KFileServerUidValue8=0x100000bb;
1.106 +
1.107 +
1.108 +
1.109 +
1.110 +/**
1.111 +@publishedPartner
1.112 +@released
1.113 +
1.114 +File server DLL UID value 16.
1.115 +*/
1.116 +const TInt KFileServerDllUidValue16=0x100039e4;
1.117 +
1.118 +
1.119 +
1.120 +
1.121 +/**
1.122 +@publishedPartner
1.123 +@released
1.124 +
1.125 +File server DLL UID value 8.
1.126 +*/
1.127 +const TInt KFileServerDllUidValue8=0x100000bd;
1.128 +
1.129 +
1.130 +
1.131 +
1.132 +/**
1.133 +@publishedPartner
1.134 +@released
1.135 +
1.136 +Local file system UID value.
1.137 +*/
1.138 +const TInt KLocalFileSystemUidValue=0x100000d6;
1.139 +
1.140 +
1.141 +
1.142 +
1.143 +/**
1.144 +@publishedPartner
1.145 +@released
1.146 +
1.147 +Estart component UID value.
1.148 +*/
1.149 +const TInt KEstartUidValue=0x10272C04;
1.150 +
1.151 +
1.152 +
1.153 +/**
1.154 +@publishedPartner
1.155 +@released
1.156 +Maximum length of a volume name.
1.157 +*/
1.158 +const TInt KMaxVolumeNameLength=11;
1.159 +
1.160 +
1.161 +
1.162 +
1.163 +/**
1.164 +@publishedPartner
1.165 +@released
1.166 +
1.167 +First local drive indicator.
1.168 +*/
1.169 +const TInt KFirstLocalDrive=EDriveC;
1.170 +
1.171 +
1.172 +const TInt KMaxExtensionCount=2;
1.173 +//
1.174 +const TInt KDriveInvalid=-1;
1.175 +//
1.176 +_LIT(KMediaPWrdFile, "?:\\sys\\data\\mmcstore");
1.177 +//
1.178 +
1.179 +/**
1.180 +@internalTechnology
1.181 +*/
1.182 +const TUint KSystemDriveKey = 0x10283049;
1.183 +
1.184 +
1.185 +/**
1.186 +@publishedPartner
1.187 +@released
1.188 +
1.189 +Enumeration that specifies whether, on opening a file:
1.190 +- an existing file is opened
1.191 +- a new file is created
1.192 +- an existing file is replaced.
1.193 +*/
1.194 +enum TFileOpen {EFileOpen,EFileCreate,EFileReplace};
1.195 +
1.196 +
1.197 +
1.198 +
1.199 +/**
1.200 +@publishedPartner
1.201 +@released
1.202 +
1.203 +The file share mode.
1.204 +*/
1.205 +typedef TFileMode TShare;
1.206 +
1.207 +
1.208 +
1.209 +
1.210 +class CMountCB;
1.211 +class CFileSystem;
1.212 +class CFileCB;
1.213 +class CDirCB;
1.214 +class CFileShare;
1.215 +class CSessionFs;
1.216 +class CFsPlugin;
1.217 +class CFileBody;
1.218 +class CMountBody;
1.219 +class CFsMessageRequest;
1.220 +class CProxyDrive;
1.221 +class CFormatCB;
1.222 +
1.223 +//
1.224 +class CFsObjectCon;
1.225 +class CFileCache;
1.226 +//
1.227 +class CExtNotifyMediaChange;
1.228 +//
1.229 +
1.230 +/**
1.231 +@publishedPartner
1.232 +@released
1.233 +
1.234 +Implements reference counting to track concurrent references to itself.
1.235 +
1.236 +An object of this type arranges automatic destruction of itself when the final
1.237 +reference is removed.
1.238 +
1.239 +A reference counting object is any object which has CFsObject as its base class.
1.240 +Constructing a CFsObject derived type or calling its Open() member function
1.241 +adds a reference to that object by adding one to the reference count; calling
1.242 +its Close() member function removes a reference by subtracting one from the
1.243 +reference count; when the last user of the object calls Close(), the reference
1.244 +count becomes zero and the object is automatically destroyed.
1.245 +*/
1.246 +class CFsObject : public CBase
1.247 +
1.248 + {
1.249 +public:
1.250 + IMPORT_C CFsObject();
1.251 + IMPORT_C virtual TInt Open();
1.252 + IMPORT_C virtual void Close();
1.253 + IMPORT_C TInt SetName(const TDesC* aName);
1.254 + IMPORT_C TName Name() const;
1.255 + IMPORT_C virtual TBool IsCorrectThread();
1.256 + inline CFsObjectCon* Container() const;
1.257 +protected:
1.258 + void DoClose();
1.259 + TInt UniqueID() const;
1.260 + inline TInt Inc();
1.261 + inline TInt Dec();
1.262 + IMPORT_C ~CFsObject();
1.263 +private:
1.264 + TInt iAccessCount;
1.265 + CFsObjectCon* iContainer;
1.266 + HBufC* iName;
1.267 +friend class CFsObjectCon;
1.268 +friend class CFsObjectIx;
1.269 + };
1.270 +
1.271 +
1.272 +
1.273 +
1.274 +class CFsRequest;
1.275 +class CFsInternalRequest;
1.276 +
1.277 +/**
1.278 +Implements a request dispatcher.
1.279 +
1.280 +Base class for file server resources.
1.281 +for example subsessions that are opened, such as RFile etc, that need closing are closed by
1.282 +issuing a subsession close request, handled by this object.
1.283 +
1.284 +@publishedPartner
1.285 +@released
1.286 +*/
1.287 +class CFsDispatchObject : public CFsObject
1.288 + {
1.289 +public:
1.290 + CFsDispatchObject();
1.291 + /**
1.292 + Returns the drive number.
1.293 + @return Drive number.
1.294 + */
1.295 + TInt DriveNumber() const {return(iDriveNumber);}
1.296 + IMPORT_C void Close();
1.297 + IMPORT_C virtual TBool IsCorrectThread();
1.298 +protected:
1.299 + void DoInitL(TInt aDrvNumber);
1.300 + void Dispatch();
1.301 + ~CFsDispatchObject();
1.302 +private:
1.303 + CFsInternalRequest* iRequest;
1.304 + TInt iDriveNumber;
1.305 +friend class TFsCloseObject;
1.306 +friend class CFileShare; // needed to override the close operation so that the file cache can be flushed on a close
1.307 + };
1.308 +
1.309 +
1.310 +
1.311 +
1.312 +/**
1.313 +Notifier class must be unique to each thread so one per drive or threaded plugin should be used
1.314 +allocated in the file system. No longer global
1.315 +
1.316 +@publishedPartner
1.317 +@released
1.318 +*/
1.319 +NONSHARABLE_CLASS(CAsyncNotifier) : public CBase
1.320 + {
1.321 +public:
1.322 + IMPORT_C static CAsyncNotifier* New();
1.323 + IMPORT_C ~CAsyncNotifier();
1.324 + IMPORT_C TInt Notify(const TDesC& aLine1,const TDesC& aLine2,const TDesC& aButton1,const TDesC& aButton2,TInt& aButtonVal);
1.325 + inline void SetMount(CMountCB* aMount) { iMount = aMount; };
1.326 +protected:
1.327 + CAsyncNotifier();
1.328 + TInt Connect();
1.329 +private:
1.330 + RNotifier iNotifier;
1.331 + CMountCB* iMount;
1.332 + };
1.333 +
1.334 +
1.335 +
1.336 +
1.337 +class CProxyDriveFactory;
1.338 +
1.339 +/**
1.340 +@publishedPartner
1.341 +@released
1.342 +
1.343 +Structure containing information related to a single drive extension.
1.344 +*/
1.345 +struct TExtensionInfo
1.346 + {
1.347 + TBool iIsPrimary; ///< Is the primary drive extension for a given drive
1.348 + CProxyDriveFactory* iFactory; ///< Pointer to the drive extension's object factory
1.349 + };
1.350 +
1.351 +
1.352 +
1.353 +
1.354 +/**
1.355 +@publishedPartner
1.356 +@released
1.357 +
1.358 +Represents information related to the Drive extension(s) in use for a given drive.
1.359 +*/
1.360 +struct TDriveExtInfo
1.361 + {
1.362 + TDriveExtInfo();
1.363 +
1.364 + TInt iCount; ///< Number of drive extensions in use
1.365 +
1.366 + TExtensionInfo iInfo[KMaxExtensionCount]; ///< Drive extension related information
1.367 + };
1.368 +
1.369 +
1.370 +
1.371 +
1.372 +/**
1.373 +@publishedPartner
1.374 +@released
1.375 +
1.376 +Represents a drive in the file server.
1.377 +
1.378 +Note that drives may act as substitutes for paths on other drives,
1.379 +in which case any access to this drive letter will be translated into
1.380 +a reference to the assigned path. In this way drives can act as short
1.381 +cuts to paths on other drives.
1.382 +*/
1.383 +class TDrive
1.384 + {
1.385 +public:
1.386 + TDrive();
1.387 + void CreateL(TInt aDriveNumber);
1.388 + TInt CheckMount();
1.389 + TInt CheckMountAndEntryName(const TDesC& aName);
1.390 + TInt FinaliseMount();
1.391 + TInt FinaliseMount(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL);
1.392 + TInt MountControl(TInt aLevel, TInt aOption, TAny* aParam);
1.393 + void MountFileSystem(TBool aForceMount, TUint32 aFsNameHash = 0);
1.394 + void FlushCachedFileInfoL();
1.395 + TInt FlushCachedFileInfo(TBool aPurgeCache = EFalse);
1.396 + void PurgeDirty(CMountCB& aMount);
1.397 + void DriveInfo(TDriveInfo& anInfo);
1.398 + TInt Volume(TVolumeInfo& aVolume);
1.399 + TInt SetVolume(const TDesC& aName);
1.400 + TInt MkDir(const TDesC& aName);
1.401 + TInt RmDir(const TDesC& aName);
1.402 + TInt Delete(const TDesC& aName);
1.403 + TInt Rename(const TDesC& anOldName,const TDesC& aNewName);
1.404 + TInt Replace(const TDesC& anOldName,const TDesC& aNewName);
1.405 + TInt Entry(const TDesC& aName,TEntry& anEntry);
1.406 + TInt SetEntry(const TDesC& aName,const TTime& aTime,TUint aMask,TUint aVal);
1.407 + TInt FileTemp(CFsRequest* aRequest,TInt& aHandle,const TDesC& aPath,TDes& aName,TUint aMode);
1.408 + TInt FileOpen(CFsRequest* aRequest,TInt& aHandle,const TDesC& aName,TUint aMode,TFileOpen anOpen);
1.409 + TInt DirOpen(CSessionFs* aSession,TInt& aHandle,const TDesC& aName,TUint anAtt,const TUidType& aUidType);
1.410 + CFormatCB* FormatOpenL(CFsRequest* aRequest, TInt& aFmtHandle, TFormatMode aFmtMode, const TLDFormatInfo* apLDFormatInfo, const TVolFormatParam* apVolFormatParam);
1.411 +
1.412 + TInt CheckDisk();
1.413 + TInt CheckDisk(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL);
1.414 +
1.415 + TInt ScanDrive();
1.416 + TInt ScanDrive(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL);
1.417 +
1.418 + TInt ReadFileSection(const TDesC& aName,TInt aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage);
1.419 + TInt ReadFileSection64(const TDesC& aName,TInt64 aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage);
1.420 + TInt GetShortName(const TDesC& aLongName,TDes& aShortName);
1.421 + TInt GetLongName(const TDesC& aShortName,TDes& aLongName);
1.422 + TInt IsFileOpen(const TDesC& aFileName,CFileCB*& aFileCB);
1.423 + TInt IsFileInRom(const TDesC& aFileName,TUint8*& aFileStart);
1.424 + TInt LockDevice(TMediaPassword& aOld,TMediaPassword& aNew,TBool aStore);
1.425 + TInt UnlockDevice(TMediaPassword& aPassword,TBool aStore);
1.426 + TInt ClearDevicePassword(TMediaPassword& aPassword);
1.427 + TInt EraseDevicePassword();
1.428 + TInt FreeDiskSpace(TInt64& aFreeDiskSpace);
1.429 + TInt ForceRemountDrive(const TDesC8* aMountInfo,TInt aMountInfoMessageHandle,TUint aFlags);
1.430 + TBool IsWriteProtected();
1.431 + TInt MountExtension(CProxyDriveFactory* aFactory,TBool aIsPrimary);
1.432 + TInt DismountExtension(CProxyDriveFactory* aFactory,TBool aIsPrimary);
1.433 + TInt ExtensionName(TDes& aExtensionName,TInt aPos);
1.434 + TInt ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2);
1.435 + void SetAtt(TUint aValue);
1.436 + IMPORT_C TUint Att();
1.437 + IMPORT_C TBool GetNotifyUser();
1.438 + IMPORT_C void Dismount();
1.439 + IMPORT_C TBool IsWriteableResource() const;
1.440 + IMPORT_C TBool IsCurrentWriteFunction() const;
1.441 + inline TInt GetReason() const;
1.442 + inline void SetChanged(TBool aValue);
1.443 + inline TBool IsChanged() const;
1.444 + inline TInt DriveNumber() const;
1.445 + inline TBool IsMounted() const;
1.446 + inline TBool IsLocal() const;
1.447 + inline TBool IsRom() const;
1.448 + inline TBool IsRemovable() const;
1.449 + inline TBool IsSubsted() const;
1.450 + inline CMountCB& CurrentMount() const;
1.451 + inline TBool IsCurrentMount(CMountCB& aMount) const;
1.452 + inline TDrive& SubstedDrive() const;
1.453 + inline void SetSubstedDrive(TDrive* aDrive);
1.454 + inline HBufC& Subst() const;
1.455 + inline void SetSubst(HBufC* aSubst);
1.456 + inline CFsObjectCon& Mount() const;
1.457 + inline CFileSystem& FSys();
1.458 + inline CFileSystem*& GetFSys();
1.459 + inline TDriveExtInfo& ExtInfo();
1.460 + inline void SetNotifyOn();
1.461 + inline void SetNotifyOff();
1.462 + inline TInt ReservedSpace() const;
1.463 + inline void SetReservedSpace(const TInt aReservedSpace);
1.464 +
1.465 + inline void SetRugged(TBool aIsRugged);
1.466 + inline TBool IsRugged() const;
1.467 +
1.468 + inline TBool IsSynchronous() const;
1.469 + inline void SetSynchronous(TBool aIsSynch);
1.470 +
1.471 + TInt DismountProxyDrive();
1.472 + TInt ForceUnmountFileSystemForFormatting();
1.473 +
1.474 +public:
1.475 + void DismountLock();
1.476 + TInt DismountUnlock();
1.477 + TInt DismountLocked() const;
1.478 + void SetDismountDeferred(TBool aPending);
1.479 + void ForceDismount();
1.480 + TInt ActiveMounts() const;
1.481 + void ReactivateMounts();
1.482 + TInt ClampFile(const TDesC& aName,TAny* aHandle);
1.483 + TInt UnclampFile(CMountCB* aMount, RFileClamp* aHandle);
1.484 + TInt ClampsOnDrive();
1.485 + inline TBool DismountDeferred() const;
1.486 + TInt DeferredDismount();
1.487 +#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
1.488 + TInt ClearDeferredDismount();
1.489 +#endif
1.490 + void SetClampFlag(TBool aClamped);
1.491 + TBool ClampFlag();
1.492 + inline void Lock();
1.493 + inline void UnLock();
1.494 + void MultiSlotDriveCheck();
1.495 +
1.496 + TInt RequestFreeSpaceOnMount(TUint64 aFreeSpaceRequired);
1.497 + TInt MountedVolumeSize(TUint64& aSize);
1.498 +
1.499 + TBool ReMount(CMountCB& aMount);
1.500 +
1.501 +private:
1.502 +
1.503 + void DoMountFileSystemL(CMountCB*& apMount, TBool aForceMount, TUint32 aFsNameHash);
1.504 +
1.505 + void SetVolumeL(const TDesC& aName,HBufC*& aBuf);
1.506 + void DirOpenL(CSessionFs* aSession,TInt& aHandle,const TDesC& aName,TUint anAtt,const TUidType& aUidType,CDirCB*& aDir);
1.507 + void FileOpenL(CFsRequest* aRequest,TInt& aHandle,const TDesC& aName,TUint aMode,TFileOpen anOpen,CFileCB*& aFileCB,CFileShare*& aFileShare);
1.508 + TInt CheckMountAndEntryNames(const TDesC& anOldName,const TDesC& aNewName);
1.509 + CFileCB* LocateFileByPath(const TDesC& aPath);
1.510 + TInt CheckDirectories(const TDesC& anOldName,const TDesC& aNewName);
1.511 + void DoEntryL(const TDesC& aName,TEntry& anEntry);
1.512 + void ReadSectionL(const TDesC& aName,TInt64 aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage);
1.513 + TInt ValidateShare(CFileCB& aFile,TShare aReqShare);
1.514 + TInt CheckAttributes(const TDesC& aName,TUint& aSetAttMask,TUint& aClearAttMask);
1.515 + TBool IsExtensionMounted(CProxyDriveFactory* aFactory);
1.516 + CFileCB* LocateFile(const TDesC& aName);
1.517 + CFileCache* LocateClosedFile(const TDesC& aName, TBool aResurrect = ETrue);
1.518 + TBool ReMount();
1.519 + IMPORT_C TBool IsDriveThread() const;
1.520 + IMPORT_C TBool IsMainThread() const;
1.521 + IMPORT_C void DriveFault(TBool aDriveError) const;
1.522 + void DoDismount();
1.523 + void DoCompleteDismountNotify(TInt aCompletionCode);
1.524 +
1.525 +private:
1.526 +
1.527 + //-- intrinsic TDrive flags. Used in iDriveFlags.
1.528 + enum
1.529 + {
1.530 + ENotifyOff = 0x01,
1.531 + EDismountDeferred= 0x02,
1.532 + ENotRugged = 0x04,
1.533 + EClampPresent = 0x08,
1.534 + EDriveIsSynch = 0x10, //-- is set on mount when the drive is synchronous (doesn't have its own thread)
1.535 + };
1.536 +
1.537 +private:
1.538 + TInt iDriveNumber;
1.539 + TUint iAtt;
1.540 + TBool iChanged;
1.541 + TInt iReason;
1.542 + TInt iMountNumber;
1.543 + CFileSystem* iFSys;
1.544 + CMountCB* iCurrentMount;
1.545 + TDrive* iSubstedDrive;
1.546 + HBufC* iSubst;
1.547 + CFsObjectCon* iMount;
1.548 + RFastLock iLock;
1.549 + TDriveExtInfo iExtInfo;
1.550 + TInt iDriveFlags; ///< intrinsic TDrive flags
1.551 + TInt iReservedSpace;
1.552 + TInt iDismountLock;
1.553 + TInt iMountFailures; // number of times the mount has failed
1.554 + TInt iLastMountError;
1.555 +
1.556 + TInt iSpare1;
1.557 + TInt iSpare2;
1.558 +
1.559 +
1.560 + friend class LocalDrives; // for access to iChanged flag
1.561 + friend class CExtNotifyMediaChange; // for access to iChanged flag
1.562 + };
1.563 +
1.564 +class CFileCB;
1.565 +class CDirCB;
1.566 +
1.567 +__ASSERT_COMPILE(sizeof(TVolFormatParam) != sizeof(TLDFormatInfo));
1.568 +
1.569 +
1.570 +
1.571 +/**
1.572 +@publishedPartner
1.573 +@released
1.574 +
1.575 +A file server interface class representing a mount.
1.576 +
1.577 +An instance of this object is referred to as a mount control block.
1.578 +
1.579 +A mount control block needs to be created for a specific volume (partition) on
1.580 +a drive in order to be able to access that volume. Volumes may be permanent
1.581 +or represent removable media. Note that removable media may also be mounted directly onto
1.582 +a device with no drive. Volumes can be formatted, unlike drives.
1.583 +
1.584 +The volume represented is either a currently mounted volume in the system or,
1.585 +in the case of removable volumes, a volume that has been removed but still has
1.586 +subsession objects open.
1.587 +
1.588 +A plug-in file system implements this class.
1.589 +*/
1.590 +class CMountCB : public CFsDispatchObject
1.591 + {
1.592 +public:
1.593 + IMPORT_C CMountCB();
1.594 + IMPORT_C ~CMountCB();
1.595 + IMPORT_C TBool operator!=(const CMountCB& aMount) const;
1.596 + IMPORT_C TBool MatchEntryAtt(TUint anAtt,TUint aMatt) const;
1.597 + IMPORT_C void SetDiskSpaceChange(TInt64 aFreeDiskSpace);
1.598 + IMPORT_C void InitL(TDrive& aDrive, CFileSystem* apFileSystem);
1.599 +
1.600 + inline TDrive& Drive() const;
1.601 + inline void SetDrive(TDrive* aDrive);
1.602 + inline HBufC& VolumeName() const;
1.603 + inline void SetVolumeName(HBufC* aName);
1.604 + inline TBool GetNotifyUser() const;
1.605 + inline void SetNotifyOn();
1.606 + inline void SetNotifyOff();
1.607 + inline void IncLock();
1.608 + inline void DecLock();
1.609 + inline TInt LockStatus() const;
1.610 + inline TBool IsCurrentMount() const;
1.611 + inline TBool Locked() const;
1.612 + inline TInt64 Size() const;
1.613 + inline TInt LocalDrive(TBusLocalDrive*& aLocalDrive);
1.614 + inline TInt ProxyDrive(CProxyDrive*& aProxyDrive);
1.615 + inline TInt LocalBufferSupport(CFileCB* aFile = NULL);
1.616 + inline TInt AddToCompositeMount(TInt aMountIndex);
1.617 +
1.618 +// Pure virtual
1.619 +
1.620 + /**
1.621 + Attempts to set the mount control block properties using
1.622 + the current mount (i.e. volume) on the associated drive.
1.623 +
1.624 + The function should set the volume name (iVolumeName),
1.625 + the unique ID (iUniqueID) and the volume size (iSize)
1.626 + by reading and processing the current mount.
1.627 +
1.628 + When aForceMount is set to ETrue, the properties of a corrupt volume should
1.629 + be forcibly stored. The classic case of when this is desirable is when
1.630 + a corrupt volume needs to be formatted.
1.631 +
1.632 + The function should leave, on error detection, with an appropriate error code.
1.633 +
1.634 + @param aForceMount Indicates whether the properties of a corrupt
1.635 + volume should be stored.
1.636 +
1.637 + @leave KErrCorrupt The properties of the current mount on the drive were
1.638 + not successfully mounted due to corruption of volume information,
1.639 + assuming that aForceMount is not set.
1.640 + */
1.641 + virtual void MountL(TBool aForceMount) =0;
1.642 +
1.643 +
1.644 + /**
1.645 + Checks whether the mount control block represents the current mount on
1.646 + the associated drive.
1.647 +
1.648 + The function should read mount information from the current volume,
1.649 + and check it against the mount information from this mount - typically
1.650 + iVolumeName and iUniqueID. If the mount information matches, the function
1.651 + should return KErrNone, otherwise it should return KErrGeneral.
1.652 +
1.653 + Called by the associated TDrive object when the drive has no current mounts,
1.654 + which is the case on first access to the drive and following a volume
1.655 + change on a drive associated with removable media. In this circumstance,
1.656 + this function is called systematically on every mount control block owned
1.657 + by the drive. If ReMount() calls for all existing mount
1.658 + control blocks fail, the drive creates a new mount control block and calls
1.659 + CMountCB::MountL() on that object; the new object is added to the list of
1.660 + mount control blocks owned by the drive.
1.661 +
1.662 + @return KErrNone if the mount represented by this object is found to be
1.663 + the current mount;
1.664 + KErrGeneral if this object is found not to represent
1.665 + the current mount;
1.666 + otherwise one of the other sytem wide error codes.
1.667 + */
1.668 + virtual TInt ReMount() =0;
1.669 +
1.670 +
1.671 + /**
1.672 + Carries out any clean-up necessary for a volume dismount.
1.673 +
1.674 + Dismounting a volume will always succeed, so the function does not need
1.675 + to return an error value. Any cached information should be discarded and no
1.676 + attempt should be made to access the volume. For removable media it may be
1.677 + that the media has already been removed. This function is called when
1.678 + a media change is detected.
1.679 + */
1.680 + virtual void Dismounted() =0;
1.681 +
1.682 +
1.683 + /**
1.684 + Gets volume information.
1.685 +
1.686 + The only information that the function has to supply is the free space,
1.687 + TVolumeInfo::iFree, since the remaining members have already been set by
1.688 + the calling function.
1.689 +
1.690 + The function should leave, on error detection, with
1.691 + an appropriate error code.
1.692 +
1.693 + @param aVolume On return, a reference to the filled volume
1.694 + information object.
1.695 + */
1.696 + virtual void VolumeL(TVolumeInfo& aVolume) const =0;
1.697 +
1.698 +
1.699 + /**
1.700 + Sets the volume name for the mount, thus writing the new volume name
1.701 + to the corresponding volume.
1.702 +
1.703 + This function should leave on error detection.
1.704 +
1.705 + @param aName A reference to a descriptor containing the new volume name.
1.706 +
1.707 + @leave KErrBadName If the specified volume name is longer than the maximum
1.708 + allowed length for a volume name
1.709 + */
1.710 + virtual void SetVolumeL(TDes& aName) =0;
1.711 +
1.712 +
1.713 + /**
1.714 + Creates a new directory on the mount.
1.715 +
1.716 + The directory to be created is identified through its full name in aName.
1.717 + The full name is in the form:
1.718 + @code
1.719 + \\dirA\\dirB\\dirC\\dirD
1.720 + @endcode
1.721 + where dirD is the new directory to be created in \\dirA\\dirB\\dirC\\.
1.722 + This means that dirC is the leaf directory in which dirD will be created.
1.723 +
1.724 + The function should leave, on error detection, with an appropriate
1.725 + error code.
1.726 +
1.727 + @param aName A reference to a descriptor containing the full name of
1.728 + the directory to be created.
1.729 +
1.730 + @leave KErrPathNotFound Part of the path in aName does not exist.
1.731 + @leave KErrAlreadyExists dirD already exists in \\dirA\\dirB\\dirC\\
1.732 + @leave KErrAccessDenied dirD already exists but is not a directory.
1.733 + @leave KErrDirFull There is no room in \\dirA\\dirB\\dirC\\ for the new entry,
1.734 + which is especially applicable to the root directory.
1.735 + */
1.736 + virtual void MkDirL(const TDesC& aName) =0;
1.737 +
1.738 +
1.739 + /**
1.740 + Removes the directory specified by aName (its full name) from the volume.
1.741 +
1.742 + The directory specified by aName is in the form:
1.743 + @code
1.744 + \\dirA\\dirB\\dirC\\dirD
1.745 + @endcode
1.746 + where dirD is the directory to be removed from \\dirA\\dirB\\dirC\\.
1.747 + This means that dirC is the leaf directory from which dirD should be removed.
1.748 +
1.749 + The function can assume that the directory exists and is not read-only.
1.750 +
1.751 + The function should leave with a suitable error code if it cannot complete
1.752 + successfully for any reason.
1.753 +
1.754 + @param aName A reference to a descriptor containing the full name of
1.755 + the directory to be removed.
1.756 +
1.757 + @leave KErrInUse dirD contains entries other than the parent (..)
1.758 + and current (.) entries.
1.759 + */
1.760 + virtual void RmDirL(const TDesC& aName) =0;
1.761 +
1.762 +
1.763 + /**
1.764 + Deletes the specified file from the mount.
1.765 +
1.766 + The function can assume that the file is closed.
1.767 +
1.768 + The file name specified by aName is of the form:
1.769 + @code
1.770 + \\dirA\\dirB\\dirC\\file.ext
1.771 + @endcode
1.772 +
1.773 + The extension is optional.
1.774 +
1.775 + The function should leave on error detection, with
1.776 + an appropriate error code.
1.777 +
1.778 + @param aName A reference to a descriptor containing the full path name
1.779 + of the file that will be removed.
1.780 +
1.781 + @leave KErrAccessDenied aName specifies a file whose attributes state that
1.782 + the file is read-only or aName specifies a directory.
1.783 + */
1.784 + virtual void DeleteL(const TDesC& aName) =0;
1.785 +
1.786 +
1.787 + /**
1.788 + Renames or moves a single file or directory on the mount.
1.789 +
1.790 + It can be used to move a file or directory since both
1.791 + anOldName and anNewName specify the respective entries with full names;
1.792 + for example,
1.793 + @code
1.794 + \\dirA\\dirB\\dirC\\oldEntryName
1.795 + @endcode
1.796 +
1.797 + and
1.798 +
1.799 + @code
1.800 + \\dirE\\dirF\\dirG\\newEntryName
1.801 + @endcode
1.802 +
1.803 + If oldEntryName is a file, it can be assumed that it is closed.
1.804 + If oldEntryName is a directory, it can be assumed that there are no
1.805 + open files in this directory. Furthermore, if newEntryName specifies
1.806 + a directory, it can be assumed that it is not a subdirectory of oldEntryName.
1.807 +
1.808 + The function should leave with an appropriate error code if it cannot
1.809 + complete successfully for any reason.
1.810 +
1.811 + @param anOldName A reference to a descriptor containing the full entry
1.812 + name of the entry to be renamed.
1.813 +
1.814 + @param anNewName A reference to a descriptor containing the new full entry
1.815 + name for the entry to be renamed.
1.816 +
1.817 + @leave KErrAlreadyExists The new entry already exists.
1.818 + */
1.819 + virtual void RenameL(const TDesC& anOldName,const TDesC& anNewName) =0;
1.820 +
1.821 +
1.822 + /**
1.823 + Replaces one file on the mount with another.
1.824 +
1.825 + The function can assume that both anOldName and, if it exists, anNewName
1.826 + contain the full file names of files, and that these files are not open.
1.827 +
1.828 + If the file aNewName does not exist it should be created.
1.829 +
1.830 + The file anOldName should have its contents, attributes, and the universal
1.831 + date and time of its last modification, copied to the file aNewName,
1.832 + overwriting any existing contents and attribute details.
1.833 + Finally anOldName should be deleted.
1.834 +
1.835 + The function should leave with an appropriate error code if it cannot
1.836 + complete successfully for any reason.
1.837 +
1.838 + @param anOldName A reference to a descriptor containing the full file name
1.839 + of the file to replace the file specified by anNewName
1.840 + @param anNewName A reference to a descriptor containing the new full file
1.841 + name for the entry to be replaced.
1.842 + */
1.843 + virtual void ReplaceL(const TDesC& anOldName,const TDesC& anNewName) =0;
1.844 +
1.845 +
1.846 + /**
1.847 + Gets the entry details for the specified file or directory.
1.848 +
1.849 + anEntry should be filled with details from the file or directory with the
1.850 + full name aName. aName is of the form
1.851 + @code
1.852 + \\dirA\\dirB\\dirC\\entry.
1.853 + @endcode
1.854 +
1.855 + Note that anEntry.iType (the entry UID) should only be set for a file whose
1.856 + size is greater than or equal to sizeof(TCheckedUid).
1.857 +
1.858 + The function should leave with an appropriate error code if it cannot
1.859 + complete successfully for any reason.
1.860 +
1.861 + @param aName A reference to a descriptor containing the full name of
1.862 + the entry whose details are required.
1.863 + @param anEntry On return, a reference to the filled entry object.
1.864 +
1.865 + @leave KErrPathNotFound The entry, aName, cannot be found.
1.866 + */
1.867 + virtual void EntryL(const TDesC& aName,TEntry& anEntry) const =0;
1.868 +
1.869 +
1.870 + /**
1.871 + Sets entry details for a specified file or directory.
1.872 +
1.873 + The entry identfied by the full name descriptor aName should have
1.874 + its modification time and its attributes mask updated as required.
1.875 +
1.876 + The entry receives a new universal modified time from aTime.
1.877 + The entry attributes are set with aSetAttMask and cleared
1.878 + with aClearAttMask:
1.879 + the bits that are set in aSetAttMask should be set
1.880 + in the entry attribute mask;
1.881 + the bits that are set in aClearAttMask
1.882 + should be cleared from the entry attribute mask.
1.883 +
1.884 + The function can assume that aSetAttMask and aClearAttMask do not change
1.885 + the type of attribute (i.e. volume or directory). Furthermore, if aName
1.886 + specifies a file, it can be assumed that this file is closed.
1.887 +
1.888 + The function should leave with an appropriate error code on error detection.
1.889 +
1.890 + @param aName A reference to a descriptor containing the full name of
1.891 + the entry to be updated.
1.892 + @param aTime A reference to the time object holding the new universal
1.893 + modified time for aName.
1.894 + @param aSetAttMask Attribute mask for setting the entry's attributes.
1.895 + @param aClearAttMask Attribute mask for clearing the entry's attributes.
1.896 + */
1.897 + virtual void SetEntryL(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask) =0;
1.898 +
1.899 +
1.900 + /**
1.901 + Customises the opening of a new or existing file on the mount.
1.902 +
1.903 + The function is called internally (via TDrive::FileOpen()) as a result of
1.904 + a call by the client, and the file is created, if necessary, and opened by
1.905 + the calling function. However this function implements any replacement
1.906 + functionality, as well as any other behaviour particular to the file system.
1.907 +
1.908 + If anOpen specifies EFileReplace (rather than EFileCreate or EFileOpen) then,
1.909 + if replacement functionality is required, the data contained in the file
1.910 + should be discarded, the archive attribute should be set, and the size of
1.911 + the file should be set to zero. Note that it can be assumed that if anOpen
1.912 + specifies EFileReplace then the file already exists.
1.913 +
1.914 + After successful completion of the function, the file control block pointer
1.915 + will be added to the file server's global files container.
1.916 +
1.917 + The function should leave with a suitable error code if it cannot be completed
1.918 + successfully.
1.919 +
1.920 + @param aName The full name of the file that will be opened.
1.921 + @param aMode The file share mode. The following share modes are available:
1.922 + EFileShareExclusive;
1.923 + EFileShareReadersOnly;
1.924 + EFileShareAny;
1.925 + EFileShareReadersOrWriters;
1.926 + EFileStream;
1.927 + EFileStreamText;
1.928 + EFileRead;
1.929 + EFileWrite.
1.930 + @param anOpen IndicatES how the file will be opened. It can be one of
1.931 + the following:
1.932 + EFileOpen;
1.933 + EFileCreate;
1.934 + EFileReplace.
1.935 + @param aFile Pointer to the file control block which will, on success,
1.936 + represent the open file.
1.937 +
1.938 + @leave KErrAccessDenied aName may specify a directory, or the function may
1.939 + be attempting to open a file on a ROM drive.
1.940 + */
1.941 + virtual void FileOpenL(const TDesC& aName,TUint aMode,TFileOpen anOpen,CFileCB* aFile) =0;
1.942 +
1.943 +
1.944 + /**
1.945 + Customises the opening of a directory on the mount.
1.946 +
1.947 + The function is called internally, and the directory will have been created
1.948 + and initialised by the calling function. Any customisation specific to
1.949 + a file system should be implemented in this function.
1.950 +
1.951 + Note that aName is of the form
1.952 + @code
1.953 + \\dirA\\dirB\\dirC\\file.ext
1.954 + @endcode
1.955 +
1.956 + where \\dirA\\dirB\\dirC\\ is the directory to be opened and file.ext is
1.957 + an optional entry name and extension.
1.958 +
1.959 + After successful completion of the function, the directory control block
1.960 + pointer will be added to the file server global directories container.
1.961 +
1.962 + The function should leave with a suitable error code if it cannot complete
1.963 + successfully for any reason.
1.964 +
1.965 + @param aName A reference to a descriptor containing the full name of
1.966 + the directory that will be opened.
1.967 + @param aDir Points to a directory control block which will, on success,
1.968 + represent the open directory.
1.969 + */
1.970 + virtual void DirOpenL(const TDesC& aName,CDirCB* aDir) =0;
1.971 +
1.972 +
1.973 + /**
1.974 + Reads the specified length of data from the specified position on
1.975 + the volume directly into the client thread.
1.976 +
1.977 + It can be assumed that if this function is called,
1.978 + then there has been a successful mount.
1.979 +
1.980 + This function should leave with an appropriate error code when
1.981 + an error is detected.
1.982 +
1.983 + @param aPos Start position in the volume for the read operation,
1.984 + in bytes.
1.985 + @param aLength The number of bytes to be read.
1.986 + @param aTrg A pointer to the buffer into which data is to be read.
1.987 + @param anOffset The offset at which to start adding data to the read buffer.
1.988 + @param aMessage
1.989 + */
1.990 + virtual void RawReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt anOffset,const RMessagePtr2& aMessage) const = 0;
1.991 +
1.992 +
1.993 + /**
1.994 + Writes a specified length of data from the client thread to the volume
1.995 + at the specified position.
1.996 +
1.997 + It can be assumed that if this function is called, then there has been
1.998 + a successful mount.
1.999 +
1.1000 + This function should leave with an appropriate error code when
1.1001 + an error is detected.
1.1002 +
1.1003 + @param aPos Start position in the volume for the write operation,
1.1004 + in bytes.
1.1005 + @param aLength The number of bytes to be written.
1.1006 + @param aSrc Pointer to the buffer from which data will be written.
1.1007 + @param anOffset The offset in the buffer at which to start writing data.
1.1008 + @param aMessage
1.1009 + */
1.1010 + virtual void RawWriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt anOffset,const RMessagePtr2& aMessage) = 0;
1.1011 +
1.1012 +
1.1013 + /**
1.1014 + Gets the short name of the file or directory with the given full name.
1.1015 +
1.1016 + This function is used in circumstances where a file system mangles
1.1017 + Symbian OS natural names, in order to be able to store them on
1.1018 + a file system that is not entirely compatible.
1.1019 +
1.1020 + The function should leave with a suitable error code if it cannot complete
1.1021 + successfully for any reason.
1.1022 +
1.1023 + @param aLongName A reference to a descriptor containing the full name
1.1024 + of the entry.
1.1025 + @param aShortName On return, a reference to a descriptor containing
1.1026 + the short name of the entry.
1.1027 +
1.1028 + @leave KErrNotFound The entry specified by its long name cannot be found.
1.1029 + */
1.1030 + virtual void GetShortNameL(const TDesC& aLongName,TDes& aShortName) = 0;
1.1031 +
1.1032 +
1.1033 + /**
1.1034 + Gets the long name of the file or directory associated with
1.1035 + the given short name.
1.1036 +
1.1037 + This function is used in circumstances where a file system mangles
1.1038 + Symbian OS natural names in order to be able to store them on
1.1039 + a file system that is not entirely compatible.
1.1040 +
1.1041 + The function should leave with a suitable error code if it cannot complete
1.1042 + successfully for any reason.
1.1043 +
1.1044 + @param aShorName A reference to a descriptor containing the short name
1.1045 + of the entry.
1.1046 +
1.1047 + @param aLongName On return, a reference to a descriptor containing
1.1048 + the long name of the entry.
1.1049 +
1.1050 + @leave KErrNotFound The entry specified by its short name cannot be found.
1.1051 + */
1.1052 + virtual void GetLongNameL(const TDesC& aShorName,TDes& aLongName) = 0;
1.1053 +
1.1054 +
1.1055 + /**
1.1056 + Reads a specified section of the file, regardless of the file's lock state.
1.1057 +
1.1058 + The function should leave with a suitable error code if it cannot complete
1.1059 + successfully for any reason.
1.1060 +
1.1061 + @param aName A reference to a descriptor containing the full name of
1.1062 + the file to be read from
1.1063 + @param aPos The byte position to start reading from.
1.1064 + @param aTrg A pointer to the buffer into which data is to be read.
1.1065 + @param aLength The length of data to be read, in bytes.
1.1066 + @param aMessage
1.1067 +
1.1068 + @leave KErrEof aPos is past the end of the file.
1.1069 + */
1.1070 + virtual void ReadSectionL(const TDesC& aName,TInt aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage)=0;
1.1071 +
1.1072 +
1.1073 + /**
1.1074 + Checks the integrity of the file system on the volume and returns an appropriate error value.
1.1075 + The default implementation must be overridden by a derived class.
1.1076 +
1.1077 + @return KErrNone if the file system is stable; otherwise one of the other system wide error codes.
1.1078 + The default implementation returns KErrNotSupported.
1.1079 + */
1.1080 + virtual TInt CheckDisk() {return(KErrNotSupported);}
1.1081 +
1.1082 + /**
1.1083 + The same as original CheckDisk(), but with some parameters.
1.1084 + */
1.1085 + virtual TInt CheckDisk(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL);
1.1086 +
1.1087 +
1.1088 + /**
1.1089 + Scans through and corrects errors found in the volume.
1.1090 +
1.1091 + The default implementation must be overridden by a derived class.
1.1092 +
1.1093 + @return KErrNone if no errors are found or all errors are corrected; otherwise one of the other system wide error codes.
1.1094 + The default implementation returns KErrNotSupported.
1.1095 + */
1.1096 + virtual TInt ScanDrive() {return(KErrNotSupported);}
1.1097 +
1.1098 + /**
1.1099 + The same as original ScanDrive(), but with some parameters.
1.1100 + */
1.1101 + virtual TInt ScanDrive(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL);
1.1102 +
1.1103 + IMPORT_C virtual void IsFileInRom(const TDesC& aFileName,TUint8*& aFileStart);
1.1104 +
1.1105 +
1.1106 + /**
1.1107 + Low-level control IO
1.1108 + */
1.1109 + virtual TInt ControlIO( const RMessagePtr2& /*aMessage*/,TInt /*aCommand*/,TAny* /*aParam1*/,TAny* /*aParam2*/) {return(KErrNotSupported);}
1.1110 +
1.1111 +
1.1112 + /**
1.1113 + Locks a media which supports password protection and replaces
1.1114 + the old password with a new one.
1.1115 +
1.1116 + If aStore is set to ETrue, then the new password should be saved to
1.1117 + the password store file, KMediaPWrdFile, using the exported file server
1.1118 + function WriteToDisk().
1.1119 +
1.1120 + The password file is used to initialise the password store on boot up,
1.1121 + so the user does not need to be prompted for the password again if
1.1122 + it is saved here.
1.1123 +
1.1124 + The default implementation must be overridden in a derived class.
1.1125 +
1.1126 + @param aOld A reference to the old password.
1.1127 + @param aNew A reference to the new password.
1.1128 + @param aStore ETrue if the new password is to be saved to
1.1129 + the password file store; EFalse if not.
1.1130 +
1.1131 + @return KErrNone if successful; otherwise another of the system wide
1.1132 + error codes. The default implementation returns KErrNotSupported.
1.1133 + */
1.1134 + virtual TInt Lock(TMediaPassword& /*aOld*/,TMediaPassword& /*aNew*/,TBool /*aStore*/) {return(KErrNotSupported);}
1.1135 +
1.1136 +
1.1137 + /**
1.1138 + Unlocks a media which supports password protection.
1.1139 +
1.1140 + If aStore is set to ETrue then the password should be saved to
1.1141 + the password store file specified by KMediaPWrdFile using the exported file
1.1142 + server function WriteToDisk().
1.1143 +
1.1144 + The password file is used to initialise the password store on boot up,
1.1145 + so the user does not need to be prompted for the password again if
1.1146 + it is saved here.
1.1147 +
1.1148 + The default implementation must be overridden in a derived class.
1.1149 +
1.1150 + @param aPassword A reference to the password.
1.1151 + @param aStore ETrue if the password is to be saved to
1.1152 + the password store file; EFalse otherwise.
1.1153 +
1.1154 + @return KErrNone if successful; otherwise another of the system wide
1.1155 + error codes. The default implementation returns KErrNotSupported.
1.1156 + */
1.1157 + virtual TInt Unlock(TMediaPassword& /*aPassword*/,TBool /*aStore*/) {return(KErrNotSupported);}
1.1158 +
1.1159 +
1.1160 + /**
1.1161 + Clears a password from a media that supports write protection.
1.1162 +
1.1163 + The default implementation must be overridden in a derived class.
1.1164 +
1.1165 + @param aPassword A reference to the password to be cleared.
1.1166 +
1.1167 + @return KErrNone if successful; otherwise another of the system wide
1.1168 + error codes. The default implementation returns KErrNotSupported.
1.1169 + */
1.1170 + virtual TInt ClearPassword(TMediaPassword& /*aPassword*/) {return(KErrNotSupported);}
1.1171 +
1.1172 +
1.1173 + /**
1.1174 + */
1.1175 + virtual TInt ForceRemountDrive(const TDesC8* /*aMountInfo*/,TInt /*aMountInfoMessageHandle*/,TUint /*aFlags*/) {return(KErrNotSupported);}
1.1176 +
1.1177 +
1.1178 + /**
1.1179 + Legacy method: finalise the mount and put it to the consistent state.
1.1180 + */
1.1181 + virtual void FinaliseMountL() {return;}
1.1182 +
1.1183 + /**
1.1184 + finalise the mount and put it to the consistent state.
1.1185 +
1.1186 + @param aOperation describes finalisation operation, see RFs::TFinaliseDrvMode
1.1187 + @param aParam1 not used, for future expansion
1.1188 + @param aParam2 not used, for future expansion
1.1189 + */
1.1190 + virtual void FinaliseMountL(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL);
1.1191 +
1.1192 +
1.1193 + protected:
1.1194 + /** Mount Control levels or operations to perform */
1.1195 + enum TMntCtlLevel
1.1196 + {
1.1197 + //-- reserved generic mount (CMountCB) control codes
1.1198 +
1.1199 + EMountStateQuery, ///< query mount state, see TMntCtlOption, ESQ_IsMountFinalised
1.1200 + EMountVolParamQuery, ///< mount-specific queries for volume parameters. See ESQ_RequestFreeSpace, ESQ_GetCurrentFreeSpace
1.1201 + ECheckFsMountable, ///< extended mount functionality, checks if this file system can be mounted on specified drive. See CheckFileSystemMountable()
1.1202 +
1.1203 + //-- starting from the next code someone may define some specific mount type control codes, like ESpecificMountCtl+17
1.1204 + ESpecificMountCtl = 0x40000000,
1.1205 +
1.1206 + //-- starting from the next code someone may define some specific File System control codes
1.1207 + ESpecificFsCtl = 0x40001000,
1.1208 +
1.1209 + EMountFsParamQuery, ///< File System parameters queries; File System properties can be "static" i.e not requiring properly mounted volume. See ESpecificFsCtlOpt
1.1210 +
1.1211 + };
1.1212 +
1.1213 + /** Mount Control options that makes sense only for certain control codes, see TMntCtlLevel */
1.1214 + enum TMntCtlOption
1.1215 + {
1.1216 + //-- reserved generic mount (CMountCB) control options codes
1.1217 +
1.1218 + /** query if the mount is finalised, corresponds to the EMountStateQuery control code only. @see IsMountFinalised() */
1.1219 + ESQ_IsMountFinalised,
1.1220 +
1.1221 + //-----------------------------------------------------------------------------------------------------------------------------
1.1222 +
1.1223 + //-- starting from the next code someone may define some specific mount type control options
1.1224 + ESpecificMountCtlOpt = 0x40000000,
1.1225 +
1.1226 + /** Corresponds to EMountVolParamQuery. Request a certain amount of free space on the volume. @see RequestFreeSpace() */
1.1227 + ESQ_RequestFreeSpace,
1.1228 +
1.1229 + /** Corresponds to EMountVolParamQuery. A request to obtain the _current_ amount of free space on the volume asynchronously, without blocking. */
1.1230 + ESQ_GetCurrentFreeSpace,
1.1231 +
1.1232 + /** Corresponds to EMountVolParamQuery. A request to obtain size of the mounted volume without blocking (CMountCB::VolumeL() can block). */
1.1233 + ESQ_MountedVolumeSize,
1.1234 +
1.1235 + //-----------------------------------------------------------------------------------------------------------------------------
1.1236 +
1.1237 + //-- starting from the next code someone may define some specific File System control options
1.1238 + ESpecificFsCtlOpt = 0x40001000,
1.1239 +
1.1240 + /** Get Maximum file size, which is supported by the file system that has produced this mount. */
1.1241 + ESQ_GetMaxSupportedFileSize,
1.1242 +
1.1243 + };
1.1244 +
1.1245 +
1.1246 + public:
1.1247 +
1.1248 + /**
1.1249 + Generic mount control method.
1.1250 + @param aLevel specifies the operation to perfrom on the mount
1.1251 + @param aOption specific option for the given operation
1.1252 + @param aParam pointer to generic parameter, its meaning depends on aLevel and aOption
1.1253 +
1.1254 + @return standard error code. Default imlementation returns KErrNotSupported
1.1255 + */
1.1256 + virtual TInt MountControl(TInt aLevel, TInt aOption, TAny* aParam);
1.1257 +
1.1258 +
1.1259 + /**
1.1260 + Erase a password from a media that supports write protection.
1.1261 +
1.1262 + The default implementation must be overridden in a derived class.
1.1263 +
1.1264 + @return KErrNone if successful; otherwise another of the system wide
1.1265 + error codes. The default implementation returns KErrNotSupported.
1.1266 + */
1.1267 + virtual TInt ErasePassword() {return(KErrNotSupported);}
1.1268 +
1.1269 + /**
1.1270 + An interface class which may optionally be returned by a file system
1.1271 + by calling GetInterface(EFileAccessor, ...)
1.1272 + */
1.1273 + class MFileAccessor
1.1274 + {
1.1275 + public:
1.1276 + virtual TInt GetFileUniqueId(const TDesC& aName, TInt64& aUniqueId) = 0;
1.1277 + virtual TInt Spare3(TInt aVal, TAny* aPtr1, TAny* aPtr2) = 0;
1.1278 + virtual TInt Spare2(TInt aVal, TAny* aPtr1, TAny* aPtr2) = 0;
1.1279 + virtual TInt Spare1(TInt aVal, TAny* aPtr1, TAny* aPtr2) = 0;
1.1280 + };
1.1281 +
1.1282 + /**
1.1283 + @prototype
1.1284 +
1.1285 + CMountCB::MFileExtendedInterface interface provides extended interface for CMountCB to
1.1286 + read a specified section of large file (size greater than 2GB - 1).
1.1287 +
1.1288 + The interface could be retrieved by calling CMountCB::GetInterface() with
1.1289 + EFileExtendedInterface as an argument.
1.1290 +
1.1291 + Sub classes of CMountCB who does support large file access will need to multiple-inherit
1.1292 + with this class and implement the interface. The implementation of the interface will be
1.1293 + retrieved via GetInterface() and provided to user by non-virtual APIs to avoid breaking
1.1294 + binary compatibility.
1.1295 +
1.1296 + NOTE: Do not try to delete CMountCB::MFileExtendedInterface interface pointer!
1.1297 +
1.1298 + @see CMountCB::GetInterface()
1.1299 + */
1.1300 +
1.1301 + class MFileExtendedInterface
1.1302 + {
1.1303 + public:
1.1304 + /**
1.1305 + Reads a specified section of the file, regardless of the file's lock state.
1.1306 +
1.1307 + The function should leave with a suitable error code if it cannot complete
1.1308 + successfully for any reason.
1.1309 +
1.1310 + This function should be implemented in file systems supporting files
1.1311 + of size greater than 2GB - 1.
1.1312 +
1.1313 + @param aName A reference to a descriptor containing the full name of
1.1314 + the file to be read from
1.1315 + @param aPos The byte position to start reading from.
1.1316 + @param aTrg A pointer to the buffer into which data is to be read.
1.1317 + @param aLength The length of data to be read, in bytes.
1.1318 + @param aMessage
1.1319 +
1.1320 + @leave KErrEof aPos is past the end of the file.
1.1321 +
1.1322 + @see CMountCB::ReadSectionL()
1.1323 + */
1.1324 + virtual void ReadSection64L(const TDesC& aName, TInt64 aPos, TAny* aTrg, TInt aLength, const RMessagePtr2& aMessage) = 0;
1.1325 + };
1.1326 +
1.1327 + /**
1.1328 + Enumeration of the aInterfaceIDs used in GetInterface.
1.1329 + */
1.1330 + enum TInterfaceIds
1.1331 + {
1.1332 + EAddFsToCompositeMount = 0,
1.1333 + EGetLocalDrive = 1,
1.1334 + EFileAccessor = 2,
1.1335 + EGetFileSystemSubType = 3,
1.1336 + EGetClusterSize = 4,
1.1337 + ELocalBufferSupport = 5,
1.1338 + EAddToCompositeMount = 6,
1.1339 + EGetProxyDrive = 7,
1.1340 + EFileExtendedInterface = 8
1.1341 + };
1.1342 +
1.1343 + // File clamping support
1.1344 + TInt ClampFile(const TInt aDriveNo,const TDesC& aName,TAny* aHandle);
1.1345 + TInt UnclampFile(RFileClamp* aHandle);
1.1346 + IMPORT_C TInt IsFileClamped(const TInt64 aUniqueId);
1.1347 + TInt NoOfClamps();
1.1348 +
1.1349 + // File accessor support
1.1350 + TInt GetFileUniqueId(const TDesC& aName, TInt64& aUniqueId);
1.1351 + TInt Spare3(TInt aVal, TAny* aPtr1, TAny* aPtr2);
1.1352 + TInt Spare2(TInt aVal, TAny* aPtr1, TAny* aPtr2);
1.1353 + TInt Spare1(TInt aVal, TAny* aPtr1, TAny* aPtr2);
1.1354 +
1.1355 + // Extensions of interface
1.1356 + TInt FileSystemSubType(TDes& aName);
1.1357 + TInt FileSystemClusterSize();
1.1358 + void FileSystemName(TDes& aName);
1.1359 +
1.1360 + // Large file support
1.1361 + void ReadSection64L(const TDesC& aName,TInt64 aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage);
1.1362 +
1.1363 + inline TInt CheckFileSystemMountable();
1.1364 + inline TInt RequestFreeSpace(TUint64 &aFreeSpaceBytes);
1.1365 + inline TInt MountedVolumeSize(TUint64& aVolSizeBytes);
1.1366 + inline TInt GetCurrentFreeSpaceAvailable(TInt64 &aFreeSpaceBytes);
1.1367 + inline TInt IsMountFinalised(TBool &aFinalised);
1.1368 + inline TInt GetMaxSupportedFileSize(TUint64 &aSize);
1.1369 +
1.1370 +protected:
1.1371 + inline void SetMountNumber(TInt aMountNumber);
1.1372 + inline void SetDismounted(TBool aDismounted=ETrue);
1.1373 + inline TInt MountNumber() const;
1.1374 + inline TBool IsDismounted() const;
1.1375 +
1.1376 + void SetProxyDriveDismounted();
1.1377 + TBool ProxyDriveDismounted();
1.1378 +
1.1379 + IMPORT_C CFileSystem* FileSystem() const;
1.1380 +
1.1381 + /**
1.1382 + Return a pointer to a specified interface extension - to allow future extension of this class without breaking
1.1383 + binary compatibility.
1.1384 + @param aInterfaceId Interface identifier of the interface to be retrieved.
1.1385 + @param aInterface A reference to a pointer that retrieves the specified interface.
1.1386 + @param aInput An arbitrary input argument.
1.1387 + @return KErrNone If the interface is supported, KErrNotSupported otherwise.
1.1388 + */
1.1389 + IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
1.1390 +
1.1391 + // calls GetInterface() with tracepoints added
1.1392 + TInt GetInterfaceTraced(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
1.1393 +
1.1394 +
1.1395 +
1.1396 +
1.1397 +private:
1.1398 + void SetFileSystem(CFileSystem* aFS);
1.1399 +
1.1400 + //-- these factory methods mus be used to produce objects representing files, directories etc. as soon as all these objects are
1.1401 + //-- associated with the mount, not the file sytem (file system is a factory for corresponding mounts)
1.1402 + //-- corresponding CFileSystem:: methods must not be used.
1.1403 + //-- CMountCB has a reference to the CFileSystem that produced it.
1.1404 + CFileCB* NewFileL() const;
1.1405 + CDirCB* NewDirL() const;
1.1406 + CFormatCB* NewFormatL() const;
1.1407 +
1.1408 +protected:
1.1409 +
1.1410 + TInt iMountNumber; ///< Unique mount number set by the TDrive object representing the drive on which the object resides.
1.1411 + TUint iUniqueID; ///< volume Unique ID. Set in MountL().
1.1412 + TInt64 iSize; ///< Size of the volume. First set in MountL().
1.1413 +
1.1414 + /**
1.1415 + A list of all open files on that mount.
1.1416 + Set by the TDrive object representing the drive of which the mount resides.
1.1417 + */
1.1418 + TDblQue<CFileCB> iMountQ;
1.1419 +
1.1420 + friend class TDrive;
1.1421 + friend class TFsAddCompositeMount;
1.1422 +
1.1423 +private:
1.1424 + TInt iLockMount;
1.1425 + TDrive* iDrive;
1.1426 + HBufC* iVolumeName;
1.1427 + CMountBody* iBody; ///< used for extending CMountCB functionality
1.1428 + };
1.1429 +
1.1430 +
1.1431 +/**
1.1432 +@internalTechnology
1.1433 +
1.1434 +MFileSystemSubType interface provides extended interface for CMountCB to retrieve sub type
1.1435 +of mounted file systems.
1.1436 +
1.1437 +The interface could be retrieved by calling CMountCB::GetInterface() with EGetFileSystemSubType
1.1438 +as an argument.
1.1439 +
1.1440 +If the file system does not support sub types, MFileSystemSubType cannot be retieved.
1.1441 +Sub classes of CMountCB who does support sub types will need to multiple-inherit with
1.1442 +this class and implement the interface. The implementation of the interface will be
1.1443 +retrieved via GetInterface() and provided to user by non-virtual APIs to avoid breaking
1.1444 +binary compatibility.
1.1445 +
1.1446 +NOTE: Do not try to delete MFileSystemSubType interface pointer!
1.1447 +
1.1448 +@see CMountCB::GetInterface()
1.1449 +*/
1.1450 +class MFileSystemSubType
1.1451 + {
1.1452 +public:
1.1453 + /**
1.1454 + Retrieves file system's sub type name (E.g. FAT16), if the file system does not have sub
1.1455 + types (E.g. Rofs), return the file system's name.
1.1456 + @param aName Returned descriptor contains file system name or sub type name.
1.1457 + @return KErrNone if successful.
1.1458 + */
1.1459 + virtual TInt SubType(TDes& aName) const = 0;
1.1460 + };
1.1461 +
1.1462 +/**
1.1463 +@internalTechnology
1.1464 +
1.1465 +MFileSystemClusterSize interface provides extended interface for CMountCB to retrieve cluster size
1.1466 +of mounted file systems.
1.1467 +
1.1468 +The interface could be retrieved by calling CMountCB::GetInterface() with EGetClusterSize
1.1469 +as an argument.
1.1470 +
1.1471 +If the file system does not support clustering, MFileSystemClusterSize cannot be retieved.
1.1472 +Sub classes of CMountCB who does support clustering will need to multiple-inherit with
1.1473 +this class and implement the interface. The implementation of the interface will be
1.1474 +retrieved via GetInterface() and provided to user by non-virtual APIs to avoid breaking
1.1475 +binary compatibility.
1.1476 +
1.1477 +NOTE: Do not try to delete MFileSystemSubType interface pointer!
1.1478 +
1.1479 +@see CMountCB::GetInterface()
1.1480 +*/
1.1481 +class MFileSystemClusterSize
1.1482 + {
1.1483 +public:
1.1484 + /**
1.1485 + Retrieves file system's cluster size
1.1486 + @return None-zero cluster size if successful.
1.1487 + */
1.1488 + virtual TInt ClusterSize() const = 0;
1.1489 + };
1.1490 +
1.1491 +
1.1492 +class CFileShare;
1.1493 +
1.1494 +
1.1495 +
1.1496 +/**
1.1497 +@internalTechnology
1.1498 +*/
1.1499 +class TAsyncReadRequest
1.1500 + {
1.1501 +public:
1.1502 + TAsyncReadRequest(TInt64 aEndPos, CFileShare* aOwningShareP, CFsRequest* aRequestP);
1.1503 + TBool CompleteIfMatching(CFileShare* aOwningShareP, TRequestStatus* aStatusP, TInt aError);
1.1504 +private:
1.1505 + TAsyncReadRequest();
1.1506 +public:
1.1507 + TInt64 iEndPos; // The request is completed file length >= iEndPos.
1.1508 + CFileShare* iOwningShareP; // The share that owns this outstanding request.
1.1509 + const TRequestStatus* iStatusP; // Used to identify the request when cancelling.
1.1510 + CSessionFs* iSessionP; // The owning session of the original request.
1.1511 + RMessage2 iMessage; // The message to be completed when data is available.
1.1512 + };
1.1513 +
1.1514 +
1.1515 +/**
1.1516 + @internalTechnology
1.1517 + @released
1.1518 +
1.1519 + File share lock
1.1520 +
1.1521 + The lock specifies the lowest and highest position in the file to be locked.
1.1522 + Note that files may have many locks on it, but overlapping sections cannot be locked.
1.1523 + This is used by a file control block, a CFileCB object.
1.1524 +
1.1525 + @see CFileCB
1.1526 +*/
1.1527 +class TFileShareLock
1.1528 + {
1.1529 +public:
1.1530 + TFileShareLock(const CFileShare* aOwner, TUint64 aPosLow, TUint64 aPosHigh);
1.1531 +
1.1532 +
1.1533 + inline TUint64 PosLow() const;
1.1534 + inline TUint64 PosHigh() const;
1.1535 + inline TBool MatchOwner(const CFileShare* aShare) const;
1.1536 +
1.1537 + TBool MatchByPos(TUint64 aPosLow, TUint64 aPosHigh) const;
1.1538 +
1.1539 +private:
1.1540 + TFileShareLock();
1.1541 + TFileShareLock(const TFileShareLock&);
1.1542 + TFileShareLock& operator=(const TFileShareLock&);
1.1543 +
1.1544 +private:
1.1545 +
1.1546 + const CFileShare* iOwner; ///<The owning file share object.
1.1547 + TUint64 iPosLow; ///<The start of the section of the file to be locked.
1.1548 + TUint64 iPosHigh; ///<The end of the section of the file to be locked.
1.1549 +
1.1550 + friend class CFileCB;
1.1551 + };
1.1552 +
1.1553 +/** @internalTechnology */
1.1554 +typedef RArray<TFileShareLock> TFileLocksArray;
1.1555 +
1.1556 +
1.1557 +/**
1.1558 +@publishedPartner
1.1559 +@released
1.1560 +
1.1561 +A file server interface class representing an open file.
1.1562 +
1.1563 +An instance of this object is referred to as a file control block.
1.1564 +
1.1565 +A file control block needs to be created for a specific file to be able to
1.1566 +access that file within a directory.
1.1567 +
1.1568 +A plug-in file system implements this class.
1.1569 +*/
1.1570 +class CFileCB : public CFsDispatchObject
1.1571 + {
1.1572 +public:
1.1573 + IMPORT_C CFileCB();
1.1574 + IMPORT_C ~CFileCB();
1.1575 +
1.1576 + IMPORT_C void InitL(TDrive* aDrive,TDrive* aCreatedDrive, HBufC* aName);
1.1577 +
1.1578 + inline void SetMount(CMountCB * aMount);
1.1579 + inline TDrive& Drive() const;
1.1580 + inline TDrive& CreatedDrive() const;
1.1581 + inline CMountCB& Mount() const;
1.1582 + inline HBufC& FileName() const;
1.1583 + inline HBufC& FileNameF() const;
1.1584 + inline TInt UniqueID() const;
1.1585 + TInt FindLock(TInt aPosLow,TInt aPosHigh);
1.1586 + TInt AddLock(CFileShare* aFileShare,TInt aPos,TInt aLength);
1.1587 + TInt RemoveLock(CFileShare* aFileShare,TInt aPos,TInt aLength);
1.1588 + TInt CheckLock(CFileShare* aFileShare,TInt aPos,TInt aLength);
1.1589 + void RemoveLocks(CFileShare* aFileShare);
1.1590 + inline TShare Share() const;
1.1591 + inline void SetShare(TShare aShare);
1.1592 + inline TInt Size() const;
1.1593 + inline void SetSize(TInt aSize);
1.1594 + inline TInt Att() const;
1.1595 + inline void SetAtt(TInt aAtt);
1.1596 + inline TTime Modified() const;
1.1597 + inline void SetModified(TTime aModified);
1.1598 + inline TBool FileCorrupt() const;
1.1599 + inline void SetFileCorrupt(TBool aFileCorrupt);
1.1600 + inline TBool BadPower() const;
1.1601 + inline void SetBadPower(TBool aBadPower);
1.1602 + inline TUint32 NameHash() const;
1.1603 + TInt CheckMount();
1.1604 + inline TInt BlockMap(SBlockMapInfo& aInfo, TInt64& aStartPos, TInt64 aEndPos=-1);
1.1605 + inline TInt LocalDrive(TBusLocalDrive*& aLocalDrive);
1.1606 +
1.1607 + TBool LocalBufferSupport() const;
1.1608 + void SetLocalBufferSupport(TBool aEnabled);
1.1609 +
1.1610 + /** File caching support methods */
1.1611 +
1.1612 + CFileCache* FileCache() const;
1.1613 + TInt FairSchedulingLen() const;
1.1614 + void ResetReadAhead();
1.1615 +
1.1616 + void SetDeleteOnClose();
1.1617 + TBool DeleteOnClose() const;
1.1618 +
1.1619 +
1.1620 +
1.1621 + void SetNotifyAsyncReadersPending(TBool aNotifyAsyncReadersPending);
1.1622 + TBool NotifyAsyncReadersPending() const;
1.1623 + TInt CancelAsyncReadRequest(CFileShare* aShareP, TRequestStatus* aStatusP);
1.1624 +
1.1625 + /** Extended API support methods */
1.1626 +
1.1627 + TBool ExtendedFileInterfaceSupported();
1.1628 + void ReadL(TInt64 aPos,TInt& aLength,TDes8* aDes,const RMessagePtr2& aMessage, TInt aOffset);
1.1629 + void WriteL(TInt64 aPos,TInt& aLength,const TDesC8* aDes,const RMessagePtr2& aMessage, TInt aOffset);
1.1630 + void SetSizeL(TInt64 aSize);
1.1631 +
1.1632 + IMPORT_C TInt64 Size64() const;
1.1633 + IMPORT_C void SetSize64(TInt64 aSize, TBool aDriveLocked);
1.1634 + IMPORT_C void SetMaxSupportedSize(TUint64 aMaxFileSize);
1.1635 +
1.1636 +
1.1637 + TInt64 CachedSize64() const;
1.1638 + void SetCachedSize64(TInt64 aSize);
1.1639 + TInt FindLock64(TInt64 aPosLow,TInt64 aPosHigh);
1.1640 + TInt AddLock64(CFileShare* aFileShare,TInt64 aPos,TInt64 aLength);
1.1641 + TInt RemoveLock64(CFileShare* aFileShare,TInt64 aPos,TInt64 aLength);
1.1642 + TInt CheckLock64(CFileShare* aFileShare,TInt64 aPos,TInt64 aLength);
1.1643 +
1.1644 + /**
1.1645 + Renames the file with the full file name provided.
1.1646 +
1.1647 + Because the full name of the file includes the path, the function can
1.1648 + also be used to move the file.
1.1649 +
1.1650 + It can be assumed that no other sub-session has access to the file:
1.1651 + i.e. the file has not been opened in EFileShareAny share mode.
1.1652 + It can also be assumed that the file has been opened for writing.
1.1653 +
1.1654 + The function should leave with KErrAlreadyExists if aNewName already exists.
1.1655 + An appropriate error code should also be generated if the function leaves
1.1656 + before completion for any other reason.
1.1657 +
1.1658 + @param aNewName The new full name of the file.
1.1659 +
1.1660 + @see CFileCB::iFileName
1.1661 + */
1.1662 + virtual void RenameL(const TDesC& aNewName) =0;
1.1663 +
1.1664 +
1.1665 + /**
1.1666 + Reads a specified number of bytes from the open file starting at
1.1667 + the specified postition, and writes the result into a descriptor.
1.1668 +
1.1669 + It can be assumed that aPos is inside the file and aLength > 0.
1.1670 + The file should only be read up to its end regardless of
1.1671 + the value of aPos + aLength. The number of bytes read should be stored
1.1672 + in aLength on return.
1.1673 +
1.1674 + If the function leaves before completion for any reason it should generate
1.1675 + an appropriate error code, and in this situation,
1.1676 + the arguments are not valid on return.
1.1677 +
1.1678 + @param aPos Represents a position relative to the start of the file
1.1679 + where ReadL() should start to read.
1.1680 + @param aLength On entry, specifies the number of bytes to be read
1.1681 + from the file. On return, this should contain the number
1.1682 + of bytes read, but this is not valid if the function leaves.
1.1683 + @param aDes Pointer to a descriptor into which the data should be written.
1.1684 + @param aMessage
1.1685 + */
1.1686 + virtual void ReadL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage) =0;
1.1687 +
1.1688 +
1.1689 + /**
1.1690 + Writes data to the open file.
1.1691 +
1.1692 + iModified and iSize are set by the file server after this function
1.1693 + has completed successfully.
1.1694 +
1.1695 + It can be assumed that aPos is within the file range and aLength > 0.
1.1696 + When aPos + aLength is greater than the file size then the file should
1.1697 + be enlarged using SetSizeL(). The number of bytes written should be
1.1698 + returned through the argument aLength.
1.1699 +
1.1700 + If the function leaves before completion for any reason it should generate
1.1701 + an appropriate error code, and in this situation the arguments are
1.1702 + not valid on return.
1.1703 +
1.1704 + @param aPos Represents a position relative to the start of the file
1.1705 + where WriteL() should start to write.
1.1706 + @param aLength Specifies the number of bytes to be written to the file.
1.1707 + On return, the number of bytes written, but this is not
1.1708 + valid if the function leaves.
1.1709 + @param aDes Pointer to a descriptor containing the data to be written
1.1710 + to the file.
1.1711 + @param aMessage
1.1712 +
1.1713 + @see CFileCB::iModified
1.1714 + @see CFileCB::iSize
1.1715 + @see CFileCB::SetSizeL
1.1716 +
1.1717 + @leave KErrDiskFull The operation cannot be completed because the disk is full.
1.1718 + */
1.1719 + virtual void WriteL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage) =0;
1.1720 +
1.1721 +
1.1722 + /**
1.1723 + Extends or truncates the file by re-setting the file size.
1.1724 +
1.1725 + The function should not change iModified and iSize attributes of
1.1726 + the file object: this is done by the file server.
1.1727 + If the file is extended, nothing should be written in the extended area.
1.1728 +
1.1729 + The function should leave with a suitable error code on error detection.
1.1730 +
1.1731 + @param aSize The new file size in number of bytes.
1.1732 +
1.1733 + @leave KErrDiskFull The operation cannot be completed because the disk is full.
1.1734 +
1.1735 + @see CFileCB::iModified
1.1736 + @see CFileCB::iSize
1.1737 + */
1.1738 + virtual void SetSizeL(TInt aSize) =0;
1.1739 +
1.1740 +
1.1741 + /**
1.1742 + Sets the attribute mask, iAtt, and the modified time of the file, iModified.
1.1743 +
1.1744 + If aMask|aVal does not equal zero, then aMask should be OR'ed with iAtt,
1.1745 + whilst the inverse of aVal should be AND'ed with iAtt.
1.1746 + If the modified flag is set in aMask then iModified should be set to aTime.
1.1747 +
1.1748 + The function should leave with a suitable error code on error detection.
1.1749 +
1.1750 + @param aTime The new modified time, if the modified flag is set in aMask.
1.1751 + @param aMask Bit mask containing bits set (to 1) that are to be set (to 1)
1.1752 + in iAtt.
1.1753 + @param aVal Bitmask containing bits set (to 1) that are to be unset (to 0)
1.1754 + in iAtt.
1.1755 +
1.1756 + @see CFileCB::iModified
1.1757 + @see CFileCB::iAtt
1.1758 + */
1.1759 + virtual void SetEntryL(const TTime& aTime,TUint aMask,TUint aVal) =0;
1.1760 +
1.1761 +
1.1762 + /**
1.1763 + Flushes, to disk, the cached information necessary for the integrity
1.1764 + of recently written data, such as the file size.
1.1765 +
1.1766 + The function should leave with a suitable error code on error detection.
1.1767 + */
1.1768 + virtual void FlushDataL() =0;
1.1769 +
1.1770 +
1.1771 + /**
1.1772 + Flushes, to disk, all cached file data (e.g. attributes, modification time,
1.1773 + file size).
1.1774 +
1.1775 + The modified bit in the file attributes mask should be cleared if
1.1776 + the flush was successful.
1.1777 +
1.1778 + The function should leave with a suitable error code on error detection.
1.1779 + */
1.1780 + virtual void FlushAllL() =0;
1.1781 + IMPORT_C virtual TInt Address(TInt& aPos) const;
1.1782 + IMPORT_C void SetArchiveAttribute();
1.1783 +
1.1784 + /**
1.1785 + Block Map API interface
1.1786 + */
1.1787 + class MBlockMapInterface
1.1788 + {
1.1789 + public:
1.1790 + virtual TInt BlockMap(SBlockMapInfo& aInfo, TInt64& aStartPos, TInt64 aEndPos)=0;
1.1791 + };
1.1792 +
1.1793 + /**
1.1794 + An interface class which may optionally be returned by a file system
1.1795 + by calling GetInterface(EExtendedFileInterface, ...)
1.1796 + The purpose of this interface is twofold:
1.1797 + - to support fair scheduling (by use of the aOffset parameter)
1.1798 + - to enable large file support
1.1799 + */
1.1800 + class MExtendedFileInterface
1.1801 + {
1.1802 + public:
1.1803 + /**
1.1804 + Functionally equivalent to CFileCB::ReadL(), but supports large files and fair scheduling
1.1805 +
1.1806 + Reads a specified number of bytes from the open file starting at
1.1807 + the specified postition, and writes the result into a descriptor.
1.1808 +
1.1809 + @param aPos Represents a position relative to the start of the file
1.1810 + where ReadL() should start to read.
1.1811 + Note that the filesystem may not support positions above KMaxTInt,
1.1812 + in which case it leaves with KErrNotSupported.
1.1813 + @param aLength On entry, specifies the number of bytes to be read
1.1814 + from the file. On return, this contains the number
1.1815 + of bytes read, this value is not valid if the function leaves.
1.1816 + @param aDes Pointer to a descriptor into which the data is written.
1.1817 + @param aMessage A reference to a client message or an RLocalMessage.
1.1818 + @param aOffset The offset into the descriptor where the data is to be written.
1.1819 + This is non-zero if the read was fair-scheduled
1.1820 +
1.1821 + @see CFileCB::ReadL
1.1822 + @see RLocalMessage
1.1823 + */
1.1824 + virtual void ReadL(TInt64 aPos,TInt& aLength,TDes8* aDes,const RMessagePtr2& aMessage, TInt aOffset) = 0;
1.1825 +
1.1826 + /**
1.1827 + Functionally equivalent to CFileCB::WriteL(), but supports large files and fair scheduling
1.1828 +
1.1829 + Writes data to the open file.
1.1830 +
1.1831 + @param aPos Represents a position relative to the start of the file
1.1832 + where WriteL() starts to write.
1.1833 + Note that the filesystem may not support positions above KMaxTInt,
1.1834 + in which case it leaves with KErrNotSupported.
1.1835 + @param aLength Specifies the number of bytes to be written to the file.
1.1836 + On return this is the number of bytes written, this value is not
1.1837 + valid if the function leaves.
1.1838 + @param aDes Pointer to a descriptor containing the data to be written
1.1839 + to the file.
1.1840 + @param aMessage A reference to a client message or an RLocalMessage
1.1841 + @param aOffset The offset into the descriptor where the data is to be read from.
1.1842 + This is non-zero if the read was fair-scheduled
1.1843 +
1.1844 + @see CFileCB::WriteL
1.1845 + @see RLocalMessage
1.1846 + */
1.1847 + virtual void WriteL(TInt64 aPos,TInt& aLength,const TDesC8* aDes,const RMessagePtr2& aMessage, TInt aOffset) = 0;
1.1848 +
1.1849 + /**
1.1850 + Functionally equivalent to CFileCB::SetSizeL(), but supports large files
1.1851 +
1.1852 + Extends or truncates the file by re-setting the file size.
1.1853 +
1.1854 + The function does not change the iModified and iSize attributes of
1.1855 + the file object: this is done by the file server.
1.1856 + If the file is extended, nothing is written in the extended area.
1.1857 +
1.1858 + The function leaves with a suitable error code when an error is to detected.
1.1859 +
1.1860 + @param aSize The new file size in bytes.
1.1861 +
1.1862 + @leave KErrDiskFull The operation cannot be completed because the disk is full.
1.1863 +
1.1864 + @see CFileCB::SetSizeL
1.1865 + @see CFileCB::iModified
1.1866 + @see CFileCB::iSize
1.1867 + */
1.1868 + virtual void SetSizeL(TInt64 aSize) = 0;
1.1869 + };
1.1870 +
1.1871 +
1.1872 +protected:
1.1873 +
1.1874 + /**
1.1875 + Return a pointer to a specified interface extension - to allow future extension of this class without breaking
1.1876 + binary compatibility.
1.1877 + @param aInterfaceId Interface identifier of the interface to be retrieved.
1.1878 + @param aInterface A reference to a pointer that retrieves the specified interface.
1.1879 + @param aInput An arbitrary input argument.
1.1880 + @return KErrNone If the interface is supported, KErrNotSupported otherwise.
1.1881 + */
1.1882 + IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
1.1883 +
1.1884 + // calls GetInterface() with tracepoints added
1.1885 + TInt GetInterfaceTraced(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
1.1886 +
1.1887 +
1.1888 + enum TInterfaceIds
1.1889 + {
1.1890 + EBlockMapInterface = 0,
1.1891 + EGetLocalDrive = 1,
1.1892 + EExtendedFileInterface
1.1893 + };
1.1894 +
1.1895 + TUint64 MaxSupportedSize(void) const;
1.1896 +
1.1897 +
1.1898 + inline TFileLocksArray& FileLocks();
1.1899 +
1.1900 +
1.1901 +
1.1902 +private:
1.1903 +
1.1904 + void DemoteShare(CFileShare* aFileShare);
1.1905 + void PromoteShare(CFileShare* aFileShare);
1.1906 +
1.1907 + RArray<TAsyncReadRequest>& AsyncReadRequests();
1.1908 + TInt AddAsyncReadRequest(CFileShare* aFileShareP, TInt64 aPos, TInt aLength, CFsRequest* aRequestP);
1.1909 + void NotifyAsyncReaders();
1.1910 +
1.1911 +protected:
1.1912 +
1.1913 + /**
1.1914 + Inititally, the mode that the file was opened with, which defines the level
1.1915 + of access allowed to the file. Set by the TDrive object
1.1916 + (representing the drive on which the file resides) when the file
1.1917 + control block is created.
1.1918 + */
1.1919 + TShare iShare;
1.1920 +
1.1921 +
1.1922 + /**
1.1923 + The size of the file. This is the low 32 bit part of the file size.
1.1924 + The upper 32 bit part of the file size is saved on the file server side
1.1925 + for File Systems supporting file size > 4GB - 1.
1.1926 + File Systems supporting file size > 4GB - 1 shall use CFileCB::Size64()
1.1927 + to query the file size and CFileCB::SetSize64() to set file size.
1.1928 + */
1.1929 + TInt iSize;
1.1930 +
1.1931 +
1.1932 + /**
1.1933 + The attributes of the file.
1.1934 + */
1.1935 + TInt iAtt;
1.1936 +
1.1937 +
1.1938 + /**
1.1939 + The universal time at which the file was last modified.
1.1940 + */
1.1941 + TTime iModified;
1.1942 +
1.1943 +
1.1944 + /**
1.1945 + Indicates whether the file that the object represents is corrupt:
1.1946 + true if it is corrupt, false otherwise.
1.1947 + */
1.1948 + TBool iFileCorrupt;
1.1949 +
1.1950 +
1.1951 + /**
1.1952 + Indicates whether a recent access to the file that the object represents
1.1953 + failed due to KErrBadPower.
1.1954 + */
1.1955 + TBool iBadPower;
1.1956 +
1.1957 +public:
1.1958 +
1.1959 + /**
1.1960 + The full name of the file, including drive and extensions.
1.1961 + */
1.1962 + HBufC* iFileName;
1.1963 +
1.1964 + /**
1.1965 + The full name of the file, including drive and extensions - Folded.
1.1966 + */
1.1967 + HBufC* iFileNameF;
1.1968 +
1.1969 +private:
1.1970 + TUint32 iNameHash;
1.1971 + TDrive* iCreatedDrive;
1.1972 + TDrive* iDrive;
1.1973 + CMountCB* iMount;
1.1974 + TFileLocksArray* iFileLocks; ///< an array of file position locks
1.1975 + TDblQueLink iMountLink;
1.1976 +
1.1977 +private:
1.1978 + CFileBody* iBody;
1.1979 +
1.1980 + friend class TDrive;
1.1981 + friend class CMountCB;
1.1982 + friend class CFileShare;
1.1983 + friend class TFsFileRead;
1.1984 + friend class TFsFileWrite;
1.1985 + friend class TFsFileSetSize;
1.1986 + friend class TFsFileReadCancel;
1.1987 + friend class TFsFileDuplicate;
1.1988 + friend class TFsFileRename;
1.1989 + friend class CCompFileCB;
1.1990 + friend class CFileCache;
1.1991 + };
1.1992 +
1.1993 +
1.1994 +/**
1.1995 +Helper class to construct a dummy RMessage2 object. This allows the file server to
1.1996 +read and write local buffers to a file system's CFileCB-derived interface.
1.1997 +
1.1998 +@internalTechnology
1.1999 +*/
1.2000 +class RLocalMessage : public RMessage2
1.2001 + {
1.2002 +public:
1.2003 + inline RLocalMessage();
1.2004 +
1.2005 + inline void InitHandle();
1.2006 + inline void SetFunction(TInt aFunction);
1.2007 + inline void SetArgs(TIpcArgs& aArgs);
1.2008 + inline TInt Arg(TInt aIndex) const;
1.2009 + };
1.2010 +
1.2011 +
1.2012 +/**
1.2013 +@publishedPartner
1.2014 +@released
1.2015 +
1.2016 +A file server interface class representing an open file that is being shared.
1.2017 +For example multiple reading of the same file.
1.2018 +
1.2019 +@see CFileCB
1.2020 +@see TFileMode
1.2021 +*/
1.2022 +NONSHARABLE_CLASS(CFileShare) : public CFsDispatchObject
1.2023 + {
1.2024 +public:
1.2025 + CFileShare(CFileCB* aFileCB);
1.2026 + ~CFileShare();
1.2027 + TInt CheckMount();
1.2028 + void InitL();
1.2029 + inline CFileCB& File();
1.2030 +
1.2031 + // For serialising aync requests
1.2032 + TBool RequestStart(CFsMessageRequest* aRequest);
1.2033 + void RequestEnd(CFsMessageRequest* aRequest);
1.2034 + TBool RequestInProgress() const;
1.2035 + inline TBool IsFileModeBig();
1.2036 +
1.2037 +public:
1.2038 + /**
1.2039 + File share mode. The mode in which the file was opened first.
1.2040 + @see TFileMode.
1.2041 + */
1.2042 + TUint iMode;
1.2043 + /**
1.2044 + Current file position. This is the position at which reading and writing takes place.
1.2045 + */
1.2046 + TInt64 iPos;
1.2047 + /**
1.2048 + Error condition due to flush.
1.2049 + */
1.2050 + TInt iFlushError;
1.2051 +private:
1.2052 + CFileCB* iFile;
1.2053 +
1.2054 + // A pointer to the current request. Used for serializing client
1.2055 + // async read/write requests which might otherwise be processed out
1.2056 + // of order due to fair scheduling
1.2057 + CFsMessageRequest* iCurrentRequest;
1.2058 + };
1.2059 +
1.2060 +
1.2061 +
1.2062 +
1.2063 +/**
1.2064 +@publishedPartner
1.2065 +@released
1.2066 +
1.2067 +A file server interface class representing an open directory
1.2068 +
1.2069 +An instance of this object is referred to as a directory control block.
1.2070 +
1.2071 +A directory control block must be created for a specific directory to access
1.2072 +that directory within a volume.
1.2073 +
1.2074 +A plug-in file system implements this class.
1.2075 +*/
1.2076 +class CDirCB : public CFsDispatchObject
1.2077 + {
1.2078 +public:
1.2079 + IMPORT_C CDirCB();
1.2080 + IMPORT_C ~CDirCB();
1.2081 + TInt CheckMount();
1.2082 + IMPORT_C void InitL(TDrive* aDrive);
1.2083 + inline void SetMount(CMountCB * aMount){iMount=aMount;};
1.2084 + inline TDrive& Drive() const;
1.2085 + inline CMountCB& Mount() const;
1.2086 + inline TBool Pending() const;
1.2087 + inline void SetPending(TBool aPending);
1.2088 +
1.2089 +
1.2090 + /**
1.2091 + Gets information from the first suitable entry in the directory,
1.2092 + starting from the current read position.
1.2093 +
1.2094 + The function should read successive entries until a suitable entry is found.
1.2095 + An entry is suitable if the entry attributes match the criteria set by this
1.2096 + object's attributes, which are set on initialisation.
1.2097 + For example, if the directory control block has the attribute
1.2098 + KEntryAttMaskSupported, and the file has the attribute KEntryAttVolume,
1.2099 + then the entry will be deemed unsuitable and the next entry will be read.
1.2100 +
1.2101 + This function is called by the file server.
1.2102 +
1.2103 + If, on return, the entry's full file name, TEntry::iName, is longer than
1.2104 + the maximum buffer size, then the entry cannot be returned to the client.
1.2105 + In this case the file server will set iPending to true and will call
1.2106 + StoreLongEntryName() before calling this function again.
1.2107 + In this case (when iPending is true), the function should re-read
1.2108 + the last entry to be read; it should also set iPending to false and
1.2109 + should not advance the current read position.
1.2110 +
1.2111 + The time stored in the iModified member of anEntry should not be converted,
1.2112 + but left as UTC time.
1.2113 +
1.2114 + When storing the iName member of anEntry, the current (.),
1.2115 + or parent marker (..) in the directory should not be returned.
1.2116 +
1.2117 + If the KEntryAttAllowUid flag is set in the iAtt member of anEntry, then
1.2118 + the entry UID type of an entry will be read. If, on reading the UID from
1.2119 + a file, KErrCorrupt is generated, because the file is corrupt,
1.2120 + ReadL() should not leave with this error message, but should return
1.2121 + as normal.
1.2122 + If any other errors are raised the function should leave.
1.2123 +
1.2124 + All of the properties of a TEntry, other than the UID types, are always read.
1.2125 +
1.2126 + ReadL() should leave with a suitable error code if it cannot complete
1.2127 + successfully for any reason.
1.2128 +
1.2129 + @param anEntry Entry information object.
1.2130 + */
1.2131 + virtual void ReadL(TEntry& anEntry) =0;
1.2132 +
1.2133 +public:
1.2134 + IMPORT_C virtual void StoreLongEntryNameL(const TDesC& aName);
1.2135 +
1.2136 +protected:
1.2137 + /**
1.2138 + Return a pointer to a specified interface extension - to allow future extension of this class without breaking
1.2139 + binary compatibility.
1.2140 + @param aInterfaceId Interface identifier of the interface to be retrieved.
1.2141 + @param aInterface A reference to a pointer that retrieves the specified interface.
1.2142 + @param aInput An arbitrary input argument.
1.2143 + @return KErrNone If the interface is supported, KErrNotSupported otherwise.
1.2144 + */
1.2145 + IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
1.2146 +
1.2147 +protected:
1.2148 + /**
1.2149 + Bitmask of the attributes of interest.
1.2150 +
1.2151 + Set using the the TDrive friend class instance representing
1.2152 + the directory's drive after the object is made.
1.2153 + */
1.2154 + TUint iAtt;
1.2155 +
1.2156 +
1.2157 + /**
1.2158 + Set after construction using the TDrive friend class instance representing
1.2159 + the directory's drive.
1.2160 + */
1.2161 + TUidType iUidType;
1.2162 +
1.2163 +
1.2164 + /**
1.2165 + Flag to indicate whether preceding entry details should be returned when
1.2166 + multiple entries are being read.
1.2167 + */
1.2168 + TBool iPending;
1.2169 + friend class TDrive;
1.2170 +private:
1.2171 + TDrive* iDrive;
1.2172 + CMountCB* iMount;
1.2173 + TUint32 iReserved; // Reserved for future expansion
1.2174 + };
1.2175 +
1.2176 +
1.2177 +
1.2178 +
1.2179 +class CFormatCBBody;
1.2180 +
1.2181 +/**
1.2182 +@publishedPartner
1.2183 +@released
1.2184 +
1.2185 +A file server interface class representing a format operation on a disk.
1.2186 +
1.2187 +An instance of this object is referred to as a format control block.
1.2188 +
1.2189 +The type of format operation to be applied depends on the type of disk,
1.2190 +and is stored in iMode. Each format operation has a number of steps and
1.2191 +is kept track of using iCurrentStep.
1.2192 +
1.2193 +A format control block needs to be created for a specific mount control block
1.2194 +for the disk controlled via that mount to be formatted.
1.2195 +
1.2196 +A plug-in file system provides an implementation of this class.
1.2197 +*/
1.2198 +
1.2199 +class CFormatCB : public CFsDispatchObject
1.2200 + {
1.2201 +public:
1.2202 + IMPORT_C CFormatCB();
1.2203 + IMPORT_C ~CFormatCB();
1.2204 + IMPORT_C TInt CheckMount();
1.2205 +
1.2206 + void InitL(TDrive* aDrive, TFormatMode aMode);
1.2207 +
1.2208 + void SetFormatParameters(const TLDFormatInfo* apLDFormatInfo);
1.2209 + TInt SetFormatParameters(const TVolFormatParam* apVolFormatParam);
1.2210 +
1.2211 +
1.2212 + inline TDrive& Drive() const;
1.2213 + inline CMountCB& Mount() const;
1.2214 + inline TFormatMode Mode() const;
1.2215 + inline TInt& CurrentStep();
1.2216 +
1.2217 + /**
1.2218 + Performs a formatting step on the drive.
1.2219 +
1.2220 + The step performed should depend on the values of iMode and iCurrentStep.
1.2221 +
1.2222 + It can be assumed that there are no resources open on the mount,
1.2223 + that the media is formattable, and that the media is not write protected.
1.2224 +
1.2225 + If iMode == EQuickFormat, then only meta data is to be written.
1.2226 + This should be carried out in a single step, with iCurrentStep set
1.2227 + to zero on completion.
1.2228 +
1.2229 + If iMode != EQuickFormat, then the format step performed by
1.2230 + this function should depend on iCurrentStep. When the function
1.2231 + returns with iCurrentStep set to zero, the formatting of the drive is complete.
1.2232 +
1.2233 + On error detection, the function should leave with an appropriate error code.
1.2234 +
1.2235 + @see CFormatCB::iMode
1.2236 + @see CFormatCB::iCurrentStep
1.2237 + */
1.2238 + virtual void DoFormatStepL() =0;
1.2239 +
1.2240 +protected:
1.2241 +
1.2242 + /** Enumeration of the aInterfaceIDs used in GetInterface */
1.2243 + enum TInterfaceIds
1.2244 + {
1.2245 + ESetFmtParameters = 1, ///< used in implementation of SetFormatParameters(const TVolFormatParam* apVolFormatParam)
1.2246 + };
1.2247 +
1.2248 +
1.2249 +
1.2250 + /**
1.2251 + Return a pointer to a specified interface extension - to allow future extension of this class without breaking
1.2252 + binary compatibility.
1.2253 + @param aInterfaceId Interface identifier of the interface to be retrieved.
1.2254 + @param aInterface A reference to a pointer that retrieves the specified interface.
1.2255 + @param aInput An arbitrary input argument.
1.2256 + @return KErrNone If the interface is supported, KErrNotSupported otherwise.
1.2257 + */
1.2258 + IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
1.2259 +
1.2260 +protected:
1.2261 +
1.2262 + TInt iCurrentStep; ///< current format step counter 100...0
1.2263 + TFormatMode iMode; ///< Format mode. This is set by the file server when this objetc is instantiated.
1.2264 + TSpecialFormatInfoBuf iSpecialInfo; ///< Buffer containing user-specified format parameters.
1.2265 +
1.2266 +private:
1.2267 +
1.2268 + TDrive* iDrive;
1.2269 + CMountCB* iMount; ///< parent Mount
1.2270 + CFormatCBBody* iBody; ///< additional data holder
1.2271 + };
1.2272 +
1.2273 +
1.2274 +
1.2275 +
1.2276 +/**
1.2277 +@publishedPartner
1.2278 +@released
1.2279 +
1.2280 +A file server interface class representing a raw disk.
1.2281 +
1.2282 +An instance of this object is referred to as a raw disk control block.
1.2283 +
1.2284 +This is not an abstract base class and does not need to be derived from
1.2285 +when implementing a file system. This is because direct disk access is
1.2286 +implemented by the file server directly calling RawReadL() and RawWriteL()
1.2287 +from the derived CMountCB object of the file system.
1.2288 +*/
1.2289 +NONSHARABLE_CLASS(CRawDiskCB) : public CFsDispatchObject
1.2290 + {
1.2291 +public:
1.2292 + CRawDiskCB();
1.2293 + ~CRawDiskCB();
1.2294 + void InitL(CMountCB* aMount,TBool aIsWriteProtected);
1.2295 + inline CMountCB& Mount();
1.2296 + inline TDrive& Drive();
1.2297 + inline TBool IsWriteProtected() const;
1.2298 + inline void SetChanged();
1.2299 +private:
1.2300 + enum { EWriteProtected = 1, EChanged = 2 };
1.2301 + inline void SetWriteProtected();
1.2302 + inline TBool IsChanged() const;
1.2303 +private:
1.2304 + CMountCB* iMount;
1.2305 + TUint32 iFlags;
1.2306 + };
1.2307 +
1.2308 +
1.2309 +class CFileSystemBody;
1.2310 +
1.2311 +/**
1.2312 +@publishedPartner
1.2313 +@released
1.2314 +
1.2315 +A file server interface class, representing the factory class for a file system.
1.2316 +
1.2317 +A plug-in file system implements this class.
1.2318 +
1.2319 +Creates objects derived from CMountCB, CFileCB, CDirCB and CFormatCB.
1.2320 +
1.2321 +@see CMountCB
1.2322 +@see CFileCB
1.2323 +@see CDirCB
1.2324 +@see CFormatCB
1.2325 +*/
1.2326 +class CFileSystem : public CFsObject
1.2327 + {
1.2328 +public:
1.2329 + IMPORT_C CFileSystem();
1.2330 + IMPORT_C ~CFileSystem();
1.2331 + IMPORT_C virtual TInt Remove();
1.2332 + IMPORT_C virtual TBool QueryVersionSupported(const TVersion& aVer) const;
1.2333 + IMPORT_C virtual TBool IsExtensionSupported() const;
1.2334 + IMPORT_C TBool IsProxyDriveSupported();
1.2335 + IMPORT_C void SetLibrary(RLibrary aLib);
1.2336 + IMPORT_C RLibrary Library() const;
1.2337 +// Pure virtual
1.2338 +
1.2339 +
1.2340 + /**
1.2341 + Installs the file system.
1.2342 +
1.2343 + The function should set the name of the file system object through a call
1.2344 + to CObject::SetName(), thus making it accessible, internally,
1.2345 + using FileSystems->FindByFullName(). This enables the file server
1.2346 + to find and handle installed file systems.
1.2347 + The function should also set the file system version.
1.2348 + The version is determined by the file system implementation.
1.2349 + It is used in calls to CFileSystem::QueryVersionSupported().
1.2350 +
1.2351 + This function is called as a result of a call to RFs::AddFileSystem().
1.2352 +
1.2353 + @return KErrNone if succesful; otherwise one of the other system-wide error
1.2354 + codes.
1.2355 +
1.2356 + @see RFs::AddFileSystem
1.2357 + @see CObject::SetName
1.2358 + @see RFs
1.2359 + @see CObject
1.2360 + */
1.2361 + virtual TInt Install() =0;
1.2362 +
1.2363 +
1.2364 + /**
1.2365 + Creates a new mount control block, a CMountCB derived object.
1.2366 +
1.2367 + On success, a pointer to the new mount object should be returned,
1.2368 + otherwise the function should leave.
1.2369 +
1.2370 + @return A pointer to the new mount object.
1.2371 +
1.2372 + @see CMountCB
1.2373 + */
1.2374 + virtual CMountCB* NewMountL() const =0;
1.2375 +
1.2376 +
1.2377 + /**
1.2378 + Creates a new file control block, i.e. a CFileCB derived object.
1.2379 +
1.2380 + On success, a pointer to the new file object should be returned,
1.2381 + otherwise the function should leave.
1.2382 +
1.2383 + @return A pointer to the new file object.
1.2384 +
1.2385 + @see CFileCB
1.2386 + */
1.2387 + virtual CFileCB* NewFileL() const =0;
1.2388 +
1.2389 +
1.2390 + /**
1.2391 + Creates a new directory control block, i.e. a CDirCB derived object.
1.2392 +
1.2393 + On success, a pointer to the new directory control block should be returned,
1.2394 + otherwise the function should leave.
1.2395 +
1.2396 + @return A pointer to the new directory object.
1.2397 +
1.2398 + @see CDirCB
1.2399 + */
1.2400 + virtual CDirCB* NewDirL() const =0;
1.2401 +
1.2402 +
1.2403 + /**
1.2404 + Creates a new volume format control block, i.e. a CFormatCB derived object.
1.2405 +
1.2406 + On success, a pointer to the new volume format control block should be returned,
1.2407 + otherwise the function should leave.
1.2408 +
1.2409 + @return A pointer to the new volume format object.
1.2410 +
1.2411 + @see CFormatCB
1.2412 + */
1.2413 + virtual CFormatCB* NewFormatL() const =0;
1.2414 +
1.2415 +
1.2416 + /**
1.2417 + Retrieves drive information.
1.2418 +
1.2419 + The function should set anInfo.iMediaAtt and anInfo.iType according to
1.2420 + the specified drive number.
1.2421 +
1.2422 + Note that anInfo.iDriveAtt will already have been set by the calling
1.2423 + function.
1.2424 +
1.2425 + The function can obtain the necessary information by calling
1.2426 + the appropriate TBusLocalDrive::Caps() function using the argument aDriveNumber.
1.2427 +
1.2428 + @param anInfo On return, contains the drive information.
1.2429 + @param aDriveNumber The drive number.
1.2430 + */
1.2431 + IMPORT_C virtual void DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const;
1.2432 +
1.2433 + virtual TInt DefaultPath(TDes& aPath) const;
1.2434 +
1.2435 + /** Enumeration of the aInterfaceIDs used in GetInterface.*/
1.2436 + enum TInterfaceIds
1.2437 + {
1.2438 + EProxyDriveSupport = 0,
1.2439 + EExtendedFunctionality, ///< corresponds to MFileSystemExtInterface
1.2440 + };
1.2441 +
1.2442 + /** This is interface corresponds to the extended CFileSystem functionality*/
1.2443 + class MFileSystemExtInterface
1.2444 + {
1.2445 + public:
1.2446 + virtual CMountCB* NewMountExL(TDrive* apDrive, CFileSystem** apFileSystem, TBool aForceMount, TUint32 aFsNameHash) = 0;
1.2447 + virtual TInt GetSupportedFileSystemName(TInt aFsNumber, TDes& aFsName) const = 0;
1.2448 +
1.2449 + };
1.2450 +
1.2451 +public:
1.2452 + CMountCB* NewMountExL(TDrive* apDrive, CFileSystem** apFileSystem, TBool aForceMount, TUint32 aFsNameHash);
1.2453 + TInt GetSupportedFileSystemName(TInt aFsNumber, TDes& aFsName);
1.2454 +
1.2455 +
1.2456 +protected:
1.2457 + /**
1.2458 + Return a pointer to a specified interface extension - to allow future extension of this class without breaking
1.2459 + binary compatibility.
1.2460 + @param aInterfaceId Interface identifier of the interface to be retrieved.
1.2461 + @param aInterface A reference to a pointer that retrieves the specified interface.
1.2462 + @param aInput An arbitrary input argument.
1.2463 + @return KErrNone If the interface is supported, KErrNotSupported otherwise.
1.2464 + */
1.2465 + IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
1.2466 +
1.2467 +protected:
1.2468 + TVersion iVersion;
1.2469 +private:
1.2470 + RLibrary iLibrary; ///< *.fsy file system plugin dll handle
1.2471 + CFileSystemBody* iBody; ///< extension of this class, used to provide extended functionality w/o changing this class size (BC issue)
1.2472 +
1.2473 +friend class TDrive;
1.2474 +
1.2475 + };
1.2476 +
1.2477 +
1.2478 +
1.2479 +
1.2480 +/**
1.2481 +@publishedPartner
1.2482 +@released
1.2483 +
1.2484 +Base abstract class.
1.2485 +Interface between a local plugin file system and a media subsystem.
1.2486 +
1.2487 +@see CLocalProxyDrive
1.2488 +@see CBaseExtProxyDrive
1.2489 +*/
1.2490 +class CProxyDrive : public CBase
1.2491 + {
1.2492 +public:
1.2493 + CProxyDrive(CMountCB* aMount);
1.2494 + ~CProxyDrive();
1.2495 + inline CMountCB* Mount() const;
1.2496 + inline void SetMount(CMountCB *aMount);
1.2497 +// virtual
1.2498 + IMPORT_C virtual TInt ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2);
1.2499 + IMPORT_C virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt aOffset,TInt aFlags);
1.2500 + IMPORT_C virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset,TInt aFlags);
1.2501 + IMPORT_C virtual TInt DeleteNotify(TInt64 aPos, TInt aLength);
1.2502 + IMPORT_C virtual TInt GetLastErrorInfo(TDes8& aErrorInfo);
1.2503 +
1.2504 + inline TInt LocalBufferSupport();
1.2505 +
1.2506 +// pure virtual
1.2507 +
1.2508 + /**
1.2509 + Initialise the proxy drive.
1.2510 +
1.2511 + Derived class must provide an implementation for it.
1.2512 +
1.2513 + @return KErrNone if successful, otherwise one of the system-wide error codes.
1.2514 + */
1.2515 + virtual TInt Initialise()=0;
1.2516 +
1.2517 + /**
1.2518 + It invokes Dismounted() on the proxy drive.
1.2519 +
1.2520 + Derived class must provide an implementation for it.
1.2521 +
1.2522 + @return KErrNone if successful, otherwise one of the system-wide error codes.
1.2523 + */
1.2524 + virtual TInt Dismounted()=0;
1.2525 +
1.2526 + /**
1.2527 + Increase the size of the proxy drive by the specified length (in bytes).
1.2528 +
1.2529 + Derived class must provide an implementation for it.
1.2530 +
1.2531 + @param aLength The length (in bytes) of which the drive is to be increased by.
1.2532 +
1.2533 + @return KErrNone if successful, otherwise one of the system-wide error codes.
1.2534 + */
1.2535 + virtual TInt Enlarge(TInt aLength)=0;
1.2536 +
1.2537 + /**
1.2538 + Reduce the size of the proxy drive by removing the specified length
1.2539 + (in bytes) starting at the specified position.
1.2540 +
1.2541 + Derived class must provide an implementation for it.
1.2542 +
1.2543 + @param aPos The start position of area to be removed.
1.2544 + @param aLength The length/size (in bytes) by which the drive is to be reduced.
1.2545 +
1.2546 + @return System-wide error codes based on the status of the operation.
1.2547 + */
1.2548 + virtual TInt ReduceSize(TInt aPos, TInt aLength)=0;
1.2549 +
1.2550 + /**
1.2551 + Read from the proxy drive.
1.2552 +
1.2553 + Derived class must provide an implementation for it.
1.2554 +
1.2555 + @param aPos The address from where the read begins.
1.2556 + @param aLength The length of the read.
1.2557 + @param aTrg A descriptor of the memory buffer from which to read.
1.2558 + @param aThreadHandle The handle-number representing the drive thread.
1.2559 + @param aOffset Offset into aTrg to read the data from.
1.2560 +
1.2561 + @return System-wide error codes based on the status of the operation.
1.2562 + */
1.2563 + virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset)=0;
1.2564 +
1.2565 + /**
1.2566 + Read from the proxy drive.
1.2567 +
1.2568 + Derived class must provide an implementation for it.
1.2569 +
1.2570 + @param aPos The address from where the read begins.
1.2571 + @param aLength The length of the read.
1.2572 + @param aTrg A descriptor of the memory buffer from which to read.
1.2573 +
1.2574 + @return System-wide error codes based on the status of the operation.
1.2575 + */
1.2576 + virtual TInt Read(TInt64 aPos,TInt aLength,TDes8& aTrg)=0;
1.2577 +
1.2578 + /**
1.2579 + Write to the proxy drive.
1.2580 +
1.2581 + Derived class must provide an implementation for it.
1.2582 +
1.2583 + @param aPos The address from where the write begins.
1.2584 + @param aLength The length of the write.
1.2585 + @param aSrc A descriptor of the memory buffer from which to write.
1.2586 + @param aThreadHandle The handle-number representing the drive thread.
1.2587 + @param aOffset Offset into aSrc to write the data to.
1.2588 +
1.2589 + @return System-wide error codes based on the status of the operation.
1.2590 + */
1.2591 + virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset)=0;
1.2592 +
1.2593 + /**
1.2594 + Write to the proxy drive.
1.2595 +
1.2596 + Derived class must provide an implementation for it.
1.2597 +
1.2598 + @param aPos The address from where the write begins.
1.2599 + @param aSrc A descriptor of the memory buffer from which to write.
1.2600 +
1.2601 + @return System-wide error codes based on the status of the operation.
1.2602 + */
1.2603 + virtual TInt Write(TInt64 aPos,const TDesC8& aSrc)=0;
1.2604 +
1.2605 + /**
1.2606 + Get the proxy drive's capabilities information.
1.2607 +
1.2608 + Derived class must provide an implementation for it.
1.2609 +
1.2610 + @param anInfo A descriptor of the connected drives capabilities.
1.2611 +
1.2612 + @return System-wide error codes based on the status of the operation.
1.2613 + */
1.2614 + virtual TInt Caps(TDes8& anInfo)=0;
1.2615 +
1.2616 + /**
1.2617 + Format the connected drive.
1.2618 +
1.2619 + Derived class must provide an implementation for it.
1.2620 +
1.2621 + @param anInfo Device specific format information.
1.2622 +
1.2623 + @return System-wide error codes based on the status of the operation.
1.2624 + */
1.2625 + virtual TInt Format(TFormatInfo& anInfo)=0;
1.2626 +
1.2627 + /**
1.2628 + Format the proxy drive.
1.2629 +
1.2630 + Derived class must provide an implementation for it.
1.2631 +
1.2632 + @param aPos The position of the data which is being formatted.
1.2633 + @param aLength The length of the data which is being formatted.
1.2634 +
1.2635 + @return System-wide error codes based on the status of the operation.
1.2636 + */
1.2637 + virtual TInt Format(TInt64 aPos,TInt aLength)=0;
1.2638 +
1.2639 + /**
1.2640 + Set the mount information on the proxy drive.
1.2641 +
1.2642 + Derived class must provide an implementation for it.
1.2643 +
1.2644 + @param aMountInfo Information passed down to the media driver.
1.2645 + The meaning of this information depends on the media driver.
1.2646 + @param aMountInfoThreadHandle Message thread handle number.
1.2647 +
1.2648 + @return System-wide error codes based on the status of the operation.
1.2649 + */
1.2650 + virtual TInt SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle=KCurrentThreadHandle)=0;
1.2651 +
1.2652 + /**
1.2653 + Forces a remount on the proxy drive
1.2654 +
1.2655 + Derived class must provide an implementation for it.
1.2656 +
1.2657 + @param aFlags Flags to be passed into the driver.
1.2658 +
1.2659 + @return System-wide error codes based on the status of the operation.
1.2660 + */
1.2661 + virtual TInt ForceRemount(TUint aFlags=0)=0;
1.2662 +
1.2663 + /**
1.2664 + Unlocks a password-enabled proxy drive.
1.2665 +
1.2666 + Derived class must provide an implementation for it.
1.2667 +
1.2668 + @param aPassword A descriptor containing the existing password.
1.2669 + @param aStorePassword If ETrue, the password is added to the password store.
1.2670 +
1.2671 + @return System-wide error codes based on the status of the operation.
1.2672 + */
1.2673 + virtual TInt Unlock(TMediaPassword &aPassword, TBool aStorePassword)=0;
1.2674 +
1.2675 + /**
1.2676 + Locks a password-enabled proxy drive with the new password.
1.2677 +
1.2678 + Derived class must provide an implementation for it.
1.2679 +
1.2680 + @param aOldPassword A descriptor containing the existing password.
1.2681 + @param aNewPassword A descriptor containing the new password.
1.2682 + @param aStorePassword If ETrue, the password is added to the password store.
1.2683 +
1.2684 + @return System-wide error codes based on the status of the operation.
1.2685 + */
1.2686 + virtual TInt Lock(TMediaPassword &aOldPassword, TMediaPassword &aNewPassword, TBool aStorePassword)=0;
1.2687 +
1.2688 + /**
1.2689 + Clears a password from a proxy drive - controller sets password to null.
1.2690 +
1.2691 + Derived class must provide an implementation for it.
1.2692 +
1.2693 + @param aPassword A descriptor containing the password.
1.2694 +
1.2695 + @return System-wide error codes based on the status of the operation.
1.2696 + */
1.2697 + virtual TInt Clear(TMediaPassword &aPassword)=0;
1.2698 +
1.2699 + /**
1.2700 + Forcibly unlock a password-enabled proxy drive.
1.2701 +
1.2702 + Derived class must provide an implementation for it.
1.2703 +
1.2704 + @return System-wide error codes based on the status of the operation.
1.2705 + */
1.2706 + virtual TInt ErasePassword()=0;
1.2707 +
1.2708 +// implementation using GetInterface(..)
1.2709 + enum TInterfaceIds
1.2710 + {
1.2711 + EGetLocalDrive,
1.2712 + ELocalBufferSupport,
1.2713 + EGetProxyDrive,
1.2714 + EFinalised,
1.2715 + };
1.2716 +
1.2717 + /**
1.2718 + Retrieves TBusLocalDrive object associated with the file.
1.2719 +
1.2720 + @return System-wide error codes based on the status of the operation.
1.2721 + */
1.2722 + IMPORT_C TInt GetLocalDrive(TBusLocalDrive*& aLocDrv);
1.2723 +
1.2724 + /**
1.2725 + Informs the extension that the mount has been finalised and is in a consistent state.
1.2726 +
1.2727 + @return System-wide error codes based on the status of the operation.
1.2728 +
1.2729 + @internalTechnology
1.2730 + */
1.2731 + IMPORT_C TInt Finalise(TBool aFinalised);
1.2732 +
1.2733 +protected:
1.2734 + /**
1.2735 + Return a pointer to a specified interface extension - to allow future extension of this class without breaking
1.2736 + binary compatibility.
1.2737 +
1.2738 + @param aInterfaceId Interface identifier of the interface to be retrieved.
1.2739 + @param aInterface A reference to a pointer that retrieves the specified interface.
1.2740 + @param aInput An arbitrary input argument.
1.2741 +
1.2742 + @return KErrNone If the interface is supported, KErrNotSupported otherwise.
1.2743 + */
1.2744 + IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
1.2745 +
1.2746 +private:
1.2747 + CMountCB* iMount;
1.2748 + TUint32 iReserved; // Reserved for future expansion
1.2749 + };
1.2750 +
1.2751 +
1.2752 +
1.2753 +
1.2754 +/**
1.2755 +@publishedPartner
1.2756 +@released
1.2757 +
1.2758 +Local drive specific mount control block.
1.2759 +*/
1.2760 +class CLocDrvMountCB : public CMountCB
1.2761 + {
1.2762 +public:
1.2763 + IMPORT_C CLocDrvMountCB();
1.2764 + IMPORT_C ~CLocDrvMountCB();
1.2765 + IMPORT_C TInt CreateLocalDrive(TBusLocalDrive& aLocDrv);
1.2766 + IMPORT_C TInt CreateDrive(TInt aDriveNumber);
1.2767 + IMPORT_C TInt InitLocalDrive();
1.2768 + IMPORT_C void DismountedLocalDrive();
1.2769 + inline CProxyDrive* LocalDrive() const;
1.2770 +
1.2771 +private:
1.2772 + CProxyDrive* iProxyDrive;
1.2773 + };
1.2774 +
1.2775 +
1.2776 +
1.2777 +
1.2778 +
1.2779 +/**
1.2780 +@publishedPartner
1.2781 +@released
1.2782 +
1.2783 +Local drive specific proxy drive interface.
1.2784 +Class passes commands directly to TBusLocalDrive.
1.2785 +
1.2786 +@see CProxyDrive
1.2787 +*/
1.2788 +NONSHARABLE_CLASS(CLocalProxyDrive) : public CProxyDrive
1.2789 + {
1.2790 +public:
1.2791 + static CLocalProxyDrive* New(CMountCB* aMount,TBusLocalDrive& aLocDrv);
1.2792 +// virtual
1.2793 + virtual TInt Initialise();
1.2794 + virtual TInt Dismounted();
1.2795 + virtual TInt Enlarge(TInt aLength);
1.2796 + virtual TInt ReduceSize(TInt aPos, TInt aLength);
1.2797 + virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt aOffset, TInt aFlags);
1.2798 + virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset);
1.2799 + virtual TInt Read(TInt64 aPos,TInt aLength,TDes8& aTrg);
1.2800 + virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt aOffset,TInt aFlags);
1.2801 + virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset);
1.2802 + virtual TInt Write(TInt64 aPos,const TDesC8& aSrc);
1.2803 + virtual TInt Caps(TDes8& anInfo);
1.2804 + virtual TInt Format(TFormatInfo& anInfo);
1.2805 + virtual TInt Format(TInt64 aPos,TInt aLength);
1.2806 + virtual TInt SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle=KCurrentThreadHandle);
1.2807 + virtual TInt ForceRemount(TUint aFlags=0);
1.2808 + virtual TInt ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2);
1.2809 + virtual TInt Unlock(TMediaPassword &aPassword, TBool aStorePassword);
1.2810 + virtual TInt Lock(TMediaPassword &aOldPassword, TMediaPassword &aNewPassword, TBool aStorePassword);
1.2811 + virtual TInt Clear(TMediaPassword &aPassword);
1.2812 + virtual TInt ErasePassword();
1.2813 + virtual TInt DeleteNotify(TInt64 aPos, TInt aLength);
1.2814 + virtual TInt GetLastErrorInfo(TDes8& aErrorInfo);
1.2815 +protected:
1.2816 + virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
1.2817 +private:
1.2818 + CLocalProxyDrive(CMountCB* aMount,TBusLocalDrive& aLocDrv);
1.2819 +private:
1.2820 + TBusLocalDrive& iLocDrv;
1.2821 + };
1.2822 +
1.2823 +
1.2824 +
1.2825 +
1.2826 +/**
1.2827 +@publishedPartner
1.2828 +@released
1.2829 +
1.2830 +Media subsystem extensions must be derived from this specific class interface.
1.2831 +Objects of this type should be created through use of a derived CProxyDriveFactory class.
1.2832 +
1.2833 +Class passes commands directly to CProxyDrive.
1.2834 +
1.2835 +@see CProxyDrive
1.2836 +@see CProxyDriveFactory
1.2837 +*/
1.2838 +class CBaseExtProxyDrive : public CProxyDrive
1.2839 + {
1.2840 +public:
1.2841 + IMPORT_C CBaseExtProxyDrive(CProxyDrive* aProxyDrive, CMountCB* aMount);
1.2842 + IMPORT_C ~CBaseExtProxyDrive();
1.2843 + IMPORT_C virtual TInt Initialise();
1.2844 + IMPORT_C virtual TInt Dismounted();
1.2845 + IMPORT_C virtual TInt Enlarge(TInt aLength);
1.2846 + IMPORT_C virtual TInt ReduceSize(TInt aPos, TInt aLength);
1.2847 + IMPORT_C virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt aOffset,TInt aFlags);
1.2848 + IMPORT_C virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset);
1.2849 + IMPORT_C virtual TInt Read(TInt64 aPos,TInt aLength,TDes8& aTrg);
1.2850 + IMPORT_C virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt aOffset,TInt aFlags);
1.2851 + IMPORT_C virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset);
1.2852 + IMPORT_C virtual TInt Write(TInt64 aPos,const TDesC8& aSrc);
1.2853 + IMPORT_C virtual TInt Caps(TDes8& anInfo);
1.2854 + IMPORT_C virtual TInt Format(TFormatInfo& anInfo);
1.2855 + IMPORT_C virtual TInt Format(TInt64 aPos,TInt aLength);
1.2856 + IMPORT_C virtual TInt SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle=KCurrentThreadHandle);
1.2857 + IMPORT_C virtual TInt ForceRemount(TUint aFlags=0);
1.2858 + IMPORT_C virtual TInt Unlock(TMediaPassword &aPassword, TBool aStorePassword);
1.2859 + IMPORT_C virtual TInt Lock(TMediaPassword &aOldPassword, TMediaPassword &aNewPassword, TBool aStorePassword);
1.2860 + IMPORT_C virtual TInt Clear(TMediaPassword &aPassword);
1.2861 + IMPORT_C virtual TInt ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2);
1.2862 + IMPORT_C virtual TInt ErasePassword();
1.2863 + IMPORT_C virtual TInt GetLastErrorInfo(TDes8& aErrorInfo);
1.2864 + IMPORT_C virtual TInt DeleteNotify(TInt64 aPos, TInt aLength);
1.2865 + inline TInt LocalBufferSupport();
1.2866 +
1.2867 +protected:
1.2868 + /**
1.2869 + Return a pointer to a specified interface extension - to allow future extension of this class without breaking
1.2870 + binary compatibility.
1.2871 + @param aInterfaceId Interface identifier of the interface to be retrieved.
1.2872 + @param aInterface A reference to a pointer that retrieves the specified interface.
1.2873 + @param aInput An arbitrary input argument.
1.2874 + @return KErrNone If the interface is supported, KErrNotSupported otherwise.
1.2875 + */
1.2876 + IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
1.2877 +private:
1.2878 + CProxyDrive* iProxy;
1.2879 + };
1.2880 +
1.2881 +
1.2882 +
1.2883 +
1.2884 +/**
1.2885 +@publishedPartner
1.2886 +@released
1.2887 +
1.2888 +Abstract base class for Proxy drive factory classes.
1.2889 +
1.2890 +Class is used for the creation of media subsystem extensions CBaseExtProxyDrive.
1.2891 +
1.2892 +@see CBaseExtProxyDrive
1.2893 +*/
1.2894 +class CProxyDriveFactory : public CFsObject
1.2895 + {
1.2896 +public:
1.2897 + IMPORT_C CProxyDriveFactory();
1.2898 + IMPORT_C virtual TInt Remove();
1.2899 + inline void SetLibrary(RLibrary aLib);
1.2900 + inline RLibrary Library() const;
1.2901 +
1.2902 + /**
1.2903 + Installation of the factory object.
1.2904 + @return system wide error code
1.2905 + */
1.2906 + virtual TInt Install() =0;
1.2907 + /**
1.2908 + Instantiates a CProxyDrive object.
1.2909 + @param aProxy Proxy drive to be used.
1.2910 + @param aMount Mount control block.
1.2911 +
1.2912 + @return pointer to Instantiated CProxyDrive object.
1.2913 + */
1.2914 + virtual CProxyDrive* NewProxyDriveL(CProxyDrive* aProxy,CMountCB* aMount)=0;
1.2915 +private:
1.2916 + RLibrary iLibrary;
1.2917 + };
1.2918 +
1.2919 +
1.2920 +
1.2921 +/**
1.2922 +@internalTechnology
1.2923 +*/
1.2924 +class CExtProxyDriveFactory : public CFsObject
1.2925 + {
1.2926 +public:
1.2927 + IMPORT_C CExtProxyDriveFactory();
1.2928 + IMPORT_C virtual TInt Remove();
1.2929 + inline void SetLibrary(RLibrary aLib);
1.2930 + inline RLibrary Library() const;
1.2931 +// pure virtual
1.2932 + virtual TInt Install() =0;
1.2933 + virtual TInt CreateProxyDrive(CProxyDrive*& aMountProxyDrive, CMountCB* aMount)=0;
1.2934 +
1.2935 + IMPORT_C virtual void AsyncEnumerate();
1.2936 +
1.2937 +private:
1.2938 + RLibrary iLibrary;
1.2939 + };
1.2940 +
1.2941 +
1.2942 +/**
1.2943 +@internalTechnology
1.2944 +*/
1.2945 +class CExtProxyDrive : public CProxyDrive
1.2946 + {
1.2947 +public:
1.2948 + IMPORT_C CExtProxyDrive(CMountCB* aMount,CExtProxyDriveFactory* aDevice);
1.2949 + IMPORT_C ~CExtProxyDrive();
1.2950 +
1.2951 + IMPORT_C virtual TInt NotifyChange(TDes8 &aChanged, TRequestStatus* aStatus);
1.2952 + IMPORT_C virtual void NotifyChangeCancel();
1.2953 + IMPORT_C virtual TInt SetInfo(const RMessage2 &msg, TAny* aMessageParam2, TAny* aMessageParam3);
1.2954 +
1.2955 + inline TInt DriveNumber();
1.2956 + inline void SetDriveNumber(TInt aDrive);
1.2957 + inline CExtProxyDriveFactory* FactoryP();
1.2958 +
1.2959 +protected:
1.2960 + /**
1.2961 + Return a pointer to a specified interface extension - to allow future extension of this class without breaking
1.2962 + binary compatibility.
1.2963 + @param aInterfaceId Interface identifier of the interface to be retrieved.
1.2964 + @param aInterface A reference to a pointer that retrieves the specified interface.
1.2965 + @param aInput An arbitrary input argument.
1.2966 + @return KErrNone If the interface is supported, KErrNotSupported otherwise.
1.2967 + */
1.2968 + IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
1.2969 +
1.2970 + TInt SetupMediaChange();
1.2971 +
1.2972 +protected:
1.2973 + CExtProxyDriveFactory* iFactory;
1.2974 + TInt iDriveNumber;
1.2975 +
1.2976 +private:
1.2977 + CExtNotifyMediaChange* iMediaChangeNotifier;
1.2978 +
1.2979 + TUint32 iReserved[4]; // Reserved bytes for future expansion
1.2980 +
1.2981 + friend class LocalDrives;
1.2982 + };
1.2983 +
1.2984 +
1.2985 +/**
1.2986 +@internalTechnology
1.2987 +*/
1.2988 +NONSHARABLE_CLASS(CExtNotifyMediaChange) : public CActive
1.2989 + {
1.2990 +public:
1.2991 + static CExtNotifyMediaChange* NewL(CExtProxyDrive* aDrive);
1.2992 + ~CExtNotifyMediaChange();
1.2993 + void RequestL();
1.2994 +
1.2995 +private:
1.2996 + CExtNotifyMediaChange(CExtProxyDrive* aDrive);
1.2997 + void ConstructL();
1.2998 +
1.2999 + void DoCancel();
1.3000 + void RunL();
1.3001 +
1.3002 +private:
1.3003 + CExtProxyDrive* iDrive;
1.3004 + TPtr8 iPtr;
1.3005 + };
1.3006 +
1.3007 +/**
1.3008 +@publishedPartner
1.3009 +@released
1.3010 +
1.3011 +Gets the local bus drive.
1.3012 +
1.3013 +@param aLocalDrive The local drive number.
1.3014 +
1.3015 +@return The local bus drive.
1.3016 +*/
1.3017 +IMPORT_C TBusLocalDrive& GetLocalDrive(TInt aLocalDrive);
1.3018 +
1.3019 +/**
1.3020 +@internalTechnology
1.3021 +
1.3022 +Gets the proxy drive device for a given drive
1.3023 +
1.3024 +@param aLocalDrive The local drive number.
1.3025 +
1.3026 +@return The local bus drive.
1.3027 +*/
1.3028 +IMPORT_C CExtProxyDrive* GetProxyDrive(TInt aDrive);
1.3029 +
1.3030 +/**
1.3031 +@internalTechnology
1.3032 +
1.3033 +Gets the proxy drive for a given drive
1.3034 +
1.3035 +@param aLocalDrive The local drive number.
1.3036 +
1.3037 +@return The proxy drive
1.3038 +*/
1.3039 +IMPORT_C TInt GetProxyDrive(TInt aDrive, CProxyDrive*& aProxyDrive);
1.3040 +
1.3041 +/**
1.3042 +@internalTechnology
1.3043 +
1.3044 +Return ETrue if drive is actually a proxy instead of a local drive
1.3045 +
1.3046 +@param The drive number.
1.3047 +
1.3048 +@return ETrue if drive is actually a proxy instead of a local drive
1.3049 +*/
1.3050 +IMPORT_C TBool IsProxyDrive(TInt aDrive);
1.3051 +
1.3052 +/**
1.3053 +@publishedPartner
1.3054 +@released
1.3055 +
1.3056 +Checks a given drive number is mapped to a local drive.
1.3057 +
1.3058 +@param aDrive The local drive number.
1.3059 +
1.3060 +@return specified drive number is mapped to a local drive.
1.3061 +*/
1.3062 +IMPORT_C TBool IsValidLocalDriveMapping(TInt aDrive);
1.3063 +
1.3064 +/**
1.3065 +@internalTechnology
1.3066 +
1.3067 +Sets the media attributes and type in the anInfo parameter to those of the
1.3068 +specified drive.
1.3069 +
1.3070 +@param anInfo TDriveInfo object to store the drive information.
1.3071 +@param aDriveNumber The number of the drive to get the information from.
1.3072 +*/
1.3073 +IMPORT_C void GetDriveInfo(TDriveInfo& anInfo,TInt aDriveNumber);
1.3074 +
1.3075 +/**
1.3076 +@publishedPartner
1.3077 +@released
1.3078 +
1.3079 +Returns the local drive number for a given drive number.
1.3080 +
1.3081 +@param aDrive The drive number.
1.3082 +
1.3083 +@return KDriveInvalid if drive is not mapped to a local drive.
1.3084 + otherwise the local drive number.
1.3085 +*/
1.3086 +IMPORT_C TInt DriveNumberToLocalDriveNumber(TInt aDrive);
1.3087 +
1.3088 +/**
1.3089 +*/
1.3090 +IMPORT_C TInt GetLocalDriveNumber(TBusLocalDrive* aLocDrv);
1.3091 +
1.3092 +
1.3093 +/**
1.3094 +@internalTechnology
1.3095 +*/
1.3096 +struct TFatUtilityFunctions;
1.3097 +
1.3098 +/**
1.3099 + Representation of FAT Utility Functions as provided by a Code Page DLL.
1.3100 + These functions are to be implemented by Code Page-DLLs.
1.3101 + @internaltechnology
1.3102 +*/
1.3103 +
1.3104 +struct TCodePageFunctions
1.3105 + {
1.3106 + typedef TBool (*TConvertFromUnicode)(TDes8& aForeign, const TDesC16& aUnicode, const TDesC8& aReplacementForUnconvertibleCharacter);
1.3107 + typedef TInt (*TConvertFromUnicodeL)(TDes8& aForeign, const TDesC16& aUnicode, TBool leaveWhenOverflow);
1.3108 + typedef TBool (*TConvertToUnicode)(TDes16& aUnicode, const TDesC8& aForeign);
1.3109 + typedef TInt (*TConvertToUnicodeL)(TDes16& aUnicode, const TDesC8& aForeign, TBool leaveWhenOverflow);
1.3110 + typedef TBool (*TIsLegalShortNameCharacter)(TUint aCharacter);
1.3111 +
1.3112 + TConvertFromUnicode iConvertFromUnicode;
1.3113 + TConvertFromUnicodeL iConvertFromUnicodeL;
1.3114 + TConvertToUnicode iConvertToUnicode;
1.3115 + TConvertToUnicodeL iConvertToUnicodeL;
1.3116 + TIsLegalShortNameCharacter iIsLegalShortNameCharacter;
1.3117 + };
1.3118 +
1.3119 +/**
1.3120 + A utility class for Codepage Dll. Controls overflow action. Provides current status of
1.3121 + Locale/codepage dll loaded. Provides conversions functions to be used by Codepage Dlls.
1.3122 +
1.3123 + @internaltechnology
1.3124 +*/
1.3125 +class TCodePageUtils
1.3126 + {
1.3127 +public:
1.3128 +
1.3129 + /**
1.3130 + Determines the Overflow action in case of if overflow occurs.
1.3131 + */
1.3132 + enum TOverflowAction
1.3133 + {
1.3134 + /**
1.3135 + Will leave if an overflow occurs.
1.3136 + */
1.3137 + EOverflowActionLeave,
1.3138 + /**
1.3139 + Will truncate the data if an overflow occurs.
1.3140 + */
1.3141 + EOverflowActionTruncate
1.3142 + };
1.3143 +
1.3144 + /**
1.3145 + Determines the current status of Locale dll / Codepage dll.
1.3146 + */
1.3147 + enum TCodepageLoaded
1.3148 + {
1.3149 + /**
1.3150 + No Locale Dll or Codepage Dll is loaded.
1.3151 + */
1.3152 + ENone = 0,
1.3153 + /**
1.3154 + Locale Dll is loaded.
1.3155 + */
1.3156 + ELocaleDll,
1.3157 + /**
1.3158 + Codepage Dll is loaded.
1.3159 + */
1.3160 + ECodePageDll
1.3161 + };
1.3162 +public:
1.3163 +
1.3164 + /**
1.3165 + Convert from Unicode, truncating if there is not enough room in the output.
1.3166 +
1.3167 + @param aForeign The output is appended here.
1.3168 + @param aUnicode The input.
1.3169 +
1.3170 + @return False if and only if aForeign has not enough space remaining.
1.3171 + */
1.3172 + TBool ConvertFromUnicode(TDes8& aForeign, const TDesC16& aUnicode, TOverflowAction aOverflowAction) const;
1.3173 +
1.3174 + /**
1.3175 + Convert from Unicode, truncating if there is not enough room in the output.
1.3176 +
1.3177 + @param aForeign The output is appended here.
1.3178 + @param aUnicode The input.
1.3179 +
1.3180 + @leave KErrOverflow if aForeign is too short for the output.
1.3181 + */
1.3182 + IMPORT_C void ConvertFromUnicodeL(TDes8& aForeign, const TDesC16& aUnicode, TOverflowAction aOverflowAction=EOverflowActionLeave) const;
1.3183 +
1.3184 + /*
1.3185 + Convert to Unicode, truncating if there is not enough room in the output.
1.3186 +
1.3187 + @param aUnicode The output is appended here.
1.3188 + @param aForeign The input.
1.3189 +
1.3190 + @return False if and only if aUnicode has not enough space remaining.
1.3191 + */
1.3192 + TBool ConvertToUnicode(TDes16& aUnicode, const TDesC8& aForeign ) const;
1.3193 +
1.3194 + /*
1.3195 + Convert to Unicode, leaving if there is not enough room in the output.
1.3196 +
1.3197 + @param aUnicode The output is appended here.
1.3198 + @param aForeign The input.
1.3199 +
1.3200 + @leave KErrOverflow if aUnicode is too short for the output.
1.3201 + */
1.3202 + IMPORT_C void ConvertToUnicodeL(TDes16& aUnicode, const TDesC8& aForeign, TOverflowAction aOverflowAction=EOverflowActionLeave) const;
1.3203 +
1.3204 + /**
1.3205 + Returns true if the input character is legal in a short name.
1.3206 +
1.3207 + @param aCharacter Character, in the foreign character encoding.
1.3208 +
1.3209 + @return true if aCharacter is legal in a FAT short name.
1.3210 + */
1.3211 + IMPORT_C TBool IsLegalShortNameCharacter(TUint aCharacter,TBool aUseExtendedChars=EFalse) const;
1.3212 +
1.3213 +public:
1.3214 +
1.3215 + /**
1.3216 + Constructor for TCodePageUtils.
1.3217 + */
1.3218 + TCodePageUtils();
1.3219 +
1.3220 + /**
1.3221 + Returns whether a Codepage dll is loaded.
1.3222 +
1.3223 + @return True if Codepage dll is loaded.
1.3224 + False otherwise
1.3225 + */
1.3226 + TBool IsCodepageLoaded() const;
1.3227 +
1.3228 + /**
1.3229 + Returns the type of active codepage.
1.3230 + @return ENone if no dll is loaded
1.3231 + ELocaleDll if Locale Dll is loaded
1.3232 + ECodepageDll if Codepage Dll is loaded
1.3233 + */
1.3234 + TCodepageLoaded CodepageLoaded() const;
1.3235 +
1.3236 + /**
1.3237 + Sets the current codepage to that provided by the current Locale DLL.
1.3238 +
1.3239 + @param aFunctions Pointer to FAT conversion functions to be used.
1.3240 +
1.3241 + @return None
1.3242 + */
1.3243 + void SetLocaleCodePage(TFatUtilityFunctions* aFunctions);
1.3244 +
1.3245 + /**
1.3246 + Gets the function pointer to the read Locale conversions functions.
1.3247 +
1.3248 + @return function pointer to the read Locale conversions functions.
1.3249 + */
1.3250 + TFatUtilityFunctions* LocaleFatUtilityFunctions() const;
1.3251 +
1.3252 + /**
1.3253 + Gets structure to function pointers to the read Codepage conversions functions.
1.3254 +
1.3255 + @return structure to function pointers to the read Codepage conversions functions.
1.3256 + */
1.3257 + TCodePageFunctions CodepageFatUtilityFunctions() const;
1.3258 +
1.3259 +private:
1.3260 +
1.3261 + /**
1.3262 + Structure to function pointers to the read Codepage conversions functions.
1.3263 + */
1.3264 + TCodePageFunctions iCodePageFunctions;
1.3265 +
1.3266 + /**
1.3267 + Function pointer to the read Locale conversions functions.
1.3268 + */
1.3269 + TFatUtilityFunctions* iLocaleFatUtilityFunctions;
1.3270 +
1.3271 + /**
1.3272 + Variable to hold the active codepage type.
1.3273 + */
1.3274 + TCodepageLoaded iCodepageLoaded;
1.3275 +
1.3276 + friend class TFsLoadCodePage;
1.3277 + };
1.3278 +
1.3279 +/**
1.3280 +@internaltechnology
1.3281 +
1.3282 +Gets the pointer to the current FAT conversions functions.
1.3283 +
1.3284 +@return Pointer to the current FAT conversions functions.
1.3285 +*/
1.3286 +IMPORT_C const TFatUtilityFunctions* GetFatUtilityFunctions();
1.3287 +
1.3288 +/**
1.3289 +@internaltechnology
1.3290 +
1.3291 +Gets the instance of TCodePageUtils class.
1.3292 +
1.3293 +@return Instance of TCodePageUtils class.
1.3294 +*/
1.3295 +IMPORT_C const TCodePageUtils& GetCodePage();
1.3296 +
1.3297 +
1.3298 +
1.3299 +/**
1.3300 +@publishedPartner
1.3301 +@released
1.3302 +
1.3303 +Copies data to a buffer.
1.3304 +
1.3305 +If necessary, the buffer, a heap descriptor, is allocated or re-allocated
1.3306 +before copying takes place.
1.3307 +
1.3308 +@param aBuf A reference to a pointer to heap descriptor forming the buffer.
1.3309 + This will be allocated if it does not already exist,
1.3310 + or re-allocated if the existing buffer is not large enough.
1.3311 +@param aDes The data to be copied.
1.3312 +*/
1.3313 +IMPORT_C void AllocBufferL(HBufC*& aBuf,const TDesC& aDes);
1.3314 +
1.3315 +
1.3316 +
1.3317 +
1.3318 +
1.3319 +/**
1.3320 +@publishedPartner
1.3321 +@released
1.3322 +
1.3323 +Notifies sessions of a debug event if aFunction has the KDebugNotifyMask set.
1.3324 +
1.3325 +This function can only be used in debug builds or if _DEBUG
1.3326 +or _DEBUG_RELEASE is defined.
1.3327 +
1.3328 +@param aFunction A function.
1.3329 +@param aDrive A drive.
1.3330 +*/
1.3331 +IMPORT_C void DebugNotifySessions(TInt aFunction,TInt aDrive);
1.3332 +
1.3333 +
1.3334 +
1.3335 +
1.3336 +/**
1.3337 +@publishedPartner
1.3338 +@released
1.3339 +
1.3340 +Writes data from a buffer to a file.
1.3341 +
1.3342 +Called by the mount control block lock and the unlock functions.
1.3343 +
1.3344 +@param aFileName The file to be written to.
1.3345 +@param aBuf The data to be written.
1.3346 +*/
1.3347 +IMPORT_C void WriteToDisk(const TDesC& aFileName,const TDesC8& aBuf);
1.3348 +
1.3349 +
1.3350 +
1.3351 +
1.3352 +/**
1.3353 +Create a proxy drive using the local proxy drive passed in
1.3354 +and any extensions that have been added to the drive.
1.3355 +
1.3356 +@param aConcreteDrive local proxy drive
1.3357 +@param aMount local proxy drive mount control block
1.3358 +
1.3359 +@return pointer to instantiated CProxyDrive object.
1.3360 +*/
1.3361 +IMPORT_C CProxyDrive* CreateProxyDriveL(CProxyDrive* aConcreteDrive,CMountCB* aMount);
1.3362 +
1.3363 +
1.3364 +
1.3365 +/**
1.3366 +@deprecated 6.1
1.3367 +*/
1.3368 +IMPORT_C TInt CompareFilenames(const TDesC& aFileName1,const TDesC& aFileName2);
1.3369 +//
1.3370 +/**
1.3371 +Lookup a file system by name.
1.3372 +
1.3373 +@param aName file system name.
1.3374 +
1.3375 +@return pointer to instantiated CFileSystem object.
1.3376 +*/
1.3377 +IMPORT_C CFileSystem* GetFileSystem(const TDesC& aName);
1.3378 +
1.3379 +
1.3380 +
1.3381 +/**
1.3382 +@internalTechnology
1.3383 +
1.3384 +A static class for retrieving F32 properties
1.3385 +*/
1.3386 +class F32Properties
1.3387 + {
1.3388 +private:
1.3389 + F32Properties();
1.3390 +public:
1.3391 + IMPORT_C static TBool Initialise(TInt aRomAddress, TInt aLength);
1.3392 + IMPORT_C static TBool GetString(const TDesC8& aSection, const TDesC8& aProperty, TDes8& aPropVal);
1.3393 + IMPORT_C static TBool GetInt(const TDesC8& aSection, const TDesC8& aProperty, TInt32& aPropVal);
1.3394 + IMPORT_C static TBool GetBool(const TDesC8& aSection, const TDesC8& aProperty, TBool& aPropVal);
1.3395 +private:
1.3396 + static TBool iInitialised;
1.3397 + static TInt iRomAddress;
1.3398 + static TInt iRomLength;
1.3399 + };
1.3400 +
1.3401 +#include <f32fsys.inl>
1.3402 +#endif