sl@0: // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // f32\inc\f32fsys.inl sl@0: // sl@0: // WARNING: This file contains some APIs which are internal and are subject sl@0: // to change without noticed. Such APIs should therefore not be used sl@0: // outside the Kernel and Hardware Services package. sl@0: // sl@0: sl@0: #define __IS_DRIVETHREAD() {__ASSERT_DEBUG(IsDriveThread(),DriveFault(ETrue));} sl@0: #define __IS_MAINTHREAD() {__ASSERT_DEBUG(IsMainThread(),DriveFault(EFalse));} sl@0: sl@0: sl@0: //--------------------------------------------------------------------------------------------------------------------------------- sl@0: // Class TDrive sl@0: sl@0: /** sl@0: Gets last error reason. sl@0: sl@0: @return TInt Returns last error reason. sl@0: */ sl@0: inline TInt TDrive::GetReason() const sl@0: { sl@0: __IS_DRIVETHREAD(); sl@0: return(iReason); sl@0: } sl@0: sl@0: sl@0: sl@0: /** sl@0: Sets a flag to state that the drive contents has changed. sl@0: sl@0: @param aValue True if contents has changed; False if unchanged. sl@0: */ sl@0: inline void TDrive::SetChanged(TBool aValue) sl@0: { sl@0: iChanged=aValue; sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Determines whether the drive content has changed. sl@0: sl@0: @return True if contents changed , False if unchanged. sl@0: */ sl@0: inline TBool TDrive::IsChanged() const sl@0: { sl@0: return(iChanged); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Returns the drive number. sl@0: sl@0: @return The drive number. sl@0: sl@0: @see TDriveNumber sl@0: */ sl@0: inline TInt TDrive::DriveNumber() const sl@0: {return(iDriveNumber);} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Determines whether the drive is mounted. sl@0: sl@0: @return True if drive is mounted, False if drive is not mounted. sl@0: */ sl@0: inline TBool TDrive::IsMounted() const sl@0: { sl@0: __IS_DRIVETHREAD(); sl@0: return(iCurrentMount!=NULL); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Determines whether attribute is set to local. sl@0: sl@0: @return True if attribute is set to KDriveAttLocal, False for all other attributes. sl@0: */ sl@0: inline TBool TDrive::IsLocal() const sl@0: {return(iAtt & KDriveAttLocal);} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Determines whether the drive is ROM drive. sl@0: sl@0: @return True if drive attribute is set as ROM drive , False if not set as ROM drive. sl@0: */ sl@0: inline TBool TDrive::IsRom() const sl@0: {return( iAtt & KDriveAttRom);} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Determines whether the drive is removable. sl@0: sl@0: @return True if drive attribute is set to removable , False for all other attributes. sl@0: */ sl@0: inline TBool TDrive::IsRemovable() const sl@0: {return( iAtt & KDriveAttRemovable);} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Determines whether the drive is substed. sl@0: sl@0: @return True if drive attribute is set to substed (KDriveAttSubsted), False for all other attributes. sl@0: */ sl@0: inline TBool TDrive::IsSubsted() const sl@0: {return( iAtt & KDriveAttSubsted);}// KDriveAttSubsted = 0x08 sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Gets a reference to the object representing the current mount. sl@0: sl@0: @return The file's mount. sl@0: */ sl@0: inline CMountCB& TDrive::CurrentMount() const sl@0: { sl@0: __IS_DRIVETHREAD(); sl@0: return(*iCurrentMount); sl@0: } sl@0: sl@0: inline TBool TDrive::IsCurrentMount(CMountCB& aMount) const sl@0: {return(iCurrentMount == &aMount);} sl@0: sl@0: sl@0: sl@0: /** sl@0: Gets the substed drive. sl@0: sl@0: @return A pointer to the drive which is substed. sl@0: */ sl@0: inline TDrive& TDrive::SubstedDrive()const sl@0: { sl@0: __IS_MAINTHREAD(); sl@0: return(*iSubstedDrive); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: sl@0: Sets the drive as substed to the path set by an earlier call to SetSubst(). sl@0: sl@0: @param aDrive A pointer to the drive on which the volume is mounted. sl@0: sl@0: */ sl@0: inline void TDrive::SetSubstedDrive(TDrive* aDrive) sl@0: { sl@0: __IS_MAINTHREAD(); sl@0: iSubstedDrive=aDrive; sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Gets the substed path set by an earlier call to SetSubst(). sl@0: sl@0: @return A reference to a heap descriptor containing the substed path. sl@0: */ sl@0: inline HBufC& TDrive::Subst() const sl@0: { sl@0: __IS_MAINTHREAD(); sl@0: return(*iSubst); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Assigns a path to a drive. sl@0: sl@0: @param aSubst Path will be assigned to a drive. sl@0: sl@0: */ sl@0: inline void TDrive::SetSubst(HBufC* aSubst) sl@0: { sl@0: __IS_MAINTHREAD(); sl@0: iSubst=aSubst; sl@0: } sl@0: sl@0: sl@0: sl@0: /** sl@0: sl@0: Gets a reference to the object representing the mount on which the file resides. sl@0: sl@0: @return The Drives's mount. sl@0: sl@0: */ sl@0: inline CFsObjectCon& TDrive::Mount() const sl@0: {return(*iMount);} sl@0: /** sl@0: sl@0: Gets a reference to the object representing the file system sl@0: sl@0: @return The reference to file system. sl@0: sl@0: */ sl@0: inline CFileSystem& TDrive::FSys() sl@0: {return(*iFSys);} sl@0: /** sl@0: sl@0: Gets the object representing the file system sl@0: sl@0: @return The file system. sl@0: sl@0: */ sl@0: inline CFileSystem*& TDrive::GetFSys() sl@0: {return(iFSys);} sl@0: /** sl@0: sl@0: Gets the object representing the TDriveExtInfo. sl@0: sl@0: @return The Drive extension information object. sl@0: sl@0: @see TDriveExtInfo sl@0: sl@0: */ sl@0: inline TDriveExtInfo& TDrive::ExtInfo() sl@0: { sl@0: __IS_DRIVETHREAD(); sl@0: return(iExtInfo); sl@0: } sl@0: /** sl@0: Sets the notification flag ON. The client will receive notifications on Read or Write sl@0: failures from the file system. sl@0: sl@0: */ sl@0: inline void TDrive::SetNotifyOn() sl@0: { sl@0: __IS_DRIVETHREAD(); sl@0: iDriveFlags &= ~ENotifyOff; sl@0: } sl@0: /** sl@0: Sets the notification flag OFF. The client will not receive notifications on Read or Write sl@0: failures from the file system. sl@0: sl@0: */ sl@0: inline void TDrive::SetNotifyOff() sl@0: { sl@0: __IS_DRIVETHREAD(); sl@0: iDriveFlags |= ENotifyOff; sl@0: } sl@0: /** sl@0: sl@0: Locks the drive.This function acquires iLock mutex. sl@0: sl@0: */ sl@0: inline void TDrive::Lock() sl@0: {iLock.Wait();} sl@0: /** sl@0: sl@0: UnLocks the drive.This function signals the iLock mutex. sl@0: sl@0: */ sl@0: sl@0: inline void TDrive::UnLock() sl@0: {iLock.Signal();} sl@0: sl@0: sl@0: /** sl@0: sl@0: Gets the reserved space of a drive sl@0: sl@0: @return Amount of space reserved in bytes. sl@0: sl@0: */ sl@0: sl@0: inline TInt TDrive::ReservedSpace() const sl@0: {return iReservedSpace;} sl@0: sl@0: /** sl@0: sl@0: Reserves a space of a drive. sl@0: sl@0: @param aReservedSpace Amount of space to reserve in bytes. sl@0: sl@0: */ sl@0: inline void TDrive::SetReservedSpace(const TInt aReservedSpace) sl@0: {iReservedSpace=aReservedSpace; } sl@0: sl@0: /** sl@0: sl@0: Sets the rugged flag in the drive object. sl@0: sl@0: @param Flag to set or clear the rugged flag. sl@0: @see IsRugged() sl@0: sl@0: */ sl@0: sl@0: inline void TDrive::SetRugged(TBool aIsRugged) sl@0: { sl@0: if (!aIsRugged) sl@0: iDriveFlags |= ENotRugged; sl@0: else sl@0: iDriveFlags &= ~ENotRugged; sl@0: } sl@0: sl@0: /** sl@0: sl@0: Returns whether the current drive is running as rugged Fat sl@0: or not.If IsRugged flag is set then in the event of power sl@0: failure fat/metadata will be in a valid state if the scandrive sl@0: utility is run immediately after. sl@0: sl@0: @return Is rugged fat flag. sl@0: */ sl@0: sl@0: inline TBool TDrive::IsRugged() const sl@0: {return !(iDriveFlags & ENotRugged); } sl@0: sl@0: sl@0: /** sl@0: @return ETrue if the drive is synchronous, i.e. runs in the main file server thread. sl@0: */ sl@0: inline TBool TDrive::IsSynchronous() const sl@0: { sl@0: return iDriveFlags & EDriveIsSynch; sl@0: } sl@0: sl@0: /** sl@0: Set or reset internal EDriveIsSynch flag for the TDrive. sl@0: */ sl@0: inline void TDrive::SetSynchronous(TBool aIsSynch) sl@0: { sl@0: if(aIsSynch) sl@0: iDriveFlags |= EDriveIsSynch; sl@0: else sl@0: iDriveFlags &= ~EDriveIsSynch; sl@0: sl@0: } sl@0: sl@0: inline TBool TDrive::DismountDeferred() const sl@0: { return(iDriveFlags & EDismountDeferred); } sl@0: sl@0: sl@0: // Class CMountCB sl@0: sl@0: /** sl@0: Gets a reference to the object representing the drive on which sl@0: the volume is mounted. sl@0: sl@0: @return The drive on which the volume is mounted. sl@0: */ sl@0: inline TDrive& CMountCB::Drive() const sl@0: {return(*iDrive);} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Sets a pointer to the object representing the drive on which sl@0: the volume is mounted. sl@0: sl@0: @param aDrive A pointer to the drive on which the volume is mounted. sl@0: */ sl@0: inline void CMountCB::SetDrive(TDrive* aDrive) sl@0: {iDrive=aDrive;} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Gets a reference to a heap descriptor containing the name of sl@0: the mounted volume. sl@0: sl@0: @return A reference to a heap descriptor containing the volume name. sl@0: */ sl@0: inline HBufC& CMountCB::VolumeName() const sl@0: {return(*iVolumeName);} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Sets a pointer to a heap descriptor containing the name of the mounted volume. sl@0: sl@0: @param aName A pointer to a heap descriptor containing the name of sl@0: the mounted volume to be set. sl@0: */ sl@0: inline void CMountCB::SetVolumeName(HBufC* aName) sl@0: {iVolumeName=aName;} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Tests whether the client is notified of any read or write failures. sl@0: sl@0: The notification status is a property of the current session with sl@0: the file server, the value of which is stored in CSessionFs::iNotifyUser. sl@0: If set to true, the client will receive notifications from the file system. sl@0: sl@0: Typically, this function might be used to save the current notification sl@0: state prior to temporarily disabling notifiers. This allows the original sl@0: notification state to be restored. sl@0: sl@0: Note that GetNotifyUser() is only available once the drive has been set for sl@0: the mount control block (using SetDrive()), since the notification status sl@0: is held by the session and accessed via the drive. sl@0: sl@0: @return True if the client receives notifications from the file system, sl@0: false otherwise. sl@0: */ sl@0: inline TBool CMountCB::GetNotifyUser() const sl@0: {return(Drive().GetNotifyUser());} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: */ sl@0: inline void CMountCB::SetNotifyOn() sl@0: {Drive().SetNotifyOn();} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: */ sl@0: inline void CMountCB::SetNotifyOff() sl@0: {Drive().SetNotifyOff();} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Locks the mount by incrementing the internal lock counter. sl@0: sl@0: The mount becomes locked on formatting or on the opening of a resource sl@0: (a file or a directory) or raw disk subsession. sl@0: A format, resource or raw disk subsession can only be opened if the mount sl@0: is not locked. sl@0: */ sl@0: inline void CMountCB::IncLock() sl@0: {iLockMount++;} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Unlocks the mount by decrementing the internal lock counter. sl@0: sl@0: The mount becomes locked on formatting or on the opening of a resource sl@0: (a file or a directory) or raw disk subsession. sl@0: A format, resource or raw disk subsession can only be opened if the mount sl@0: is not locked. sl@0: */ sl@0: inline void CMountCB::DecLock() sl@0: {iLockMount--;} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Gets the current lock status. sl@0: sl@0: It delivers the current lock status by returning the internal lock counter. sl@0: sl@0: @return The current lock status. sl@0: */ sl@0: inline TInt CMountCB::LockStatus() const sl@0: {return(iLockMount);} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Tests whether the mount is currently locked. sl@0: sl@0: A mount is locked when the internal lock counter is greater than zero. sl@0: On creation, the lock counter is set to zero. sl@0: sl@0: The mount becomes locked on formatting or on the opening of a resource sl@0: (a file or a directory) or raw disk subsession. sl@0: A format, resource or raw disk subsession can only be opened if the mount sl@0: is not locked. sl@0: sl@0: @return True if the mount is locked, false, otherwise. sl@0: */ sl@0: inline TBool CMountCB::Locked() const sl@0: {return iLockMount>0; } sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Tests whether the mount control block represents the current mount on sl@0: the associated drive. sl@0: sl@0: A drive has only one mount which is accessible: the current mount. sl@0: Any mount other than the current mount relates to a partition (i.e. volume) sl@0: that was present on a removable media which has since been removed. sl@0: The reason the mount has persisted is because resources (i.e. files/directories) sl@0: are still open on it. sl@0: sl@0: This function is only available when the drive has been set for the mount sl@0: control block (using SetDrive()), since the current mount is held by the drive. sl@0: sl@0: @return True if the mount is the current mount on the drive, false otherwise. sl@0: */ sl@0: inline TBool CMountCB::IsCurrentMount() const sl@0: {return(this==&iDrive->CurrentMount());} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: */ sl@0: inline TInt64 CMountCB::Size() const sl@0: {return(iSize);} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Set the unique mount number sl@0: @param aMountNumber - The unique mount number sl@0: */ sl@0: const TInt KMountDismounted = 0x80000000; sl@0: inline void CMountCB::SetMountNumber(TInt aMountNumber) sl@0: { iMountNumber = (aMountNumber &~ KMountDismounted); } sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Set the mount to be dismounted sl@0: */ sl@0: inline void CMountCB::SetDismounted(TBool aDismounted) sl@0: { sl@0: if(aDismounted) sl@0: iMountNumber |= KMountDismounted; sl@0: else sl@0: iMountNumber &= ~KMountDismounted; sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Returns the unique mount number sl@0: @return The unique mount number sl@0: */ sl@0: inline TInt CMountCB::MountNumber() const sl@0: { return(iMountNumber &~ KMountDismounted); } sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Returns ETrue if the mount is flagged as dismounted. sl@0: @return ETrue if the mount is flagged as dismounted sl@0: */ sl@0: inline TBool CMountCB::IsDismounted() const sl@0: { return(iMountNumber & KMountDismounted); } sl@0: sl@0: sl@0: sl@0: /** sl@0: Retrieves TBusLocalDrive object associated with the mount sl@0: */ sl@0: inline TInt CMountCB::LocalDrive(TBusLocalDrive*& aLocalDrive) sl@0: { sl@0: aLocalDrive = NULL; sl@0: return GetInterface(EGetLocalDrive, (TAny*&) aLocalDrive, NULL); sl@0: } sl@0: sl@0: /** sl@0: Retrieves CProxyDrive object associated with the mount sl@0: */ sl@0: inline TInt CMountCB::ProxyDrive(CProxyDrive*& aProxyDrive) sl@0: { sl@0: aProxyDrive = NULL; sl@0: return GetInterface(EGetProxyDrive, (TAny*&) aProxyDrive, NULL); sl@0: } sl@0: sl@0: inline TInt CMountCB::AddToCompositeMount(TInt aMountIndex) sl@0: { sl@0: TAny *mountInterface = NULL; sl@0: return(GetInterface(EAddToCompositeMount, mountInterface, (TAny*)aMountIndex)); sl@0: } sl@0: sl@0: /** sl@0: Returns whether the mount (and any extensions) support file caching sl@0: */ sl@0: inline TInt CMountCB::LocalBufferSupport(CFileCB* aFile) sl@0: { sl@0: TAny* dummyInterface; sl@0: return GetInterface(ELocalBufferSupport, dummyInterface, aFile); sl@0: } sl@0: sl@0: inline TInt CMountCB::MountControl(TInt /*aLevel*/, TInt /*aOption*/, TAny* /*aParam*/) sl@0: { sl@0: return KErrNotSupported; sl@0: } sl@0: sl@0: sl@0: inline void CMountCB::FinaliseMountL(TInt aOperation, TAny* /*aParam1=NULL*/, TAny* /*aParam2=NULL*/) sl@0: { sl@0: if(aOperation == RFs::EFinal_RW) sl@0: {//-- call the legacy method sl@0: FinaliseMountL(); sl@0: return; sl@0: } sl@0: sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: inline TInt CMountCB::CheckDisk(TInt /*aOperation*/, TAny* /*aParam1=NULL*/, TAny* /*aParam2=NULL*/) sl@0: { sl@0: return(KErrNotSupported); sl@0: } sl@0: sl@0: inline TInt CMountCB::ScanDrive(TInt /*aOperation*/, TAny* /*aParam1=NULL*/, TAny* /*aParam2=NULL*/) sl@0: { sl@0: return(KErrNotSupported); sl@0: } sl@0: sl@0: sl@0: //--------------------------------------------------------------------------------------------------------------------------------- sl@0: sl@0: /** sl@0: Check is this file system can be mounted on the drive at all. The file system implementation may, for example, sl@0: read and validate the boot region without real mounting overhead. sl@0: sl@0: sl@0: @return KErrNotSupported this feature is not supported by the file system sl@0: KErrNone this file system can be mounted on this drive sl@0: KErrLocked the media is locked on a physical level. sl@0: other error codes depending on the implementation, indicating that this filesystem can't be mouned sl@0: */ sl@0: inline TInt CMountCB::CheckFileSystemMountable() sl@0: { sl@0: return MountControl(ECheckFsMountable, 0, NULL); sl@0: } sl@0: sl@0: //--------------------------------------------------------------------------------------------------------------------------------- sl@0: /** sl@0: Query if the mount is finalised, corresponds to the EMountStateQuery control code only. sl@0: @param aFinalised out: ETrue if the mount is finalised, EFalse otherwise. sl@0: sl@0: @return KErrNotSupported this feature is not supported by the file system sl@0: KErrNone on success sl@0: */ sl@0: inline TInt CMountCB::IsMountFinalised(TBool &aFinalised) sl@0: { sl@0: return MountControl(EMountStateQuery, ESQ_IsMountFinalised, &aFinalised); sl@0: } sl@0: sl@0: //--------------------------------------------------------------------------------------------------------------------------------- sl@0: /** sl@0: Corresponds to EMountVolParamQuery. Request a certain amount of free space on the volume. sl@0: If _current_ amount of free space is >= than required or it is not being updated in background by the mount, returns immediately; sl@0: If mount is still counting free space and If _current_ amount of free space is < than required, the caller will be blocked sl@0: until mount finds enough free space or reports that the _final_ amount of free space is less than required. sl@0: sl@0: @param aFreeSpaceBytes in: number of free bytes on the volume required, out: resulted amount of free space. It can be less than sl@0: required if there isn't enough free space on the volume at all. sl@0: sl@0: @return KErrNotSupported this feature is not supported by the file system sl@0: KErrNone on success sl@0: */ sl@0: inline TInt CMountCB::RequestFreeSpace(TUint64 &aFreeSpaceBytes) sl@0: { sl@0: return MountControl(EMountVolParamQuery, ESQ_RequestFreeSpace, &aFreeSpaceBytes); sl@0: } sl@0: sl@0: //--------------------------------------------------------------------------------------------------------------------------------- sl@0: /** sl@0: Corresponds to EMountVolParamQuery. A request to obtain the _current_ amount of free space on the volume asynchronously, without blocking. sl@0: Some mounts implementations can count volume free space in the background. sl@0: sl@0: @param aFreeSpaceBytes in: none; out: _current_ amount of free space on the volume. sl@0: sl@0: @return KErrNotSupported this feature is not supported by the file system sl@0: KErrNone on success sl@0: */ sl@0: inline TInt CMountCB::GetCurrentFreeSpaceAvailable(TInt64 &aFreeSpaceBytes) sl@0: { sl@0: return MountControl(EMountVolParamQuery, ESQ_GetCurrentFreeSpace, &aFreeSpaceBytes); sl@0: } sl@0: sl@0: //--------------------------------------------------------------------------------------------------------------------------------- sl@0: /** sl@0: Corresponds to EMountVolParamQuery. A request to obtain size of the mounted volume without blocking (CMountCB::VolumeL() can block). sl@0: @param aVolSizeBytes in: none; out: mounted volume size, same as TVolumeInfo::iSize sl@0: sl@0: @return KErrNotSupported this feature is not supported by the file system sl@0: KErrNone on success sl@0: */ sl@0: inline TInt CMountCB::MountedVolumeSize(TUint64& aVolSizeBytes) sl@0: { sl@0: return MountControl(EMountVolParamQuery, ESQ_MountedVolumeSize, &aVolSizeBytes); sl@0: } sl@0: sl@0: sl@0: //--------------------------------------------------------------------------------------------------------------------------------- sl@0: /** sl@0: Get Maximum file size, which is supported by the file system that has produced this mount. sl@0: @param aVolSizeBytes in: none; out: Theoretical max. supported by this file system file size. sl@0: sl@0: @return KErrNotSupported this feature is not supported by the file system sl@0: KErrNone on success sl@0: */ sl@0: inline TInt CMountCB::GetMaxSupportedFileSize(TUint64 &aSize) sl@0: { sl@0: return MountControl(EMountFsParamQuery, ESQ_GetMaxSupportedFileSize, &aSize); sl@0: } sl@0: sl@0: sl@0: sl@0: //############################################################################################### sl@0: // Class CFileCB sl@0: sl@0: /** sl@0: Sets the mount associated with the file. sl@0: sl@0: @param aMount The mount. sl@0: */ sl@0: inline void CFileCB::SetMount(CMountCB * aMount) sl@0: {iMount=aMount;} sl@0: sl@0: /** sl@0: Gets a reference to the object representing the drive on which sl@0: the file resides. sl@0: sl@0: @return A reference to the file's drive. sl@0: */ sl@0: inline TDrive& CFileCB::Drive() const sl@0: {return(*iDrive);} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Gets a reference to the object representing the drive on which the file was created. sl@0: sl@0: The 'created drive' is only different from the 'drive', as returned by Drive(), if sl@0: the 'drive' was a substitute for the 'created drive' in the file server session. sl@0: sl@0: @return A reference to the drive on which the file was created. sl@0: */ sl@0: inline TDrive& CFileCB::CreatedDrive() const sl@0: {return(*iCreatedDrive);} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Gets a reference to the object representing the mount on which the file resides. sl@0: sl@0: @return The file's mount. sl@0: */ sl@0: inline CMountCB& CFileCB::Mount() const sl@0: {return(*iMount);} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Gets a reference to a heap descriptor containing the full file name. sl@0: sl@0: @return A heap descriptor containing the full file name. sl@0: */ sl@0: inline HBufC& CFileCB::FileName() const sl@0: {return(*iFileName);} sl@0: sl@0: /** sl@0: Gets a reference to a heap descriptor containing the folded full file name. sl@0: sl@0: @return A heap descriptor containing the full file name. sl@0: */ sl@0: inline HBufC& CFileCB::FileNameF() const sl@0: {return(*iFileNameF);} sl@0: sl@0: /** sl@0: Gets the hash of the folded filename sl@0: sl@0: @return hash of the folded file name sl@0: */ sl@0: inline TUint32 CFileCB::NameHash() const sl@0: {return(iNameHash);} sl@0: sl@0: sl@0: /** sl@0: Gets a reference to the file share locks array being used by the file. sl@0: @return The file share lock. sl@0: */ sl@0: inline TFileLocksArray& CFileCB::FileLocks() sl@0: {return(*iFileLocks);} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Gets the file object's unique ID, as returned by CObject::UniqueID(). sl@0: sl@0: @return The object's unique ID. sl@0: sl@0: @see CObject sl@0: */ sl@0: inline TInt CFileCB::UniqueID() const sl@0: {return(CFsObject::UniqueID());} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Gets the iShare value, which defines the level of access allowed to the file. sl@0: sl@0: @return The value of iShare sl@0: sl@0: @see CFileCB::iShare sl@0: */ sl@0: inline TShare CFileCB::Share() const sl@0: {return(iShare);} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Sets the iShare value, which defines the level of access allowed to the file. sl@0: sl@0: @param aShare The new value. sl@0: sl@0: @see CFileCB::iShare sl@0: */ sl@0: inline void CFileCB::SetShare(TShare aShare) sl@0: {iShare=aShare;} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Gets the size of the file. sl@0: sl@0: @return The size of the file. sl@0: */ sl@0: inline TInt CFileCB::Size() const sl@0: {return(iSize);} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Sets the size of the file. sl@0: sl@0: @param aSize The size of the file. sl@0: */ sl@0: inline void CFileCB::SetSize(TInt aSize) sl@0: {iSize=aSize;} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Gets the file's attributes. sl@0: sl@0: @return An integer containing the file attribute bit mask. sl@0: */ sl@0: inline TInt CFileCB::Att() const sl@0: {return(iAtt);} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Sets the file's attributes. sl@0: sl@0: @param aAtt The file attribute bit mask. sl@0: */ sl@0: inline void CFileCB::SetAtt(TInt aAtt) sl@0: {iAtt=aAtt;} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Gets the universal time when the file was last modified. sl@0: sl@0: @return The universal time when the file was last modiified. sl@0: */ sl@0: inline TTime CFileCB::Modified() const sl@0: {return(iModified);} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Sets the universal time when the file was last modified. sl@0: sl@0: @param aModified The universal time when the file was last modified. sl@0: */ sl@0: inline void CFileCB::SetModified(TTime aModified) sl@0: {iModified=aModified;} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Tests whether the file is corrupt. sl@0: sl@0: @return ETrue if the file is corrupt; EFalse otherwise. sl@0: */ sl@0: inline TBool CFileCB::FileCorrupt() const sl@0: {return iFileCorrupt;} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Sets whether the file is corrupt. sl@0: sl@0: @param aFileCorrupt ETrue, if the file is corrupt; EFalse, otherwise. sl@0: */ sl@0: inline void CFileCB::SetFileCorrupt(TBool aFileCorrupt) sl@0: {iFileCorrupt=aFileCorrupt;} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Gets the iBadPower value. sl@0: sl@0: @return The value of iBadPower sl@0: sl@0: @see CFileCB::iBadPower sl@0: */ sl@0: inline TBool CFileCB::BadPower() const sl@0: {return (iBadPower);} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Sets the iBadPower value. sl@0: sl@0: @param aBadPower ETrue, if an operation on the file has failed due sl@0: to bad power; sl@0: EFalse if power has been found to be good. sl@0: sl@0: @see CFileCB::iBadPower sl@0: */ sl@0: inline void CFileCB::SetBadPower(TBool aBadPower) sl@0: {iBadPower=aBadPower;} sl@0: sl@0: sl@0: /** sl@0: Retrieves the BlockMap of a file. sl@0: sl@0: @param aInfo sl@0: sl@0: @param aStartPos sl@0: sl@0: @param aEndPos sl@0: sl@0: @return sl@0: */ sl@0: inline TInt CFileCB::BlockMap(SBlockMapInfo& aInfo, TInt64& aStartPos, TInt64 aEndPos) sl@0: { sl@0: TAny* pM; sl@0: TInt r = GetInterface(EBlockMapInterface, pM, (TAny*) this); sl@0: if (KErrNone!=r) sl@0: return r; sl@0: return reinterpret_cast(pM)->BlockMap(aInfo, aStartPos, aEndPos); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Retrieves TBusLocalDrive object associated with an open file. sl@0: */ sl@0: inline TInt CFileCB::LocalDrive(TBusLocalDrive*& aLocalDrive) sl@0: { sl@0: aLocalDrive = NULL; sl@0: return GetInterface(EGetLocalDrive, (TAny*&) aLocalDrive, NULL); sl@0: } sl@0: sl@0: //--------------------------------------------------------------------------------------------------------------------------------- sl@0: // Class RLocalMessage sl@0: inline RLocalMessage::RLocalMessage() sl@0: {InitHandle();} sl@0: sl@0: inline void RLocalMessage::InitHandle() sl@0: {iHandle = KLocalMessageHandle; iFunction=-1;} sl@0: sl@0: inline void RLocalMessage::SetFunction(TInt aFunction) sl@0: {iFunction = aFunction;} sl@0: sl@0: inline void RLocalMessage::SetArgs(TIpcArgs& aArgs) sl@0: { sl@0: iArgs[0] = aArgs.iArgs[0]; sl@0: iArgs[1] = aArgs.iArgs[1]; sl@0: iArgs[2] = aArgs.iArgs[2]; sl@0: iArgs[3] = aArgs.iArgs[3]; sl@0: sl@0: } sl@0: sl@0: inline TInt RLocalMessage::Arg(TInt aIndex) const sl@0: {return iArgs[aIndex];} sl@0: sl@0: //--------------------------------------------------------------------------------------------------------------------------------- sl@0: // Class CFileShare sl@0: /** sl@0: Gets a reference to the object representing an open file that is being shared. sl@0: sl@0: @return A reference to the shared file. sl@0: */ sl@0: inline CFileCB& CFileShare::File() sl@0: {return(*iFile);} sl@0: sl@0: sl@0: // Returns ETrue if the file share mode is EFileBifFile sl@0: // indicating large file access for the file share sl@0: inline TBool CFileShare::IsFileModeBig() sl@0: { sl@0: return (iMode & EFileBigFile) ? (TBool)ETrue:(TBool)EFalse; sl@0: } sl@0: sl@0: sl@0: //--------------------------------------------------------------------------------------------------------------------------------- sl@0: // Class CDirCB sl@0: sl@0: /** sl@0: Gets a reference to the object representing the drive on which sl@0: the directory resides. sl@0: sl@0: @return A reference to the directory's drive. sl@0: */ sl@0: inline TDrive& CDirCB::Drive() const sl@0: {return(*iDrive);} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Gets a reference to the object representing the mount on which sl@0: the directory resides. sl@0: sl@0: @return A reference to the directory's mount. sl@0: */ sl@0: inline CMountCB& CDirCB::Mount() const sl@0: {return(*iMount);} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Tests whether the preceding entry details should be returned when sl@0: multiple entries are being read. sl@0: sl@0: @return True if the preceding entry details should be returned; sl@0: false otherwise. sl@0: */ sl@0: inline TBool CDirCB::Pending() const sl@0: {return iPending;} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Sets whether the preceding entry details should be returned when sl@0: multiple entries are being read. sl@0: sl@0: @param aPending ETrue if the preceding entry details should be returned; sl@0: EFalse otherwise. sl@0: */ sl@0: inline void CDirCB::SetPending(TBool aPending) sl@0: {iPending=aPending;} sl@0: sl@0: sl@0: sl@0: //--------------------------------------------------------------------------------------------------------------------------------- sl@0: // class CFormatCB sl@0: sl@0: /** sl@0: Gets the object representing the drive on which the disk to sl@0: be formatted resides. sl@0: sl@0: @return The drive for the format action. sl@0: */ sl@0: inline TDrive& CFormatCB::Drive() const sl@0: {return(*iDrive);} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Gets the object representing the mount on which the disk to sl@0: be formatted resides. sl@0: sl@0: @return The mount for the format action. sl@0: */ sl@0: inline CMountCB& CFormatCB::Mount() const sl@0: {return(*iMount);} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Gets the mode of the format operation. sl@0: sl@0: @return The value of the format mode. sl@0: */ sl@0: inline TFormatMode CFormatCB::Mode() const sl@0: {return(iMode);} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Gets the current stage in the format operation. sl@0: sl@0: @return The stage the current format operation has reached. sl@0: */ sl@0: inline TInt& CFormatCB::CurrentStep() sl@0: {return(iCurrentStep);} sl@0: sl@0: sl@0: sl@0: //--------------------------------------------------------------------------------------------------------------------------------- sl@0: // class CRawDiskCB sl@0: sl@0: /** sl@0: Gets a reference to an object representing the drive on which the disk resides. sl@0: sl@0: @return A reference to the drive on which the disk resides. sl@0: */ sl@0: inline TDrive& CRawDiskCB::Drive() sl@0: {return(iMount->Drive());} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Gets an object representing the mount on which the disk resides. sl@0: sl@0: @return The mount on which the disk resides. sl@0: */ sl@0: inline CMountCB& CRawDiskCB::Mount() sl@0: {return(*iMount);} sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Tests whether the mount on which the disk resides is write protected. sl@0: sl@0: @return True if the mount is write protected, false otherwise. sl@0: */ sl@0: inline TBool CRawDiskCB::IsWriteProtected() const sl@0: { return(iFlags & EWriteProtected); } sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Stores the write protected state of the disk. sl@0: */ sl@0: inline void CRawDiskCB::SetWriteProtected() sl@0: { iFlags |= EWriteProtected; } sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Tests whether the disk contents has changed (due to a write operation) sl@0: sl@0: @return True if the disk contents has changed sl@0: */ sl@0: inline TBool CRawDiskCB::IsChanged() const sl@0: { return(iFlags & EChanged); } sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Set a flag to state that the disk contents has changed (due to a write operation) sl@0: */ sl@0: inline void CRawDiskCB::SetChanged() sl@0: { iFlags |= EChanged; } sl@0: sl@0: sl@0: sl@0: //--------------------------------------------------------------------------------------------------------------------------------- sl@0: // class CProxyDriveFactory sl@0: /** sl@0: Sets the Library (DLL) handle to be used by the CProxyDriveFactory sl@0: */ sl@0: inline void CProxyDriveFactory::SetLibrary(RLibrary aLib) sl@0: {iLibrary=aLib;} sl@0: /** sl@0: Gets the Library (DLL) handle in use by the CProxyDriveFactory sl@0: @return Library (DLL) handle sl@0: */ sl@0: inline RLibrary CProxyDriveFactory::Library() const sl@0: {return(iLibrary);} sl@0: sl@0: sl@0: inline void CExtProxyDriveFactory::SetLibrary(RLibrary aLib) sl@0: {iLibrary=aLib;} sl@0: sl@0: inline RLibrary CExtProxyDriveFactory::Library() const sl@0: {return(iLibrary);} sl@0: sl@0: sl@0: //--------------------------------------------------------------------------------------------------------------------------------- sl@0: // class CProxyDrive sl@0: /** sl@0: Gets the mount control block object for a specific volume on a drive. sl@0: sl@0: @return either a currently mounted volume in the system or the volume that has been removed but still has sl@0: subsession objects open. sl@0: */ sl@0: inline CMountCB* CProxyDrive::Mount() const sl@0: {return(iMount);} sl@0: sl@0: inline void CProxyDrive::SetMount(CMountCB *aMount) sl@0: { sl@0: iMount = aMount; sl@0: } sl@0: sl@0: /** sl@0: Returns wheher the drive (and any extensions) support file caching sl@0: */ sl@0: inline TInt CProxyDrive::LocalBufferSupport() sl@0: { sl@0: TAny* dummyInterface; sl@0: return GetInterface(ELocalBufferSupport, dummyInterface, NULL); sl@0: } sl@0: sl@0: /** sl@0: return whether proxy drive supports file caching sl@0: */ sl@0: inline TInt CBaseExtProxyDrive::LocalBufferSupport() sl@0: { sl@0: return iProxy->LocalBufferSupport(); sl@0: } sl@0: sl@0: //--------------------------------------------------------------------------------------------------------------------------------- sl@0: // Surrogate Pair hepler apis sl@0: /** sl@0: Determines if aChar is the outsite BMP. sl@0: sl@0: @param aChar character to checked if that is outside BMP. sl@0: @return ETrue if outside BMP, EFalse otherwise. sl@0: */ sl@0: inline TBool IsSupplementary(TUint aChar) sl@0: { sl@0: return (aChar > 0xFFFF); sl@0: } sl@0: sl@0: /** sl@0: Determines if aInt16 is a high surrogate. sl@0: sl@0: @param aInt16 character to checked if that is high surrogate. sl@0: @return ETrue if high surrogate, EFalse otherwise. sl@0: */ sl@0: inline TBool IsHighSurrogate(TText16 aInt16) sl@0: { sl@0: return (aInt16 & 0xFC00) == 0xD800; sl@0: } sl@0: sl@0: /** sl@0: Determines if aInt16 is a low surrogate. sl@0: sl@0: @param aInt16 character to checked if that is low surrogate. sl@0: @return ETrue if low surrogate, EFalse otherwise. sl@0: */ sl@0: inline TBool IsLowSurrogate(TText16 aInt16) sl@0: { sl@0: return (aInt16 & 0xFC00) == 0xDC00; sl@0: } sl@0: sl@0: /** sl@0: Joins high surrogate character aHighSurrogate and low surrogate character aLowSurrogate. sl@0: sl@0: @param aHighSurrogate a high surrogate character to be joined. sl@0: @param aLowSurrogate a low surrogate character to be joined. sl@0: @return joined character that is outside BMP. sl@0: */ sl@0: inline TUint JoinSurrogate(TText16 aHighSurrogate, TText16 aLowSurrogate) sl@0: { sl@0: return ((aHighSurrogate - 0xD7F7) << 10) + aLowSurrogate; sl@0: } sl@0: sl@0: //--------------------------------------------------------------------------------------------------------------------------------- sl@0: // class CExtProxyDrive sl@0: inline TInt CExtProxyDrive::DriveNumber() sl@0: {return iDriveNumber;}; sl@0: inline void CExtProxyDrive::SetDriveNumber(TInt aDrive) sl@0: {iDriveNumber = aDrive;}; sl@0: inline CExtProxyDriveFactory* CExtProxyDrive::FactoryP() sl@0: {return iFactory;}; sl@0: sl@0: //--------------------------------------------------------------------------------------------------------------------------------- sl@0: // class CLocDrvMountCB sl@0: /** sl@0: Gets the mounted local drive object sl@0: sl@0: @return The local drive. sl@0: */ sl@0: inline CProxyDrive* CLocDrvMountCB::LocalDrive() const sl@0: {return(iProxyDrive);} sl@0: sl@0: //--------------------------------------------------------------------------------------------------------------------------------- sl@0: // class CFsObject sl@0: inline CFsObjectCon* CFsObject::Container() const sl@0: { return iContainer; } sl@0: inline TInt CFsObject::Inc() sl@0: { return __e32_atomic_tas_ord32(&iAccessCount, 1, 1, 0); } sl@0: inline TInt CFsObject::Dec() sl@0: { return __e32_atomic_tas_ord32(&iAccessCount, 1, -1, 0); } sl@0: sl@0: