0
|
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 "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// e32\include\d32locd.inl
|
|
15 |
//
|
|
16 |
// WARNING: This file contains some APIs which are internal and are subject
|
|
17 |
// to change without noticed. Such APIs should therefore not be used
|
|
18 |
// outside the Kernel and Hardware Services package.
|
|
19 |
//
|
|
20 |
|
|
21 |
// class RLocalDrive
|
|
22 |
inline TVersion RLocalDrive::VersionRequired() const
|
|
23 |
{ return TVersion(KLocalDriveMajorVersion,KLocalDriveMinorVersion,KLocalDriveBuildVersion); }
|
|
24 |
/**
|
|
25 |
@capability TCB
|
|
26 |
*/
|
|
27 |
inline TInt RLocalDrive::Connect(TInt aDriveNumber, TBool& aChangedFlag)
|
|
28 |
{ return DoCreate(KLitLocalDriveLddName,VersionRequired(),aDriveNumber,NULL,(const TDesC8*)&aChangedFlag,EOwnerProcess); }
|
|
29 |
inline TInt RLocalDrive::Enlarge(TInt aLength)
|
|
30 |
{ return DoControl(EControlEnlarge, (TAny*)aLength); }
|
|
31 |
inline TInt RLocalDrive::Reduce(TInt aPos, TInt aLength)
|
|
32 |
{ return DoControl(EControlReduce, (TAny*)aPos, (TAny*)aLength); }
|
|
33 |
inline TInt RLocalDrive::Read(TInt64 aPos, TInt aLength, const TAny* aTrg, TInt aMessageHandle, TInt aOffset, TInt aFlags)
|
|
34 |
{ TLocalDriveMessageData d(aPos,aLength,aTrg,aMessageHandle,aOffset,aFlags); return DoControl(EControlRead, &d); }
|
|
35 |
inline TInt RLocalDrive::Read(TInt64 aPos, TInt aLength, const TAny* aTrg, TInt aMessageHandle, TInt anOffset)
|
|
36 |
{ TLocalDriveMessageData d(aPos,aLength,aTrg,aMessageHandle,anOffset,0); return DoControl(EControlRead, &d); }
|
|
37 |
inline TInt RLocalDrive::Read(TInt64 aPos, TInt aLength, TDes8& aTrg)
|
|
38 |
{ TLocalDriveMessageData d(aPos,aLength,&aTrg,KLocalMessageHandle,0,ELocDrvMetaData); return DoControl(EControlRead, &d); }
|
|
39 |
inline TInt RLocalDrive::Write(TInt64 aPos, TInt aLength, const TAny* aSrc, TInt aMessageHandle, TInt aOffset, TInt aFlags)
|
|
40 |
{ TLocalDriveMessageData d(aPos,aLength,aSrc,aMessageHandle,aOffset,aFlags); return DoControl(EControlWrite, &d); }
|
|
41 |
inline TInt RLocalDrive::Write(TInt64 aPos, TInt aLength, const TAny* aSrc, TInt aMessageHandle, TInt anOffset)
|
|
42 |
{ TLocalDriveMessageData d(aPos,aLength,aSrc,aMessageHandle,anOffset,0); return DoControl(EControlWrite, &d); }
|
|
43 |
inline TInt RLocalDrive::Write(TInt64 aPos, const TDesC8& aSrc)
|
|
44 |
{ TLocalDriveMessageData d(aPos,aSrc.Length(),&aSrc,KLocalMessageHandle,0,ELocDrvMetaData); return DoControl(EControlWrite, &d); }
|
|
45 |
inline TInt RLocalDrive::Caps(TDes8& anInfo)
|
|
46 |
{ return DoControl(EControlCaps, &anInfo); }
|
|
47 |
inline TInt RLocalDrive::Format(TInt64 aPos, TInt aLength)
|
|
48 |
{ TLocalDriveMessageData d(aPos,aLength,NULL,KLocalMessageHandle,0,0); return DoControl(EControlFormat, &d); }
|
|
49 |
inline TInt RLocalDrive::ForceMediaChange(TInt aMode)
|
|
50 |
{ return DoControl(EControlForceMediaChange, (TAny*)aMode); }
|
|
51 |
inline void RLocalDrive::NotifyChange(TRequestStatus* aStatus)
|
|
52 |
{ *aStatus=KRequestPending; DoControl(EControlNotifyChange, aStatus); }
|
|
53 |
inline void RLocalDrive::NotifyChangeCancel()
|
|
54 |
{ DoControl(EControlNotifyChangeCancel); }
|
|
55 |
inline TMediaDevice RLocalDrive::MediaDevice()
|
|
56 |
{ return (TMediaDevice)DoControl(EControlMediaDevice); }
|
|
57 |
inline TInt RLocalDrive::SetMountInfo(const TDesC8* aInfo,TInt aMessageHandle)
|
|
58 |
{ TLocalDriveMessageData d(0,0,aInfo,aMessageHandle,0,0); return DoControl(EControlSetMountInfo, &d); }
|
|
59 |
inline TInt RLocalDrive::IsRemovable(TInt& aSocketNum)
|
|
60 |
{ return DoControl(EControlIsRemovable,&aSocketNum); }
|
|
61 |
inline TInt RLocalDrive::ControlIO(TInt aCommand, TAny* aParam1, TAny* aParam2)
|
|
62 |
{ TLocalDriveControlIOData d(aCommand,aParam1,aParam2,KLocalMessageHandle); return DoControl(EControlControlIO,&d); }
|
|
63 |
inline TInt RLocalDrive::ControlIO(TInt aCommand, TDes8& aBuf, TInt aParam)
|
|
64 |
{ TLocalDriveControlIOData d(aCommand, (TUint8*) aBuf.Ptr(), aParam, aBuf.MaxLength()); return DoControl(EControlControlIO,&d); }
|
|
65 |
inline TInt RLocalDrive::ControlIO(TInt aCommand, TDesC8& aBuf, TInt aParam)
|
|
66 |
{ TLocalDriveControlIOData d(aCommand, (TUint8*) aBuf.Ptr(), aParam, aBuf.Length()); return DoControl(EControlControlIO,&d); }
|
|
67 |
inline TInt RLocalDrive::ControlIO(TInt aCommand, TInt aParam1, TInt aParam2)
|
|
68 |
{ TLocalDriveControlIOData d(aCommand,(TAny*) aParam1,(TAny*) aParam2,0); return DoControl(EControlControlIO,&d); }
|
|
69 |
|
|
70 |
|
|
71 |
// RLocalDrive Password Control (Set/Lock/Unlock)
|
|
72 |
inline TInt RLocalDrive::Unlock(const TDesC8& aPassword, TBool aStorePassword)
|
|
73 |
{ TLocalDrivePasswordData d((TDesC8&)aPassword, (TDesC8&)aPassword, aStorePassword); return DoControl(EControlPasswordUnlock, &d); }
|
|
74 |
inline TInt RLocalDrive::SetPassword(const TDesC8& aOldPassword, const TDesC8& aNewPassword, TBool aStorePassword)
|
|
75 |
{ TLocalDrivePasswordData d((TDesC8&)aOldPassword, (TDesC8&)aNewPassword, aStorePassword); return DoControl(EControlPasswordLock, &d); }
|
|
76 |
inline TInt RLocalDrive::Clear(const TDesC8& aPassword)
|
|
77 |
{ TLocalDrivePasswordData d((TDesC8&)aPassword, (TDesC8&)aPassword, EFalse); return DoControl(EControlPasswordClear, &d); }
|
|
78 |
inline TInt RLocalDrive::ErasePassword()
|
|
79 |
{ return DoControl(EControlPasswordErase); }
|
|
80 |
|
|
81 |
// RLocalDrive Password Store Control (Read/Write/Length)
|
|
82 |
inline TInt RLocalDrive::ReadPasswordData(TDesC8& aStoreData)
|
|
83 |
{ return DoControl(EControlReadPasswordStore, (TDesC8*)&aStoreData); }
|
|
84 |
inline TInt RLocalDrive::WritePasswordData(const TDesC8& aStoreData)
|
|
85 |
{ return DoControl(EControlWritePasswordStore, (TDesC8*)&aStoreData); }
|
|
86 |
inline TInt RLocalDrive::PasswordStoreLengthInBytes()
|
|
87 |
{ TInt length=0; return DoControl(EControlPasswordStoreLengthInBytes, (TAny*)&length)==KErrNone?length:0; }
|
|
88 |
|
|
89 |
inline TInt RLocalDrive::DeleteNotify(TInt64 aPos, TInt aLength)
|
|
90 |
{ TLocalDriveMessageData d(aPos,aLength,0,KLocalMessageHandle,0,0); return DoControl(EControlDeleteNotify, &d); }
|
|
91 |
|
|
92 |
// Get Last Error Info
|
|
93 |
inline TInt RLocalDrive::GetLastErrorInfo(TDesC8& aErrorInfo)
|
|
94 |
{ return DoControl(EControlGetLastErrorInfo, (TDesC8*)&aErrorInfo); }
|
|
95 |
|
|
96 |
|
|
97 |
inline TInt RLocalDrive::QueryDevice(TQueryDevice aQueryDevice, TDes8 &aBuf)
|
|
98 |
{ return DoControl(EControlQueryDevice, (TAny*) aQueryDevice, &aBuf); }
|
|
99 |
|
|
100 |
inline TLDFormatInfo::TLDFormatInfo()
|
|
101 |
:iCapacity(0),iSectorsPerCluster(0),iSectorsPerTrack(0),iNumberOfSides(0),iFATBits(EFBDontCare),
|
|
102 |
iReservedSectors(0), iFlags(0), iPad(0)
|
|
103 |
{
|
|
104 |
}
|
|
105 |
|
|
106 |
inline TInt64 TLocalDriveCapsV4::MediaSizeInBytes()
|
|
107 |
{
|
|
108 |
//
|
|
109 |
// Return the actual size of the media (as opposed to the partition size)
|
|
110 |
//
|
|
111 |
// Note : We calculate including iNumPagesPerBlock to maintain compatibility with NAND flash
|
|
112 |
// where iNumberOfSectors == iNumOfBlocks and iSectorSizeInBytes == iNumBytesMain.
|
|
113 |
// The local media subsystem sets a default value of iNumPagesPerBlock == 1.
|
|
114 |
//
|
|
115 |
return(TInt64(iNumberOfSectors) * iSectorSizeInBytes * iNumPagesPerBlock);
|
|
116 |
}
|