sl@0: // Copyright (c) 1999-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: // e32\include\d32locd.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: // class RLocalDrive sl@0: inline TVersion RLocalDrive::VersionRequired() const sl@0: { return TVersion(KLocalDriveMajorVersion,KLocalDriveMinorVersion,KLocalDriveBuildVersion); } sl@0: /** sl@0: @capability TCB sl@0: */ sl@0: inline TInt RLocalDrive::Connect(TInt aDriveNumber, TBool& aChangedFlag) sl@0: { return DoCreate(KLitLocalDriveLddName,VersionRequired(),aDriveNumber,NULL,(const TDesC8*)&aChangedFlag,EOwnerProcess); } sl@0: inline TInt RLocalDrive::Enlarge(TInt aLength) sl@0: { return DoControl(EControlEnlarge, (TAny*)aLength); } sl@0: inline TInt RLocalDrive::Reduce(TInt aPos, TInt aLength) sl@0: { return DoControl(EControlReduce, (TAny*)aPos, (TAny*)aLength); } sl@0: inline TInt RLocalDrive::Read(TInt64 aPos, TInt aLength, const TAny* aTrg, TInt aMessageHandle, TInt aOffset, TInt aFlags) sl@0: { TLocalDriveMessageData d(aPos,aLength,aTrg,aMessageHandle,aOffset,aFlags); return DoControl(EControlRead, &d); } sl@0: inline TInt RLocalDrive::Read(TInt64 aPos, TInt aLength, const TAny* aTrg, TInt aMessageHandle, TInt anOffset) sl@0: { TLocalDriveMessageData d(aPos,aLength,aTrg,aMessageHandle,anOffset,0); return DoControl(EControlRead, &d); } sl@0: inline TInt RLocalDrive::Read(TInt64 aPos, TInt aLength, TDes8& aTrg) sl@0: { TLocalDriveMessageData d(aPos,aLength,&aTrg,KLocalMessageHandle,0,ELocDrvMetaData); return DoControl(EControlRead, &d); } sl@0: inline TInt RLocalDrive::Write(TInt64 aPos, TInt aLength, const TAny* aSrc, TInt aMessageHandle, TInt aOffset, TInt aFlags) sl@0: { TLocalDriveMessageData d(aPos,aLength,aSrc,aMessageHandle,aOffset,aFlags); return DoControl(EControlWrite, &d); } sl@0: inline TInt RLocalDrive::Write(TInt64 aPos, TInt aLength, const TAny* aSrc, TInt aMessageHandle, TInt anOffset) sl@0: { TLocalDriveMessageData d(aPos,aLength,aSrc,aMessageHandle,anOffset,0); return DoControl(EControlWrite, &d); } sl@0: inline TInt RLocalDrive::Write(TInt64 aPos, const TDesC8& aSrc) sl@0: { TLocalDriveMessageData d(aPos,aSrc.Length(),&aSrc,KLocalMessageHandle,0,ELocDrvMetaData); return DoControl(EControlWrite, &d); } sl@0: inline TInt RLocalDrive::Caps(TDes8& anInfo) sl@0: { return DoControl(EControlCaps, &anInfo); } sl@0: inline TInt RLocalDrive::Format(TInt64 aPos, TInt aLength) sl@0: { TLocalDriveMessageData d(aPos,aLength,NULL,KLocalMessageHandle,0,0); return DoControl(EControlFormat, &d); } sl@0: inline TInt RLocalDrive::ForceMediaChange(TInt aMode) sl@0: { return DoControl(EControlForceMediaChange, (TAny*)aMode); } sl@0: inline void RLocalDrive::NotifyChange(TRequestStatus* aStatus) sl@0: { *aStatus=KRequestPending; DoControl(EControlNotifyChange, aStatus); } sl@0: inline void RLocalDrive::NotifyChangeCancel() sl@0: { DoControl(EControlNotifyChangeCancel); } sl@0: inline TMediaDevice RLocalDrive::MediaDevice() sl@0: { return (TMediaDevice)DoControl(EControlMediaDevice); } sl@0: inline TInt RLocalDrive::SetMountInfo(const TDesC8* aInfo,TInt aMessageHandle) sl@0: { TLocalDriveMessageData d(0,0,aInfo,aMessageHandle,0,0); return DoControl(EControlSetMountInfo, &d); } sl@0: inline TInt RLocalDrive::IsRemovable(TInt& aSocketNum) sl@0: { return DoControl(EControlIsRemovable,&aSocketNum); } sl@0: inline TInt RLocalDrive::ControlIO(TInt aCommand, TAny* aParam1, TAny* aParam2) sl@0: { TLocalDriveControlIOData d(aCommand,aParam1,aParam2,KLocalMessageHandle); return DoControl(EControlControlIO,&d); } sl@0: inline TInt RLocalDrive::ControlIO(TInt aCommand, TDes8& aBuf, TInt aParam) sl@0: { TLocalDriveControlIOData d(aCommand, (TUint8*) aBuf.Ptr(), aParam, aBuf.MaxLength()); return DoControl(EControlControlIO,&d); } sl@0: inline TInt RLocalDrive::ControlIO(TInt aCommand, TDesC8& aBuf, TInt aParam) sl@0: { TLocalDriveControlIOData d(aCommand, (TUint8*) aBuf.Ptr(), aParam, aBuf.Length()); return DoControl(EControlControlIO,&d); } sl@0: inline TInt RLocalDrive::ControlIO(TInt aCommand, TInt aParam1, TInt aParam2) sl@0: { TLocalDriveControlIOData d(aCommand,(TAny*) aParam1,(TAny*) aParam2,0); return DoControl(EControlControlIO,&d); } sl@0: sl@0: sl@0: // RLocalDrive Password Control (Set/Lock/Unlock) sl@0: inline TInt RLocalDrive::Unlock(const TDesC8& aPassword, TBool aStorePassword) sl@0: { TLocalDrivePasswordData d((TDesC8&)aPassword, (TDesC8&)aPassword, aStorePassword); return DoControl(EControlPasswordUnlock, &d); } sl@0: inline TInt RLocalDrive::SetPassword(const TDesC8& aOldPassword, const TDesC8& aNewPassword, TBool aStorePassword) sl@0: { TLocalDrivePasswordData d((TDesC8&)aOldPassword, (TDesC8&)aNewPassword, aStorePassword); return DoControl(EControlPasswordLock, &d); } sl@0: inline TInt RLocalDrive::Clear(const TDesC8& aPassword) sl@0: { TLocalDrivePasswordData d((TDesC8&)aPassword, (TDesC8&)aPassword, EFalse); return DoControl(EControlPasswordClear, &d); } sl@0: inline TInt RLocalDrive::ErasePassword() sl@0: { return DoControl(EControlPasswordErase); } sl@0: sl@0: // RLocalDrive Password Store Control (Read/Write/Length) sl@0: inline TInt RLocalDrive::ReadPasswordData(TDesC8& aStoreData) sl@0: { return DoControl(EControlReadPasswordStore, (TDesC8*)&aStoreData); } sl@0: inline TInt RLocalDrive::WritePasswordData(const TDesC8& aStoreData) sl@0: { return DoControl(EControlWritePasswordStore, (TDesC8*)&aStoreData); } sl@0: inline TInt RLocalDrive::PasswordStoreLengthInBytes() sl@0: { TInt length=0; return DoControl(EControlPasswordStoreLengthInBytes, (TAny*)&length)==KErrNone?length:0; } sl@0: sl@0: inline TInt RLocalDrive::DeleteNotify(TInt64 aPos, TInt aLength) sl@0: { TLocalDriveMessageData d(aPos,aLength,0,KLocalMessageHandle,0,0); return DoControl(EControlDeleteNotify, &d); } sl@0: sl@0: // Get Last Error Info sl@0: inline TInt RLocalDrive::GetLastErrorInfo(TDesC8& aErrorInfo) sl@0: { return DoControl(EControlGetLastErrorInfo, (TDesC8*)&aErrorInfo); } sl@0: sl@0: sl@0: inline TInt RLocalDrive::QueryDevice(TQueryDevice aQueryDevice, TDes8 &aBuf) sl@0: { return DoControl(EControlQueryDevice, (TAny*) aQueryDevice, &aBuf); } sl@0: sl@0: inline TLDFormatInfo::TLDFormatInfo() sl@0: :iCapacity(0),iSectorsPerCluster(0),iSectorsPerTrack(0),iNumberOfSides(0),iFATBits(EFBDontCare), sl@0: iReservedSectors(0), iFlags(0), iPad(0) sl@0: { sl@0: } sl@0: sl@0: inline TInt64 TLocalDriveCapsV4::MediaSizeInBytes() sl@0: { sl@0: // sl@0: // Return the actual size of the media (as opposed to the partition size) sl@0: // sl@0: // Note : We calculate including iNumPagesPerBlock to maintain compatibility with NAND flash sl@0: // where iNumberOfSectors == iNumOfBlocks and iSectorSizeInBytes == iNumBytesMain. sl@0: // The local media subsystem sets a default value of iNumPagesPerBlock == 1. sl@0: // sl@0: return(TInt64(iNumberOfSectors) * iSectorSizeInBytes * iNumPagesPerBlock); sl@0: }