author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 11 Jun 2010 15:02:23 +0300 | |
changeset 152 | 657f875b013e |
parent 90 | 947f0dc9f7a8 |
child 140 | 2ac1c5c27758 |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 1998-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 |
// f32\sfile\sf_std.inl |
|
15 |
// |
|
16 |
// |
|
17 |
||
18 |
#ifndef SF_STD_INL |
|
19 |
#define SF_STD_INL |
|
20 |
||
21 |
//Class CFsRequest |
|
22 |
||
23 |
void CFsRequest::Kill(TInt aReason) |
|
24 |
{ |
|
25 |
if(!ErrorPlugin(aReason)) |
|
26 |
Message().Kill(aReason); |
|
27 |
} |
|
28 |
||
29 |
void CFsRequest::Terminate(TInt aReason) |
|
30 |
{ |
|
31 |
if(!ErrorPlugin(aReason)) |
|
32 |
Message().Terminate(aReason); |
|
33 |
} |
|
34 |
||
35 |
void CFsRequest::Panic(const TDesC &aCategory,TInt aReason) |
|
36 |
{ |
|
37 |
__IF_DEBUG(Print(_L("CFsRequest::Panic %S %d"),&aCategory,aReason)); |
|
38 |
if(!ErrorPlugin(aReason)) |
|
39 |
Message().Panic(aCategory,aReason); |
|
40 |
} |
|
41 |
||
42 |
TBool CFsRequest::ErrorPlugin(TInt aError) |
|
43 |
{ |
|
44 |
CFsMessageRequest& self = *(CFsMessageRequest*)this; |
|
45 |
CFsPlugin* plugin = self.iOwnerPlugin; |
|
46 |
if(plugin) |
|
47 |
{ |
|
48 |
plugin->iLastError = aError; |
|
49 |
plugin->iThreadP->OperationLockSignal(); |
|
50 |
self.iOwnerPlugin = NULL; |
|
51 |
return ETrue; |
|
52 |
} |
|
53 |
return EFalse; |
|
54 |
} |
|
55 |
||
56 |
// class CFsObjectIx |
|
57 |
TInt CFsObjectIx::Count() const |
|
58 |
{return(iHighWaterMark);} |
|
59 |
TInt CFsObjectIx::ActiveCount() const |
|
60 |
{return(iNumEntries);} |
|
61 |
void CFsObjectIx::Lock() |
|
62 |
{iLock.Wait();} |
|
63 |
void CFsObjectIx::Unlock() |
|
64 |
{iLock.Signal();} |
|
65 |
||
66 |
// class CFsObjectCon |
|
67 |
void CFsObjectCon::Lock() |
|
68 |
{iLock.Wait();} |
|
69 |
void CFsObjectCon::Unlock() |
|
70 |
{iLock.Signal();} |
|
71 |
TInt CFsObjectCon::UniqueID() const |
|
72 |
{return(iUniqueID);} |
|
73 |
TInt CFsObjectCon::Count() const |
|
74 |
{return(iCount);} |
|
75 |
||
76 |
// class CDisconnectThread |
|
77 |
CFsInternalRequest* CDisconnectThread::GetRequest() |
|
78 |
{return(iRequest);} |
|
79 |
||
80 |
||
81 |
||
82 |
||
83 |
||
84 |
||
85 |
||
86 |
||
87 |
// class CServerFs |
|
88 |
void CServerFs::SessionQueueLockWait() |
|
89 |
{iSessionQueueLock.Wait();} |
|
90 |
||
91 |
void CServerFs::SessionQueueLockSignal() |
|
92 |
{iSessionQueueLock.Signal();} |
|
93 |
||
94 |
// class CSessionFs |
|
95 |
void CSessionFs::IncResourceCount() |
|
96 |
{ __e32_atomic_add_ord32(&iResourceCount, 1); } |
|
97 |
void CSessionFs::DecResourceCount() |
|
98 |
{ __e32_atomic_add_ord32(&iResourceCount, (TUint32)(-1)); } |
|
99 |
CFsObjectIx& CSessionFs::Handles() |
|
100 |
{return(*iHandles);} |
|
101 |
||
102 |
||
103 |
HBufC& CSessionFs::Path() |
|
104 |
{/*__CHECK_MAINTHREAD();*/ return(*iPath);} |
|
105 |
void CSessionFs::SetPath(HBufC* aPath) |
|
106 |
{__CHECK_MAINTHREAD(); iPath=aPath;} |
|
107 |
||
108 |
TThreadId& CSessionFs::ThreadId() |
|
109 |
{ return iId; } |
|
110 |
void CSessionFs::SetThreadId(const TThreadId& aId) |
|
111 |
{ |
|
112 |
iId = aId; |
|
113 |
} |
|
114 |
||
115 |
||
116 |
// class TReservedDriveAccess |
|
117 |
TReservedDriveAccess::TReservedDriveAccess(TInt aDriveNumber) |
|
118 |
: iDriveNumber(aDriveNumber), |
|
119 |
iReservedSpace(0), |
|
120 |
iReservedAccess(EFalse) |
|
121 |
{ } |
|
122 |
||
123 |
TReservedDriveAccess::TReservedDriveAccess(TInt aDriveNumber, TInt aReservedSpace) |
|
124 |
: iDriveNumber(aDriveNumber), |
|
125 |
iReservedSpace(aReservedSpace), |
|
126 |
iReservedAccess(EFalse) |
|
127 |
{ } |
|
128 |
||
129 |
||
130 |
// class TOperation |
|
131 |
TBool TOperation::IsSync() const |
|
132 |
{return(iFlags & ESync)?(TBool)ETrue:(TBool)EFalse;} |
|
133 |
TInt TOperation::Function() |
|
134 |
{return(iFunction);} |
|
135 |
TInt TOperation::Initialise(CFsRequest* aRequest) |
|
136 |
{return((*iInitialise)(aRequest));} |
|
137 |
TInt TOperation::PostInitialise(CFsRequest* aRequest) |
|
138 |
{return((*iPostInitialise)(aRequest));} |
|
139 |
TInt TOperation::DoRequestL(CFsRequest* aRequest) |
|
140 |
{return((*iDoRequestL)(aRequest));} |
|
141 |
TFsPluginRequest::TF32ArgType TOperation::Arg(TUint aIndex) |
|
142 |
{return((TFsPluginRequest::TF32ArgType)((TUint8*)&iArgs)[aIndex]);} |
|
143 |
||
144 |
||
145 |
inline void TMsgOperation::Set(TInt64 aPos, TInt aLength, TUint8* aData, TInt aOffset, TInt aNextState) |
|
146 |
{ |
|
147 |
iReadWriteArgs.iPos = aPos; |
|
148 |
iReadWriteArgs.iTotalLength = iReadWriteArgs.iLength = aLength; |
|
149 |
iReadWriteArgs.iData = aData; |
|
150 |
iReadWriteArgs.iOffset = aOffset; |
|
151 |
iClientRequest = EFalse; |
|
152 |
iState = aNextState; |
|
153 |
} |
|
154 |
||
155 |
//Operations pushed from the client use this version of Set |
|
156 |
inline void TMsgOperation::Set(TInt64 aPos, TInt aLength, TDesC8* aData, TInt aOffset, TInt aNextState) |
|
157 |
{ |
|
158 |
iReadWriteArgs.iPos = aPos; |
|
159 |
iReadWriteArgs.iTotalLength = iReadWriteArgs.iLength = aLength; |
|
160 |
iReadWriteArgs.iData = aData; |
|
161 |
iReadWriteArgs.iOffset = aOffset; |
|
162 |
iClientRequest = ETrue; |
|
163 |
iState = aNextState; |
|
164 |
} |
|
165 |
||
166 |
// class CFsRequest |
|
167 |
TOperation* CFsRequest::Operation() |
|
168 |
{return(iOperation);} |
|
169 |
CSessionFs* CFsRequest::Session() |
|
170 |
{return(iSession);} |
|
171 |
void CFsRequest::SetSession(CSessionFs* aSession) |
|
172 |
{iSession=aSession;} |
|
173 |
TInt CFsRequest::DriveNumber() |
|
174 |
{return(iDriveNumber);} |
|
175 |
void CFsRequest::SetDriveNumber(TInt aDriveNumber) |
|
176 |
{iDriveNumber=aDriveNumber;} |
|
177 |
TBool CFsRequest::IsCompleted() |
|
178 |
{return(iIsCompleted);} |
|
179 |
void CFsRequest::SetCompleted(TBool aIsCompleted) |
|
180 |
{iIsCompleted=aIsCompleted;} |
|
181 |
TUint CFsRequest::ScratchValue() |
|
182 |
{return I64LOW(iScratchValue);} |
|
183 |
void CFsRequest::SetScratchValue(const TUint aValue) |
|
184 |
{SetAndOpenScratchValue(aValue);} |
|
185 |
TInt64 CFsRequest::ScratchValue64() |
|
186 |
{return(iScratchValue);} |
|
187 |
void CFsRequest::SetScratchValue64(const TInt64& aValue) |
|
188 |
{SetAndOpenScratchValue(aValue);} |
|
189 |
TBool CFsRequest::IsSeparateThread() |
|
190 |
{return(!iOperation->IsSync());} |
|
191 |
TBool CFsRequest::IsPostOperation() const |
|
192 |
{return iFlags & EPostOperation;} |
|
193 |
void CFsRequest::SetPostOperation(TBool aSet) |
|
194 |
{aSet? iFlags |= EPostOperation : iFlags &= ~EPostOperation;} |
|
195 |
TBool CFsRequest::IsPluginSpecific() const |
|
196 |
{return(iOperation->iFunction == EFsPluginOpen || |
|
197 |
iOperation->iFunction == EFsPluginDoRequest || |
|
198 |
iOperation->iFunction == EFsPluginDoControl || |
|
199 |
iOperation->iFunction == EFsPluginDoCancel);} |
|
200 |
||
201 |
TBool CFsRequest::IsExpectedResult(TInt aError) const |
|
202 |
{return ((aError == KErrNone) || |
|
203 |
(iOperation->iFunction == EFsDirReadPacked && aError == KErrEof));} |
|
204 |
||
205 |
void CFsRequest::SetError(TInt aError) |
|
206 |
{iError = aError;} |
|
207 |
||
208 |
TInt CFsRequest::GetError() const |
|
209 |
{return iError;} |
|
210 |
||
211 |
TBool CFsRequest::IsChangeNotify() const |
|
212 |
{ return ( iSession && iSession->IsChangeNotify() && iOperation->IsChangeNotify()); } |
|
213 |
||
214 |
void CFsRequest::SetState(TReqStates aReqState) |
|
215 |
{ iReqState = aReqState; } |
|
216 |
||
217 |
TBool CFsRequest::DirectToDrive() |
|
218 |
{ return(iDirectToDrive); } |
|
219 |
||
220 |
TBool CFsRequest::IsFsObjectOpen() |
|
221 |
{ return iFlags & EFsObjectOpen;} |
|
222 |
void CFsRequest::SetFsObjectOpen(TBool aSet) |
|
223 |
{aSet? iFlags |= EFsObjectOpen : iFlags &= ~EFsObjectOpen;} |
|
224 |
||
225 |
/** |
|
226 |
Returns ETrue if the IPC Message Argument slot is packed with descriptor data for |
|
227 |
EFsFileRead, EFsFileWrite, EFsFileSeek, EFsFileLock, EFsFileUnLock, EFsFileSize, |
|
228 |
EFsFileSetSize and EFsReadFileSection requests. |
|
229 |
||
230 |
@panic if the aMsgNum is greater than the number of IPC message arguments, KMaxMessageArguments. |
|
231 |
||
232 |
@param IPC message argument index |
|
233 |
*/ |
|
234 |
TBool CFsRequest::IsDescData(TInt aMsgNum) |
|
235 |
{ |
|
236 |
__ASSERT_DEBUG(aMsgNum < KMaxMessageArguments, Fault(EBadMessageSlotIndex)); |
|
237 |
return ((1 << (aMsgNum + KIpcFlagOffset)) & Message().Function())?(TBool)ETrue:(TBool)EFalse; |
|
238 |
} |
|
239 |
||
240 |
/** |
|
241 |
Least 16 bits (0 to 15) are used for file server operation index. |
|
242 |
Remaining bits (16 to 31) are reserved for other purposes. |
|
243 |
Should be called in place of CFsRequest::Message().Function() |
|
244 |
if the file server operation index is required. |
|
245 |
||
246 |
@return Returns the file server operation index by masking the upper 16 bits. |
|
247 |
*/ |
|
248 |
TInt CFsRequest::FsFunction() |
|
249 |
{return (Message().Function() & KIpcFunctionMask);} |
|
250 |
||
251 |
// class CFsMessageRequest |
|
252 |
void CFsMessageRequest::SetMessage(RMessage2& aMessage) |
|
253 |
{iMessage=aMessage;} |
|
254 |
||
255 |
TMsgOperation* CFsMessageRequest::CurrentOperationPtr() |
|
256 |
{return iCurrentOperation;} |
|
257 |
||
258 |
// class CFsInternalRequest |
|
259 |
void CFsInternalRequest::SetThreadHandle(TInt aThreadHandle) |
|
260 |
{iThreadHandle=aThreadHandle;} |
|
261 |
TInt CFsInternalRequest::ThreadHandle() |
|
262 |
{return(iThreadHandle);} |
|
263 |
TRequestStatus& CFsInternalRequest::Status() |
|
264 |
{return(iStatus);} |
|
265 |
TBool CFsInternalRequest::IsAllocated() |
|
266 |
{return(iIsAllocated);} |
|
267 |
void CFsInternalRequest::SetAllocated() |
|
268 |
{iIsAllocated=ETrue;} |
|
269 |
||
270 |
// class CFsMessageRequest |
|
271 |
TBool CFsMessageRequest::IsFreeChanged() |
|
272 |
{return(iFlags & EFreeChanged);} |
|
273 |
void CFsMessageRequest::SetFreeChanged(TBool aChanged) |
|
274 |
{ if (aChanged) iFlags |= EFreeChanged; else iFlags &= ~EFreeChanged;}; |
|
275 |
TBool CFsMessageRequest::IsAllocated() |
|
276 |
{return(iFlags & EIsAllocated);} |
|
277 |
void CFsMessageRequest::SetAllocated() |
|
278 |
{iFlags |= EIsAllocated;} |
|
279 |
CFsMessageRequest::CFsMessageRequest() |
|
280 |
{iFlags &= ~EIsAllocated;} |
|
281 |
||
282 |
TBool CFsMessageRequest::PostInterceptEnabled() |
|
283 |
{return iFlags & EPostInterceptEnabled;} |
|
284 |
void CFsMessageRequest::EnablePostIntercept(TBool aEnable) |
|
285 |
{if (aEnable) iFlags |= EPostInterceptEnabled; else iFlags &= ~EPostInterceptEnabled;} |
|
286 |
||
287 |
||
288 |
||
289 |
inline TInt& CFsMessageRequest::LastError() |
|
290 |
{ |
|
291 |
return iLastError; |
|
292 |
} |
|
293 |
inline void CFsMessageRequest::SetLastError(TInt aLastError) |
|
294 |
{ |
|
295 |
iLastError = aLastError; |
|
296 |
} |
|
297 |
||
298 |
inline void CFsMessageRequest::Init() |
|
299 |
{ |
|
300 |
SetLastError(KErrNone); |
|
301 |
iCurrentOperation = NULL; |
|
302 |
} |
|
303 |
||
304 |
||
305 |
// class CNotifyInfo |
|
306 |
CSessionFs* CNotifyInfo::Session() |
|
307 |
{return(iSession);} |
|
308 |
TRequestStatus* CNotifyInfo::Status() |
|
309 |
{return(iStatus);} |
|
310 |
||
311 |
#if defined(_USE_CONTROLIO) || defined(_DEBUG) || defined(_DEBUG_RELEASE) |
|
312 |
// Class RequestAllocator |
|
313 |
/** returns number of permanently & dynamically allocated requests */ |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
314 |
TInt RequestAllocator::RequestCount() |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
315 |
{ return iRequestCount;} |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
316 |
TInt RequestAllocator::RequestCountPeak() |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
317 |
{ return iRequestCountPeak;} |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
318 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
319 |
TInt OperationAllocator::FreeCount() |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
320 |
{ return iFreeCount;} |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
321 |
TInt OperationAllocator::RequestCount() |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
322 |
{ return iRequestCount;} |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
323 |
TInt OperationAllocator::RequestCountPeak() |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
324 |
{ return iRequestCountPeak;} |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
325 |
|
0 | 326 |
#endif |
327 |
||
328 |
//--------------------------------------------------------------------------------------------------------------------- |
|
329 |
||
330 |
inline CFileSystem* CMountBody::GetFileSystem() const |
|
331 |
{ |
|
332 |
return iFSys; |
|
333 |
} |
|
334 |
||
335 |
inline void CMountBody::SetFileSystem(CFileSystem* aFsys) |
|
336 |
{ |
|
337 |
iFSys = aFsys; |
|
338 |
} |
|
339 |
||
340 |
||
341 |
||
342 |
#endif //SF_STD_INL |
|
343 |
||
344 |