author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 11 Jun 2010 15:02:23 +0300 | |
changeset 152 | 657f875b013e |
parent 0 | a41df078684a |
child 257 | 3e88ff8f41d5 |
child 273 | 6a75fa55495f |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 1995-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\sfsrv\cl_file.cpp |
|
15 |
// |
|
16 |
// |
|
17 |
||
18 |
#include "cl_std.h" |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
19 |
#ifdef OST_TRACE_COMPILER_IN_USE |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
20 |
#include "cl_fileTraces.h" |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
21 |
#endif |
0 | 22 |
static _LIT_SECURITY_POLICY_S1(KFileServerPolicy,KFileServerUidValue,ECapabilityTCB); |
23 |
||
24 |
EFSRV_EXPORT_C TInt RFile::Adopt(RFs& aFs, TInt aHandle) |
|
25 |
/** |
|
26 |
Adopts an already open file. |
|
27 |
||
28 |
@param aFs The file server session. |
|
29 |
@param aHandle The handle number of the already opened file |
|
30 |
||
31 |
@return KErrNone if successful, |
|
32 |
KErrBadHandle if the sub-session handle is invalid, |
|
33 |
otherwise one of the other system-wide error codes. |
|
34 |
||
35 |
@deprecated |
|
36 |
*/ |
|
37 |
{ |
|
38 |
||
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
39 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILEADOPT, "sess %x subs %x", (TUint) aFs.Handle(), (TUint) aHandle); |
0 | 40 |
// duplicate the sub-session handle; don't panic if it's invalid. |
41 |
RFile file; |
|
42 |
TInt r = file.CreateSubSession(aFs, EFsFileDuplicate, TIpcArgs(aHandle, EFalse)); |
|
43 |
if (r == KErrArgument) |
|
44 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
45 |
OstTrace1(TRACE_BORDER, EFSRV_EFILEADOPTRETURN1, "r %d", KErrBadHandle); |
0 | 46 |
return KErrBadHandle; |
47 |
} |
|
48 |
else if (r != KErrNone) |
|
49 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
50 |
OstTrace1(TRACE_BORDER, EFSRV_EFILEADOPTRETURN2, "r %d", r); |
0 | 51 |
return r; |
52 |
} |
|
53 |
// adopt the duplicated handle |
|
54 |
r = CreateAutoCloseSubSession(aFs, EFsFileAdopt, TIpcArgs(file.SubSessionHandle(), KFileAdopt32)); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
55 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFILEADOPTRETURN3, "r %d sess %x subs %x", (TUint) r, (TUint) Session().Handle(), (TUint) SubSessionHandle()); |
0 | 56 |
return r; |
57 |
} |
|
58 |
||
59 |
||
60 |
||
61 |
||
62 |
EFSRV_EXPORT_C TInt RFile::AdoptFromServer(TInt aFsHandle, TInt aFileHandle) |
|
63 |
/** |
|
64 |
Allows a client to adopt an already open file from a server. |
|
65 |
||
66 |
Assumes that the server's RFs and RFile handles have been sent to the |
|
67 |
client using TransferToClient(). |
|
68 |
||
69 |
This RFile will own it's RFs session so that when the sub-session (RFile) |
|
70 |
is closed so will the RFs session. |
|
71 |
||
72 |
@param aFsHandle The file server session (RFs) handle |
|
73 |
@param aFileHandle The file (RFile) handle of the already opened file |
|
74 |
||
75 |
@return KErrNone if successful, otherwise one of the other system-wide |
|
76 |
error codes. |
|
77 |
*/ |
|
78 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
79 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILEADOPTFROMSERVER, "sess %x subs %x", (TUint) aFsHandle, (TUint) aFileHandle); |
0 | 80 |
RFs fs; |
81 |
TInt r = fs.SetReturnedHandle(aFsHandle, KFileServerPolicy); |
|
82 |
if (r != KErrNone) |
|
83 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
84 |
OstTrace1(TRACE_BORDER, EFSRV_EFILEADOPTFROMSERVERRETURN1, "r %d", r); |
0 | 85 |
return r; |
86 |
} |
|
87 |
r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(aFileHandle, KFileAdopt32)); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
88 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFILEADOPTFROMSERVERRETURN2, "r %d sess %x subs %x", (TUint) r, (TUint) Session().Handle(), (TUint) SubSessionHandle()); |
0 | 89 |
return r; |
90 |
} |
|
91 |
||
92 |
||
93 |
EFSRV_EXPORT_C TInt RFile::AdoptFromClient(const RMessage2& aMsg, TInt aFsHandleIndex, TInt aFileHandleIndex) |
|
94 |
/** |
|
95 |
Allows a server to adopt an already open file from a client. |
|
96 |
The client's RFs and RFile handles are contained in message slots within aMsg. |
|
97 |
||
98 |
Assumes that the client's RFs and RFile handles have been sent to the server |
|
99 |
using TransferToServer(). |
|
100 |
||
101 |
||
102 |
This RFile will own it's RFs session so that when the sub-session (RFile) |
|
103 |
is closed so will the RFs session. |
|
104 |
||
105 |
@param aMsg The message received from the client |
|
106 |
@param aFsHandleIndex The index that identifies the message slot |
|
107 |
of a file server session (RFs) handle |
|
108 |
@param aFileHandleIndex The index that identifies the message slot |
|
109 |
of the sub-session (RFile) handle of the already opened file |
|
110 |
||
111 |
@return KErrNone if successful, otherwise one of the other system-wide |
|
112 |
error codes. |
|
113 |
*/ |
|
114 |
{ |
|
115 |
TInt fileHandle = NULL; |
|
116 |
||
117 |
TInt r = KErrNone; |
|
118 |
if (aFileHandleIndex == 0) |
|
119 |
fileHandle = aMsg.Int0(); |
|
120 |
else if (aFileHandleIndex == 1) |
|
121 |
fileHandle = aMsg.Int1(); |
|
122 |
else if (aFileHandleIndex == 2) |
|
123 |
fileHandle = aMsg.Int2(); |
|
124 |
else if (aFileHandleIndex == 3) |
|
125 |
fileHandle = aMsg.Int3(); |
|
126 |
else |
|
127 |
r = KErrArgument; |
|
128 |
||
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
129 |
#ifdef OST_TRACE_COMPILER_IN_USE |
0 | 130 |
TInt handle = NULL; |
131 |
if (aFsHandleIndex == 0) |
|
132 |
handle = aMsg.Int0(); |
|
133 |
else if (aFsHandleIndex == 1) |
|
134 |
handle = aMsg.Int1(); |
|
135 |
else if (aFsHandleIndex == 2) |
|
136 |
handle = aMsg.Int2(); |
|
137 |
else if (aFsHandleIndex == 3) |
|
138 |
handle = aMsg.Int3(); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
139 |
OstTraceExt4(TRACE_BORDER, EFSRV_EFILEADOPTFROMCLIENT, "sess %x subs %x aFsHandleIndex %d aFileHandleIndex %d ", (TUint) handle, (TUint) fileHandle, (TUint) aFsHandleIndex, (TUint) aFileHandleIndex); |
0 | 140 |
#endif |
141 |
||
142 |
if (r != KErrNone) |
|
143 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
144 |
OstTrace1(TRACE_BORDER, EFSRV_EFILEADOPTFROMCLIENTRETURN1, "r %d", r); |
0 | 145 |
return r; |
146 |
} |
|
147 |
||
148 |
// Duplicates the file server (RFs) session handle identified by an |
|
149 |
// existing handle contained in the message slot at index aFsHandleIndex |
|
150 |
RFs fs; |
|
151 |
r = fs.Open(aMsg, aFsHandleIndex, KFileServerPolicy); |
|
152 |
if (r != KErrNone) |
|
153 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
154 |
OstTrace1(TRACE_BORDER, EFSRV_EFILEADOPTFROMCLIENTRETURN2, "r %d", r); |
0 | 155 |
return r; |
156 |
} |
|
157 |
||
158 |
r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle, KFileAdopt32)); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
159 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFILEADOPTFROMCLIENTRETURN3, "r %d sess %x subs %x", (TUint) r, (TUint) Session().Handle(), (TUint) SubSessionHandle()); |
0 | 160 |
return r; |
161 |
} |
|
162 |
||
163 |
||
164 |
EFSRV_EXPORT_C TInt RFile::AdoptFromCreator(TInt aFsHandleIndex, TInt aFileHandleIndex) |
|
165 |
/** |
|
166 |
Allows a server to adopt an already open file from a client process. |
|
167 |
The client's file-server (RFs) and file (RFile) handles are contained in |
|
168 |
this process's environment data slots. |
|
169 |
||
170 |
Assumes that the client's RFs and RFile handles have been sent to the server process |
|
171 |
using TransferToProcess(). |
|
172 |
||
173 |
This RFile will own it's RFs session so that when the sub-session (RFile) |
|
174 |
is closed so will the RFs session. |
|
175 |
||
176 |
@param aFsHandleIndex An index that identifies the slot in the process |
|
177 |
environment data that contains the file server session (RFs) handle |
|
178 |
@param aFileHandleIndex An index that identifies the slot in the process |
|
179 |
environment data that contains the sub-session (RFile) handle |
|
180 |
of the already opened file |
|
181 |
||
182 |
@return KErrNone if successful, otherwise one of the other system-wide |
|
183 |
error codes. |
|
184 |
*/ |
|
185 |
{ |
|
186 |
TInt fileHandle = NULL; |
|
187 |
||
188 |
TInt r = User::GetTIntParameter(aFileHandleIndex, fileHandle); |
|
189 |
||
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
190 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFILEADOPTFROMCREATOR, "subs %x aFsHandleIndex %d aFileHandleIndex %d", (TUint) fileHandle, (TUint) aFsHandleIndex, (TUint) aFileHandleIndex); |
0 | 191 |
if (r != KErrNone) |
192 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
193 |
OstTrace1(TRACE_BORDER, EFSRV_EFILEADOPTFROMCREATORRETURN1, "r %d", r); |
0 | 194 |
return r; |
195 |
} |
|
196 |
||
197 |
||
198 |
// Duplicates the file server (RFs) session handle identified by an |
|
199 |
// existing handle contained in the environment slot at index aFsHandleIndex |
|
200 |
RFs fs; |
|
201 |
r = fs.Open(aFsHandleIndex, KFileServerPolicy); |
|
202 |
if (r != KErrNone) |
|
203 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
204 |
OstTrace1(TRACE_BORDER, EFSRV_EFILEADOPTFROMCREATORRETURN2, "r %d", r); |
0 | 205 |
return r; |
206 |
} |
|
207 |
||
208 |
r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle, KFileAdopt32)); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
209 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFILEADOPTFROMCREATORRETURN3, "r %d sess %x subs %x", (TUint) r, (TUint) Session().Handle(), (TUint) SubSessionHandle()); |
0 | 210 |
return r; |
211 |
} |
|
212 |
||
213 |
||
214 |
||
215 |
/** |
|
216 |
Make a duplicate of the passed file handle in the same thread. |
|
217 |
||
218 |
By default, any thread in the process can use the duplicated handle to access the |
|
219 |
file. However, specifying EOwnerThread as the second parameter to this function, |
|
220 |
means that only the creating thread can use the handle. |
|
221 |
||
222 |
@param aFile The file handle to duplicate |
|
223 |
@param aType An enumeration whose enumerators define the ownership of this |
|
224 |
handle. If not explicitly specified, EOwnerProcess is taken |
|
225 |
as default. |
|
226 |
||
227 |
@return one of the other system-wide error codes. |
|
228 |
*/ |
|
229 |
EFSRV_EXPORT_C TInt RFile::Duplicate(const RFile& aFile, TOwnerType aType) |
|
230 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
231 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFILEDUPLICATE, "sess %x subs %x aType %d", (TUint) aFile.Session().Handle(), (TUint) aFile.SubSessionHandle(), (TUint) aType); |
0 | 232 |
RFs fs; |
233 |
fs.SetHandle(aFile.Session().Handle()); |
|
234 |
||
235 |
// Need to make a duplicate of the session handle in the current thread, |
|
236 |
// otherwise closing one session will close both sub-sessions. |
|
237 |
TInt r = fs.Duplicate(RThread(), aType); |
|
238 |
if (r != KErrNone) |
|
239 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
240 |
OstTrace1(TRACE_BORDER, EFSRV_EFILEDUPLICATERETURN1, "r %d", r); |
0 | 241 |
return r; |
242 |
} |
|
243 |
||
244 |
// duplicate the sub-session handle |
|
245 |
TInt dupSubSessionHandle; |
|
246 |
r = aFile.DuplicateHandle(dupSubSessionHandle); |
|
247 |
if (r != KErrNone) |
|
248 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
249 |
OstTrace1(TRACE_BORDER, EFSRV_EFILEDUPLICATERETURN2, "r %d", r); |
0 | 250 |
return r; |
251 |
} |
|
252 |
||
253 |
// adopt the duplicated sub-session handle |
|
254 |
r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(dupSubSessionHandle, KFileDuplicate)); |
|
255 |
||
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
256 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFILEDUPLICATERETURN3, "r %d sess %x subs %x", (TUint) r, (TUint) Session().Handle(), (TUint) SubSessionHandle()); |
0 | 257 |
return r; |
258 |
} |
|
259 |
||
260 |
||
261 |
// Makes a duplicate of this file (RFile) handle in the current thread and |
|
262 |
// returns it in aSubSessionHandle. |
|
263 |
// The duplicate file handle will effectively be in limbo (although still |
|
264 |
// owned by the session) until : |
|
265 |
// (1) the session handle is duplicated into another process - |
|
266 |
// this happens in one of : TransferToClient(), TransferToProcess() or |
|
267 |
// AdoptFromClient() and |
|
268 |
// (2) the sub-session handle is transferred to the other process - using AdoptXXX() |
|
269 |
// |
|
270 |
TInt RFile::DuplicateHandle(TInt& aSubSessionHandle) const |
|
271 |
{ |
|
272 |
RFs fs; |
|
273 |
fs.SetHandle(Session().Handle()); |
|
274 |
RFile file; |
|
275 |
||
276 |
// duplicate the sub-session handle; panic if it's invalid. |
|
277 |
TInt r = file.CreateSubSession(fs, EFsFileDuplicate, TIpcArgs(SubSessionHandle(), ETrue)); |
|
278 |
||
279 |
// return the duplicated handle |
|
280 |
// Note that this handle needs to be adopted before it can be used |
|
281 |
aSubSessionHandle = file.SubSessionHandle(); |
|
282 |
||
283 |
return r; |
|
284 |
} |
|
285 |
||
286 |
||
287 |
/** |
|
288 |
Transfers an already open file to a server. |
|
289 |
||
290 |
Before this function can be called, the file server session which owns this file handle |
|
291 |
must first be marked as shareable by calling RFs::ShareProtected(). |
|
292 |
||
293 |
This function packages handle details for this file into 2 arguments of a TIpcArgs object. |
|
294 |
When these arguments are sent in an IPC message, the server which receives them may |
|
295 |
call AdoptFromClient() to open a new RFile object which refers to the same file as this. |
|
296 |
||
297 |
@param aIpcArgs The IPC message arguments. |
|
298 |
@param aFsHandleIndex An index that identifies an argument in aIpcArgs where the |
|
299 |
file server session handle will be stored. |
|
300 |
This argument must not be used for anything else otherwise the |
|
301 |
results will be unpredictable. |
|
302 |
@param aFileHandleIndex An index that identifies an argument in aIpcArgs where the |
|
303 |
file handle will be stored. |
|
304 |
This argument must not be used for anything else otherwise the |
|
305 |
results will be unpredictable. |
|
306 |
||
307 |
@return KErrNone if successful, otherwise one of the other system-wide |
|
308 |
error codes. |
|
309 |
||
310 |
*/ |
|
311 |
EFSRV_EXPORT_C TInt RFile::TransferToServer(TIpcArgs& aIpcArgs, TInt aFsHandleIndex, TInt aFileHandleIndex) const |
|
312 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
313 |
OstTraceExt4(TRACE_BORDER, EFSRV_EFILETRANSFERTOSERVER, "sess %x subs %x aFsHandleIndex %d aFileHandleIndex %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aFsHandleIndex, (TUint) aFileHandleIndex); |
0 | 314 |
if ((aFsHandleIndex < 0) || (aFsHandleIndex > (KMaxMessageArguments-2))) |
315 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
316 |
OstTrace1(TRACE_BORDER, EFSRV_EFILETRANSFERTOSERVERRETURN1, "r %d", (TUint) KErrArgument); |
0 | 317 |
return KErrArgument; |
318 |
} |
|
319 |
||
320 |
TInt dupSubSessionHandle; |
|
321 |
TInt r = DuplicateHandle(dupSubSessionHandle); |
|
322 |
if (r == KErrNone) |
|
323 |
{ |
|
324 |
aIpcArgs.Set(aFsHandleIndex, Session()); |
|
325 |
aIpcArgs.Set(aFileHandleIndex, dupSubSessionHandle); |
|
326 |
} |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
327 |
OstTrace1(TRACE_BORDER, EFSRV_EFILETRANSFERTOSERVERRETURN2, "r %d", r); |
0 | 328 |
return r; |
329 |
} |
|
330 |
||
331 |
/** |
|
332 |
Transfers an already open file from a server to a client. |
|
333 |
||
334 |
Before this function can be called, the file server session which owns this file handle |
|
335 |
must first be marked as shareable by calling RFs::ShareProtected(). |
|
336 |
||
337 |
The file (RFile) handle is written to the client's address space to the package |
|
338 |
buffer in the message address slot in aMsg identified by aFileHandleIndex. |
|
339 |
||
340 |
If no error occurs, then the message is completed with the file-server (RFs) |
|
341 |
session handle. |
|
342 |
||
343 |
When the message completes, the client may call AdoptFromServer() to open |
|
344 |
a new RFile object which refers to the same file as this. |
|
345 |
||
346 |
Note that if an error occurs then the message is not completed. |
|
347 |
||
348 |
@param aMsg A message received from the client |
|
349 |
@param aFileHandleIndex Identifies the message slot that contains a package |
|
350 |
buffer pointing to an address in the client's address space |
|
351 |
to receive the file (RFile) handle |
|
352 |
||
353 |
@return KErrNone if successful, otherwise one of the other system-wide |
|
354 |
error codes. |
|
355 |
*/ |
|
356 |
EFSRV_EXPORT_C TInt RFile::TransferToClient(const RMessage2& aMsg, TInt aFileHandleIndex) const |
|
357 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
358 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFILETRANSFERTOCLIENT, "sess %x subs %x aFileHandleIndex %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aFileHandleIndex); |
0 | 359 |
if (TUint(aFileHandleIndex) >= TUint(KMaxMessageArguments)) |
360 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
361 |
OstTrace1(TRACE_BORDER, EFSRV_EFILETRANSFERTOCLIENTRETURN1, "r %d", (TUint) KErrArgument); |
0 | 362 |
return KErrArgument; |
363 |
} |
|
364 |
||
365 |
TInt dupSubSessionHandle; |
|
366 |
TInt r = DuplicateHandle(dupSubSessionHandle); |
|
367 |
if (r == KErrNone) |
|
368 |
r = aMsg.Write(aFileHandleIndex, TPckgC<TInt>(dupSubSessionHandle)); |
|
369 |
||
370 |
if (r != KErrNone) |
|
371 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
372 |
OstTrace1(TRACE_BORDER, EFSRV_EFILETRANSFERTOCLIENTRETURN2, "r %d", r); |
0 | 373 |
return r; |
374 |
} |
|
375 |
||
376 |
aMsg.Complete(Session()); |
|
377 |
||
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
378 |
OstTrace1(TRACE_BORDER, EFSRV_EFILETRANSFERTOCLIENTRETURN3, "r %d", r); |
0 | 379 |
return r; |
380 |
} |
|
381 |
||
382 |
||
383 |
/** |
|
384 |
Transfers an already open file to another process. |
|
385 |
||
386 |
Before this function can be called, the file server session which owns this file handle |
|
387 |
must first be marked as shareable by calling RFs::ShareProtected(). |
|
388 |
||
389 |
This function packages handle details for this file into 2 arguments in another |
|
390 |
process's environment data slots. |
|
391 |
When the other process runs, it may call AdoptFromCreator() to open a new RFile |
|
392 |
object which refers to the same file as this. |
|
393 |
||
394 |
@param aProcess A handle to another process. |
|
395 |
@param aFsHandleIndex An index that identifies a slot in the process's |
|
396 |
environment data which on exit will contain the file server |
|
397 |
session (RFs) handle |
|
398 |
This slot must not be used for anything else otherwise the |
|
399 |
results will be unpredictable. |
|
400 |
@param aFileHandleIndex An index that identifies a slot in the process's |
|
401 |
environment data which on exit will contain the file |
|
402 |
(RFile) handle. |
|
403 |
This slot must not be used for anything else otherwise the |
|
404 |
results will be unpredictable. |
|
405 |
@return KErrNone if successful, otherwise one of the other system-wide |
|
406 |
error codes. |
|
407 |
*/ |
|
408 |
// NB slot 0 is reserved for the command line |
|
409 |
EFSRV_EXPORT_C TInt RFile::TransferToProcess(RProcess& aProcess, TInt aFsHandleIndex, TInt aFileHandleIndex) const |
|
410 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
411 |
OstTraceExt4(TRACE_BORDER, EFSRV_EFILETRANSFERTOPROCESS, "sess %x subs %x aFsHandleIndex %d aFileHandleIndex %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aFsHandleIndex, (TUint) aFileHandleIndex); |
0 | 412 |
TInt dupSubSessionHandle; |
413 |
TInt r = DuplicateHandle(dupSubSessionHandle); |
|
414 |
||
415 |
if (r == KErrNone) |
|
416 |
r = aProcess.SetParameter(aFsHandleIndex, RHandleBase(Session())); |
|
417 |
||
418 |
if (r == KErrNone) |
|
419 |
r = aProcess.SetParameter(aFileHandleIndex, dupSubSessionHandle); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
420 |
OstTrace1(TRACE_BORDER, EFSRV_EFILETRANSFERTOPROCESSRETURN, "r %d", r); |
0 | 421 |
return r; |
422 |
} |
|
423 |
||
424 |
||
425 |
EFSRV_EXPORT_C TInt RFile::Name(TDes& aName) const |
|
426 |
/** |
|
427 |
Gets the final part of a filename |
|
428 |
||
429 |
This is used to retrieve the name and extension of a file that has been |
|
430 |
passed from one process to another using the RFile::AdoptXXX() methods. |
|
431 |
||
432 |
@param aName On return, contains the name of the file, including the name and |
|
433 |
extension but excluding the drive letter and path. |
|
434 |
||
435 |
@return KErrNone if successful, otherwise one of the other |
|
436 |
system-wide error codes. |
|
437 |
||
438 |
*/ |
|
439 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
440 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILEGETNAME, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle()); |
0 | 441 |
TInt r = SendReceive(EFsFileName, TIpcArgs(&aName)); |
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
442 |
OstTraceData(TRACE_BORDER, EFSRV_EFILEGETNAME_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1); |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
443 |
OstTrace1(TRACE_BORDER, EFSRV_EFILEGETNAMERETURN, "r %d", r); |
0 | 444 |
return r; |
445 |
} |
|
446 |
||
447 |
||
448 |
EFSRV_EXPORT_C TInt RFile::FullName(TDes& aName) const |
|
449 |
/** |
|
450 |
Gets the full filename |
|
451 |
||
452 |
This is used to retrieve the full filename, including drive and path, |
|
453 |
of a file that has been passed from one process to another using the |
|
454 |
RFile::AdoptXXX() methods. |
|
455 |
||
456 |
@param aName On return, contains the full name of the file, including drive and path. |
|
457 |
||
458 |
@return KErrNone if successful, otherwise one of the other |
|
459 |
system-wide error codes. |
|
460 |
||
461 |
*/ |
|
462 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
463 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILEFULLNAME, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle()); |
0 | 464 |
TInt r = SendReceive(EFsFileFullName, TIpcArgs(&aName)); |
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
465 |
OstTraceData(TRACE_BORDER, EFSRV_EFILEFULLNAME_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1); |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
466 |
OstTrace1(TRACE_BORDER, EFSRV_EFILEFULLNAMERETURN, "r %d", r); |
0 | 467 |
return r; |
468 |
} |
|
469 |
||
470 |
||
471 |
||
472 |
EFSRV_EXPORT_C TInt RFile::Open(RFs& aFs,const TDesC& aName,TUint aMode) |
|
473 |
/** |
|
474 |
Opens an existing file for reading or writing. |
|
475 |
||
476 |
If the file does not already exist, an error is returned. |
|
477 |
||
478 |
Notes: |
|
479 |
||
480 |
1. To close the file, use Close() |
|
481 |
||
482 |
2. Attempting to open a file with the read-only attribute using the EFileWrite |
|
483 |
access mode results in an error. |
|
484 |
||
485 |
3. Attempting to open a file which is greater than or equal to 2GByte (2,147,483,648 bytes) |
|
486 |
will fail with KErrTooBig |
|
487 |
||
488 |
4. After a file has been opened, the current write position is set to the start |
|
489 |
of the file. |
|
490 |
If necessary, use RFile::Seek() to move to a different position within |
|
491 |
the file. |
|
492 |
||
493 |
@param aFs The file server session. |
|
494 |
@param aName The name of the file. Any path components (i.e. drive letter |
|
495 |
or directory), which are not specified, are taken from |
|
496 |
the session path.The file name shall not contain wild cards |
|
497 |
('?' or '*' characters) and illegal characters like |
|
498 |
'<', '>', ':', '"', '/', '|' and '\000'. Backslash '\\' character |
|
499 |
is allowed only as a path delimiter. The filename containing only |
|
500 |
white space characters (See TChar::IsSpace()) is also illegal. |
|
501 |
||
502 |
@param aMode The mode in which the file is opened. See TFileMode. |
|
503 |
||
504 |
@return KErrNone if successful, otherwise one of the other system-wide |
|
505 |
error codes. |
|
506 |
||
507 |
@see TFileMode |
|
508 |
||
509 |
@capability Dependent If the path for aName is /Sys and aMode is neither |
|
510 |
EFileShareReadersOnly nor EFileRead then Tcb capability is required. |
|
511 |
@capability Dependent If the path for aName is /Sys and aMode is either |
|
512 |
EFileShareReadersOnly or EFileRead then Allfiles capability is required. |
|
513 |
@capability Dependent If the path for aName begins with /Private and does not match this process' |
|
514 |
SID then AllFiles capability is required. |
|
515 |
@capability Dependent If the path for aName begins with /Resource and aMode is neither |
|
516 |
EFileShareReadersOrWriters|EFileRead nor EFileShareReadersOnly |
|
517 |
nor EFileRead then Tcb capability is required. |
|
518 |
||
519 |
*/ |
|
520 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
521 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILEOPEN, "sess %x mode %x", (TUint) aFs.Handle(), (TUint) aMode); |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
522 |
OstTraceData(TRACE_BORDER, EFSRV_EFILEOPEN_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1); |
0 | 523 |
aMode &= ~EFileBigFile; |
524 |
TInt r = CreateSubSession(aFs,EFsFileOpen,TIpcArgs(&aName,aMode)); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
525 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILEOPENRETURN, "r %d subs %x", (TUint) r, (TUint) SubSessionHandle()); |
0 | 526 |
return r; |
527 |
} |
|
528 |
||
529 |
||
530 |
EFSRV_EXPORT_C void RFile::Close() |
|
531 |
/** |
|
532 |
Closes the file. |
|
533 |
||
534 |
Any open files are closed when the file server session is closed. |
|
535 |
||
536 |
Close() is guaranteed to return, and provides no indication whether |
|
537 |
it completed successfully or not. When closing a file you have written to, |
|
538 |
you should ensure that data is committed to the file by invoking RFile::Flush() |
|
539 |
before closing. If Flush() completes successfully, Close() is essentially a |
|
540 |
no-operation. |
|
541 |
*/ |
|
542 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
543 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILECLOSE, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle()); |
0 | 544 |
|
545 |
CloseSubSession(EFsFileSubClose); |
|
546 |
||
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
547 |
OstTrace0(TRACE_BORDER, EFSRV_EFILECLOSERETURN, ""); |
0 | 548 |
} |
549 |
||
550 |
||
551 |
EFSRV_EXPORT_C TInt RFile::Create(RFs& aFs,const TDesC& aName,TUint aMode) |
|
552 |
/** |
|
553 |
Creates and opens a new file for writing. |
|
554 |
||
555 |
If the file already exists, an error is returned. |
|
556 |
||
557 |
If the resulting path does not exist, then the operation cannot proceed and |
|
558 |
the function returns an error code. |
|
559 |
||
560 |
Notes: |
|
561 |
||
562 |
1. To close the file, use Close() |
|
563 |
||
564 |
2. It automatically sets the file's archive attribute. |
|
565 |
||
566 |
@param aFs The file server session. |
|
567 |
@param aName The name of the file. Any path components (i.e. drive letter |
|
568 |
or directory), which are not specified, are taken from |
|
569 |
the session path. The file name shall not contain wild cards |
|
570 |
('?' or '*' characters) and illegal characters like |
|
571 |
'<', '>', ':', '"', '/', '|' and '\000'. Backslash '\\' character |
|
572 |
is allowed only as a path delimiter. The filename containing only |
|
573 |
white space characters (See TChar::IsSpace()) is also illegal. |
|
574 |
||
575 |
@param aMode The mode in which the file is opened. The access mode is |
|
576 |
automatically set to EFileWrite. See TFileMode. |
|
577 |
||
578 |
@return KErrNone if successful, otherwise one of the other system-wide |
|
579 |
error codes. |
|
580 |
||
581 |
@see TFileMode |
|
582 |
||
583 |
@capability Dependent If the path in aName starts with /Sys then capability Tcb is required |
|
584 |
@capability Dependent If the path in aName starts with /Resource then capability Tcb is required |
|
585 |
@capability Dependent If the path in aName starts with /Private and does not match this process' |
|
586 |
SID then AllFiles capability is required. |
|
587 |
||
588 |
*/ |
|
589 |
{ |
|
590 |
aMode &= ~EFileBigFile; |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
591 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILECREATE, "sess %x mode %x", (TUint) aFs.Handle(), (TUint) aMode); |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
592 |
OstTraceData(TRACE_BORDER, EFSRV_EFILECREATE_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1); |
0 | 593 |
TInt r = CreateSubSession(aFs,EFsFileCreate,TIpcArgs(&aName,aMode)); |
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
594 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILECREATERETURN, "r %d subs %x", (TUint) r, (TUint) SubSessionHandle()); |
0 | 595 |
return r; |
596 |
} |
|
597 |
||
598 |
||
599 |
||
600 |
||
601 |
EFSRV_EXPORT_C TInt RFile::Replace(RFs& aFs,const TDesC& aName,TUint aMode) |
|
602 |
/** |
|
603 |
Opens a file for writing, replacing the content of any existing file of the |
|
604 |
same name if it exists, or creating a new file if it does not exist. |
|
605 |
||
606 |
If the resulting path exists, then: |
|
607 |
||
608 |
- the length of an existing file with the same filename is re-set to zero |
|
609 |
||
610 |
- a new file is created, if no existing file with the same filename can be found. |
|
611 |
||
612 |
If the resulting path does not exist, then the operation cannot proceed and |
|
613 |
the function returns an error code. |
|
614 |
||
615 |
Notes: |
|
616 |
||
617 |
- To close the file, use Close(), defined in the base class RFsBase. |
|
618 |
||
619 |
- It automatically sets the file's archive attribute. |
|
620 |
||
621 |
@param aFs The file server session. |
|
622 |
@param aName The name of the file. Any path components (i.e. drive letter |
|
623 |
or directory), which are not specified, are taken from |
|
624 |
the session path. The file name shall not contain wild cards |
|
625 |
('?' or '*' characters) and illegal characters like |
|
626 |
'<', '>', ':', '"', '/', '|' and '\000'. Backslash '\\' character |
|
627 |
is allowed only as a path delimiter. The filename containing only |
|
628 |
white space characters (See TChar::IsSpace()) is also illegal. |
|
629 |
||
630 |
@param aMode The mode in which the file is opened. The access mode is |
|
631 |
automatically set to EFileWrite. See TFileMode. |
|
632 |
||
633 |
@return KErrNone if successful, otherwise one of the other system-wide |
|
634 |
error codes. |
|
635 |
||
636 |
@see TFileMode |
|
637 |
||
638 |
@capability Dependent If the path in aName starts with /Sys then capability Tcb is required |
|
639 |
@capability Dependent If the path in aName starts with /Resource then capability Tcb is required |
|
640 |
@capability Dependent If the path in aName starts with /Private and does not match this process' |
|
641 |
SID then AllFiles capability is required. |
|
642 |
||
643 |
*/ |
|
644 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
645 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILEREPLACE, "sess %x mode %x", (TUint) aFs.Handle(), (TUint) aMode); |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
646 |
OstTraceData(TRACE_BORDER, EFSRV_EFILEREPLACE_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1); |
0 | 647 |
aMode &= ~EFileBigFile; |
648 |
TInt r = CreateSubSession(aFs,EFsFileReplace,TIpcArgs(&aName,aMode)); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
649 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILEREPLACERETURN, "r %d subs %x", (TUint) r, (TUint) SubSessionHandle()); |
0 | 650 |
return r; |
651 |
} |
|
652 |
||
653 |
||
654 |
||
655 |
||
656 |
EFSRV_EXPORT_C TInt RFile::Temp(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aMode) |
|
657 |
/** |
|
658 |
Creates and opens a temporary file with a unique name for writing and reading. |
|
659 |
||
660 |
Notes: |
|
661 |
||
662 |
1. To close the file, use Close() |
|
663 |
||
664 |
@param aFs The file server session. |
|
665 |
@param aPath The directory in which the file is created. |
|
666 |
@param aName On return, contains the full path and file name of the file. |
|
667 |
The filename is guaranteed to be unique within the directory |
|
668 |
specified by aPath. |
|
669 |
@param aMode The mode in which the file is opened. The access mode is |
|
670 |
automatically set to EFileWrite. See TFileMode. |
|
671 |
||
672 |
@return KErrNone if successful, otherwise one of the other system-wide |
|
673 |
error codes. |
|
674 |
||
675 |
@see TFileMode |
|
676 |
||
677 |
@capability Dependent If aPath starts with /Sys then capability Tcb is required |
|
678 |
@capability Dependent If aPath starts with /Resource then capability Tcb is required |
|
679 |
@capability Dependent If aPath starts with /Private and does not match this process' |
|
680 |
SID then AllFiles capability is required. |
|
681 |
*/ |
|
682 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
683 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILETEMP, "sess %x aMode %x", (TUint) aFs.Handle(), (TUint) aMode); |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
684 |
OstTraceData(TRACE_BORDER, EFSRV_EFILETEMP_EDIRNAME, "Dir %S", aPath.Ptr(), aPath.Length()<<1); |
0 | 685 |
aMode &= ~EFileBigFile; |
686 |
TInt r = CreateSubSession(aFs,EFsFileTemp,TIpcArgs(&aPath,aMode,&aName)); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
687 |
OstTraceData(TRACE_BORDER, EFSRV_EFILETEMP_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1); |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
688 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILETEMPRETURN, "r %d subs %x", (TUint) r, (TUint) SubSessionHandle()); |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
689 |
|
0 | 690 |
return r; |
691 |
} |
|
692 |
||
693 |
||
694 |
||
695 |
||
696 |
EFSRV_EXPORT_C TInt RFile::Read(TDes8& aDes) const |
|
697 |
/** |
|
698 |
Reads from the file at the current position. |
|
699 |
||
700 |
This is a synchronous function. |
|
701 |
||
702 |
Note that when an attempt is made to read beyond the end of the file, |
|
703 |
no error is returned. |
|
704 |
The descriptor's length is set to the number of bytes read into |
|
705 |
it. Therefore, when reading through a file,the end of file has been reached |
|
706 |
when the descriptor length, as returned by TDesC8::Length(), is zero. |
|
707 |
||
708 |
@param aDes Descriptor into which binary data is read. Any existing contents |
|
709 |
are overwritten. On return, its length is set to the number of |
|
710 |
bytes read. |
|
711 |
@return KErrNone if successful, otherwise one of the other system-wide error |
|
712 |
codes. |
|
713 |
||
714 |
@see TDesC8::Length |
|
715 |
*/ |
|
716 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
717 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFILEREAD1, "sess %x subs %x desmaxlen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aDes.MaxLength()); |
0 | 718 |
TInt r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),I64LOW(KCurrentPosition64))); |
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
719 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILEREAD1RETURN, "r %d len %d", (TUint) r, (TUint) aDes.Length()); |
0 | 720 |
return r; |
721 |
} |
|
722 |
||
723 |
||
724 |
||
725 |
||
726 |
EFSRV_EXPORT_C void RFile::Read(TDes8& aDes,TRequestStatus& aStatus) const |
|
727 |
/** |
|
728 |
Reads from the file at the current position. |
|
729 |
||
730 |
This is an asynchronous function. |
|
731 |
||
732 |
Note that when an attempt is made to read beyond the end of the file, |
|
733 |
no error is returned. |
|
734 |
The descriptor's length is set to the number of bytes read into |
|
735 |
it. Therefore, when reading through a file,the end of file has been reached |
|
736 |
when the descriptor length, as returned by TDesC8::Length(), is zero. |
|
737 |
||
738 |
@param aDes Descriptor into which binary data is read. Any existing contents |
|
739 |
are overwritten. On return, its length is set to the number of |
|
740 |
bytes read. |
|
741 |
NB: this function is asynchronous and the request that it |
|
742 |
represents may not complete until some time after the call |
|
743 |
to the function has returned. It is important, therefore, that |
|
744 |
this descriptor remain valid, or remain in scope, until you have |
|
745 |
been notified that the request is complete. |
|
746 |
||
747 |
@param aStatus Request status. On completion contains: |
|
748 |
KErrNone, if successful, otherwise one of the other system-wide error codes. |
|
749 |
||
750 |
@see TDesC8::Length |
|
751 |
*/ |
|
752 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
753 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFILEREAD2, "sess %x subs %x maxdeslen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aDes.MaxLength()); |
0 | 754 |
RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),I64LOW(KCurrentPosition64)),aStatus); |
755 |
||
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
756 |
OstTrace0(TRACE_BORDER, EFSRV_EFILEREAD2RETURN, ""); |
0 | 757 |
} |
758 |
||
759 |
||
760 |
||
761 |
||
762 |
EFSRV_EXPORT_C TInt RFile::Read(TDes8& aDes,TInt aLength) const |
|
763 |
/** |
|
764 |
Reads the specified number of bytes of binary data from the file at the current position. |
|
765 |
||
766 |
This is a synchronous function. |
|
767 |
||
768 |
Note that when an attempt is made to read beyond the end of the file, |
|
769 |
no error is returned. |
|
770 |
The descriptor's length is set to the number of bytes read into |
|
771 |
it. Therefore, when reading through a file,the end of file has been reached |
|
772 |
when the descriptor length, as returned by TDesC8::Length(), is zero. |
|
773 |
Assuming aLength is less than the maximum length of the descriptor, the only circumstances |
|
774 |
in which Read() can return fewer bytes than requested, is when the end of |
|
775 |
file is reached or if an error occurs. |
|
776 |
||
777 |
@param aDes Descriptor into which binary data is read. Any existing |
|
778 |
contents are overwritten. On return, its length is set to |
|
779 |
the number of bytes read. |
|
780 |
||
781 |
@param aLength The number of bytes to be read from the file into the descriptor. |
|
782 |
If an attempt is made to read more bytes than the descriptor's |
|
783 |
maximum length, the function returns KErrOverflow. |
|
784 |
This value must not be negative, otherwise the function |
|
785 |
returns KErrArgument. |
|
786 |
||
787 |
@return KErrNone if successful, otherwise one of the other system-wide error |
|
788 |
codes. |
|
789 |
*/ |
|
790 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
791 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFILEREAD5, "sess %x subs %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aLength); |
0 | 792 |
if (aLength==0) |
793 |
{ |
|
794 |
aDes.Zero(); |
|
795 |
return(KErrNone); |
|
796 |
} |
|
797 |
else if(aLength>aDes.MaxLength()) |
|
798 |
{ |
|
799 |
return(KErrOverflow); |
|
800 |
} |
|
801 |
TInt r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,I64LOW(KCurrentPosition64))); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
802 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILEREAD5RETURN, "r %d len %d", (TUint) r, (TUint) aDes.Length()); |
0 | 803 |
return r; |
804 |
} |
|
805 |
||
806 |
||
807 |
||
808 |
||
809 |
EFSRV_EXPORT_C void RFile::Read(TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const |
|
810 |
/** |
|
811 |
Reads a specified number of bytes of binary data from the file at the current position. |
|
812 |
||
813 |
This is an asynchronous function. |
|
814 |
||
815 |
Note that when an attempt is made to read beyond the end of the file, |
|
816 |
no error is returned. |
|
817 |
The descriptor's length is set to the number of bytes read into it. |
|
818 |
Therefore, when reading through a file, the end of file has been reached |
|
819 |
when the descriptor length, as returned by TDesC8::Length(), is zero. |
|
820 |
Assuming aLength is less than the maximum length of the descriptor, the only |
|
821 |
circumstances in which Read() can return fewer bytes than requested is when |
|
822 |
the end of file is reached or if an error has occurred. |
|
823 |
||
824 |
@param aDes Descriptor into which binary data is read. Any existing |
|
825 |
contents are overwritten. On return, its length is set to the |
|
826 |
number of bytes read. |
|
827 |
NB: this function is asynchronous and the request that it |
|
828 |
represents may not complete until some time after the call |
|
829 |
to the function has returned. It is important, therefore, that |
|
830 |
this descriptor remain valid, or remain in scope, until you have |
|
831 |
been notified that the request is complete. |
|
832 |
||
833 |
@param aLength The number of bytes to be read from the file into the descriptor. |
|
834 |
If an attempt is made to read more bytes than the descriptor's |
|
835 |
maximum length, then the function updates aStatus parameter with KErrOverflow. |
|
836 |
It must not be negative otherwise the function updates aStatus with KErrArgument. |
|
837 |
||
838 |
@param aStatus Request status. On completion contains KErrNone if successful, |
|
839 |
otherwise one of the other system-wide error codes. |
|
840 |
*/ |
|
841 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
842 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFILEREAD6, "sess %x subs %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aLength); |
0 | 843 |
if (aLength==0) |
844 |
{ |
|
845 |
aDes.Zero(); |
|
846 |
TRequestStatus* req=(&aStatus); |
|
847 |
User::RequestComplete(req,KErrNone); |
|
848 |
return; |
|
849 |
} |
|
850 |
else if(aLength>aDes.MaxLength()) |
|
851 |
{ |
|
852 |
TRequestStatus* req=(&aStatus); |
|
853 |
User::RequestComplete(req,KErrOverflow); |
|
854 |
return; |
|
855 |
} |
|
856 |
||
857 |
RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,I64LOW(KCurrentPosition64)),aStatus); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
858 |
OstTrace0(TRACE_BORDER, EFSRV_EFILEREAD6RETURN, ""); |
0 | 859 |
} |
860 |
||
861 |
||
862 |
||
863 |
||
864 |
EFSRV_EXPORT_C TInt RFile::Read(TInt aPos,TDes8& aDes) const |
|
865 |
/** |
|
866 |
Reads from the file at the specified offset within the file |
|
867 |
||
868 |
This is a synchronous function. |
|
869 |
||
870 |
Note that when an attempt is made to read beyond the end of the file, |
|
871 |
no error is returned. |
|
872 |
The descriptor's length is set to the number of bytes read into it. |
|
873 |
Therefore, when reading through a file, the end of file has been reached |
|
874 |
when the descriptor length, as returned by TDesC8::Length(), is zero. |
|
875 |
||
876 |
@param aPos Position of first byte to be read. This is an offset from |
|
877 |
the start of the file. If no position is specified, reading |
|
878 |
begins at the current file position. |
|
879 |
If aPos is beyond the end of the file, the function returns |
|
880 |
a zero length descriptor. |
|
881 |
||
882 |
@param aDes The descriptor into which binary data is read. Any existing content |
|
883 |
is overwritten. On return, its length is set to the number of |
|
884 |
bytes read. |
|
885 |
||
886 |
@return KErrNone if successful, otherwise one of the other system-wide error |
|
887 |
codes. |
|
888 |
||
889 |
@panic FSCLIENT 19 if aPos is negative. |
|
890 |
*/ |
|
891 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
892 |
OstTraceExt4(TRACE_BORDER, EFSRV_EFILEREAD3, "sess %x subs %x aPos %x maxdeslen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aDes.MaxLength()); |
0 | 893 |
__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative)); |
894 |
||
895 |
TInt r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),aPos)); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
896 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILEREAD3RETURN, "r %d len %d", (TUint) r, (TUint) aDes.Length()); |
0 | 897 |
return r; |
898 |
} |
|
899 |
||
900 |
||
901 |
||
902 |
||
903 |
EFSRV_EXPORT_C void RFile::Read(TInt aPos,TDes8& aDes,TRequestStatus& aStatus) const |
|
904 |
/** |
|
905 |
Reads from the file at the specified offset within the file. |
|
906 |
||
907 |
This is an asynchronous function. |
|
908 |
||
909 |
Note that when an attempt is made to read beyond the end of the file, |
|
910 |
no error is returned. |
|
911 |
The descriptor's length is set to the number of bytes read into it. |
|
912 |
Therefore, when reading through a file, the end of file has been reached |
|
913 |
when the descriptor length, as returned by TDesC8::Length(), is zero. |
|
914 |
||
915 |
@param aPos Position of first byte to be read. This is an offset from |
|
916 |
the start of the file. If no position is specified, |
|
917 |
reading begins at the current file position. |
|
918 |
If aPos is beyond the end of the file, the function returns |
|
919 |
a zero length descriptor. |
|
920 |
||
921 |
@param aDes The descriptor into which binary data is read. Any existing |
|
922 |
content is overwritten. On return, its length is set to |
|
923 |
the number of bytes read. |
|
924 |
NB: this function is asynchronous and the request that it |
|
925 |
represents may not complete until some time after the call |
|
926 |
to the function has returned. It is important, therefore, that |
|
927 |
this descriptor remain valid, or remain in scope, until you have |
|
928 |
been notified that the request is complete. |
|
929 |
||
930 |
@param aStatus The request status. On completion, contains an error code of KErrNone |
|
931 |
if successful, otherwise one of the other system-wide error codes. |
|
932 |
||
933 |
@panic FSCLIENT 19 if aPos is negative. |
|
934 |
*/ |
|
935 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
936 |
OstTraceExt4(TRACE_BORDER, EFSRV_EFILEREAD4, "sess %x subs %x aPos %x maxdeslen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aDes.MaxLength()); |
0 | 937 |
__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative)); |
938 |
RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),aPos),aStatus); |
|
939 |
||
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
940 |
OstTrace0(TRACE_BORDER, EFSRV_EFILEREAD4RETURN, ""); |
0 | 941 |
} |
942 |
||
943 |
||
944 |
||
945 |
||
946 |
EFSRV_EXPORT_C TInt RFile::Read(TInt aPos,TDes8& aDes,TInt aLength) const |
|
947 |
/** |
|
948 |
Reads the specified number of bytes of binary data from the file at a specified |
|
949 |
offset within the file. |
|
950 |
||
951 |
This is a synchronous function. |
|
952 |
||
953 |
Note that when an attempt is made to read beyond the end of the file, |
|
954 |
no error is returned. |
|
955 |
The descriptor's length is set to the number of bytes read into it. |
|
956 |
Therefore, when reading through a file, the end of file has been reached |
|
957 |
when the descriptor length, as returned by TDesC8::Length(), is zero. |
|
958 |
Assuming aLength is less than the maximum length of the descriptor, the only |
|
959 |
circumstances in which Read() can return fewer bytes than requested is when |
|
960 |
the end of file is reached or if an error has occurred. |
|
961 |
||
962 |
@param aPos Position of first byte to be read. This is an offset from |
|
963 |
the start of the file. If no position is specified, |
|
964 |
reading begins at the current file position. |
|
965 |
If aPos is beyond the end of the file, the function returns |
|
966 |
a zero length descriptor. |
|
967 |
||
968 |
@param aDes The descriptor into which binary data is read. Any existing |
|
969 |
contents are overwritten. On return, its length is set to |
|
970 |
the number of bytes read. |
|
971 |
@param aLength The number of bytes to read from the file into the descriptor. |
|
972 |
If an attempt is made to read more bytes than the descriptor's |
|
973 |
maximum length, then the function updates aStatus parameter with KErrOverflow. |
|
974 |
It must not be negative otherwise the function updates aStatus with KErrArgument. |
|
975 |
||
976 |
@return KErrNone if successful, otherwise one of the other system-wide |
|
977 |
error codes. |
|
978 |
||
979 |
@panic FSCLIENT 19 if aPos is negative. |
|
980 |
*/ |
|
981 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
982 |
OstTraceExt4(TRACE_BORDER, EFSRV_EFILEREAD7, "sess %x subs %x aPos %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength); |
0 | 983 |
__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative)); |
984 |
if (aLength==0) |
|
985 |
{ |
|
986 |
aDes.Zero(); |
|
987 |
return(KErrNone); |
|
988 |
} |
|
989 |
else if(aLength>aDes.MaxLength()) |
|
990 |
{ |
|
991 |
return(KErrOverflow); |
|
992 |
} |
|
993 |
||
994 |
TInt r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,aPos)); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
995 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILEREAD7RETURN, "r %d len %d", (TUint) r, (TUint) aDes.Length()); |
0 | 996 |
return r; |
997 |
} |
|
998 |
||
999 |
||
1000 |
||
1001 |
||
1002 |
EFSRV_EXPORT_C void RFile::Read(TInt aPos,TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const |
|
1003 |
/** |
|
1004 |
Reads the specified number of bytes of binary data from the file at a specified |
|
1005 |
offset within the file. |
|
1006 |
||
1007 |
This is an asynchronous function. |
|
1008 |
||
1009 |
Note that when an attempt is made to read beyond the end of the file, |
|
1010 |
no error is returned. |
|
1011 |
The descriptor's length is set to the number of bytes read into it. |
|
1012 |
Therefore, when reading through a file, the end of file has been reached |
|
1013 |
when the descriptor length, as returned by TDesC8::Length(), is zero. |
|
1014 |
Assuming aLength is less than the maximum length of the descriptor, the only |
|
1015 |
circumstances in which Read() can return fewer bytes than requested is when |
|
1016 |
the end of file is reached or if an error has occurred. |
|
1017 |
||
1018 |
@param aPos Position of first byte to be read. This is an offset from |
|
1019 |
the start of the file. If no position is specified, |
|
1020 |
reading begins at the current file position. |
|
1021 |
If aPos is beyond the end of the file, the function returns |
|
1022 |
a zero length descriptor. |
|
1023 |
||
1024 |
@param aDes The descriptor into which binary data is read. Any existing |
|
1025 |
contents are overwritten. On return, its length is set to |
|
1026 |
the number of bytes read. |
|
1027 |
NB: this function is asynchronous and the request that it |
|
1028 |
represents may not complete until some time after the call |
|
1029 |
to the function has returned. It is important, therefore, that |
|
1030 |
this descriptor remain valid, or remain in scope, until you have |
|
1031 |
been notified that the request is complete. |
|
1032 |
||
1033 |
@param aLength The number of bytes to read from the file into the descriptor. |
|
1034 |
If an attempt is made to read more bytes than the descriptor's |
|
1035 |
maximum length, then the function returns KErrOverflow. |
|
1036 |
It must not be negative otherwise the function returns KErrArgument. |
|
1037 |
||
1038 |
@param aStatus Request status. On completion contains KErrNone if successful, |
|
1039 |
otherwise one of the other system-wide error codes. |
|
1040 |
||
1041 |
@panic FSCLIENT 19 if aPos is negative. |
|
1042 |
*/ |
|
1043 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1044 |
OstTraceExt4(TRACE_BORDER, EFSRV_EFILEREAD9, "sess %x subs %x aPos %x maxlen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength); |
0 | 1045 |
__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative)); |
1046 |
if (aLength==0) |
|
1047 |
{ |
|
1048 |
aDes.Zero(); |
|
1049 |
TRequestStatus* req=(&aStatus); |
|
1050 |
User::RequestComplete(req,KErrNone); |
|
1051 |
return; |
|
1052 |
} |
|
1053 |
else if(aLength>aDes.MaxLength()) |
|
1054 |
{ |
|
1055 |
TRequestStatus* req=(&aStatus); |
|
1056 |
User::RequestComplete(req,KErrOverflow); |
|
1057 |
return; |
|
1058 |
} |
|
1059 |
||
1060 |
RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,aPos),aStatus); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1061 |
OstTrace0(TRACE_BORDER, EFSRV_EFILEREAD9RETURN, ""); |
0 | 1062 |
} |
1063 |
||
1064 |
||
1065 |
||
1066 |
||
1067 |
EFSRV_EXPORT_C void RFile::ReadCancel(TRequestStatus& aStatus) const |
|
1068 |
/** |
|
1069 |
Cancels a specific outstanding asynchronous read request. |
|
1070 |
||
1071 |
The outstanding request completes with KErrCancel. |
|
1072 |
||
1073 |
@param aStat The request status object identified with the original |
|
1074 |
asynchronous read. |
|
1075 |
*/ |
|
1076 |
{ |
|
1077 |
if(aStatus != KRequestPending) |
|
1078 |
return; |
|
1079 |
SendReceive(EFsFileReadCancel, TIpcArgs(&aStatus)); |
|
1080 |
} |
|
1081 |
||
1082 |
||
1083 |
||
1084 |
||
1085 |
EFSRV_EXPORT_C void RFile::ReadCancel() const |
|
1086 |
/** |
|
1087 |
Cancels all outstanding asynchronous read requests for this subsession. |
|
1088 |
||
1089 |
All outstanding requests complete with KErrCancel. |
|
1090 |
*/ |
|
1091 |
{ |
|
1092 |
SendReceive(EFsFileReadCancel, TIpcArgs(NULL)); |
|
1093 |
} |
|
1094 |
||
1095 |
||
1096 |
||
1097 |
||
1098 |
EFSRV_EXPORT_C TInt RFile::Write(const TDesC8& aDes) |
|
1099 |
/** |
|
1100 |
Writes to the file at the current offset within the file. |
|
1101 |
||
1102 |
This is a synchronous function. |
|
1103 |
||
1104 |
NB Attempting to extend the file to 2 GByte or greater will fail with KErrTooBig |
|
1105 |
||
1106 |
@param aDes The descriptor from which binary data is written. |
|
1107 |
The function writes the entire contents of aDes to the file. |
|
1108 |
||
1109 |
@return KErrNone if successful, otherwise one of the other system-wide error |
|
1110 |
codes. |
|
1111 |
*/ |
|
1112 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1113 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFILEWRITE1, "sess %x subs %x deslen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aDes.Length()); |
0 | 1114 |
TInt r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),I64LOW(KCurrentPosition64))); |
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1115 |
OstTrace1(TRACE_BORDER, EFSRV_EFILEWRITE1RETURN, "r %d", r); |
0 | 1116 |
return r; |
1117 |
} |
|
1118 |
||
1119 |
||
1120 |
EFSRV_EXPORT_C void RFile::Write(const TDesC8& aDes,TRequestStatus& aStatus) |
|
1121 |
/** |
|
1122 |
Writes to the file at the current offset within the file. |
|
1123 |
||
1124 |
This is an asynchronous function. |
|
1125 |
||
1126 |
NB Attempting to extend the file to 2 GByte or greater will fail with KErrTooBig |
|
1127 |
||
1128 |
@param aDes The descriptor from which binary data is written. |
|
1129 |
The function writes the entire contents of aDes to the file. |
|
1130 |
NB: this function is asynchronous and the request that it |
|
1131 |
represents may not complete until some time after the call |
|
1132 |
to the function has returned. It is important, therefore, that |
|
1133 |
this descriptor remain valid, or remain in scope, until you have |
|
1134 |
been notified that the request is complete. |
|
1135 |
||
1136 |
@param aStatus Request status. On completion contains KErrNone if successful, |
|
1137 |
otherwise one of the other system-wide error codes. |
|
1138 |
*/ |
|
1139 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1140 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFILEWRITE2, "sess %x subs %x deslen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aDes.Length()); |
0 | 1141 |
RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),I64LOW(KCurrentPosition64)),aStatus); |
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1142 |
OstTrace0(TRACE_BORDER, EFSRV_EFILEWRITE2RETURN, ""); |
0 | 1143 |
} |
1144 |
||
1145 |
||
1146 |
||
1147 |
||
1148 |
EFSRV_EXPORT_C TInt RFile::Write(const TDesC8& aDes,TInt aLength) |
|
1149 |
/** |
|
1150 |
Writes a portion of a descriptor to the file at the current offset within |
|
1151 |
the file. |
|
1152 |
||
1153 |
This is a synchronous function. |
|
1154 |
||
1155 |
NB Attempting to extend the file to 2 GByte or greater will fail with KErrTooBig |
|
1156 |
||
1157 |
@param aDes The descriptor from which binary data is written. |
|
1158 |
@param aLength The number of bytes to be written from the descriptor. |
|
1159 |
This must not be greater than the length of the descriptor. |
|
1160 |
It must not be negative. |
|
1161 |
||
1162 |
@return KErrNone if successful; KErrArgument if aLength is negative; |
|
1163 |
otherwise one of the other system-wide error codes. |
|
1164 |
||
1165 |
@panic FSCLIENT 27 in debug mode, if aLength is greater than the length |
|
1166 |
of the descriptor aDes. |
|
1167 |
*/ |
|
1168 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1169 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFILEWRITE5, "sess %x subs %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aLength); |
0 | 1170 |
__ASSERT_DEBUG(aDes.Length()>=aLength,Panic(EBadLength)); |
1171 |
TInt r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,I64LOW(KCurrentPosition64))); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1172 |
OstTrace1(TRACE_BORDER, EFSRV_EFILEWRITE5RETURN, "r %d", r); |
0 | 1173 |
return r; |
1174 |
} |
|
1175 |
||
1176 |
||
1177 |
||
1178 |
||
1179 |
EFSRV_EXPORT_C void RFile::Write(const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus) |
|
1180 |
/** |
|
1181 |
Writes a portion of a descriptor to the file at the current offset |
|
1182 |
within the file. |
|
1183 |
||
1184 |
This is an asynchronous function. |
|
1185 |
||
1186 |
NB Attempting to extend the file to 2 GByte or greater will fail with KErrTooBig |
|
1187 |
||
1188 |
@param aDes The descriptor from which binary data is written. |
|
1189 |
NB: this function is asynchronous and the request that it |
|
1190 |
represents may not complete until some time after the call |
|
1191 |
to the function has returned. It is important, therefore, that |
|
1192 |
this descriptor remain valid, or remain in scope, until you have |
|
1193 |
been notified that the request is complete. |
|
1194 |
||
1195 |
@param aLength The number of bytes to be written from the descriptor. |
|
1196 |
This must not be greater than the length of the descriptor. |
|
1197 |
It must not be negative. |
|
1198 |
||
1199 |
@param aStatus Request status. On completion contains KErrNone if successful; |
|
1200 |
KErrArgument if aLength is negative; |
|
1201 |
otherwise one of the other system-wide error codes. |
|
1202 |
||
1203 |
*/ |
|
1204 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1205 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFILEWRITE9, "sess %x subs %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aLength); |
0 | 1206 |
|
1207 |
RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,I64LOW(KCurrentPosition64)),aStatus); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1208 |
OstTrace0(TRACE_BORDER, EFSRV_EFILEWRITE9RETURN, ""); |
0 | 1209 |
} |
1210 |
||
1211 |
||
1212 |
||
1213 |
||
1214 |
||
1215 |
EFSRV_EXPORT_C TInt RFile::Write(TInt aPos,const TDesC8& aDes) |
|
1216 |
/** |
|
1217 |
Writes to the file at the specified offset within the file |
|
1218 |
||
1219 |
This is a synchronous function. |
|
1220 |
||
1221 |
NB Attempting to extend the file to 2 GByte or greater will fail with KErrTooBig |
|
1222 |
||
1223 |
@param aPos The offset from the start of the file at which the first |
|
1224 |
byte is written. |
|
1225 |
If a position beyond the end of the file is specified, then |
|
1226 |
the write operation begins at the end of the file. |
|
1227 |
If the position has been locked, then the write fails. |
|
1228 |
||
1229 |
@param aDes The descriptor from which binary data is written. The function writes |
|
1230 |
the entire contents of aDes to the file. |
|
1231 |
||
1232 |
@return KErrNone if successful, otherwise one of the other system-wide error |
|
1233 |
codes. |
|
1234 |
||
1235 |
@panic FSCLIENT 19 if aPos is negative. |
|
1236 |
*/ |
|
1237 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1238 |
OstTraceExt4(TRACE_BORDER, EFSRV_EFILEWRITE3, "sess %x subs %x aPos %x len %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aDes.Length()); |
0 | 1239 |
__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative)); |
1240 |
TInt r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),aPos)); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1241 |
OstTrace1(TRACE_BORDER, EFSRV_EFILEWRITE3RETURN, "r %d", r); |
0 | 1242 |
return r; |
1243 |
} |
|
1244 |
||
1245 |
||
1246 |
||
1247 |
||
1248 |
EFSRV_EXPORT_C void RFile::Write(TInt aPos,const TDesC8& aDes,TRequestStatus& aStatus) |
|
1249 |
/** |
|
1250 |
Writes to the file at the specified offset within the file |
|
1251 |
||
1252 |
This is an asynchronous function. |
|
1253 |
||
1254 |
NB Attempting to extend the file to 2 GByte or greater will fail with KErrTooBig |
|
1255 |
||
1256 |
@param aPos The offset from the start of the file at which the first |
|
1257 |
byte is written. |
|
1258 |
If a position beyond the end of the file is specified, then |
|
1259 |
the write operation begins at the end of the file. |
|
1260 |
If the position has been locked, then the write fails. |
|
1261 |
||
1262 |
@param aDes The descriptor from which binary data is written. The function |
|
1263 |
writes the entire contents of aDes to the file. |
|
1264 |
NB: this function is asynchronous and the request that it |
|
1265 |
represents may not complete until some time after the call |
|
1266 |
to the function has returned. It is important, therefore, that |
|
1267 |
this descriptor remain valid, or remain in scope, until you have |
|
1268 |
been notified that the request is complete. |
|
1269 |
||
1270 |
@param aStatus Request status. On completion contains KErrNone if successful, |
|
1271 |
otherwise one of the other system-wide error codes. |
|
1272 |
||
1273 |
@panic FSCLIENT 19 if aPos is negative. |
|
1274 |
*/ |
|
1275 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1276 |
OstTraceExt4(TRACE_BORDER, EFSRV_EFILEWRITE4, "sess %x subs %x aPos %x deslen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aDes.Length()); |
0 | 1277 |
__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative)); |
1278 |
RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),aPos),aStatus); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1279 |
OstTrace0(TRACE_BORDER, EFSRV_EFILEWRITE4RETURN, ""); |
0 | 1280 |
} |
1281 |
||
1282 |
||
1283 |
||
1284 |
||
1285 |
EFSRV_EXPORT_C TInt RFile::Write(TInt aPos,const TDesC8& aDes,TInt aLength) |
|
1286 |
/** |
|
1287 |
Writes the specified number of bytes to the file at the specified offset within the file. |
|
1288 |
||
1289 |
This is a synchronous function. |
|
1290 |
||
1291 |
NB Attempting to extend the file to 2 GByte or greater will fail with KErrTooBig |
|
1292 |
||
1293 |
@param aPos The offset from the start of the file at which the first |
|
1294 |
byte is written. |
|
1295 |
If a position beyond the end of the file is specified, then |
|
1296 |
the write operation begins at the end of the file. |
|
1297 |
If the position has been locked, then the write fails. |
|
1298 |
||
1299 |
@param aDes The descriptor from which binary data is written. |
|
1300 |
@param aLength The number of bytes to be written from aDes . |
|
1301 |
It must not be negative. |
|
1302 |
||
1303 |
@return KErrNone if successful; KErrArgument if aLength is negative; |
|
1304 |
otherwise one of the other system-wide error codes. |
|
1305 |
||
1306 |
@panic FSCLIENT 19 if aPos is negative. |
|
1307 |
*/ |
|
1308 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1309 |
OstTraceExt4(TRACE_BORDER, EFSRV_EFILEWRITE6, "sess %x subs %x aPos %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength); |
0 | 1310 |
__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative)); |
1311 |
TInt r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,aPos)); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1312 |
OstTrace1(TRACE_BORDER, EFSRV_EFILEWRITE6RETURN, "r %d", r); |
0 | 1313 |
return r; |
1314 |
} |
|
1315 |
||
1316 |
||
1317 |
||
1318 |
||
1319 |
EFSRV_EXPORT_C void RFile::Write(TInt aPos,const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus) |
|
1320 |
/** |
|
1321 |
Writes the specified number of bytes to the file at the specified offset within the file. |
|
1322 |
||
1323 |
This is an asynchronous function. |
|
1324 |
||
1325 |
NB Attempting to extend the file to 2 GByte or greater will fail with KErrTooBig |
|
1326 |
||
1327 |
@param aPos The offset from the start of the file at which the first |
|
1328 |
byte is written. |
|
1329 |
If a position beyond the end of the file is specified, then |
|
1330 |
the write operation begins at the end of the file. |
|
1331 |
If the position has been locked, then the write fails. |
|
1332 |
||
1333 |
@param aDes The descriptor from which binary data is written. |
|
1334 |
NB: this function is asynchronous and the request that it |
|
1335 |
represents may not complete until some time after the call |
|
1336 |
to the function has returned. It is important, therefore, that |
|
1337 |
this descriptor remain valid, or remain in scope, until you have |
|
1338 |
been notified that the request is complete. |
|
1339 |
||
1340 |
@param aLength The number of bytes to be written from aDes. |
|
1341 |
It must not be negative. |
|
1342 |
||
1343 |
@param aStatus Request status. On completion contains KErrNone if successful; |
|
1344 |
KErrArgument if aLength is negative; |
|
1345 |
otherwise one of the other system-wide error codes. |
|
1346 |
||
1347 |
@panic FSCLIENT 19 if aPos is negative. |
|
1348 |
*/ |
|
1349 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1350 |
OstTraceExt4(TRACE_BORDER, EFSRV_EFILEWRITE10, "sess %x subs %x aPos %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength); |
0 | 1351 |
__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative)); |
1352 |
RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,aPos),aStatus); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1353 |
OstTrace0(TRACE_BORDER, EFSRV_EFILEWRITE10RETURN, ""); |
0 | 1354 |
} |
1355 |
||
1356 |
||
1357 |
||
1358 |
||
1359 |
EFSRV_EXPORT_C TInt RFile::Lock(TInt aPos,TInt aLength) const |
|
1360 |
/** |
|
1361 |
Locks a region within the file as defined by a range of bytes. |
|
1362 |
||
1363 |
This ensures that those bytes are accessible |
|
1364 |
only through the RFile object which claims the lock. To re-allow access by |
|
1365 |
other programs to the locked region, it must either be unlocked or the file |
|
1366 |
closed. Locking can be used to synchronize operations on a file when more |
|
1367 |
than one program has access to the file in EFileShareAny mode. |
|
1368 |
||
1369 |
More than one distinct region of a file can be locked, but an error is returned |
|
1370 |
if more than one lock is placed on the same region. Different RFile objects |
|
1371 |
can lock different parts of the same file as long as the file is opened in |
|
1372 |
EFileShareAny mode. The locked region may extend beyond the end of a file; |
|
1373 |
this prevents the file from being extended by other programs. |
|
1374 |
||
1375 |
@param aPos Position in file from which to lock; this is the offset from |
|
1376 |
the beginning of the file. |
|
1377 |
@param aLength Number of bytes to lock. |
|
1378 |
||
1379 |
@return KErrNone if successful; KErrArgument if aPos+aLength>2G-1 boundary; |
|
1380 |
otherwise one of the other system-wide error codes. |
|
1381 |
||
1382 |
@panic FSCLIENT 17 if aLength is not greater than zero, |
|
1383 |
@panic FSCLIENT 19 if aPos is negative. |
|
1384 |
||
1385 |
*/ |
|
1386 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1387 |
OstTraceExt4(TRACE_BORDER, EFSRV_EFILELOCK, "RFile::Lock() sess %x subs %x aPos %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength); |
0 | 1388 |
__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative)); |
1389 |
TInt r = SendReceive(EFsFileLock,TIpcArgs(aPos,aLength)); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1390 |
OstTrace1(TRACE_BORDER, EFSRV_EFILELOCKRETURN, "r %d", r); |
0 | 1391 |
return r; |
1392 |
} |
|
1393 |
||
1394 |
||
1395 |
||
1396 |
||
1397 |
EFSRV_EXPORT_C TInt RFile::UnLock(TInt aPos,TInt aLength) const |
|
1398 |
/** |
|
1399 |
Unlocks a region within the file as defined by a range of bytes. |
|
1400 |
||
1401 |
A lock can only be removed by the RFile object which claimed the lock. |
|
1402 |
||
1403 |
A portion of a locked region cannot be unlocked. The entire locked region |
|
1404 |
must be unlocked otherwise an error is returned. If any byte within |
|
1405 |
the specified range of bytes to unlock is not locked, an error is returned. |
|
1406 |
||
1407 |
@param aPos Position in file from which to unlock; this is the offset from |
|
1408 |
the beginning of the file. |
|
1409 |
@param aLength Number of bytes to unlock. |
|
1410 |
||
1411 |
@return KErrNone if successful; KErrArgument if aPos+aLength>2G-1 boundary; |
|
1412 |
otherwise one of the other system-wide error codes. |
|
1413 |
||
1414 |
@panic FSCLIENT 18 if aLength is not greater than zero, |
|
1415 |
@panic FSCLIENT 19 if aPos is negative. |
|
1416 |
*/ |
|
1417 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1418 |
OstTraceExt4(TRACE_BORDER, EFSRV_EFILEUNLOCK, "RFile::UnLock() sess %x subs %x aPos %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength); |
0 | 1419 |
__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative)); |
1420 |
TInt r = SendReceive(EFsFileUnLock,TIpcArgs(aPos,aLength)); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1421 |
OstTrace1(TRACE_BORDER, EFSRV_EFILEUNLOCKRETURN, "r %d", r); |
0 | 1422 |
return r; |
1423 |
} |
|
1424 |
||
1425 |
||
1426 |
||
1427 |
||
1428 |
EFSRV_EXPORT_C TInt RFile::Seek(TSeek aMode,TInt& aPos) const |
|
1429 |
/** |
|
1430 |
Sets the the current file position. |
|
1431 |
||
1432 |
The function can also be used to get the current file |
|
1433 |
position without changing it. The file position is the position at which |
|
1434 |
reading and writing takes place. The start of the file is position zero. |
|
1435 |
||
1436 |
To retrieve the current file position without changing it, specify ESeekCurrent |
|
1437 |
for the seek mode, and zero for the offset. |
|
1438 |
||
1439 |
If the seek mode is ESeekStart, then: |
|
1440 |
||
1441 |
1. the function does not modify the aPos argument, |
|
1442 |
||
1443 |
2. the function returns an error if the offset specified is negative. |
|
1444 |
||
1445 |
If the seek mode is ESeekAddress, an error is returned if: |
|
1446 |
||
1447 |
1. the file is not in ROM, |
|
1448 |
||
1449 |
2. the offset specified is greater than the size of the file. |
|
1450 |
||
1451 |
@param aMode Seek mode. Controls the destination of the seek operation. |
|
1452 |
@param aPos Offset from location specified in aMode. Can be negative. |
|
1453 |
On return contains the new file position. |
|
1454 |
If the seek mode is either ESeekCurrent or ESeekEnd and the offset |
|
1455 |
specifies a position before the start of the file |
|
1456 |
or beyond the end of the file, then on return, aPos is set to |
|
1457 |
the new file position (either the start or the end of the file). |
|
1458 |
If the seek mode is ESeekAddress, aPos returns the address of |
|
1459 |
the byte at the specified offset within the file. |
|
1460 |
||
1461 |
@return KErrNone if successful, otherwise one of the other system-wide error |
|
1462 |
codes. |
|
1463 |
*/ |
|
1464 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1465 |
OstTraceExt4(TRACE_BORDER, EFSRV_EFILESEEK1, "sess %x subs %x aMode %x aPos %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aMode, (TUint) aPos); |
0 | 1466 |
TInt64 newPos = aPos; |
1467 |
TPckg<TInt64> pkNewPos(newPos); |
|
1468 |
TInt r = SendReceive(EFsFileSeek|KIpcArgSlot2Desc,TIpcArgs(aPos,aMode,&pkNewPos)); |
|
1469 |
if(KErrNone == r) |
|
1470 |
aPos = I64LOW(newPos); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1471 |
OstTrace1(TRACE_BORDER, EFSRV_EFILESEEK1RETURN, "r %d", r); |
0 | 1472 |
return r; |
1473 |
} |
|
1474 |
||
1475 |
||
1476 |
||
1477 |
||
1478 |
EFSRV_EXPORT_C TInt RFile::Flush() |
|
1479 |
/** |
|
1480 |
Commits data to the storage device and flushes internal buffers without closing |
|
1481 |
the file. |
|
1482 |
||
1483 |
Although RFile::Close() also flushes internal buffers, it is often useful |
|
1484 |
to call Flush() before a file is closed. This is because Close() returns no |
|
1485 |
error information, so there is no way of telling whether the final data was |
|
1486 |
written to the file successfully or not. Once data has been flushed, Close() |
|
1487 |
is effectively a no-operation. |
|
1488 |
||
1489 |
@return KErrNone if successful, otherwise one of the other system-wide error |
|
1490 |
codes. |
|
1491 |
*/ |
|
1492 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1493 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFILEFLUSH1, "sess %x subs %x status %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) NULL); |
0 | 1494 |
TInt r = RSubSessionBase::SendReceive(EFsFileFlush); |
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1495 |
OstTrace1(TRACE_BORDER, EFSRV_EFILEFLUSH1RETURN, "r %d", r); |
0 | 1496 |
return r; |
1497 |
} |
|
1498 |
||
1499 |
||
1500 |
||
1501 |
||
1502 |
EFSRV_EXPORT_C void RFile::Flush(TRequestStatus& aStatus) |
|
1503 |
/** |
|
1504 |
Commits data to the storage device and flushes internal buffers without closing |
|
1505 |
the file. |
|
1506 |
||
1507 |
Although RFile::Close() also flushes internal buffers, it is often useful |
|
1508 |
to call Flush() before a file is closed. This is because Close() returns no |
|
1509 |
error information, so there is no way of telling whether the final data was |
|
1510 |
written to the file successfully or not. Once data has been flushed, Close() |
|
1511 |
is effectively a no-operation. |
|
1512 |
||
1513 |
@param aStatus Request status. On completion contains KErrNone if successful, |
|
1514 |
otherwise one of the other system-wide error codes. |
|
1515 |
*/ |
|
1516 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1517 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFILEFLUSH2, "sess %x subs %x status %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) &aStatus); |
0 | 1518 |
RSubSessionBase::SendReceive(EFsFileFlush, aStatus); |
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1519 |
OstTrace0(TRACE_BORDER, EFSRV_EFILEFLUSH2RETURN, ""); |
0 | 1520 |
} |
1521 |
||
1522 |
||
1523 |
||
1524 |
||
1525 |
EFSRV_EXPORT_C TInt RFile::Size(TInt& aSize) const |
|
1526 |
/** |
|
1527 |
Gets the current file size. |
|
1528 |
||
1529 |
@param aSize On return, the size of the file in bytes. |
|
1530 |
||
1531 |
@return KErrNone if successful, otherwise one of the other system-wide error |
|
1532 |
codes. |
|
1533 |
*/ |
|
1534 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1535 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILESIZE, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle()); |
0 | 1536 |
TInt64 size = aSize; |
1537 |
TPckg<TInt64> pkSize(size); |
|
1538 |
TInt r = SendReceive(EFsFileSize|KIpcArgSlot0Desc,TIpcArgs(&pkSize)); |
|
1539 |
if(KErrNone != r) |
|
1540 |
return r; |
|
1541 |
aSize = I64LOW(size); |
|
1542 |
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
1543 |
if (size > KMaxTInt) |
|
1544 |
return (KErrTooBig); |
|
1545 |
#endif |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1546 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILESIZERETURN, "r %d aSize %d", (TUint) r, (TUint) aSize); |
0 | 1547 |
return r; |
1548 |
} |
|
1549 |
||
1550 |
||
1551 |
||
1552 |
||
1553 |
EFSRV_EXPORT_C TInt RFile::SetSize(TInt aSize) |
|
1554 |
/** |
|
1555 |
Sets the file size. |
|
1556 |
||
1557 |
If the size of the file is reduced, data may be lost from |
|
1558 |
the end of the file. |
|
1559 |
||
1560 |
Note: |
|
1561 |
||
1562 |
1. The current file position remains unchanged unless SetSize() reduces the size |
|
1563 |
of the file in such a way that the current file position is now beyond |
|
1564 |
the end of the file. In this case, the current file position is set to |
|
1565 |
the end of file. |
|
1566 |
||
1567 |
2. If the file was not opened for writing, an error is returned. |
|
1568 |
||
1569 |
@param aSize The new size of the file, in bytes. This value must not be negative, otherwise the function raises a panic. |
|
1570 |
||
1571 |
@return KErrNone if successful, otherwise one of the other system-wide error |
|
1572 |
codes. |
|
1573 |
||
1574 |
@panic FSCLIENT 20 If aSize is negative. |
|
1575 |
||
1576 |
*/ |
|
1577 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1578 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFILESETSIZE1, "sess %x subs %x aSize %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aSize); |
0 | 1579 |
TInt r = SendReceive(EFsFileSetSize,TIpcArgs(aSize)); |
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1580 |
OstTrace1(TRACE_BORDER, EFSRV_EFILESETSIZE1RETURN, "r %d", r); |
0 | 1581 |
return r; |
1582 |
} |
|
1583 |
||
1584 |
||
1585 |
||
1586 |
||
1587 |
EFSRV_EXPORT_C TInt RFile::Att(TUint& aVal) const |
|
1588 |
/** |
|
1589 |
Gets the file's attributes. |
|
1590 |
||
1591 |
@param aVal A bitmask which, on return, contains the file’s attributes. |
|
1592 |
For more information, see KEntryAttNormal and the other |
|
1593 |
file/directory attributes. |
|
1594 |
||
1595 |
@return KErrNone if successful, otherwise one of the other system-wide error |
|
1596 |
codes. |
|
1597 |
||
1598 |
@see KEntryAttNormal |
|
1599 |
*/ |
|
1600 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1601 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILEATT, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle()); |
0 | 1602 |
TPtr8 a((TUint8*)&aVal,sizeof(TUint)); |
1603 |
||
1604 |
TInt r = SendReceive(EFsFileAtt,TIpcArgs(&a)); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1605 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILEATTRETURN, "r %d aVal %x", (TUint) r, (TUint) aVal); |
0 | 1606 |
return r; |
1607 |
} |
|
1608 |
||
1609 |
||
1610 |
||
1611 |
||
1612 |
EFSRV_EXPORT_C TInt RFile::SetAtt(TUint aSetAttMask,TUint aClearAttMask) |
|
1613 |
/** |
|
1614 |
Sets or clears file attributes using two bitmasks. |
|
1615 |
||
1616 |
The first mask controls which attributes are set. |
|
1617 |
The second controls which attributes are cleared. |
|
1618 |
||
1619 |
Notes: |
|
1620 |
||
1621 |
1. The file must have been opened for writing, or an error is returned. |
|
1622 |
||
1623 |
2. A panic is raised if any attribute is specified in both bitmasks. |
|
1624 |
||
1625 |
3. An attempt to set or clear the KEntryAttDir, KEntryAttVolume or KEntryAttRemote |
|
1626 |
attributes have no effect. |
|
1627 |
||
1628 |
4. The new attribute values take effect when the file is flushed or closed (which |
|
1629 |
implies a flush). |
|
1630 |
||
1631 |
@param aSetAttMask A bitmask indicating the file attributes to be set |
|
1632 |
@param aClearAttMask A bitmask indicating the attributes to be cleared. For |
|
1633 |
more information see KEntryAttNormal, and the other |
|
1634 |
file/directory attributes. |
|
1635 |
||
1636 |
@return KErrNone if successful, otherwise one of the other system-wide error |
|
1637 |
codes. |
|
1638 |
||
1639 |
@panic FSCLIENT 21 if the same attribute bit is set in both bitmasks. |
|
1640 |
*/ |
|
1641 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1642 |
OstTraceExt4(TRACE_BORDER, EFSRV_EFILESETATT, "sess %x subs %x aSetAttMask %x aClearAttMask %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aSetAttMask, (TUint) aClearAttMask); |
0 | 1643 |
__ASSERT_ALWAYS((aSetAttMask&aClearAttMask)==0,Panic(EAttributesIllegal)); |
1644 |
||
1645 |
TInt r = SendReceive(EFsFileSetAtt,TIpcArgs(aSetAttMask,aClearAttMask)); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1646 |
OstTrace1(TRACE_BORDER, EFSRV_EFILESETATTRETURN, "r %d", r); |
0 | 1647 |
return r; |
1648 |
} |
|
1649 |
||
1650 |
||
1651 |
||
1652 |
||
1653 |
EFSRV_EXPORT_C TInt RFile::Modified(TTime& aTime) const |
|
1654 |
/** |
|
1655 |
Gets local date and time the file was last modified, in universal time. |
|
1656 |
||
1657 |
@param aTime On return, contains the date and time the file was last modified in UTC. |
|
1658 |
||
1659 |
@return KErrNone if successful, otherwise one of the other system-wide error |
|
1660 |
codes. |
|
1661 |
*/ |
|
1662 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1663 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILEMODIFIED, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle()); |
0 | 1664 |
TPtr8 t((TUint8*)&aTime,sizeof(TTime)); |
1665 |
TInt r = SendReceive(EFsFileModified,TIpcArgs(&t)); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1666 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFILEMODIFIEDRETURN, "r %d aTime %x:%x ", (TUint) r, (TUint) I64HIGH(aTime.Int64()), (TUint) I64LOW(aTime.Int64())); |
0 | 1667 |
return r; |
1668 |
} |
|
1669 |
||
1670 |
||
1671 |
||
1672 |
||
1673 |
EFSRV_EXPORT_C TInt RFile::SetModified(const TTime& aTime) |
|
1674 |
/** |
|
1675 |
Sets the date and time the file was last modified. UTC date and time should be used. |
|
1676 |
||
1677 |
Notes: |
|
1678 |
||
1679 |
1. The file must have been opened for writing, or an error is returned. |
|
1680 |
||
1681 |
2. The new modified time takes effect when the file is flushed or closed (which |
|
1682 |
implies a flush). |
|
1683 |
||
1684 |
@param aTime The new date and time the file was last modified, in universal time. |
|
1685 |
||
1686 |
@return KErrNone if successful, otherwise one of the other system-wide error |
|
1687 |
codes. |
|
1688 |
*/ |
|
1689 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1690 |
OstTraceExt4(TRACE_BORDER, EFSRV_EFILESETMODIFIED, "sess %x subs %x aTime %x:%x ", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aTime.Int64()), (TUint) I64LOW(aTime.Int64())); |
0 | 1691 |
TPtrC8 t((TUint8*)&aTime,sizeof(TTime)); |
1692 |
TInt r = SendReceive(EFsFileSetModified,TIpcArgs(&t)); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1693 |
OstTrace1(TRACE_BORDER, EFSRV_EFILESETMODIFIEDRETURN, "r %d", r); |
0 | 1694 |
return r; |
1695 |
} |
|
1696 |
||
1697 |
||
1698 |
||
1699 |
||
1700 |
EFSRV_EXPORT_C TInt RFile::Set(const TTime& aTime,TUint aMask,TUint aVal) |
|
1701 |
/** |
|
1702 |
Sets the file’s attributes, and the date and time it was last modified. |
|
1703 |
||
1704 |
It combines the functionality of SetAtt() and SetModified() |
|
1705 |
||
1706 |
An attempt to set or clear the KEntryAttDir, KEntryAttVolume or KEntryAttRemote |
|
1707 |
attributes have no effect. |
|
1708 |
||
1709 |
@param aTime The new date and time the file was last modified. UTC date and time should be used. |
|
1710 |
@param aMask A bitmask indicating the file attributes to be set |
|
1711 |
@param aVal A bitmask indicating the attributes to be cleared. For |
|
1712 |
more information see KEntryAttNormal, and the other |
|
1713 |
file/directory attributes. |
|
1714 |
||
1715 |
@return KErrNone if successful, otherwise one of the other system-wide error |
|
1716 |
codes. |
|
1717 |
||
1718 |
@panic FSCLIENT 21 if the same attribute bit is set in both bitmasks. |
|
1719 |
||
1720 |
@see RFile::SetModified |
|
1721 |
@see RFile::SetAtt |
|
1722 |
*/ |
|
1723 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1724 |
OstTraceExt4(TRACE_BORDER, EFSRV_EFILESETA, "sess %x subs %x aSetAttMask %x aClearAttMask %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aMask, (TUint) aVal); |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1725 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILESETB, "aTime %x:%x ", (TUint) I64HIGH(aTime.Int64()), (TUint) I64LOW(aTime.Int64())); |
0 | 1726 |
__ASSERT_ALWAYS((aVal&aMask)==0,Panic(EAttributesIllegal)); |
1727 |
TPtrC8 t((TUint8*)&aTime,sizeof(TTime)); |
|
1728 |
TInt r = SendReceive(EFsFileSet,TIpcArgs(&t,aMask,aVal)); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1729 |
OstTrace1(TRACE_BORDER, EFSRV_EFILESETRETURN, "r %d", r); |
0 | 1730 |
return r; |
1731 |
} |
|
1732 |
||
1733 |
||
1734 |
||
1735 |
||
1736 |
EFSRV_EXPORT_C TInt RFile::ChangeMode(TFileMode aNewMode) |
|
1737 |
/** |
|
1738 |
Switches an open file's access mode between EFileShareExclusive and EFileShareReadersOnly. |
|
1739 |
||
1740 |
This allows or disallows read-only access without having to close and re-open the file. |
|
1741 |
||
1742 |
@param aNewMode The new access mode. |
|
1743 |
||
1744 |
@return KErrNone, if successful; |
|
1745 |
KErrArgument, if aNewMode has any value other than the two specified; |
|
1746 |
KErrAccessDenied, if: |
|
1747 |
a) the function is called when the current file share |
|
1748 |
mode is EFileShareAny; |
|
1749 |
b) the file has multiple readers, and an attempt is made |
|
1750 |
to change the share mode to EFileShareExclusive; |
|
1751 |
c) the file has been opened for writing in EFileShareExclusive mode, and an |
|
1752 |
attempt is made to change the access mode to EFileShareReadersOnly. |
|
1753 |
||
1754 |
@capability Dependent If the path starts with /Resource then capability DiskAdmin is required |
|
1755 |
||
1756 |
*/ |
|
1757 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1758 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFILECHANGEMODE, "sess %x subs %x aNewMode %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aNewMode); |
0 | 1759 |
if (aNewMode!=EFileShareExclusive && aNewMode!=EFileShareReadersOnly) |
1760 |
return(KErrArgument); |
|
1761 |
TInt r = SendReceive(EFsFileChangeMode,TIpcArgs(aNewMode)); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1762 |
OstTrace1(TRACE_BORDER, EFSRV_EFILECHANGEMODERETURN, "r %d", r); |
0 | 1763 |
return r; |
1764 |
} |
|
1765 |
||
1766 |
||
1767 |
||
1768 |
||
1769 |
EFSRV_EXPORT_C TInt RFile::Rename(const TDesC& aNewName) |
|
1770 |
/** |
|
1771 |
Renames a file. |
|
1772 |
||
1773 |
If aNewName specifies a different directory to the one in which |
|
1774 |
the file is currently located, then the file is moved. |
|
1775 |
||
1776 |
No other process may have access to the file, that is, the file must have |
|
1777 |
been opened in EFileShareExclusive share mode, or an error is returned. The |
|
1778 |
file must have been opened for writing (using EFileWrite access mode). An |
|
1779 |
error is returned if a file with the new filename already exists in the target |
|
1780 |
directory. |
|
1781 |
||
1782 |
The file or directory may not be moved to another device by this means, either |
|
1783 |
explicitly (by another drive specified in the name) or implicitly (because |
|
1784 |
the directory has been mapped to another device with RFs::SetSubst()). |
|
1785 |
||
1786 |
Note that the function builds up the new file specification by using all |
|
1787 |
of the path components specified |
|
1788 |
in aNewName (directory path, filename and extension), |
|
1789 |
then adding any missing components from the current file specification, and |
|
1790 |
finally adding any missing components from the session path. A consequence |
|
1791 |
of this is that you cannot rename a file to remove its extension. An alternative |
|
1792 |
to this function is RFs::Rename() which renames the file using the new name |
|
1793 |
as provided. |
|
1794 |
||
1795 |
@param aNewName The new file name and/or directory path. No part may contain |
|
1796 |
wildcard characters or an error is returned. |
|
1797 |
||
1798 |
@return KErrNone if successful, otherwise one of the other system-wide error |
|
1799 |
codes. |
|
1800 |
||
1801 |
@capability Dependent If aNewName starts with /Sys then capability Tcb is required |
|
1802 |
@capability Dependent If aNewName starts with /Resource then capability Tcb is required |
|
1803 |
@capability Dependent If aNewName starts with /Private and does not match this process' |
|
1804 |
SID then AllFiles capability is required. |
|
1805 |
||
1806 |
*/ |
|
1807 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1808 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILERENAME, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle()); |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1809 |
OstTraceData(TRACE_BORDER, EFSRV_EFILERENAME_ENEWNAME, "NewName %S", aNewName.Ptr(), aNewName.Length()<<1); |
0 | 1810 |
TInt r = SendReceive(EFsFileRename,TIpcArgs(&aNewName)); |
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1811 |
OstTrace1(TRACE_BORDER, EFSRV_EFILERENAMERETURN, "r %d", r); |
0 | 1812 |
return r; |
1813 |
} |
|
1814 |
||
1815 |
||
1816 |
||
1817 |
||
1818 |
EFSRV_EXPORT_C TInt RFile::Drive(TInt &aDriveNumber, TDriveInfo &aDriveInfo) const |
|
1819 |
/** |
|
1820 |
Gets information about the drive on which this file resides. |
|
1821 |
||
1822 |
@param aDriveNumber On return, the drive number. |
|
1823 |
||
1824 |
@param aDriveInfo On return, contains information describing the drive |
|
1825 |
and the medium mounted on it. The value of TDriveInfo::iType |
|
1826 |
shows whether the drive contains media. |
|
1827 |
||
1828 |
@return KErrNone, if successful, otherwise one of the other |
|
1829 |
system-wide error codes |
|
1830 |
||
1831 |
@see RFs::Drive |
|
1832 |
*/ |
|
1833 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1834 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILEDRIVE, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle()); |
0 | 1835 |
TPckg<TInt> pki(aDriveNumber); |
1836 |
TPckg<TDriveInfo> pkdi(aDriveInfo); |
|
1837 |
TInt r = SendReceive(EFsFileDrive,TIpcArgs(&pki,&pkdi)); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1838 |
OstTraceExt4(TRACE_BORDER, EFSRV_EFILEDRIVERETURN, "r %d driveAtt %x mediaAtt %x type %x", (TUint) r, (TUint) aDriveInfo.iDriveAtt, (TUint) aDriveInfo.iMediaAtt, (TUint) aDriveInfo.iType); |
0 | 1839 |
return r; |
1840 |
} |
|
1841 |
||
1842 |
||
1843 |
TInt RFile::Clamp(RFileClamp& aHandle) |
|
1844 |
/** |
|
1845 |
Instructs the File Server that the file is not to be modified on storage media. |
|
1846 |
||
1847 |
@param aHandle On return, a handle to the file. |
|
1848 |
||
1849 |
@return KErrNone, if successful, otherwise one of the other |
|
1850 |
system-wide error codes |
|
1851 |
||
1852 |
@see RFs::Unclamp |
|
1853 |
*/ |
|
1854 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1855 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILECLAMP, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle()); |
0 | 1856 |
TPckg<RFileClamp> pkHandle(aHandle); |
1857 |
TInt r = SendReceive(EFsFileClamp,TIpcArgs(& pkHandle)); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1858 |
OstTrace1(TRACE_BORDER, EFSRV_EFILECLAMPRETURN, "r %d", r); |
0 | 1859 |
return r; |
1860 |
} |
|
1861 |
||
1862 |
/** |
|
1863 |
Fetches the Block Map of a file. Each file in the file system will consist of |
|
1864 |
a number of groups of blocks. Each group represents a number of contiguous blocks. |
|
1865 |
Such a group is represented by the TBlockMapEntry class. The full Block Map representing |
|
1866 |
the file may be determined by repeatedly calling RFile::BlockMap until KErrCompletion is |
|
1867 |
returned. |
|
1868 |
||
1869 |
Note: |
|
1870 |
||
1871 |
1. If the Block Map for the whole file is not required, then a start and end position |
|
1872 |
for a section of the file can be specified. Both of these parameters specify offsets |
|
1873 |
from the start of the file in bytes. |
|
1874 |
||
1875 |
@param aInfo A structure describing a group of block maps. |
|
1876 |
||
1877 |
@param aStartPos A start position for a desired section of the file. |
|
1878 |
||
1879 |
@param aEndPos An end position for a desired section of the file. If not passed, then the end of the |
|
1880 |
file is assumed. |
|
1881 |
||
1882 |
@return KErrNone until the end of the file or the file section is successfully reached; |
|
1883 |
KErrCompletion if the end of the file is reached; |
|
1884 |
KErrNotSupported if the file system does not support Block Mapping or the media is either removable or not pageable. |
|
1885 |
*/ |
|
1886 |
EFSRV_EXPORT_C TInt RFile::BlockMap(SBlockMapInfo& aInfo, TInt64& aStartPos, TInt64 aEndPos, TInt aBlockMapUsage) const |
|
1887 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1888 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILEBLOCKMAPA, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle()); |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1889 |
OstTraceExt5(TRACE_BORDER, EFSRV_EFILEBLOCKMAPB, "RFile::BlockMap() aStartPos %x:%x aEndPos %x:%x aBlockMapusage %d", (TUint) I64HIGH(aStartPos), (TUint) I64LOW(aStartPos), (TUint) I64HIGH(aEndPos), (TUint) I64LOW(aEndPos), (TUint) aBlockMapUsage); |
0 | 1890 |
SBlockMapArgs args; |
1891 |
args.iStartPos = aStartPos; |
|
1892 |
args.iEndPos = aEndPos; |
|
1893 |
TPckg<SBlockMapInfo> pkInfo(aInfo); |
|
1894 |
TPckg<SBlockMapArgs> pkArgs(args); |
|
1895 |
TInt r = SendReceive(EFsBlockMap, TIpcArgs(&pkInfo, &pkArgs, aBlockMapUsage)); |
|
1896 |
if(r==KErrNone) |
|
1897 |
aStartPos = args.iStartPos; |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1898 |
OstTrace1(TRACE_BORDER, EFSRV_EFILEBLOCKMAPRETURN, "r %d", r); |
0 | 1899 |
return r; |
1900 |
} |
|
1901 |
||
1902 |
||
1903 |
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
1904 |
/** |
|
1905 |
Opens an existing file for reading or writing. |
|
1906 |
||
1907 |
If the file does not already exist, an error is returned. |
|
1908 |
||
1909 |
This is equivalent to calling RFile::Open except that this function |
|
1910 |
can open files of size greater than 2GB - 1 also. |
|
1911 |
||
1912 |
Notes: |
|
1913 |
||
1914 |
1. To close the file, use Close() |
|
1915 |
||
1916 |
2. Attempting to open a file with the read-only attribute using the EFileWrite |
|
1917 |
access mode results in an error. |
|
1918 |
||
1919 |
3. After a file has been opened, the current write position is set to the start |
|
1920 |
of the file. |
|
1921 |
If necessary, use RFile64::Seek() to move to a different position within |
|
1922 |
the file. |
|
1923 |
||
1924 |
4. It enables big file support to handle files whose size are greater then 2GB-1 |
|
1925 |
||
1926 |
@param aFs The file server session. |
|
1927 |
@param aName The name of the file. Any path components (i.e. drive letter |
|
1928 |
or directory), which are not specified, are taken from |
|
1929 |
the session path. |
|
1930 |
@param aMode The mode in which the file is opened. See TFileMode. |
|
1931 |
||
1932 |
@return KErrNone if successful, otherwise one of the other system-wide |
|
1933 |
error codes. |
|
1934 |
||
1935 |
@see TFileMode |
|
1936 |
@see RFile::Open() |
|
1937 |
||
1938 |
@capability Dependent If the path for aName is /Sys and aMode is neither |
|
1939 |
EFileShareReadersOnly nor EFileRead then Tcb capability is required. |
|
1940 |
@capability Dependent If the path for aName is /Sys and aMode is either |
|
1941 |
EFileShareReadersOnly or EFileRead then Allfiles capability is required. |
|
1942 |
@capability Dependent If the path for aName begins with /Private and does not match this process' |
|
1943 |
SID then AllFiles capability is required. |
|
1944 |
@capability Dependent If the path for aName begins with /Resource and aMode is neither |
|
1945 |
EFileShareReadersOrWriters|EFileRead nor EFileShareReadersOnly |
|
1946 |
nor EFileRead then Tcb capability is required. |
|
1947 |
||
1948 |
*/ |
|
1949 |
EFSRV_EXPORT_C TInt RFile64::Open(RFs& aFs,const TDesC& aName,TUint aFileMode) |
|
1950 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1951 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64OPEN, "sess %x mode %x", (TUint) aFs.Handle(), (TUint) aFileMode); |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1952 |
OstTraceData(TRACE_BORDER, EFSRV_EFILE64OPEN_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1); |
0 | 1953 |
|
1954 |
TInt r = CreateSubSession(aFs,EFsFileOpen,TIpcArgs(&aName,aFileMode|EFileBigFile)); |
|
1955 |
||
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1956 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64OPENRETURN, "r %d subs %x", (TUint) r, (TUint) SubSessionHandle()); |
0 | 1957 |
return r; |
1958 |
} |
|
1959 |
||
1960 |
/** |
|
1961 |
Creates and opens a new file for writing. |
|
1962 |
||
1963 |
If the file already exists, an error is returned. |
|
1964 |
||
1965 |
If the resulting path does not exist, then the operation cannot proceed and |
|
1966 |
the function returns an error code. |
|
1967 |
||
1968 |
This is equivalent to calling RFile::Create except that the file created with |
|
1969 |
this function can grow beyond 2GB - 1 also. |
|
1970 |
||
1971 |
Notes: |
|
1972 |
||
1973 |
1. To close the file, use Close() |
|
1974 |
||
1975 |
2. It automatically sets the file's archive attribute. |
|
1976 |
||
1977 |
3. It enables big file support to handle files whose size are greater then 2GB-1 |
|
1978 |
||
1979 |
||
1980 |
@param aFs The file server session. |
|
1981 |
@param aName The name of the file. Any path components (i.e. drive letter |
|
1982 |
or directory), which are not specified, are taken from |
|
1983 |
the session path. |
|
1984 |
@param aMode The mode in which the file is opened. The access mode is |
|
1985 |
automatically set to EFileWrite. See TFileMode. |
|
1986 |
||
1987 |
@return KErrNone if successful, otherwise one of the other system-wide |
|
1988 |
error codes. |
|
1989 |
||
1990 |
@see RFile::Create() |
|
1991 |
@see TFileMode |
|
1992 |
||
1993 |
@capability Dependent If the path in aName starts with /Sys then capability Tcb is required |
|
1994 |
@capability Dependent If the path in aName starts with /Resource then capability Tcb is required |
|
1995 |
@capability Dependent If the path in aName starts with /Private and does not match this process' |
|
1996 |
SID then AllFiles capability is required. |
|
1997 |
||
1998 |
*/ |
|
1999 |
EFSRV_EXPORT_C TInt RFile64::Create(RFs& aFs,const TDesC& aName,TUint aFileMode) |
|
2000 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2001 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64CREATE, "sess %x mode %x", (TUint) aFs.Handle(), (TUint) aFileMode); |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2002 |
OstTraceData(TRACE_BORDER, EFSRV_EFILE64CREATE_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1); |
0 | 2003 |
TInt r = CreateSubSession(aFs,EFsFileCreate,TIpcArgs(&aName,aFileMode|EFileBigFile)); |
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2004 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64CREATERETURN, "r %d subs %x", (TUint) r, (TUint) SubSessionHandle()); |
0 | 2005 |
return r; |
2006 |
} |
|
2007 |
||
2008 |
/** |
|
2009 |
Opens a file for writing, replacing the content of any existing file of the |
|
2010 |
same name if it exists, or creating a new file if it does not exist. |
|
2011 |
||
2012 |
This is equivalent to calling RFile::Replace except that the file created or replaced |
|
2013 |
with this function can grow beyond 2GB - 1 also. |
|
2014 |
||
2015 |
||
2016 |
If the resulting path exists, then: |
|
2017 |
||
2018 |
- the length of an existing file with the same filename is re-set to zero |
|
2019 |
||
2020 |
- a new file is created, if no existing file with the same filename can be found. |
|
2021 |
||
2022 |
If the resulting path does not exist, then the operation cannot proceed and |
|
2023 |
the function returns an error code. |
|
2024 |
||
2025 |
Notes: |
|
2026 |
||
2027 |
- To close the file, use Close(), defined in the base class RFsBase. |
|
2028 |
||
2029 |
- It automatically sets the file's archive attribute. |
|
2030 |
||
2031 |
- It enables big file support to handle files whose size are greater then 2GB-1 |
|
2032 |
||
2033 |
||
2034 |
@param aFs The file server session. |
|
2035 |
@param aName The name of the file. Any path components (i.e. drive letter |
|
2036 |
or directory), which are not specified, are taken from |
|
2037 |
the session path. |
|
2038 |
@param aMode The mode in which the file is opened. The access mode is |
|
2039 |
automatically set to EFileWrite. See TFileMode. |
|
2040 |
||
2041 |
@return KErrNone if successful, otherwise one of the other system-wide |
|
2042 |
error codes. |
|
2043 |
||
2044 |
@see TFileMode |
|
2045 |
@see RFile::Replace() |
|
2046 |
||
2047 |
@capability Dependent If the path in aName starts with /Sys then capability Tcb is required |
|
2048 |
@capability Dependent If the path in aName starts with /Resource then capability Tcb is required |
|
2049 |
@capability Dependent If the path in aName starts with /Private and does not match this process' |
|
2050 |
SID then AllFiles capability is required. |
|
2051 |
||
2052 |
*/ |
|
2053 |
EFSRV_EXPORT_C TInt RFile64::Replace(RFs& aFs,const TDesC& aName,TUint aFileMode) |
|
2054 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2055 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64REPLACE, "sess %x mode %x", (TUint) aFs.Handle(), (TUint) aFileMode); |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2056 |
OstTraceData(TRACE_BORDER, EFSRV_EFILE64REPLACE_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1); |
0 | 2057 |
TInt r = CreateSubSession(aFs,EFsFileReplace,TIpcArgs(&aName,aFileMode|EFileBigFile)); |
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2058 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64REPLACERETURN, "r %d subs %x", (TUint) r, (TUint) SubSessionHandle()); |
0 | 2059 |
return r; |
2060 |
} |
|
2061 |
||
2062 |
||
2063 |
/** |
|
2064 |
Creates and opens a temporary file with a unique name for writing and reading. |
|
2065 |
This is equivalent to calling RFile::Temp except that the file created |
|
2066 |
with this function can grow beyond 2GB - 1 also. |
|
2067 |
||
2068 |
||
2069 |
Notes: |
|
2070 |
||
2071 |
1. To close the file, use Close() |
|
2072 |
2. It enables big file support to handle files whose size are greater then 2GB-1 |
|
2073 |
||
2074 |
@param aFs The file server session. |
|
2075 |
@param aPath The directory in which the file is created. |
|
2076 |
@param aName On return, contains the full path and file name of the file. |
|
2077 |
The filename is guaranteed to be unique within the directory |
|
2078 |
specified by aPath. |
|
2079 |
@param aMode The mode in which the file is opened. The access mode is |
|
2080 |
automatically set to EFileWrite. See TFileMode. |
|
2081 |
||
2082 |
@return KErrNone if successful, otherwise one of the other system-wide |
|
2083 |
error codes. |
|
2084 |
||
2085 |
@see TFileMode |
|
2086 |
@see RFile::Temp() |
|
2087 |
||
2088 |
@capability Dependent If aPath starts with /Sys then capability Tcb is required |
|
2089 |
@capability Dependent If aPath starts with /Resource then capability Tcb is required |
|
2090 |
@capability Dependent If aPath starts with /Private and does not match this process' |
|
2091 |
SID then AllFiles capability is required. |
|
2092 |
*/ |
|
2093 |
EFSRV_EXPORT_C TInt RFile64::Temp(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aFileMode) |
|
2094 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2095 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64TEMP, "sess %x aMode %x", (TUint) aFs.Handle(), (TUint) aFileMode); |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2096 |
OstTraceData(TRACE_BORDER, EFSRV_EFILE64TEMP_EDIRNAME, "Dir %S", aPath.Ptr(), aPath.Length()<<1); |
0 | 2097 |
TInt r = CreateSubSession(aFs,EFsFileTemp,TIpcArgs(&aPath,aFileMode|EFileBigFile,&aName)); |
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2098 |
OstTraceData(TRACE_BORDER, EFSRV_EFILE64TEMP_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1); |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2099 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64TEMPRETURN, "r %d subs %x", (TUint) r, (TUint) SubSessionHandle()); |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2100 |
|
0 | 2101 |
return r; |
2102 |
} |
|
2103 |
||
2104 |
||
2105 |
/** |
|
2106 |
Allows a server to adopt an already open file from a client. |
|
2107 |
The client's RFs and RFile or RFile64 handles are contained in message slots within aMsg. |
|
2108 |
||
2109 |
Assumes that the client's RFs and RFile or RFile64 handles have been sent to the server |
|
2110 |
using TransferToServer(). |
|
2111 |
||
2112 |
This is equivalent to calling RFile::AdoptFromClient |
|
2113 |
except that the file adopted can be enlarged to sizes beyond 2GB-1. |
|
2114 |
||
2115 |
Note: |
|
2116 |
If a RFile handle is received from the client then enlarging the file beyond |
|
2117 |
2GB-1 might result in inconsistent behaviour by the client, since it(client) would |
|
2118 |
not be able to handle files of size greater than 2GB-1. |
|
2119 |
||
2120 |
If a RFile64 handle is received from the client then enlarging the file beyond |
|
2121 |
2GB-1 should not cause any issues since the client would be |
|
2122 |
capable of handling files of size greater than 2GB-1. |
|
2123 |
||
2124 |
This RFile or RFile64 will own it's RFs session so that when the sub-session (RFile or RFile64) |
|
2125 |
is closed so will the RFs session. |
|
2126 |
||
2127 |
@param aMsg The message received from the client |
|
2128 |
@param aFsHandleIndex The index that identifies the message slot |
|
2129 |
of a file server session (RFs) handle |
|
2130 |
@param aFileHandleIndex The index that identifies the message slot |
|
2131 |
of the sub-session (RFile or RFile64) handle of the already opened file |
|
2132 |
||
2133 |
@return KErrNone if successful, otherwise one of the other system-wide |
|
2134 |
error codes. |
|
2135 |
*/ |
|
2136 |
EFSRV_EXPORT_C TInt RFile64::AdoptFromClient(const RMessage2& aMsg, TInt aFsHandleIndex, TInt aFileHandleIndex) |
|
2137 |
{ |
|
2138 |
TInt fileHandle = NULL; |
|
2139 |
||
2140 |
TInt r = KErrNone; |
|
2141 |
if (aFileHandleIndex == 0) |
|
2142 |
fileHandle = aMsg.Int0(); |
|
2143 |
else if (aFileHandleIndex == 1) |
|
2144 |
fileHandle = aMsg.Int1(); |
|
2145 |
else if (aFileHandleIndex == 2) |
|
2146 |
fileHandle = aMsg.Int2(); |
|
2147 |
else if (aFileHandleIndex == 3) |
|
2148 |
fileHandle = aMsg.Int3(); |
|
2149 |
else |
|
2150 |
r = KErrArgument; |
|
2151 |
||
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2152 |
#ifdef OST_TRACE_COMPILER_IN_USE |
0 | 2153 |
TInt handle = NULL; |
2154 |
if (aFsHandleIndex == 0) |
|
2155 |
handle = aMsg.Int0(); |
|
2156 |
else if (aFsHandleIndex == 1) |
|
2157 |
handle = aMsg.Int1(); |
|
2158 |
else if (aFsHandleIndex == 2) |
|
2159 |
handle = aMsg.Int2(); |
|
2160 |
else if (aFsHandleIndex == 3) |
|
2161 |
handle = aMsg.Int3(); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2162 |
OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMCLIENT, "sess %x subs %x aFsHandleIndex %d aFileHandleIndex %d ", (TUint) handle, (TUint) fileHandle, (TUint) aFsHandleIndex, (TUint) aFileHandleIndex); |
0 | 2163 |
#endif |
2164 |
if (r != KErrNone) |
|
2165 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2166 |
OstTrace1(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMCLIENTRETURN1, "r %d", r); |
0 | 2167 |
return r; |
2168 |
} |
|
2169 |
// Duplicates the file server (RFs) session handle identified by an |
|
2170 |
// existing handle contained in the message slot at index aFsHandleIndex |
|
2171 |
RFs fs; |
|
2172 |
r = fs.Open(aMsg, aFsHandleIndex, KFileServerPolicy); |
|
2173 |
if (r != KErrNone) |
|
2174 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2175 |
OstTrace1(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMCLIENTRETURN2, "r %d", r); |
0 | 2176 |
return r; |
2177 |
} |
|
2178 |
||
2179 |
//return CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle)); |
|
2180 |
// Slot 1: Indicate Large File Supportis required. |
|
2181 |
r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle, KFileAdopt64)); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2182 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMCLIENTRETURN3, "r %d sess %x subs %x", (TUint) r, (TUint) Session().Handle(), (TUint) SubSessionHandle()); |
0 | 2183 |
return r; |
2184 |
} |
|
2185 |
||
2186 |
||
2187 |
/** |
|
2188 |
Allows a client to adopt an already open file from a server. |
|
2189 |
||
2190 |
Assumes that the server's RFs and RFile or RFile64 handles have been sent to the |
|
2191 |
client using TransferToClient(). |
|
2192 |
||
2193 |
This is equivalent to calling RFile::AdoptFromServer |
|
2194 |
except that the file adopted can be enlarged to sizes beyond 2GB-1. |
|
2195 |
||
2196 |
Note: |
|
2197 |
If a RFile handle is received from the server then enlarging the file beyond |
|
2198 |
2GB-1 might result in inconsistent behaviour by the server, since it(server) would |
|
2199 |
not be able to handle files of size greater than 2GB-1. |
|
2200 |
||
2201 |
If a RFile64 handle is received from the server then enlarging the file beyond |
|
2202 |
2GB-1 should not cause any issues since the server would be capable of |
|
2203 |
handling files of size greater than 2GB-1. |
|
2204 |
||
2205 |
This RFile or RFile64 will own it's RFs session so that when the sub-session (RFile or RFile64) |
|
2206 |
is closed so will the RFs session. |
|
2207 |
||
2208 |
@param aFsHandle The file server session (RFs) handle |
|
2209 |
@param aFileHandle The file (RFile or RFile64) handle of the already opened file |
|
2210 |
||
2211 |
@return KErrNone if successful, otherwise one of the other system-wide |
|
2212 |
error codes. |
|
2213 |
*/ |
|
2214 |
EFSRV_EXPORT_C TInt RFile64::AdoptFromServer(TInt aFsHandle, TInt aFileHandle) |
|
2215 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2216 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMSERVER, "sess %x subs %x", (TUint) aFsHandle, (TUint) aFileHandle); |
0 | 2217 |
RFs fs; |
2218 |
TInt r = fs.SetReturnedHandle(aFsHandle, KFileServerPolicy); |
|
2219 |
if (r != KErrNone) |
|
2220 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2221 |
OstTrace1(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMSERVERRETURN1, "r %d", r); |
0 | 2222 |
return r; |
2223 |
} |
|
2224 |
||
2225 |
//return(CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(aFileHandle))); |
|
2226 |
// Slot 1: Indicate Large File Supportis required. |
|
2227 |
r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(aFileHandle, KFileAdopt64)); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2228 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMSERVERRETURN2, "r %d sess %x subs %x", (TUint) r, (TUint) Session().Handle(), (TUint) SubSessionHandle()); |
0 | 2229 |
return r; |
2230 |
} |
|
2231 |
||
2232 |
||
2233 |
/** |
|
2234 |
Allows a server to adopt an already open file from a client process. |
|
2235 |
The client's file-server (RFs) and file (RFile or RFile64) handles are contained in |
|
2236 |
this process's environment data slots. |
|
2237 |
||
2238 |
Assumes that the client's RFs and RFile or RFile64 handles have been sent to the server process |
|
2239 |
using TransferToProcess(). |
|
2240 |
||
2241 |
This is equivalent to calling RFile::AdoptFromCreator |
|
2242 |
except that the file adopted can be enlarged to sizes beyond 2GB-1. |
|
2243 |
||
2244 |
Note: |
|
2245 |
If a RFile handle is received from the client then enlarging the file beyond |
|
2246 |
2GB-1 might result in inconsistent behaviour by the client, since it(client) would |
|
2247 |
not be able to handle files of size greater than 2GB-1. |
|
2248 |
||
2249 |
If a RFile64 handle is received from the client then enlarging the file beyond |
|
2250 |
2GB-1 should not cause any issues since the client would be capable of |
|
2251 |
handling files of size greater than 2GB-1. |
|
2252 |
||
2253 |
This RFile or RFile64 will own it's RFs session so that when the sub-session (RFile or RFile64) |
|
2254 |
is closed so will the RFs session. |
|
2255 |
||
2256 |
@param aFsHandleIndex An index that identifies the slot in the process |
|
2257 |
environment data that contains the file server session (RFs) handle |
|
2258 |
@param aFileHandleIndex An index that identifies the slot in the process |
|
2259 |
environment data that contains the sub-session (RFile or RFile64) handle |
|
2260 |
of the already opened file |
|
2261 |
||
2262 |
@return KErrNone if successful, otherwise one of the other system-wide |
|
2263 |
error codes. |
|
2264 |
*/ |
|
2265 |
EFSRV_EXPORT_C TInt RFile64::AdoptFromCreator(TInt aFsHandleIndex, TInt aFileHandleIndex) |
|
2266 |
{ |
|
2267 |
TInt fileHandle; |
|
2268 |
TInt r = User::GetTIntParameter(aFileHandleIndex, fileHandle); |
|
2269 |
||
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2270 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMCREATOR, "subs %x aFsHandleIndex %d aFileHandleIndex %d", (TUint) fileHandle, (TUint) aFsHandleIndex, (TUint) aFileHandleIndex); |
0 | 2271 |
if (r != KErrNone) |
2272 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2273 |
OstTrace1(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMCREATORRETURN1, "r %d", r); |
0 | 2274 |
return r; |
2275 |
} |
|
2276 |
||
2277 |
||
2278 |
// Duplicates the file server (RFs) session handle identified by an |
|
2279 |
// existing handle contained in the environment slot at index aFsHandleIndex |
|
2280 |
RFs fs; |
|
2281 |
r = fs.Open(aFsHandleIndex, KFileServerPolicy); |
|
2282 |
if (r != KErrNone) |
|
2283 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2284 |
OstTrace1(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMCREATORRETURN2, "r %d", r); |
0 | 2285 |
return r; |
2286 |
} |
|
2287 |
||
2288 |
//return(CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle))); |
|
2289 |
// Slot 1: Indicate Large File Supportis required. |
|
2290 |
r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle, KFileAdopt64)); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2291 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMCREATORRETURN3, "r %d sess %x subs %x", (TUint) r, (TUint) Session().Handle(), (TUint) SubSessionHandle()); |
0 | 2292 |
return r; |
2293 |
} |
|
2294 |
||
2295 |
||
2296 |
/** |
|
2297 |
Reads from the file at the specified offset within the file |
|
2298 |
||
2299 |
This is a synchronous function. |
|
2300 |
||
2301 |
This is equivalent to calling RFile::Read(TInt, TDes8&) except that this function |
|
2302 |
accepts TInt64, instead of TInt, as its first parameter. This allows to specify |
|
2303 |
the read position beyond 2GB-1. |
|
2304 |
||
2305 |
@see RFile::Read(TInt aPos, TDes8& aDes) |
|
2306 |
||
2307 |
Note that when an attempt is made to read beyond the end of the file, |
|
2308 |
no error is returned. |
|
2309 |
The descriptor's length is set to the number of bytes read into it. |
|
2310 |
Therefore, when reading through a file, the end of file has been reached |
|
2311 |
when the descriptor length, as returned by TDesC8::Length(), is zero. |
|
2312 |
||
2313 |
@param aPos Position of first byte to be read. This is an offset from |
|
2314 |
the start of the file. If no position is specified, reading |
|
2315 |
begins at the current file position. |
|
2316 |
If aPos is beyond the end of the file, the function returns |
|
2317 |
a zero length descriptor. |
|
2318 |
||
2319 |
@param aDes The descriptor into which binary data is read. Any existing content |
|
2320 |
is overwritten. On return, its length is set to the number of |
|
2321 |
bytes read. |
|
2322 |
||
2323 |
@return KErrNone if successful, otherwise one of the other system-wide error |
|
2324 |
codes. |
|
2325 |
||
2326 |
@panic FSCLIENT 19 if aPos is negative. |
|
2327 |
*/ |
|
2328 |
EFSRV_EXPORT_C TInt RFile64::Read(TInt64 aPos, TDes8& aDes) const |
|
2329 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2330 |
OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64READ8, "RFile::Read() sess %x subs %x aPos %x:%x maxdeslen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aDes.MaxLength()); |
0 | 2331 |
__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative)); |
2332 |
||
2333 |
TInt r; |
|
2334 |
if (!(I64HIGH(aPos+1))) |
|
2335 |
{ |
|
2336 |
r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),I64LOW(aPos))); |
|
2337 |
} |
|
2338 |
else |
|
2339 |
{ |
|
2340 |
TPckgC<TInt64> pkPos(aPos); |
|
2341 |
r = SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.MaxLength(),&pkPos)); |
|
2342 |
} |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2343 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64READ8RETURN, "r %d len %d", (TUint) r, (TUint) aDes.Length()); |
0 | 2344 |
return r; |
2345 |
} |
|
2346 |
||
2347 |
||
2348 |
/** |
|
2349 |
Reads from the file at the specified offset within the file. |
|
2350 |
||
2351 |
This is an asynchronous function. |
|
2352 |
||
2353 |
This is equivalent to calling RFile::Read(TInt, TDes8&, TRequestStatus&) except |
|
2354 |
that this function accepts TInt64, instead of TInt, as its first parameter. |
|
2355 |
This allows to specify the read position beyond 2GB-1. |
|
2356 |
||
2357 |
@see RFile::Read(TInt aPos, TDes8& aDes, TRequestStatus& aStatus) |
|
2358 |
||
2359 |
Note that when an attempt is made to read beyond the end of the file, |
|
2360 |
no error is returned. |
|
2361 |
The descriptor's length is set to the number of bytes read into it. |
|
2362 |
Therefore, when reading through a file, the end of file has been reached |
|
2363 |
when the descriptor length, as returned by TDesC8::Length(), is zero. |
|
2364 |
||
2365 |
@param aPos Position of first byte to be read. This is an offset from |
|
2366 |
the start of the file. If no position is specified, |
|
2367 |
reading begins at the current file position. |
|
2368 |
If aPos is beyond the end of the file, the function returns |
|
2369 |
a zero length descriptor. |
|
2370 |
||
2371 |
@param aDes The descriptor into which binary data is read. Any existing |
|
2372 |
content is overwritten. On return, its length is set to |
|
2373 |
the number of bytes read. |
|
2374 |
NB: this function is asynchronous and the request that it |
|
2375 |
represents may not complete until some time after the call |
|
2376 |
to the function has returned. It is important, therefore, that |
|
2377 |
this descriptor remain valid, or remain in scope, until you have |
|
2378 |
been notified that the request is complete. |
|
2379 |
||
2380 |
@param aStatus The request status. On completion, contains an error code of KErrNone |
|
2381 |
if successful, otherwise one of the other system-wide error codes. |
|
2382 |
||
2383 |
@panic FSCLIENT 19 if aPos is negative. |
|
2384 |
*/ |
|
2385 |
EFSRV_EXPORT_C void RFile64::Read(TInt64 aPos, TDes8& aDes, TRequestStatus& aStatus) const |
|
2386 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2387 |
OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64READ10, "RFile::Read() sess %x subs %x aPos %x:%x maxlen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aDes.MaxLength()); |
0 | 2388 |
__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative)); |
2389 |
if (!(I64HIGH(aPos+1))) |
|
2390 |
{ |
|
2391 |
RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),I64LOW(aPos)),aStatus); |
|
2392 |
} |
|
2393 |
else |
|
2394 |
{ |
|
2395 |
TPckgC<TInt64> pkPos(aPos); |
|
2396 |
RSubSessionBase::SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.MaxLength(),&pkPos),aStatus); |
|
2397 |
} |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2398 |
OstTrace0(TRACE_BORDER, EFSRV_EFILE64READ10RETURN, ""); |
0 | 2399 |
} |
2400 |
||
2401 |
||
2402 |
/** |
|
2403 |
Reads the specified number of bytes of binary data from the file at a specified |
|
2404 |
offset within the file. |
|
2405 |
||
2406 |
This is a synchronous function. |
|
2407 |
||
2408 |
This is equivalent to calling RFile::Read(TInt, TDes8&, TInt) except |
|
2409 |
that this function accepts TInt64, instead of TInt, as its first parameter. |
|
2410 |
This allows to specify the read position beyond 2GB-1. |
|
2411 |
||
2412 |
@see RFile::Read(TInt aPos, TDes8& aDes, TInt aLength) |
|
2413 |
||
2414 |
Note that when an attempt is made to read beyond the end of the file, |
|
2415 |
no error is returned. |
|
2416 |
The descriptor's length is set to the number of bytes read into it. |
|
2417 |
Therefore, when reading through a file, the end of file has been reached |
|
2418 |
when the descriptor length, as returned by TDesC8::Length(), is zero. |
|
2419 |
Assuming aLength is less than the maximum length of the descriptor, the only |
|
2420 |
circumstances in which Read() can return fewer bytes than requested is when |
|
2421 |
the end of file is reached or if an error has occurred. |
|
2422 |
||
2423 |
@param aPos Position of first byte to be read. This is an offset from |
|
2424 |
the start of the file. If no position is specified, |
|
2425 |
reading begins at the current file position. |
|
2426 |
If aPos is beyond the end of the file, the function returns |
|
2427 |
a zero length descriptor. |
|
2428 |
||
2429 |
@param aDes The descriptor into which binary data is read. Any existing |
|
2430 |
contents are overwritten. On return, its length is set to |
|
2431 |
the number of bytes read. |
|
2432 |
@param aLength The number of bytes to read from the file into the descriptor. |
|
2433 |
If an attempt is made to read more bytes than the descriptor's |
|
2434 |
maximum length, then the function updates aStatus parameter with KErrOverflow. |
|
2435 |
It must not be negative otherwise the function updates aStatus with KErrArgument. |
|
2436 |
||
2437 |
@return KErrNone if successful, otherwise one of the other system-wide |
|
2438 |
error codes. |
|
2439 |
||
2440 |
@panic FSCLIENT 19 if aPos is negative. |
|
2441 |
*/ |
|
2442 |
EFSRV_EXPORT_C TInt RFile64::Read(TInt64 aPos, TDes8& aDes, TInt aLength) const |
|
2443 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2444 |
OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64READ15, "RFile::Read() sess %x subs %x aPos %x:%x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aLength); |
0 | 2445 |
__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative)); |
2446 |
if (aLength==0) |
|
2447 |
{ |
|
2448 |
aDes.Zero(); |
|
2449 |
return(KErrNone); |
|
2450 |
} |
|
2451 |
else if(aLength>aDes.MaxLength()) |
|
2452 |
{ |
|
2453 |
return(KErrOverflow); |
|
2454 |
} |
|
2455 |
||
2456 |
TInt r; |
|
2457 |
if (!(I64HIGH(aPos+1))) |
|
2458 |
{ |
|
2459 |
r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,I64LOW(aPos))); |
|
2460 |
} |
|
2461 |
else |
|
2462 |
{ |
|
2463 |
TPckgC<TInt64> pkPos(aPos); |
|
2464 |
r = SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos)); |
|
2465 |
} |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2466 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64READ15RETURN, "r %d len %d", (TUint) r, (TUint) aDes.Length()); |
0 | 2467 |
return r; |
2468 |
} |
|
2469 |
||
2470 |
||
2471 |
/** |
|
2472 |
Reads the specified number of bytes of binary data from the file at a specified |
|
2473 |
offset within the file. |
|
2474 |
||
2475 |
This is an asynchronous function. |
|
2476 |
||
2477 |
This is equivalent to calling RFile::Read(TInt, TDes8&, TInt, TRequestStatus&) except |
|
2478 |
that this function accepts TInt64, instead of TInt, as its first parameter. |
|
2479 |
This allows to specify the read position beyond 2GB-1. |
|
2480 |
||
2481 |
@see RFile::Read(TInt aPos, TDes8& aDes,TInt aLength,TRequestStatus& aStatus) |
|
2482 |
||
2483 |
Note that when an attempt is made to read beyond the end of the file, |
|
2484 |
no error is returned. |
|
2485 |
The descriptor's length is set to the number of bytes read into it. |
|
2486 |
Therefore, when reading through a file, the end of file has been reached |
|
2487 |
when the descriptor length, as returned by TDesC8::Length(), is zero. |
|
2488 |
Assuming aLength is less than the maximum length of the descriptor, the only |
|
2489 |
circumstances in which Read() can return fewer bytes than requested is when |
|
2490 |
the end of file is reached or if an error has occurred. |
|
2491 |
||
2492 |
@param aPos Position of first byte to be read. This is an offset from |
|
2493 |
the start of the file. If no position is specified, |
|
2494 |
reading begins at the current file position. |
|
2495 |
If aPos is beyond the end of the file, the function returns |
|
2496 |
a zero length descriptor. |
|
2497 |
||
2498 |
@param aDes The descriptor into which binary data is read. Any existing |
|
2499 |
contents are overwritten. On return, its length is set to |
|
2500 |
the number of bytes read. |
|
2501 |
NB: this function is asynchronous and the request that it |
|
2502 |
represents may not complete until some time after the call |
|
2503 |
to the function has returned. It is important, therefore, that |
|
2504 |
this descriptor remain valid, or remain in scope, until you have |
|
2505 |
been notified that the request is complete. |
|
2506 |
||
2507 |
@param aLength The number of bytes to read from the file into the descriptor. |
|
2508 |
If an attempt is made to read more bytes than the descriptor's |
|
2509 |
maximum length, then the function returns KErrOverflow. |
|
2510 |
It must not be negative otherwise the function returns KErrArgument. |
|
2511 |
||
2512 |
@param aStatus Request status. On completion contains KErrNone if successful, |
|
2513 |
otherwise one of the other system-wide error codes. |
|
2514 |
||
2515 |
@panic FSCLIENT 19 if aPos is negative. |
|
2516 |
*/ |
|
2517 |
EFSRV_EXPORT_C void RFile64::Read(TInt64 aPos, TDes8& aDes, TInt aLength,TRequestStatus& aStatus) const |
|
2518 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2519 |
OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64READ11, "RFile::Read() sess %x subs %x aPos %x:%x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aLength); |
0 | 2520 |
__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative)); |
2521 |
if (aLength==0) |
|
2522 |
{ |
|
2523 |
aDes.Zero(); |
|
2524 |
TRequestStatus* req=(&aStatus); |
|
2525 |
User::RequestComplete(req,KErrNone); |
|
2526 |
return; |
|
2527 |
} |
|
2528 |
else if(aLength>aDes.MaxLength()) |
|
2529 |
{ |
|
2530 |
TRequestStatus* req=(&aStatus); |
|
2531 |
User::RequestComplete(req,KErrOverflow); |
|
2532 |
return; |
|
2533 |
} |
|
2534 |
||
2535 |
if (!(I64HIGH(aPos+1))) |
|
2536 |
{ |
|
2537 |
RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,I64LOW(aPos)),aStatus); |
|
2538 |
} |
|
2539 |
else |
|
2540 |
{ |
|
2541 |
TPckgC<TInt64> pkPos(aPos); |
|
2542 |
RSubSessionBase::SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos),aStatus); |
|
2543 |
} |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2544 |
OstTrace0(TRACE_BORDER, EFSRV_EFILE64READ11RETURN, ""); |
0 | 2545 |
} |
2546 |
||
2547 |
||
2548 |
/** |
|
2549 |
Writes to the file at the specified offset within the file |
|
2550 |
||
2551 |
This is a synchronous function. |
|
2552 |
||
2553 |
This is equivalent to calling RFile::Write(TInt, TDes8&) except |
|
2554 |
that this function accepts TInt64, instead of TInt, as its first parameter. |
|
2555 |
This allows to specify the write position beyond 2GB-1. |
|
2556 |
||
2557 |
@see RFile::Write(TInt aPos, TDes8& aDes) |
|
2558 |
||
2559 |
||
2560 |
@param aPos The offset from the start of the file at which the first |
|
2561 |
byte is written. |
|
2562 |
If a position beyond the end of the file is specified, then |
|
2563 |
the write operation begins at the end of the file. |
|
2564 |
If the position has been locked, then the write fails. |
|
2565 |
||
2566 |
@param aDes The descriptor from which binary data is written. The function writes |
|
2567 |
the entire contents of aDes to the file. |
|
2568 |
||
2569 |
@return KErrNone if successful, otherwise one of the other system-wide error |
|
2570 |
codes. |
|
2571 |
||
2572 |
@panic FSCLIENT 19 if aPos is negative. |
|
2573 |
*/ |
|
2574 |
EFSRV_EXPORT_C TInt RFile64::Write(TInt64 aPos, const TDesC8& aDes) |
|
2575 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2576 |
OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64WRITE13, "RFile::Write() sess %x subs %x aPos %x:%x deslen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aDes.Length()); |
0 | 2577 |
__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative)); |
2578 |
||
2579 |
TInt r; |
|
2580 |
if (!(I64HIGH(aPos+1))) |
|
2581 |
{ |
|
2582 |
r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),I64LOW(aPos))); |
|
2583 |
} |
|
2584 |
else |
|
2585 |
{ |
|
2586 |
TPckgC<TInt64> pkPos(aPos); |
|
2587 |
r = SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.Length(),&pkPos)); |
|
2588 |
} |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2589 |
OstTrace1(TRACE_BORDER, EFSRV_EFILE64WRITE13RETURN, "r %d", r); |
0 | 2590 |
return r; |
2591 |
} |
|
2592 |
||
2593 |
||
2594 |
/** |
|
2595 |
Writes to the file at the specified offset within the file |
|
2596 |
||
2597 |
This is an asynchronous function. |
|
2598 |
||
2599 |
This is equivalent to calling RFile::Write(TInt, TDes8&, TRequestStatus&) except |
|
2600 |
that this function accepts TInt64, instead of TInt, as its first parameter. |
|
2601 |
This allows to specify the write position beyond 2GB-1. |
|
2602 |
||
2603 |
@see RFile::Write(TInt aPos, TDes8& aDes, TRequestStatus& aStatus) |
|
2604 |
||
2605 |
||
2606 |
@param aPos The offset from the start of the file at which the first |
|
2607 |
byte is written. |
|
2608 |
If a position beyond the end of the file is specified, then |
|
2609 |
the write operation begins at the end of the file. |
|
2610 |
If the position has been locked, then the write fails. |
|
2611 |
||
2612 |
@param aDes The descriptor from which binary data is written. The function |
|
2613 |
writes the entire contents of aDes to the file. |
|
2614 |
NB: this function is asynchronous and the request that it |
|
2615 |
represents may not complete until some time after the call |
|
2616 |
to the function has returned. It is important, therefore, that |
|
2617 |
this descriptor remain valid, or remain in scope, until you have |
|
2618 |
been notified that the request is complete. |
|
2619 |
||
2620 |
@param aStatus Request status. On completion contains KErrNone if successful, |
|
2621 |
otherwise one of the other system-wide error codes. |
|
2622 |
||
2623 |
@panic FSCLIENT 19 if aPos is negative. |
|
2624 |
*/ |
|
2625 |
EFSRV_EXPORT_C void RFile64::Write(TInt64 aPos, const TDesC8& aDes,TRequestStatus& aStatus) |
|
2626 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2627 |
OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64WRITE15, "RFile::Write() sess %x subs %x pos %x:%x len %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aDes.Length()); |
0 | 2628 |
__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative)); |
2629 |
||
2630 |
if (!(I64HIGH(aPos+1))) |
|
2631 |
{ |
|
2632 |
RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),I64LOW(aPos)),aStatus); |
|
2633 |
} |
|
2634 |
else |
|
2635 |
{ |
|
2636 |
TPckgC<TInt64> pkPos(aPos); |
|
2637 |
RSubSessionBase::SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.Length(),&pkPos),aStatus); |
|
2638 |
} |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2639 |
OstTrace0(TRACE_BORDER, EFSRV_EFILE64WRITE15RETURN, ""); |
0 | 2640 |
} |
2641 |
||
2642 |
||
2643 |
/** |
|
2644 |
Writes the specified number of bytes to the file at the specified offset within the file. |
|
2645 |
||
2646 |
This is a synchronous function. |
|
2647 |
||
2648 |
This is equivalent to calling RFile::Write(TInt, TDes8&, TInt) except |
|
2649 |
that this function accepts TInt64, instead of TInt, as its first parameter. |
|
2650 |
This allows to specify the write position beyond 2GB-1. |
|
2651 |
||
2652 |
@see RFile::Write(TInt aPos, TDes8& aDes, TInt aLength) |
|
2653 |
||
2654 |
@param aPos The offset from the start of the file at which the first |
|
2655 |
byte is written. |
|
2656 |
If a position beyond the end of the file is specified, then |
|
2657 |
the write operation begins at the end of the file. |
|
2658 |
If the position has been locked, then the write fails. |
|
2659 |
||
2660 |
@param aDes The descriptor from which binary data is written. |
|
2661 |
@param aLength The number of bytes to be written from aDes . |
|
2662 |
It must not be negative. |
|
2663 |
||
2664 |
@return KErrNone if successful; KErrArgument if aLength is negative; |
|
2665 |
otherwise one of the other system-wide error codes. |
|
2666 |
||
2667 |
@panic FSCLIENT 19 if aPos is negative. |
|
2668 |
*/ |
|
2669 |
EFSRV_EXPORT_C TInt RFile64::Write(TInt64 aPos, const TDesC8& aDes,TInt aLength) |
|
2670 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2671 |
OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64WRITE7, "RFile::Write() sess %x subs %x aPos %x:%x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aLength); |
0 | 2672 |
__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative)); |
2673 |
||
2674 |
TInt r; |
|
2675 |
if (!(I64HIGH(aPos+1))) |
|
2676 |
{ |
|
2677 |
r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,I64LOW(aPos))); |
|
2678 |
} |
|
2679 |
else |
|
2680 |
{ |
|
2681 |
TPckgC<TInt64> pkPos(aPos); |
|
2682 |
r = SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos)); |
|
2683 |
} |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2684 |
OstTrace1(TRACE_BORDER, EFSRV_EFILE64WRITE7RETURN, "r %d", r); |
0 | 2685 |
return r; |
2686 |
} |
|
2687 |
||
2688 |
||
2689 |
/** |
|
2690 |
Writes the specified number of bytes to the file at the specified offset within the file. |
|
2691 |
||
2692 |
This is an asynchronous function. |
|
2693 |
||
2694 |
This is equivalent to calling RFile::Write(TInt, TDes8&, TInt, TRequestStatus&) except |
|
2695 |
that this function accepts TInt64, instead of TInt, as its first parameter. |
|
2696 |
This allows to specify the write position beyond 2GB-1. |
|
2697 |
||
2698 |
@see RFile::Write(TInt aPos, TDes8& aDes, TInt aLength, TRequestStatus &aStatus) |
|
2699 |
||
2700 |
@param aPos The offset from the start of the file at which the first |
|
2701 |
byte is written. |
|
2702 |
If a position beyond the end of the file is specified, then |
|
2703 |
the write operation begins at the end of the file. |
|
2704 |
If the position has been locked, then the write fails. |
|
2705 |
||
2706 |
@param aDes The descriptor from which binary data is written. |
|
2707 |
NB: this function is asynchronous and the request that it |
|
2708 |
represents may not complete until some time after the call |
|
2709 |
to the function has returned. It is important, therefore, that |
|
2710 |
this descriptor remain valid, or remain in scope, until you have |
|
2711 |
been notified that the request is complete. |
|
2712 |
||
2713 |
@param aLength The number of bytes to be written from aDes. |
|
2714 |
It must not be negative. |
|
2715 |
||
2716 |
@param aStatus Request status. On completion contains KErrNone if successful; |
|
2717 |
KErrArgument if aLength is negative; |
|
2718 |
otherwise one of the other system-wide error codes. |
|
2719 |
||
2720 |
@panic FSCLIENT 19 if aPos is negative. |
|
2721 |
*/ |
|
2722 |
EFSRV_EXPORT_C void RFile64::Write(TInt64 aPos, const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus) |
|
2723 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2724 |
OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64WRITE11, "RFile::Write() sess %x subs %x aPos %x:%x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aLength); |
0 | 2725 |
__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative)); |
2726 |
||
2727 |
if (!(I64HIGH(aPos+1))) |
|
2728 |
{ |
|
2729 |
RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,I64LOW(aPos)),aStatus); |
|
2730 |
} |
|
2731 |
else |
|
2732 |
{ |
|
2733 |
TPckgC<TInt64> pkPos(aPos); |
|
2734 |
RSubSessionBase::SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos),aStatus); |
|
2735 |
} |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2736 |
OstTrace0(TRACE_BORDER, EFSRV_EFILE64WRITE11RETURN, ""); |
0 | 2737 |
} |
2738 |
||
2739 |
||
2740 |
/** |
|
2741 |
Sets the the current file position. |
|
2742 |
||
2743 |
The function can also be used to get the current file |
|
2744 |
position without changing it. The file position is the position at which |
|
2745 |
reading and writing takes place. The start of the file is position zero. |
|
2746 |
||
2747 |
To retrieve the current file position without changing it, specify ESeekCurrent |
|
2748 |
for the seek mode, and zero for the offset. |
|
2749 |
||
2750 |
This is equivalent to calling RFile::Seek except that this function accepts |
|
2751 |
a reference to TInt64, instead of TInt, as its second parameter. |
|
2752 |
This allows to seek to positions beyond 2GB-1. |
|
2753 |
||
2754 |
@see RFile::Seek() |
|
2755 |
||
2756 |
If the seek mode is ESeekStart, then: |
|
2757 |
||
2758 |
1. the function does not modify the aPos argument, |
|
2759 |
||
2760 |
2. the function returns an error if the offset specified is negative. |
|
2761 |
||
2762 |
If the seek mode is ESeekAddress, an error is returned if: |
|
2763 |
||
2764 |
1. the file is not in ROM, |
|
2765 |
||
2766 |
2. the offset specified is greater than the size of the file. |
|
2767 |
||
2768 |
@param aMode Seek mode. Controls the destination of the seek operation. |
|
2769 |
@param aPos Offset from location specified in aMode. Can be negative. |
|
2770 |
On return contains the new file position. |
|
2771 |
If the seek mode is either ESeekCurrent or ESeekEnd and the offset |
|
2772 |
specifies a position before the start of the file |
|
2773 |
or beyond the end of the file, then on return, aPos is set to |
|
2774 |
the new file position (either the start or the end of the file). |
|
2775 |
If the seek mode is ESeekAddress, aPos returns the address of |
|
2776 |
the byte at the specified offset within the file. |
|
2777 |
||
2778 |
@return KErrNone if successful, otherwise one of the other system-wide error |
|
2779 |
codes. |
|
2780 |
*/ |
|
2781 |
EFSRV_EXPORT_C TInt RFile64::Seek(TSeek aMode, TInt64& aPos) const |
|
2782 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2783 |
OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64SEEK2, "RFile::Seek() sess %x subs %x aMode %x aPos %x:%x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aMode, (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos)); |
0 | 2784 |
TPckgC<TInt64> pkOffset(aPos); |
2785 |
TPckg<TInt64> pkNewPos(aPos); |
|
2786 |
TInt r = SendReceive(EFsFileSeek|KIpcArgSlot0Desc|KIpcArgSlot2Desc,TIpcArgs(&pkOffset,aMode,&pkNewPos)); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2787 |
OstTrace1(TRACE_BORDER, EFSRV_EFILE64SEEK2RETURN, "r %d", r); |
0 | 2788 |
return r; |
2789 |
} |
|
2790 |
||
2791 |
||
2792 |
/** |
|
2793 |
Gets the current file size. |
|
2794 |
||
2795 |
This is equivalent to calling RFile::Size except that this function accepts |
|
2796 |
a reference to TInt64, instead of TInt, as its first parameter. |
|
2797 |
This allows to query file sizes, which are greater than 2GB-1 |
|
2798 |
||
2799 |
@see RFile::Size() |
|
2800 |
||
2801 |
||
2802 |
@param aSize On return, the size of the file in bytes. |
|
2803 |
||
2804 |
@return KErrNone if successful, otherwise one of the other system-wide error |
|
2805 |
codes. |
|
2806 |
*/ |
|
2807 |
EFSRV_EXPORT_C TInt RFile64::Size(TInt64& aSize) const |
|
2808 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2809 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64SIZE2, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle()); |
0 | 2810 |
TPckg<TInt64> pkSize(aSize); |
2811 |
TInt r = SendReceive(EFsFileSize|KIpcArgSlot0Desc,TIpcArgs(&pkSize)); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2812 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFILE64SIZE2RETURN, "r %d aSize %x:%x", (TUint) r, (TUint) I64HIGH(aSize), (TUint) I64LOW(aSize)); |
0 | 2813 |
return r; |
2814 |
} |
|
2815 |
||
2816 |
||
2817 |
/** |
|
2818 |
Sets the file size. |
|
2819 |
||
2820 |
If the size of the file is reduced, data may be lost from |
|
2821 |
the end of the file. |
|
2822 |
||
2823 |
This is equivalent to calling RFile::SetSize except that this function accepts |
|
2824 |
a reference to TInt64, instead of TInt, as its first parameter. |
|
2825 |
This allows to set file sizes to greater than 2GB-1 |
|
2826 |
||
2827 |
@see RFile::SetSize() |
|
2828 |
||
2829 |
||
2830 |
Note: |
|
2831 |
||
2832 |
1. The current file position remains unchanged unless SetSize() reduces the size |
|
2833 |
of the file in such a way that the current file position is now beyond |
|
2834 |
the end of the file. In this case, the current file position is set to |
|
2835 |
the end of file. |
|
2836 |
||
2837 |
2. If the file was not opened for writing, an error is returned. |
|
2838 |
||
2839 |
@param aSize The new size of the file, in bytes. This value must not be negative, otherwise the function raises a panic. |
|
2840 |
||
2841 |
@return KErrNone if successful, otherwise one of the other system-wide error |
|
2842 |
codes. |
|
2843 |
||
2844 |
@panic FSCLIENT 20 If aSize is negative. |
|
2845 |
*/ |
|
2846 |
EFSRV_EXPORT_C TInt RFile64::SetSize(TInt64 aSize) |
|
2847 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2848 |
OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64SETSIZE2, "sess %x subs %x aSize %x:%x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aSize), (TUint) I64LOW(aSize)); |
0 | 2849 |
TPckgC<TInt64> pkSize(aSize); |
2850 |
TInt r = SendReceive(EFsFileSetSize|KIpcArgSlot0Desc, TIpcArgs(&pkSize)); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2851 |
OstTrace1(TRACE_BORDER, EFSRV_EFILE64SETSIZE2RETURN, "r %d", r); |
0 | 2852 |
return r; |
2853 |
} |
|
2854 |
||
2855 |
||
2856 |
/** |
|
2857 |
Locks a region within the file as defined by a range of bytes. |
|
2858 |
||
2859 |
This ensures that those bytes are accessible |
|
2860 |
only through the RFile object which claims the lock. To re-allow access by |
|
2861 |
other programs to the locked region, it must either be unlocked or the file |
|
2862 |
closed. Locking can be used to synchronize operations on a file when more |
|
2863 |
than one program has access to the file in EFileShareAny mode. |
|
2864 |
||
2865 |
More than one distinct region of a file can be locked, but an error is returned |
|
2866 |
if more than one lock is placed on the same region. Different RFile objects |
|
2867 |
can lock different parts of the same file as long as the file is opened in |
|
2868 |
EFileShareAny mode. The locked region may extend beyond the end of a file; |
|
2869 |
this prevents the file from being extended by other programs. |
|
2870 |
||
2871 |
This is equivalent to calling RFile::Lock except that this function accepts |
|
2872 |
TInt64 parameters instead of TInt parameters. |
|
2873 |
This allows to to lock positions in file beyond 2GB-1. |
|
2874 |
||
2875 |
@see RFile::Lock() |
|
2876 |
||
2877 |
@param aPos Position in file from which to lock; this is the offset from |
|
2878 |
the beginning of the file. |
|
2879 |
@param aLength Number of bytes to lock. |
|
2880 |
||
2881 |
@return KErrNone if successful, otherwise one of the other system-wide error |
|
2882 |
codes. |
|
2883 |
||
2884 |
@panic FSCLIENT 17 if aLength is not greater than zero, |
|
2885 |
*/ |
|
2886 |
EFSRV_EXPORT_C TInt RFile64::Lock(TInt64 aPos, TInt64 aLength) const |
|
2887 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2888 |
OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64LOCK, "RFile::Lock() sess %x subs %x aPos %x:%x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aLength); |
0 | 2889 |
__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative)); |
2890 |
TPckgC<TInt64> pkPos(aPos); |
|
2891 |
TPckgC<TInt64> pkLength(aLength); |
|
2892 |
||
2893 |
TInt r; |
|
2894 |
||
2895 |
if(aPos <= KMaxTInt && aLength <= KMaxTInt) |
|
2896 |
r = SendReceive(EFsFileLock,TIpcArgs(I64LOW(aPos), I64LOW(aLength))); |
|
2897 |
else if(aPos <= KMaxTInt) |
|
2898 |
r = SendReceive(EFsFileLock|KIpcArgSlot1Desc,TIpcArgs(I64LOW(aPos), &pkLength)); |
|
2899 |
else if(aLength <= KMaxTInt) |
|
2900 |
r = SendReceive(EFsFileLock|KIpcArgSlot0Desc,TIpcArgs(&pkPos, I64LOW(aLength))); |
|
2901 |
else |
|
2902 |
r = SendReceive(EFsFileLock|KIpcArgSlot0Desc|KIpcArgSlot1Desc,TIpcArgs(&pkPos, &pkLength)); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2903 |
OstTrace1(TRACE_BORDER, EFSRV_EFILE64LOCKRETURN, "r %d", r); |
0 | 2904 |
return r; |
2905 |
} |
|
2906 |
||
2907 |
||
2908 |
/** |
|
2909 |
Unlocks a region within the file as defined by a range of bytes. |
|
2910 |
||
2911 |
A lock can only be removed by the RFile object which claimed the lock. |
|
2912 |
||
2913 |
A portion of a locked region cannot be unlocked. The entire locked region |
|
2914 |
must be unlocked otherwise an error is returned. If any byte within |
|
2915 |
the specified range of bytes to unlock is not locked, an error is returned. |
|
2916 |
||
2917 |
This is equivalent to calling RFile::UnLock except that this function accepts |
|
2918 |
TInt64 parameters instead of TInt parameters. |
|
2919 |
This allows to to unlock positions in file beyond 2GB-1. |
|
2920 |
||
2921 |
@see RFile::UnLock() |
|
2922 |
||
2923 |
@param aPos Position in file from which to unlock; this is the offset from |
|
2924 |
the beginning of the file. |
|
2925 |
@param aLength Number of bytes to unlock. |
|
2926 |
||
2927 |
@return KErrNone if successful, otherwise one of the other system-wide error |
|
2928 |
codes. |
|
2929 |
||
2930 |
@panic FSCLIENT 18 if aLength is not greater than zero, |
|
2931 |
*/ |
|
2932 |
EFSRV_EXPORT_C TInt RFile64::UnLock(TInt64 aPos, TInt64 aLength) const |
|
2933 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2934 |
OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64UNLOCK, "RFile::UnLock() sess %x subs %x aPos %x:%x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aLength); |
0 | 2935 |
__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative)); |
2936 |
||
2937 |
TPckgC<TInt64> pkPos(aPos); |
|
2938 |
TPckgC<TInt64> pkLength(aLength); |
|
2939 |
||
2940 |
TInt r; |
|
2941 |
||
2942 |
if(aPos <= KMaxTInt && aLength <= KMaxTInt) |
|
2943 |
r = SendReceive(EFsFileUnLock,TIpcArgs(I64LOW(aPos), I64LOW(aLength))); |
|
2944 |
else if(aPos <= KMaxTInt) |
|
2945 |
r = SendReceive(EFsFileUnLock|KIpcArgSlot1Desc,TIpcArgs(I64LOW(aPos), &pkLength)); |
|
2946 |
else if(aLength <= KMaxTInt) |
|
2947 |
r = SendReceive(EFsFileUnLock|KIpcArgSlot0Desc,TIpcArgs(&pkPos, I64LOW(aLength))); |
|
2948 |
else |
|
2949 |
r = SendReceive(EFsFileUnLock|KIpcArgSlot0Desc|KIpcArgSlot1Desc,TIpcArgs(&pkPos, &pkLength)); |
|
2950 |
||
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2951 |
OstTrace1(TRACE_BORDER, EFSRV_EFILE64UNLOCKRETURN, "r %d", r); |
0 | 2952 |
return r; |
2953 |
} |
|
2954 |
||
2955 |
||
2956 |
/** |
|
2957 |
Reads from the file at the specified offset within the file |
|
2958 |
||
2959 |
This is a synchronous function. |
|
2960 |
||
2961 |
This is equivalent to calling RFile::Read(TInt, TDes8&) or RFile64::Read(TInt64, TDes8&) |
|
2962 |
except that this function accepts TUint, instead of TInt or TInt64, as its first parameter. |
|
2963 |
||
2964 |
This function is provided for gradual migration of a client from 32-bit RFile APIs |
|
2965 |
to 64-bit RFile64 APIs. It is protected under _F32_STRICT_64_BIT_MIGRATION |
|
2966 |
macro. If the macro is defined, then it hides this overload, which would then throw |
|
2967 |
compile-time errors for any user code that uses TUint parameter for RFile64::Read. |
|
2968 |
||
2969 |
||
2970 |
@see RFile::Read(TInt aPos, TDes8& aDes) |
|
2971 |
@see RFile64::Read(TInt aPos, TDes8& aDes) |
|
2972 |
||
2973 |
Note that when an attempt is made to read beyond the end of the file, |
|
2974 |
no error is returned. |
|
2975 |
The descriptor's length is set to the number of bytes read into it. |
|
2976 |
Therefore, when reading through a file, the end of file has been reached |
|
2977 |
when the descriptor length, as returned by TDesC8::Length(), is zero. |
|
2978 |
||
2979 |
@param aPos Position of first byte to be read. This is an offset from |
|
2980 |
the start of the file. If no position is specified, reading |
|
2981 |
begins at the current file position. |
|
2982 |
If aPos is beyond the end of the file, the function returns |
|
2983 |
a zero length descriptor. |
|
2984 |
||
2985 |
@param aDes The descriptor into which binary data is read. Any existing content |
|
2986 |
is overwritten. On return, its length is set to the number of |
|
2987 |
bytes read. |
|
2988 |
||
2989 |
@return KErrNone if successful, otherwise one of the other system-wide error |
|
2990 |
codes. |
|
2991 |
||
2992 |
*/ |
|
2993 |
EFSRV_EXPORT_C TInt RFile64::Read(TUint aPos,TDes8& aDes) const |
|
2994 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2995 |
OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64READ14, "sess %x subs %x aPos %x maxlen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aDes.MaxLength()); |
0 | 2996 |
TInt r; |
2997 |
if(!(aPos + 1)) |
|
2998 |
{ |
|
2999 |
r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),aPos)); |
|
3000 |
} |
|
3001 |
else |
|
3002 |
{ |
|
3003 |
TInt64 pos = aPos; |
|
3004 |
TPckgC<TInt64> pkPos(pos); |
|
3005 |
r = SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.MaxLength(),&pkPos)); |
|
3006 |
} |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3007 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64READ14RETURN, "r %d len %d", (TUint) r, (TUint) aDes.Length()); |
0 | 3008 |
return r; |
3009 |
} |
|
3010 |
||
3011 |
||
3012 |
/** |
|
3013 |
Reads from the file at the specified offset within the file. |
|
3014 |
||
3015 |
This is an asynchronous function. |
|
3016 |
||
3017 |
This is equivalent to calling RFile::Read(TInt, TDes8&, TRequestStatus&) or |
|
3018 |
RFile64::Read(TInt64, TDes8&, TRequestStatus&) except that this function |
|
3019 |
accepts TUint, instead of TInt or TInt64, as its first parameter. |
|
3020 |
||
3021 |
This function is provided for gradual migration of a client from 32-bit RFile APIs |
|
3022 |
to 64-bit RFile64 APIs. It is protected under _F32_STRICT_64_BIT_MIGRATION |
|
3023 |
macro. If the macro is defined, then it hides this overload, which would then throw |
|
3024 |
compile-time errors for any user code that uses TUint parameter for RFile64::Read. |
|
3025 |
||
3026 |
@see RFile::Read(TInt aPos, TDes8& aDes, TRequestStatus& aStatus) |
|
3027 |
@see RFile64::Read(TInt aPos, TDes8& aDes, TRequestStatus& aStatus) |
|
3028 |
||
3029 |
Note that when an attempt is made to read beyond the end of the file, |
|
3030 |
no error is returned. |
|
3031 |
The descriptor's length is set to the number of bytes read into it. |
|
3032 |
Therefore, when reading through a file, the end of file has been reached |
|
3033 |
when the descriptor length, as returned by TDesC8::Length(), is zero. |
|
3034 |
||
3035 |
@param aPos Position of first byte to be read. This is an offset from |
|
3036 |
the start of the file. If no position is specified, |
|
3037 |
reading begins at the current file position. |
|
3038 |
If aPos is beyond the end of the file, the function returns |
|
3039 |
a zero length descriptor. |
|
3040 |
||
3041 |
@param aDes The descriptor into which binary data is read. Any existing |
|
3042 |
content is overwritten. On return, its length is set to |
|
3043 |
the number of bytes read. |
|
3044 |
NB: this function is asynchronous and the request that it |
|
3045 |
represents may not complete until some time after the call |
|
3046 |
to the function has returned. It is important, therefore, that |
|
3047 |
this descriptor remain valid, or remain in scope, until you have |
|
3048 |
been notified that the request is complete. |
|
3049 |
||
3050 |
@param aStatus The request status. On completion, contains an error code of KErrNone |
|
3051 |
if successful, otherwise one of the other system-wide error codes. |
|
3052 |
||
3053 |
*/ |
|
3054 |
EFSRV_EXPORT_C void RFile64::Read(TUint aPos,TDes8& aDes,TRequestStatus& aStatus) const |
|
3055 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3056 |
OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64READ12, "sess %x subs %x aPos %x maxlen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aDes.MaxLength()); |
0 | 3057 |
if(!(aPos + 1)) |
3058 |
{ |
|
3059 |
RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),aPos),aStatus); |
|
3060 |
} |
|
3061 |
else |
|
3062 |
{ |
|
3063 |
TInt64 pos = aPos; |
|
3064 |
TPckgC<TInt64> pkPos(pos); |
|
3065 |
RSubSessionBase::SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.MaxLength(),&pkPos),aStatus); |
|
3066 |
} |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3067 |
OstTrace0(TRACE_BORDER, EFSRV_EFILE64READ12RETURN, ""); |
0 | 3068 |
} |
3069 |
||
3070 |
||
3071 |
/** |
|
3072 |
Reads the specified number of bytes of binary data from the file at a specified |
|
3073 |
offset within the file. |
|
3074 |
||
3075 |
This is a synchronous function. |
|
3076 |
||
3077 |
This is equivalent to calling RFile::Read(TInt, TDes8&, TInt) or |
|
3078 |
RFile64::Read(TInt64, TDes8&, TInt) except that this function |
|
3079 |
accepts TUint, instead of TInt or TInt64, as its first parameter. |
|
3080 |
||
3081 |
This function is provided for gradual migration of a client from 32-bit RFile APIs |
|
3082 |
to 64-bit RFile64 APIs. It is protected under _F32_STRICT_64_BIT_MIGRATION |
|
3083 |
macro. If the macro is defined, then it hides this overload, which would then throw |
|
3084 |
compile-time errors for any user code that uses TUint parameter for RFile64::Read. |
|
3085 |
||
3086 |
||
3087 |
@see RFile::Read(TInt aPos, TDes8& aDes,TInt aLength) |
|
3088 |
@see RFile64::Read(TInt aPos, TDes8& aDes,TInt aLength) |
|
3089 |
||
3090 |
Note that when an attempt is made to read beyond the end of the file, |
|
3091 |
no error is returned. |
|
3092 |
The descriptor's length is set to the number of bytes read into it. |
|
3093 |
Therefore, when reading through a file, the end of file has been reached |
|
3094 |
when the descriptor length, as returned by TDesC8::Length(), is zero. |
|
3095 |
Assuming aLength is less than the maximum length of the descriptor, the only |
|
3096 |
circumstances in which Read() can return fewer bytes than requested is when |
|
3097 |
the end of file is reached or if an error has occurred. |
|
3098 |
||
3099 |
@param aPos Position of first byte to be read. This is an offset from |
|
3100 |
the start of the file. If no position is specified, |
|
3101 |
reading begins at the current file position. |
|
3102 |
If aPos is beyond the end of the file, the function returns |
|
3103 |
a zero length descriptor. |
|
3104 |
||
3105 |
@param aDes The descriptor into which binary data is read. Any existing |
|
3106 |
contents are overwritten. On return, its length is set to |
|
3107 |
the number of bytes read. |
|
3108 |
@param aLength The number of bytes to read from the file into the descriptor. |
|
3109 |
If an attempt is made to read more bytes than the descriptor's |
|
3110 |
maximum length, then the function updates aStatus parameter with KErrOverflow. |
|
3111 |
It must not be negative otherwise the function updates aStatus with KErrArgument. |
|
3112 |
||
3113 |
@return KErrNone if successful, otherwise one of the other system-wide |
|
3114 |
error codes. |
|
3115 |
||
3116 |
*/ |
|
3117 |
EFSRV_EXPORT_C TInt RFile64::Read(TUint aPos,TDes8& aDes,TInt aLength) const |
|
3118 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3119 |
OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64READ16, "sess %x subs %x aPos %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength); |
0 | 3120 |
if (aLength==0) |
3121 |
{ |
|
3122 |
aDes.Zero(); |
|
3123 |
return(KErrNone); |
|
3124 |
} |
|
3125 |
else if(aLength>aDes.MaxLength()) |
|
3126 |
{ |
|
3127 |
return(KErrOverflow); |
|
3128 |
} |
|
3129 |
||
3130 |
TInt r; |
|
3131 |
if(!(aPos + 1)) |
|
3132 |
{ |
|
3133 |
r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,aPos)); |
|
3134 |
} |
|
3135 |
else |
|
3136 |
{ |
|
3137 |
TInt64 pos = aPos; |
|
3138 |
TPckgC<TInt64> pkPos(pos); |
|
3139 |
r = SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos)); |
|
3140 |
} |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3141 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64READ16RETURN, "r %d len %d", (TUint) r, (TUint) aDes.Length()); |
0 | 3142 |
return r; |
3143 |
} |
|
3144 |
||
3145 |
||
3146 |
/** |
|
3147 |
Reads the specified number of bytes of binary data from the file at a specified |
|
3148 |
offset within the file. |
|
3149 |
||
3150 |
This is an asynchronous function. |
|
3151 |
||
3152 |
This is equivalent to calling RFile::Read(TInt, TDes8&, TInt,TRequestStatus&) or |
|
3153 |
RFile64::Read(TInt64, TDes8&, TInt, TRequestStatus&) except that this function |
|
3154 |
accepts TUint, instead of TInt or TInt64, as its first parameter. |
|
3155 |
||
3156 |
This function is provided for gradual migration of a client from 32-bit RFile APIs |
|
3157 |
to 64-bit RFile64 APIs. It is protected under _F32_STRICT_64_BIT_MIGRATION |
|
3158 |
macro. If the macro is defined, then it hides this overload, which would then throw |
|
3159 |
compile-time errors for any user code that uses TUint parameter for RFile64::Read. |
|
3160 |
||
3161 |
||
3162 |
@see RFile::Read(TInt aPos, TDes8& aDes,TInt aLength,TRequestStatus& aStatus) |
|
3163 |
@see RFile64::Read(TInt aPos, TDes8& aDes,TInt aLength,TRequestStatus& aStatus) |
|
3164 |
||
3165 |
Note that when an attempt is made to read beyond the end of the file, |
|
3166 |
no error is returned. |
|
3167 |
The descriptor's length is set to the number of bytes read into it. |
|
3168 |
Therefore, when reading through a file, the end of file has been reached |
|
3169 |
when the descriptor length, as returned by TDesC8::Length(), is zero. |
|
3170 |
Assuming aLength is less than the maximum length of the descriptor, the only |
|
3171 |
circumstances in which Read() can return fewer bytes than requested is when |
|
3172 |
the end of file is reached or if an error has occurred. |
|
3173 |
||
3174 |
@param aPos Position of first byte to be read. This is an offset from |
|
3175 |
the start of the file. If no position is specified, |
|
3176 |
reading begins at the current file position. |
|
3177 |
If aPos is beyond the end of the file, the function returns |
|
3178 |
a zero length descriptor. |
|
3179 |
||
3180 |
@param aDes The descriptor into which binary data is read. Any existing |
|
3181 |
contents are overwritten. On return, its length is set to |
|
3182 |
the number of bytes read. |
|
3183 |
NB: this function is asynchronous and the request that it |
|
3184 |
represents may not complete until some time after the call |
|
3185 |
to the function has returned. It is important, therefore, that |
|
3186 |
this descriptor remain valid, or remain in scope, until you have |
|
3187 |
been notified that the request is complete. |
|
3188 |
||
3189 |
@param aLength The number of bytes to read from the file into the descriptor. |
|
3190 |
If an attempt is made to read more bytes than the descriptor's |
|
3191 |
maximum length, then the function returns KErrOverflow. |
|
3192 |
It must not be negative otherwise the function returns KErrArgument. |
|
3193 |
||
3194 |
@param aStatus Request status. On completion contains KErrNone if successful, |
|
3195 |
otherwise one of the other system-wide error codes. |
|
3196 |
||
3197 |
*/ |
|
3198 |
EFSRV_EXPORT_C void RFile64::Read(TUint aPos,TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const |
|
3199 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3200 |
OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64READ13, "sess %x subs %x aPos %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength); |
0 | 3201 |
if (aLength==0) |
3202 |
{ |
|
3203 |
aDes.Zero(); |
|
3204 |
TRequestStatus* req=(&aStatus); |
|
3205 |
User::RequestComplete(req,KErrNone); |
|
3206 |
return; |
|
3207 |
} |
|
3208 |
else if(aLength>aDes.MaxLength()) |
|
3209 |
{ |
|
3210 |
TRequestStatus* req=(&aStatus); |
|
3211 |
User::RequestComplete(req,KErrOverflow); |
|
3212 |
return; |
|
3213 |
} |
|
3214 |
||
3215 |
if(!(aPos + 1)) |
|
3216 |
{ |
|
3217 |
RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,aPos),aStatus); |
|
3218 |
} |
|
3219 |
else |
|
3220 |
{ |
|
3221 |
TInt64 pos = aPos; |
|
3222 |
TPckgC<TInt64> pkPos(pos); |
|
3223 |
RSubSessionBase::SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos),aStatus); |
|
3224 |
} |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3225 |
OstTrace0(TRACE_BORDER, EFSRV_EFILE64READ13RETURN, ""); |
0 | 3226 |
} |
3227 |
||
3228 |
||
3229 |
/** |
|
3230 |
Writes to the file at the specified offset within the file |
|
3231 |
||
3232 |
This is a synchronous function. |
|
3233 |
||
3234 |
This is equivalent to calling RFile::Write(TInt, TDes8&) or |
|
3235 |
RFile64::Write(TInt64, TDes8&) except that this function |
|
3236 |
accepts TUint, instead of TInt or TInt64, as its first parameter. |
|
3237 |
||
3238 |
This function is provided for gradual migration of a client from 32-bit RFile APIs |
|
3239 |
to 64-bit RFile64 APIs. It is protected under _F32_STRICT_64_BIT_MIGRATION |
|
3240 |
macro. If the macro is defined, then it hides this overload, which would then throw |
|
3241 |
compile-time errors for any user code that uses TUint parameter for RFile64::Read. |
|
3242 |
||
3243 |
||
3244 |
@see RFile::Write(TInt aPos, TDes8& aDes) |
|
3245 |
@see RFile64::Write(TInt aPos, TDes8& aDes) |
|
3246 |
||
3247 |
||
3248 |
@param aPos The offset from the start of the file at which the first |
|
3249 |
byte is written. |
|
3250 |
If a position beyond the end of the file is specified, then |
|
3251 |
the write operation begins at the end of the file. |
|
3252 |
If the position has been locked, then the write fails. |
|
3253 |
||
3254 |
@param aDes The descriptor from which binary data is written. The function writes |
|
3255 |
the entire contents of aDes to the file. |
|
3256 |
||
3257 |
@return KErrNone if successful, otherwise one of the other system-wide error |
|
3258 |
codes. |
|
3259 |
||
3260 |
*/ |
|
3261 |
EFSRV_EXPORT_C TInt RFile64::Write(TUint aPos,const TDesC8& aDes) |
|
3262 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3263 |
OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64WRITE14, "sess %x subs %x aPos %x len %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aDes.Length()); |
0 | 3264 |
TInt r; |
3265 |
if(!(aPos + 1)) |
|
3266 |
{ |
|
3267 |
r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),aPos)); |
|
3268 |
} |
|
3269 |
else |
|
3270 |
{ |
|
3271 |
TInt64 pos = aPos; |
|
3272 |
TPckgC<TInt64> pkPos(pos); |
|
3273 |
r = SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.Length(),&pkPos)); |
|
3274 |
} |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3275 |
OstTrace1(TRACE_BORDER, EFSRV_EFILE64WRITE14RETURN, "r %d", r); |
0 | 3276 |
return r; |
3277 |
} |
|
3278 |
||
3279 |
||
3280 |
/** |
|
3281 |
Writes to the file at the specified offset within the file |
|
3282 |
||
3283 |
This is an asynchronous function. |
|
3284 |
||
3285 |
This is equivalent to calling RFile::Write(TInt, TDes8&,TRequestStatus&) or |
|
3286 |
RFile64::Write(TInt64, TDes8&,TRequestStatus&) except that this function |
|
3287 |
accepts TUint, instead of TInt or TInt64, as its first parameter. |
|
3288 |
||
3289 |
This function is provided for gradual migration of a client from 32-bit RFile APIs |
|
3290 |
to 64-bit RFile64 APIs. It is protected under _F32_STRICT_64_BIT_MIGRATION |
|
3291 |
macro. If the macro is defined, then it hides this overload, which would then throw |
|
3292 |
compile-time errors for any user code that uses TUint parameter for RFile64::Read. |
|
3293 |
||
3294 |
||
3295 |
@see RFile::Write(TInt aPos, TDes8& aDes,TRequestStatus& aStatus) |
|
3296 |
@see RFile64::Write(TInt aPos, TDes8& aDes,TRequestStatus& aStatus) |
|
3297 |
||
3298 |
||
3299 |
@param aPos The offset from the start of the file at which the first |
|
3300 |
byte is written. |
|
3301 |
If a position beyond the end of the file is specified, then |
|
3302 |
the write operation begins at the end of the file. |
|
3303 |
If the position has been locked, then the write fails. |
|
3304 |
||
3305 |
@param aDes The descriptor from which binary data is written. The function |
|
3306 |
writes the entire contents of aDes to the file. |
|
3307 |
NB: this function is asynchronous and the request that it |
|
3308 |
represents may not complete until some time after the call |
|
3309 |
to the function has returned. It is important, therefore, that |
|
3310 |
this descriptor remain valid, or remain in scope, until you have |
|
3311 |
been notified that the request is complete. |
|
3312 |
||
3313 |
@param aStatus Request status. On completion contains KErrNone if successful, |
|
3314 |
otherwise one of the other system-wide error codes. |
|
3315 |
||
3316 |
*/ |
|
3317 |
EFSRV_EXPORT_C void RFile64::Write(TUint aPos,const TDesC8& aDes,TRequestStatus& aStatus) |
|
3318 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3319 |
OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64WRITE16, "sess %x subs %x pos %x len %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aDes.Length()); |
0 | 3320 |
if(!(aPos + 1)) |
3321 |
{ |
|
3322 |
RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),aPos),aStatus); |
|
3323 |
} |
|
3324 |
else |
|
3325 |
{ |
|
3326 |
TInt64 pos = aPos; |
|
3327 |
TPckgC<TInt64> pkPos(pos); |
|
3328 |
RSubSessionBase::SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.Length(),&pkPos),aStatus); |
|
3329 |
} |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3330 |
OstTrace0(TRACE_BORDER, EFSRV_EFILE64WRITE16RETURN, ""); |
0 | 3331 |
} |
3332 |
||
3333 |
||
3334 |
/** |
|
3335 |
Writes the specified number of bytes to the file at the specified offset within the file. |
|
3336 |
||
3337 |
This is a synchronous function. |
|
3338 |
||
3339 |
This is equivalent to calling RFile::Write(TInt, TDes8&,TInt) or |
|
3340 |
RFile64::Write(TInt64, TDes8&,TInt) except that this function |
|
3341 |
accepts TUint, instead of TInt or TInt64, as its first parameter. |
|
3342 |
||
3343 |
This function is provided for gradual migration of a client from 32-bit RFile APIs |
|
3344 |
to 64-bit RFile64 APIs. It is protected under _F32_STRICT_64_BIT_MIGRATION |
|
3345 |
macro. If the macro is defined, then it hides this overload, which would then throw |
|
3346 |
compile-time errors for any user code that uses TUint parameter for RFile64::Read. |
|
3347 |
||
3348 |
||
3349 |
@see RFile::Write(TInt aPos, TDes8& aDes,TInt aLength) |
|
3350 |
@see RFile64::Write(TInt aPos, TDes8& aDes,TInt aLength) |
|
3351 |
||
3352 |
@param aPos The offset from the start of the file at which the first |
|
3353 |
byte is written. |
|
3354 |
If a position beyond the end of the file is specified, then |
|
3355 |
the write operation begins at the end of the file. |
|
3356 |
If the position has been locked, then the write fails. |
|
3357 |
||
3358 |
@param aDes The descriptor from which binary data is written. |
|
3359 |
@param aLength The number of bytes to be written from aDes . |
|
3360 |
It must not be negative. |
|
3361 |
||
3362 |
@return KErrNone if successful; KErrArgument if aLength is negative; |
|
3363 |
otherwise one of the other system-wide error codes. |
|
3364 |
||
3365 |
*/ |
|
3366 |
EFSRV_EXPORT_C TInt RFile64::Write(TUint aPos,const TDesC8& aDes,TInt aLength) |
|
3367 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3368 |
OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64WRITE8, "sess %x subs %x aPos %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength); |
0 | 3369 |
TInt r; |
3370 |
if(!(aPos + 1)) |
|
3371 |
{ |
|
3372 |
r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,aPos)); |
|
3373 |
} |
|
3374 |
else |
|
3375 |
{ |
|
3376 |
TInt64 pos = aPos; |
|
3377 |
TPckgC<TInt64> pkPos(pos); |
|
3378 |
r = SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos)); |
|
3379 |
} |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3380 |
OstTrace1(TRACE_BORDER, EFSRV_EFILE64WRITE8RETURN, "r %d", r); |
0 | 3381 |
return r; |
3382 |
} |
|
3383 |
||
3384 |
||
3385 |
/** |
|
3386 |
Writes the specified number of bytes to the file at the specified offset within the file. |
|
3387 |
||
3388 |
This is an asynchronous function. |
|
3389 |
||
3390 |
This is equivalent to calling RFile::Write(TInt, TDes8&,TInt,TRequestStatus&) or |
|
3391 |
RFile64::Write(TInt64, TDes8&,TInt,TRequestStatus&) except that this function |
|
3392 |
accepts TUint, instead of TInt or TInt64, as its first parameter. |
|
3393 |
||
3394 |
This function is provided for gradual migration of a client from 32-bit RFile APIs |
|
3395 |
to 64-bit RFile64 APIs. It is protected under _F32_STRICT_64_BIT_MIGRATION |
|
3396 |
macro. If the macro is defined, then it hides this overload, which would then throw |
|
3397 |
compile-time errors for any user code that uses TUint parameter for RFile64::Read. |
|
3398 |
||
3399 |
||
3400 |
@see RFile::Write(TInt aPos, TDes8& aDes, TInt aLength, TRequestStatus& aStatus) |
|
3401 |
@see RFile64::Write(TInt aPos, TDes8& aDes,TInt aLength, TRequestStatus& aStatus) |
|
3402 |
||
3403 |
||
3404 |
@param aPos The offset from the start of the file at which the first |
|
3405 |
byte is written. |
|
3406 |
If a position beyond the end of the file is specified, then |
|
3407 |
the write operation begins at the end of the file. |
|
3408 |
If the position has been locked, then the write fails. |
|
3409 |
||
3410 |
@param aDes The descriptor from which binary data is written. |
|
3411 |
NB: this function is asynchronous and the request that it |
|
3412 |
represents may not complete until some time after the call |
|
3413 |
to the function has returned. It is important, therefore, that |
|
3414 |
this descriptor remain valid, or remain in scope, until you have |
|
3415 |
been notified that the request is complete. |
|
3416 |
||
3417 |
@param aLength The number of bytes to be written from aDes. |
|
3418 |
It must not be negative. |
|
3419 |
||
3420 |
@param aStatus Request status. On completion contains KErrNone if successful; |
|
3421 |
KErrArgument if aLength is negative; |
|
3422 |
otherwise one of the other system-wide error codes. |
|
3423 |
||
3424 |
*/ |
|
3425 |
EFSRV_EXPORT_C void RFile64::Write(TUint aPos,const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus) |
|
3426 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3427 |
OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64WRITE12, "sess %x subs %x aPos %x len %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength); |
0 | 3428 |
if(!(aPos + 1)) |
3429 |
{ |
|
3430 |
RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,aPos),aStatus); |
|
3431 |
} |
|
3432 |
else |
|
3433 |
{ |
|
3434 |
TInt64 pos = aPos; |
|
3435 |
TPckgC<TInt64> pkPos(pos); |
|
3436 |
RSubSessionBase::SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos),aStatus); |
|
3437 |
} |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3438 |
OstTrace0(TRACE_BORDER, EFSRV_EFILE64WRITE12RETURN, ""); |
0 | 3439 |
} |
3440 |
#else |
|
3441 |
EFSRV_EXPORT_C TInt RFile64::Open(RFs& /*aFs*/,const TDesC& /*aName*/,TUint /*aFileMode*/) |
|
3442 |
{Panic(ENotImplemented);return (KErrNotSupported);} |
|
3443 |
EFSRV_EXPORT_C TInt RFile64::Create(RFs& /*aFs*/,const TDesC& /*aName*/,TUint /*aFileMode*/) |
|
3444 |
{Panic(ENotImplemented);return (KErrNotSupported);} |
|
3445 |
EFSRV_EXPORT_C TInt RFile64::Replace(RFs& /*aFs*/,const TDesC& /*aName*/,TUint /*aFileMode*/) |
|
3446 |
{Panic(ENotImplemented);return (KErrNotSupported);} |
|
3447 |
EFSRV_EXPORT_C TInt RFile64::Temp(RFs& /*aFs*/,const TDesC& /*aPath*/,TFileName& /*aName*/,TUint /*aFileMode*/) |
|
3448 |
{Panic(ENotImplemented);return (KErrNotSupported);} |
|
3449 |
EFSRV_EXPORT_C TInt RFile64::AdoptFromClient(const RMessage2& /*aMsg*/, TInt /*aFsHandleIndex*/, TInt /*aFileHandleIndex*/) |
|
3450 |
{Panic(ENotImplemented);return (KErrNotSupported);} |
|
3451 |
EFSRV_EXPORT_C TInt RFile64::AdoptFromServer(TInt /*aFsHandle*/, TInt /*aFileHandle*/) |
|
3452 |
{Panic(ENotImplemented);return (KErrNotSupported);} |
|
3453 |
EFSRV_EXPORT_C TInt RFile64::AdoptFromCreator(TInt /*aFsHandleIndex*/, TInt /*aFileHandleIndex*/) |
|
3454 |
{Panic(ENotImplemented);return (KErrNotSupported);} |
|
3455 |
EFSRV_EXPORT_C TInt RFile64::Read(TInt64 /*aPos*/, TDes8& /*aDes*/) const |
|
3456 |
{Panic(ENotImplemented);return (KErrNotSupported);} |
|
3457 |
EFSRV_EXPORT_C void RFile64::Read(TInt64 /*aPos*/, TDes8& /*aDes*/, TRequestStatus& /*aStatus*/) const |
|
3458 |
{Panic(ENotImplemented);} |
|
3459 |
EFSRV_EXPORT_C TInt RFile64::Read(TInt64 /*aPos*/, TDes8& /*aDes*/, TInt /*aLength*/) const |
|
3460 |
{Panic(ENotImplemented);return (KErrNotSupported);} |
|
3461 |
EFSRV_EXPORT_C void RFile64::Read(TInt64 /*aPos*/, TDes8& /*aDes*/, TInt /*aLength*/,TRequestStatus& /*aStatus*/) const |
|
3462 |
{Panic(ENotImplemented);} |
|
3463 |
EFSRV_EXPORT_C TInt RFile64::Write(TInt64 /*aPos*/, const TDesC8& /*aDes*/) |
|
3464 |
{Panic(ENotImplemented);return (KErrNotSupported);} |
|
3465 |
EFSRV_EXPORT_C void RFile64::Write(TInt64 /*aPos*/, const TDesC8& /*aDes*/,TRequestStatus& /*aStatus*/) |
|
3466 |
{Panic(ENotImplemented);} |
|
3467 |
EFSRV_EXPORT_C TInt RFile64::Write(TInt64 /*aPos*/, const TDesC8& /*aDes*/, TInt /*aLength*/) |
|
3468 |
{Panic(ENotImplemented);return (KErrNotSupported);} |
|
3469 |
EFSRV_EXPORT_C void RFile64::Write(TInt64 /*aPos*/, const TDesC8& /*aDes*/,TInt /*aLength*/,TRequestStatus& /*aStatus*/) |
|
3470 |
{Panic(ENotImplemented);} |
|
3471 |
EFSRV_EXPORT_C TInt RFile64::Seek(TSeek /*aMode*/, TInt64& /*aPos*/) const |
|
3472 |
{Panic(ENotImplemented);return (KErrNotSupported);} |
|
3473 |
EFSRV_EXPORT_C TInt RFile64::Size(TInt64& /*aSize*/) const |
|
3474 |
{Panic(ENotImplemented);return (KErrNotSupported);} |
|
3475 |
EFSRV_EXPORT_C TInt RFile64::SetSize(TInt64 /*aSize*/) |
|
3476 |
{Panic(ENotImplemented);return (KErrNotSupported);} |
|
3477 |
EFSRV_EXPORT_C TInt RFile64::Lock(TInt64 /*aPos*/, TInt64 /*aLength*/) const |
|
3478 |
{Panic(ENotImplemented);return (KErrNotSupported);} |
|
3479 |
EFSRV_EXPORT_C TInt RFile64::UnLock(TInt64 /*aPos*/, TInt64 /*aLength*/) const |
|
3480 |
{Panic(ENotImplemented);return (KErrNotSupported);} |
|
3481 |
EFSRV_EXPORT_C TInt RFile64::Read(TUint /*aPos*/,TDes8& /*aDes*/) const |
|
3482 |
{Panic(ENotImplemented);return (KErrNotSupported);} |
|
3483 |
EFSRV_EXPORT_C void RFile64::Read(TUint /*aPos*/,TDes8& /*aDes*/,TRequestStatus& /*aStatus*/) const |
|
3484 |
{Panic(ENotImplemented);} |
|
3485 |
EFSRV_EXPORT_C TInt RFile64::Read(TUint /*aPos*/,TDes8& /*aDes*/,TInt /*aLength*/) const |
|
3486 |
{Panic(ENotImplemented);return (KErrNotSupported);} |
|
3487 |
EFSRV_EXPORT_C void RFile64::Read(TUint /*aPos*/,TDes8& /*aDes*/,TInt /*aLength*/,TRequestStatus& /*aStatus*/) const |
|
3488 |
{Panic(ENotImplemented);} |
|
3489 |
EFSRV_EXPORT_C TInt RFile64::Write(TUint /*aPos*/,const TDesC8& /*aDes*/) |
|
3490 |
{Panic(ENotImplemented);return (KErrNotSupported);} |
|
3491 |
EFSRV_EXPORT_C void RFile64::Write(TUint /*aPos*/,const TDesC8& /*aDes*/,TRequestStatus& /*aStatus*/) |
|
3492 |
{Panic(ENotImplemented);} |
|
3493 |
EFSRV_EXPORT_C TInt RFile64::Write(TUint /*aPos*/,const TDesC8& /*aDes*/,TInt /*aLength*/) |
|
3494 |
{Panic(ENotImplemented);return (KErrNotSupported);} |
|
3495 |
EFSRV_EXPORT_C void RFile64::Write(TUint /*aPos*/, const TDesC8& /*aDes*/,TInt /*aLength*/,TRequestStatus& /*aStatus*/) |
|
3496 |
{Panic(ENotImplemented);} |
|
3497 |
#endif |