1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kernel/eka/include/d32locd.inl Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,116 @@
1.4 +// Copyright (c) 1999-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 +// e32\include\d32locd.inl
1.18 +//
1.19 +// WARNING: This file contains some APIs which are internal and are subject
1.20 +// to change without noticed. Such APIs should therefore not be used
1.21 +// outside the Kernel and Hardware Services package.
1.22 +//
1.23 +
1.24 +// class RLocalDrive
1.25 +inline TVersion RLocalDrive::VersionRequired() const
1.26 + { return TVersion(KLocalDriveMajorVersion,KLocalDriveMinorVersion,KLocalDriveBuildVersion); }
1.27 +/**
1.28 +@capability TCB
1.29 +*/
1.30 +inline TInt RLocalDrive::Connect(TInt aDriveNumber, TBool& aChangedFlag)
1.31 + { return DoCreate(KLitLocalDriveLddName,VersionRequired(),aDriveNumber,NULL,(const TDesC8*)&aChangedFlag,EOwnerProcess); }
1.32 +inline TInt RLocalDrive::Enlarge(TInt aLength)
1.33 + { return DoControl(EControlEnlarge, (TAny*)aLength); }
1.34 +inline TInt RLocalDrive::Reduce(TInt aPos, TInt aLength)
1.35 + { return DoControl(EControlReduce, (TAny*)aPos, (TAny*)aLength); }
1.36 +inline TInt RLocalDrive::Read(TInt64 aPos, TInt aLength, const TAny* aTrg, TInt aMessageHandle, TInt aOffset, TInt aFlags)
1.37 + { TLocalDriveMessageData d(aPos,aLength,aTrg,aMessageHandle,aOffset,aFlags); return DoControl(EControlRead, &d); }
1.38 +inline TInt RLocalDrive::Read(TInt64 aPos, TInt aLength, const TAny* aTrg, TInt aMessageHandle, TInt anOffset)
1.39 + { TLocalDriveMessageData d(aPos,aLength,aTrg,aMessageHandle,anOffset,0); return DoControl(EControlRead, &d); }
1.40 +inline TInt RLocalDrive::Read(TInt64 aPos, TInt aLength, TDes8& aTrg)
1.41 + { TLocalDriveMessageData d(aPos,aLength,&aTrg,KLocalMessageHandle,0,ELocDrvMetaData); return DoControl(EControlRead, &d); }
1.42 +inline TInt RLocalDrive::Write(TInt64 aPos, TInt aLength, const TAny* aSrc, TInt aMessageHandle, TInt aOffset, TInt aFlags)
1.43 + { TLocalDriveMessageData d(aPos,aLength,aSrc,aMessageHandle,aOffset,aFlags); return DoControl(EControlWrite, &d); }
1.44 +inline TInt RLocalDrive::Write(TInt64 aPos, TInt aLength, const TAny* aSrc, TInt aMessageHandle, TInt anOffset)
1.45 + { TLocalDriveMessageData d(aPos,aLength,aSrc,aMessageHandle,anOffset,0); return DoControl(EControlWrite, &d); }
1.46 +inline TInt RLocalDrive::Write(TInt64 aPos, const TDesC8& aSrc)
1.47 + { TLocalDriveMessageData d(aPos,aSrc.Length(),&aSrc,KLocalMessageHandle,0,ELocDrvMetaData); return DoControl(EControlWrite, &d); }
1.48 +inline TInt RLocalDrive::Caps(TDes8& anInfo)
1.49 + { return DoControl(EControlCaps, &anInfo); }
1.50 +inline TInt RLocalDrive::Format(TInt64 aPos, TInt aLength)
1.51 + { TLocalDriveMessageData d(aPos,aLength,NULL,KLocalMessageHandle,0,0); return DoControl(EControlFormat, &d); }
1.52 +inline TInt RLocalDrive::ForceMediaChange(TInt aMode)
1.53 + { return DoControl(EControlForceMediaChange, (TAny*)aMode); }
1.54 +inline void RLocalDrive::NotifyChange(TRequestStatus* aStatus)
1.55 + { *aStatus=KRequestPending; DoControl(EControlNotifyChange, aStatus); }
1.56 +inline void RLocalDrive::NotifyChangeCancel()
1.57 + { DoControl(EControlNotifyChangeCancel); }
1.58 +inline TMediaDevice RLocalDrive::MediaDevice()
1.59 + { return (TMediaDevice)DoControl(EControlMediaDevice); }
1.60 +inline TInt RLocalDrive::SetMountInfo(const TDesC8* aInfo,TInt aMessageHandle)
1.61 + { TLocalDriveMessageData d(0,0,aInfo,aMessageHandle,0,0); return DoControl(EControlSetMountInfo, &d); }
1.62 +inline TInt RLocalDrive::IsRemovable(TInt& aSocketNum)
1.63 + { return DoControl(EControlIsRemovable,&aSocketNum); }
1.64 +inline TInt RLocalDrive::ControlIO(TInt aCommand, TAny* aParam1, TAny* aParam2)
1.65 + { TLocalDriveControlIOData d(aCommand,aParam1,aParam2,KLocalMessageHandle); return DoControl(EControlControlIO,&d); }
1.66 +inline TInt RLocalDrive::ControlIO(TInt aCommand, TDes8& aBuf, TInt aParam)
1.67 + { TLocalDriveControlIOData d(aCommand, (TUint8*) aBuf.Ptr(), aParam, aBuf.MaxLength()); return DoControl(EControlControlIO,&d); }
1.68 +inline TInt RLocalDrive::ControlIO(TInt aCommand, TDesC8& aBuf, TInt aParam)
1.69 + { TLocalDriveControlIOData d(aCommand, (TUint8*) aBuf.Ptr(), aParam, aBuf.Length()); return DoControl(EControlControlIO,&d); }
1.70 +inline TInt RLocalDrive::ControlIO(TInt aCommand, TInt aParam1, TInt aParam2)
1.71 + { TLocalDriveControlIOData d(aCommand,(TAny*) aParam1,(TAny*) aParam2,0); return DoControl(EControlControlIO,&d); }
1.72 +
1.73 +
1.74 +// RLocalDrive Password Control (Set/Lock/Unlock)
1.75 +inline TInt RLocalDrive::Unlock(const TDesC8& aPassword, TBool aStorePassword)
1.76 + { TLocalDrivePasswordData d((TDesC8&)aPassword, (TDesC8&)aPassword, aStorePassword); return DoControl(EControlPasswordUnlock, &d); }
1.77 +inline TInt RLocalDrive::SetPassword(const TDesC8& aOldPassword, const TDesC8& aNewPassword, TBool aStorePassword)
1.78 + { TLocalDrivePasswordData d((TDesC8&)aOldPassword, (TDesC8&)aNewPassword, aStorePassword); return DoControl(EControlPasswordLock, &d); }
1.79 +inline TInt RLocalDrive::Clear(const TDesC8& aPassword)
1.80 + { TLocalDrivePasswordData d((TDesC8&)aPassword, (TDesC8&)aPassword, EFalse); return DoControl(EControlPasswordClear, &d); }
1.81 +inline TInt RLocalDrive::ErasePassword()
1.82 + { return DoControl(EControlPasswordErase); }
1.83 +
1.84 +// RLocalDrive Password Store Control (Read/Write/Length)
1.85 +inline TInt RLocalDrive::ReadPasswordData(TDesC8& aStoreData)
1.86 + { return DoControl(EControlReadPasswordStore, (TDesC8*)&aStoreData); }
1.87 +inline TInt RLocalDrive::WritePasswordData(const TDesC8& aStoreData)
1.88 + { return DoControl(EControlWritePasswordStore, (TDesC8*)&aStoreData); }
1.89 +inline TInt RLocalDrive::PasswordStoreLengthInBytes()
1.90 + { TInt length=0; return DoControl(EControlPasswordStoreLengthInBytes, (TAny*)&length)==KErrNone?length:0; }
1.91 +
1.92 +inline TInt RLocalDrive::DeleteNotify(TInt64 aPos, TInt aLength)
1.93 + { TLocalDriveMessageData d(aPos,aLength,0,KLocalMessageHandle,0,0); return DoControl(EControlDeleteNotify, &d); }
1.94 +
1.95 +// Get Last Error Info
1.96 +inline TInt RLocalDrive::GetLastErrorInfo(TDesC8& aErrorInfo)
1.97 + { return DoControl(EControlGetLastErrorInfo, (TDesC8*)&aErrorInfo); }
1.98 +
1.99 +
1.100 +inline TInt RLocalDrive::QueryDevice(TQueryDevice aQueryDevice, TDes8 &aBuf)
1.101 + { return DoControl(EControlQueryDevice, (TAny*) aQueryDevice, &aBuf); }
1.102 +
1.103 +inline TLDFormatInfo::TLDFormatInfo()
1.104 + :iCapacity(0),iSectorsPerCluster(0),iSectorsPerTrack(0),iNumberOfSides(0),iFATBits(EFBDontCare),
1.105 + iReservedSectors(0), iFlags(0), iPad(0)
1.106 + {
1.107 + }
1.108 +
1.109 +inline TInt64 TLocalDriveCapsV4::MediaSizeInBytes()
1.110 + {
1.111 + //
1.112 + // Return the actual size of the media (as opposed to the partition size)
1.113 + //
1.114 + // Note : We calculate including iNumPagesPerBlock to maintain compatibility with NAND flash
1.115 + // where iNumberOfSectors == iNumOfBlocks and iSectorSizeInBytes == iNumBytesMain.
1.116 + // The local media subsystem sets a default value of iNumPagesPerBlock == 1.
1.117 + //
1.118 + return(TInt64(iNumberOfSectors) * iSectorSizeInBytes * iNumPagesPerBlock);
1.119 + }