symport/e32/include/d32locd.inl
changeset 1 0a7b44b10206
child 2 806186ab5e14
equal deleted inserted replaced
0:c55016431358 1:0a7b44b10206
       
     1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Symbian Foundation License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // e32\include\d32locd.inl
       
    15 // 
       
    16 //
       
    17 
       
    18 // class RLocalDrive
       
    19 inline TVersion RLocalDrive::VersionRequired() const
       
    20 	{ return TVersion(KLocalDriveMajorVersion,KLocalDriveMinorVersion,KLocalDriveBuildVersion); }
       
    21 /**
       
    22 @capability TCB
       
    23 */
       
    24 inline TInt RLocalDrive::Connect(TInt aDriveNumber, TBool& aChangedFlag)
       
    25 	{ return DoCreate(KLitLocalDriveLddName,VersionRequired(),aDriveNumber,NULL,(const TDesC8*)&aChangedFlag,EOwnerProcess); }
       
    26 inline TInt RLocalDrive::Enlarge(TInt aLength)
       
    27 	{ return DoControl(EControlEnlarge, (TAny*)aLength); }
       
    28 inline TInt RLocalDrive::Reduce(TInt aPos, TInt aLength)
       
    29 	{ return DoControl(EControlReduce, (TAny*)aPos, (TAny*)aLength); }
       
    30 inline TInt RLocalDrive::Read(TInt64 aPos, TInt aLength, const TAny* aTrg, TInt aMessageHandle, TInt aOffset, TInt aFlags)
       
    31 	{ TLocalDriveMessageData d(aPos,aLength,aTrg,aMessageHandle,aOffset,aFlags); return DoControl(EControlRead, &d); }
       
    32 inline TInt RLocalDrive::Read(TInt64 aPos, TInt aLength, const TAny* aTrg, TInt aMessageHandle, TInt anOffset)
       
    33 	{ TLocalDriveMessageData d(aPos,aLength,aTrg,aMessageHandle,anOffset,0); return DoControl(EControlRead, &d); }
       
    34 inline TInt RLocalDrive::Read(TInt64 aPos, TInt aLength, TDes8& aTrg)
       
    35 	{ TLocalDriveMessageData d(aPos,aLength,&aTrg,KLocalMessageHandle,0,ELocDrvMetaData); return DoControl(EControlRead, &d); }
       
    36 inline TInt RLocalDrive::Write(TInt64 aPos, TInt aLength, const TAny* aSrc, TInt aMessageHandle, TInt aOffset, TInt aFlags)
       
    37 	{ TLocalDriveMessageData d(aPos,aLength,aSrc,aMessageHandle,aOffset,aFlags); return DoControl(EControlWrite, &d); }
       
    38 inline TInt RLocalDrive::Write(TInt64 aPos, TInt aLength, const TAny* aSrc, TInt aMessageHandle, TInt anOffset)
       
    39 	{ TLocalDriveMessageData d(aPos,aLength,aSrc,aMessageHandle,anOffset,0); return DoControl(EControlWrite, &d); }
       
    40 inline TInt RLocalDrive::Write(TInt64 aPos, const TDesC8& aSrc)
       
    41 	{ TLocalDriveMessageData d(aPos,aSrc.Length(),&aSrc,KLocalMessageHandle,0,ELocDrvMetaData); return DoControl(EControlWrite, &d); }
       
    42 inline TInt RLocalDrive::Caps(TDes8& anInfo)
       
    43 	{ return DoControl(EControlCaps, &anInfo); }
       
    44 inline TInt RLocalDrive::Format(TInt64 aPos, TInt aLength)
       
    45 	{ TLocalDriveMessageData d(aPos,aLength,NULL,KLocalMessageHandle,0,0); return DoControl(EControlFormat, &d); }
       
    46 inline TInt RLocalDrive::ForceMediaChange(TInt aMode)
       
    47 	{ return DoControl(EControlForceMediaChange, (TAny*)aMode); }
       
    48 inline void RLocalDrive::NotifyChange(TRequestStatus* aStatus)
       
    49 	{ *aStatus=KRequestPending; DoControl(EControlNotifyChange, aStatus); }
       
    50 inline void RLocalDrive::NotifyChangeCancel()
       
    51 	{ DoControl(EControlNotifyChangeCancel); }
       
    52 inline TMediaDevice RLocalDrive::MediaDevice()
       
    53 	{ return (TMediaDevice)DoControl(EControlMediaDevice); }
       
    54 inline TInt RLocalDrive::SetMountInfo(const TDesC8* aInfo,TInt aMessageHandle)
       
    55 	{ TLocalDriveMessageData d(0,0,aInfo,aMessageHandle,0,0); return DoControl(EControlSetMountInfo, &d); }
       
    56 inline TInt RLocalDrive::IsRemovable(TInt& aSocketNum)
       
    57 	{ return DoControl(EControlIsRemovable,&aSocketNum); }
       
    58 inline TInt RLocalDrive::ControlIO(TInt aCommand, TAny* aParam1, TAny* aParam2)
       
    59 	{ TLocalDriveControlIOData d(aCommand,aParam1,aParam2,KLocalMessageHandle); return DoControl(EControlControlIO,&d); }
       
    60 
       
    61 
       
    62 // RLocalDrive Password Control (Set/Lock/Unlock)
       
    63 inline TInt RLocalDrive::Unlock(const TDesC8& aPassword, TBool aStorePassword)
       
    64 	{ TLocalDrivePasswordData d((TDesC8&)aPassword, (TDesC8&)aPassword, aStorePassword); return DoControl(EControlPasswordUnlock, &d); }
       
    65 inline TInt RLocalDrive::SetPassword(const TDesC8& aOldPassword, const TDesC8& aNewPassword, TBool aStorePassword)
       
    66 	{ TLocalDrivePasswordData d((TDesC8&)aOldPassword, (TDesC8&)aNewPassword, aStorePassword); return DoControl(EControlPasswordLock, &d); }
       
    67 inline TInt RLocalDrive::Clear(const TDesC8& aPassword)
       
    68 	{ TLocalDrivePasswordData d((TDesC8&)aPassword, (TDesC8&)aPassword, EFalse); return DoControl(EControlPasswordClear, &d); }
       
    69 inline TInt RLocalDrive::ErasePassword()
       
    70 	{ return DoControl(EControlPasswordErase); }
       
    71 
       
    72 // RLocalDrive Password Store Control (Read/Write/Length)
       
    73 inline TInt RLocalDrive::ReadPasswordData(TDesC8& aStoreData)
       
    74 	{ return DoControl(EControlReadPasswordStore, (TDesC8*)&aStoreData); }
       
    75 inline TInt RLocalDrive::WritePasswordData(const TDesC8& aStoreData)
       
    76 	{ return DoControl(EControlWritePasswordStore, (TDesC8*)&aStoreData); }
       
    77 inline TInt RLocalDrive::PasswordStoreLengthInBytes()
       
    78 	{ TInt length=0; return DoControl(EControlPasswordStoreLengthInBytes, (TAny*)&length)==KErrNone?length:0; }
       
    79 
       
    80 inline TInt RLocalDrive::DeleteNotify(TInt64 aPos, TInt aLength)
       
    81 	{ TLocalDriveMessageData d(aPos,aLength,0,KLocalMessageHandle,0,0); return DoControl(EControlDeleteNotify, &d); }
       
    82 
       
    83 // Get Last Error Info
       
    84 inline TInt RLocalDrive::GetLastErrorInfo(TDesC8& aErrorInfo)
       
    85 	{ return DoControl(EControlGetLastErrorInfo, (TDesC8*)&aErrorInfo); }
       
    86 
       
    87 
       
    88 inline TLDFormatInfo::TLDFormatInfo()
       
    89                      :iCapacity(0),iSectorsPerCluster(0),iSectorsPerTrack(0),iNumberOfSides(0),iFATBits(EFBDontCare),
       
    90                      iReservedSectors(0), iFlags(0), iPad(0)
       
    91     {
       
    92     }
       
    93 
       
    94 inline TInt64 TLocalDriveCapsV4::MediaSizeInBytes()
       
    95 	{
       
    96 	//
       
    97 	// Return the actual size of the media (as opposed to the partition size)
       
    98 	//
       
    99 	// Note : We calculate including iNumPagesPerBlock to maintain compatibility with NAND flash
       
   100 	//		  where iNumberOfSectors == iNumOfBlocks and iSectorSizeInBytes == iNumBytesMain.
       
   101 	//		  The local media subsystem sets a default value of iNumPagesPerBlock == 1.
       
   102 	//
       
   103 	return(TInt64(iNumberOfSectors) * iSectorSizeInBytes * iNumPagesPerBlock);
       
   104 	}