Update contrib.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // f32\sfsrv\cl_file.cpp
20 static _LIT_SECURITY_POLICY_S1(KFileServerPolicy,KFileServerUidValue,ECapabilityTCB);
22 EFSRV_EXPORT_C TInt RFile::Adopt(RFs& aFs, TInt aHandle)
24 Adopts an already open file.
26 @param aFs The file server session.
27 @param aHandle The handle number of the already opened file
29 @return KErrNone if successful,
30 KErrBadHandle if the sub-session handle is invalid,
31 otherwise one of the other system-wide error codes.
37 TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileAdopt, MODULEUID, aFs.Handle(), aHandle);
39 // duplicate the sub-session handle; don't panic if it's invalid.
41 TInt r = file.CreateSubSession(aFs, EFsFileDuplicate, TIpcArgs(aHandle, EFalse));
42 if (r == KErrArgument)
44 TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptReturn, MODULEUID, KErrBadHandle);
47 else if (r != KErrNone)
49 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptReturn, MODULEUID, r);
52 // adopt the duplicated handle
53 r = CreateAutoCloseSubSession(aFs, EFsFileAdopt, TIpcArgs(file.SubSessionHandle(), KFileAdopt32));
55 TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
63 EFSRV_EXPORT_C TInt RFile::AdoptFromServer(TInt aFsHandle, TInt aFileHandle)
65 Allows a client to adopt an already open file from a server.
67 Assumes that the server's RFs and RFile handles have been sent to the
68 client using TransferToClient().
70 This RFile will own it's RFs session so that when the sub-session (RFile)
71 is closed so will the RFs session.
73 @param aFsHandle The file server session (RFs) handle
74 @param aFileHandle The file (RFile) handle of the already opened file
76 @return KErrNone if successful, otherwise one of the other system-wide
80 TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromServer, MODULEUID, aFsHandle, aFileHandle);
83 TInt r = fs.SetReturnedHandle(aFsHandle, KFileServerPolicy);
86 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromServerReturn, MODULEUID, r);
89 r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(aFileHandle, KFileAdopt32));
91 TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromServerReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
97 EFSRV_EXPORT_C TInt RFile::AdoptFromClient(const RMessage2& aMsg, TInt aFsHandleIndex, TInt aFileHandleIndex)
99 Allows a server to adopt an already open file from a client.
100 The client's RFs and RFile handles are contained in message slots within aMsg.
102 Assumes that the client's RFs and RFile handles have been sent to the server
103 using TransferToServer().
106 This RFile will own it's RFs session so that when the sub-session (RFile)
107 is closed so will the RFs session.
109 @param aMsg The message received from the client
110 @param aFsHandleIndex The index that identifies the message slot
111 of a file server session (RFs) handle
112 @param aFileHandleIndex The index that identifies the message slot
113 of the sub-session (RFile) handle of the already opened file
115 @return KErrNone if successful, otherwise one of the other system-wide
119 TInt fileHandle = NULL;
122 if (aFileHandleIndex == 0)
123 fileHandle = aMsg.Int0();
124 else if (aFileHandleIndex == 1)
125 fileHandle = aMsg.Int1();
126 else if (aFileHandleIndex == 2)
127 fileHandle = aMsg.Int2();
128 else if (aFileHandleIndex == 3)
129 fileHandle = aMsg.Int3();
133 #ifdef SYMBIAN_FTRACE_ENABLE
135 if (aFsHandleIndex == 0)
136 handle = aMsg.Int0();
137 else if (aFsHandleIndex == 1)
138 handle = aMsg.Int1();
139 else if (aFsHandleIndex == 2)
140 handle = aMsg.Int2();
141 else if (aFsHandleIndex == 3)
142 handle = aMsg.Int3();
143 TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClient, MODULEUID, handle, fileHandle, aFsHandleIndex, aFileHandleIndex);
148 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClientReturn, MODULEUID, r);
152 // Duplicates the file server (RFs) session handle identified by an
153 // existing handle contained in the message slot at index aFsHandleIndex
155 r = fs.Open(aMsg, aFsHandleIndex, KFileServerPolicy);
158 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClientReturn, MODULEUID, r);
162 r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle, KFileAdopt32));
164 TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClientReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
170 EFSRV_EXPORT_C TInt RFile::AdoptFromCreator(TInt aFsHandleIndex, TInt aFileHandleIndex)
172 Allows a server to adopt an already open file from a client process.
173 The client's file-server (RFs) and file (RFile) handles are contained in
174 this process's environment data slots.
176 Assumes that the client's RFs and RFile handles have been sent to the server process
177 using TransferToProcess().
179 This RFile will own it's RFs session so that when the sub-session (RFile)
180 is closed so will the RFs session.
182 @param aFsHandleIndex An index that identifies the slot in the process
183 environment data that contains the file server session (RFs) handle
184 @param aFileHandleIndex An index that identifies the slot in the process
185 environment data that contains the sub-session (RFile) handle
186 of the already opened file
188 @return KErrNone if successful, otherwise one of the other system-wide
192 TInt fileHandle = NULL;
194 TInt r = User::GetTIntParameter(aFileHandleIndex, fileHandle);
196 TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreator, MODULEUID, fileHandle, aFsHandleIndex, aFileHandleIndex);
200 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreatorReturn, MODULEUID, r);
205 // Duplicates the file server (RFs) session handle identified by an
206 // existing handle contained in the environment slot at index aFsHandleIndex
208 r = fs.Open(aFsHandleIndex, KFileServerPolicy);
211 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreatorReturn, MODULEUID, r);
215 r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle, KFileAdopt32));
217 TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreatorReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
225 Make a duplicate of the passed file handle in the same thread.
227 By default, any thread in the process can use the duplicated handle to access the
228 file. However, specifying EOwnerThread as the second parameter to this function,
229 means that only the creating thread can use the handle.
231 @param aFile The file handle to duplicate
232 @param aType An enumeration whose enumerators define the ownership of this
233 handle. If not explicitly specified, EOwnerProcess is taken
236 @return one of the other system-wide error codes.
238 EFSRV_EXPORT_C TInt RFile::Duplicate(const RFile& aFile, TOwnerType aType)
240 TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileDuplicate, MODULEUID, aFile.Session().Handle(), aFile.SubSessionHandle(), aType);
243 fs.SetHandle(aFile.Session().Handle());
245 // Need to make a duplicate of the session handle in the current thread,
246 // otherwise closing one session will close both sub-sessions.
247 TInt r = fs.Duplicate(RThread(), aType);
250 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileDuplicateReturn, MODULEUID, r);
254 // duplicate the sub-session handle
255 TInt dupSubSessionHandle;
256 r = aFile.DuplicateHandle(dupSubSessionHandle);
259 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileDuplicateReturn, MODULEUID, r);
263 // adopt the duplicated sub-session handle
264 r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(dupSubSessionHandle, KFileDuplicate));
266 TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileDuplicateReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
272 // Makes a duplicate of this file (RFile) handle in the current thread and
273 // returns it in aSubSessionHandle.
274 // The duplicate file handle will effectively be in limbo (although still
275 // owned by the session) until :
276 // (1) the session handle is duplicated into another process -
277 // this happens in one of : TransferToClient(), TransferToProcess() or
278 // AdoptFromClient() and
279 // (2) the sub-session handle is transferred to the other process - using AdoptXXX()
281 TInt RFile::DuplicateHandle(TInt& aSubSessionHandle) const
284 fs.SetHandle(Session().Handle());
287 // duplicate the sub-session handle; panic if it's invalid.
288 TInt r = file.CreateSubSession(fs, EFsFileDuplicate, TIpcArgs(SubSessionHandle(), ETrue));
290 // return the duplicated handle
291 // Note that this handle needs to be adopted before it can be used
292 aSubSessionHandle = file.SubSessionHandle();
299 Transfers an already open file to a server.
301 Before this function can be called, the file server session which owns this file handle
302 must first be marked as shareable by calling RFs::ShareProtected().
304 This function packages handle details for this file into 2 arguments of a TIpcArgs object.
305 When these arguments are sent in an IPC message, the server which receives them may
306 call AdoptFromClient() to open a new RFile object which refers to the same file as this.
308 @param aIpcArgs The IPC message arguments.
309 @param aFsHandleIndex An index that identifies an argument in aIpcArgs where the
310 file server session handle will be stored.
311 This argument must not be used for anything else otherwise the
312 results will be unpredictable.
313 @param aFileHandleIndex An index that identifies an argument in aIpcArgs where the
314 file handle will be stored.
315 This argument must not be used for anything else otherwise the
316 results will be unpredictable.
318 @return KErrNone if successful, otherwise one of the other system-wide
322 EFSRV_EXPORT_C TInt RFile::TransferToServer(TIpcArgs& aIpcArgs, TInt aFsHandleIndex, TInt aFileHandleIndex) const
324 TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToServer, MODULEUID, Session().Handle(), SubSessionHandle(), aFsHandleIndex, aFileHandleIndex);
326 if ((aFsHandleIndex < 0) || (aFsHandleIndex > (KMaxMessageArguments-2)))
328 TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToServerReturn, MODULEUID, (TUint) KErrArgument);
332 TInt dupSubSessionHandle;
333 TInt r = DuplicateHandle(dupSubSessionHandle);
336 aIpcArgs.Set(aFsHandleIndex, Session());
337 aIpcArgs.Set(aFileHandleIndex, dupSubSessionHandle);
340 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToServerReturn, MODULEUID, r);
345 Transfers an already open file from a server to a client.
347 Before this function can be called, the file server session which owns this file handle
348 must first be marked as shareable by calling RFs::ShareProtected().
350 The file (RFile) handle is written to the client's address space to the package
351 buffer in the message address slot in aMsg identified by aFileHandleIndex.
353 If no error occurs, then the message is completed with the file-server (RFs)
356 When the message completes, the client may call AdoptFromServer() to open
357 a new RFile object which refers to the same file as this.
359 Note that if an error occurs then the message is not completed.
361 @param aMsg A message received from the client
362 @param aFileHandleIndex Identifies the message slot that contains a package
363 buffer pointing to an address in the client's address space
364 to receive the file (RFile) handle
366 @return KErrNone if successful, otherwise one of the other system-wide
369 EFSRV_EXPORT_C TInt RFile::TransferToClient(const RMessage2& aMsg, TInt aFileHandleIndex) const
371 TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToClient, MODULEUID, Session().Handle(), SubSessionHandle(), aFileHandleIndex);
373 if (TUint(aFileHandleIndex) >= TUint(KMaxMessageArguments))
375 TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToClientReturn, MODULEUID, (TUint) KErrArgument);
379 TInt dupSubSessionHandle;
380 TInt r = DuplicateHandle(dupSubSessionHandle);
382 r = aMsg.Write(aFileHandleIndex, TPckgC<TInt>(dupSubSessionHandle));
386 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToClientReturn, MODULEUID, r);
390 aMsg.Complete(Session());
392 TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToClientReturn, MODULEUID, r);
399 Transfers an already open file to another process.
401 Before this function can be called, the file server session which owns this file handle
402 must first be marked as shareable by calling RFs::ShareProtected().
404 This function packages handle details for this file into 2 arguments in another
405 process's environment data slots.
406 When the other process runs, it may call AdoptFromCreator() to open a new RFile
407 object which refers to the same file as this.
409 @param aProcess A handle to another process.
410 @param aFsHandleIndex An index that identifies a slot in the process's
411 environment data which on exit will contain the file server
413 This slot must not be used for anything else otherwise the
414 results will be unpredictable.
415 @param aFileHandleIndex An index that identifies a slot in the process's
416 environment data which on exit will contain the file
418 This slot must not be used for anything else otherwise the
419 results will be unpredictable.
420 @return KErrNone if successful, otherwise one of the other system-wide
423 // NB slot 0 is reserved for the command line
424 EFSRV_EXPORT_C TInt RFile::TransferToProcess(RProcess& aProcess, TInt aFsHandleIndex, TInt aFileHandleIndex) const
426 TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToProcess, MODULEUID, Session().Handle(), SubSessionHandle(), aFsHandleIndex, aFileHandleIndex);
428 TInt dupSubSessionHandle;
429 TInt r = DuplicateHandle(dupSubSessionHandle);
432 r = aProcess.SetParameter(aFsHandleIndex, RHandleBase(Session()));
435 r = aProcess.SetParameter(aFileHandleIndex, dupSubSessionHandle);
437 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToProcessReturn, MODULEUID, r);
443 EFSRV_EXPORT_C TInt RFile::Name(TDes& aName) const
445 Gets the final part of a filename
447 This is used to retrieve the name and extension of a file that has been
448 passed from one process to another using the RFile::AdoptXXX() methods.
450 @param aName On return, contains the name of the file, including the name and
451 extension but excluding the drive letter and path.
453 @return KErrNone if successful, otherwise one of the other
454 system-wide error codes.
458 TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileName, MODULEUID, Session().Handle(), SubSessionHandle());
460 TInt r = SendReceive(EFsFileName, TIpcArgs(&aName));
462 TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFileNameReturn, MODULEUID, r, aName);
468 EFSRV_EXPORT_C TInt RFile::FullName(TDes& aName) const
470 Gets the full filename
472 This is used to retrieve the full filename, including drive and path,
473 of a file that has been passed from one process to another using the
474 RFile::AdoptXXX() methods.
476 @param aName On return, contains the full name of the file, including drive and path.
478 @return KErrNone if successful, otherwise one of the other
479 system-wide error codes.
483 TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileFullName, MODULEUID, Session().Handle(), SubSessionHandle());
485 TInt r = SendReceive(EFsFileFullName, TIpcArgs(&aName));
487 TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFileFullNameReturn, MODULEUID, r, aName);
494 EFSRV_EXPORT_C TInt RFile::Open(RFs& aFs,const TDesC& aName,TUint aMode)
496 Opens an existing file for reading or writing.
498 If the file does not already exist, an error is returned.
502 1. To close the file, use Close()
504 2. Attempting to open a file with the read-only attribute using the EFileWrite
505 access mode results in an error.
507 3. Attempting to open a file which is greater than or equal to 2GByte (2,147,483,648 bytes)
508 will fail with KErrTooBig
510 4. After a file has been opened, the current write position is set to the start
512 If necessary, use RFile::Seek() to move to a different position within
515 @param aFs The file server session.
516 @param aName The name of the file. Any path components (i.e. drive letter
517 or directory), which are not specified, are taken from
518 the session path.The file name shall not contain wild cards
519 ('?' or '*' characters) and illegal characters like
520 '<', '>', ':', '"', '/', '|' and '\000'. Backslash '\\' character
521 is allowed only as a path delimiter. The filename containing only
522 white space characters (See TChar::IsSpace()) is also illegal.
524 @param aMode The mode in which the file is opened. See TFileMode.
526 @return KErrNone if successful, otherwise one of the other system-wide
531 @capability Dependent If the path for aName is /Sys and aMode is neither
532 EFileShareReadersOnly nor EFileRead then Tcb capability is required.
533 @capability Dependent If the path for aName is /Sys and aMode is either
534 EFileShareReadersOnly or EFileRead then Allfiles capability is required.
535 @capability Dependent If the path for aName begins with /Private and does not match this process'
536 SID then AllFiles capability is required.
537 @capability Dependent If the path for aName begins with /Resource and aMode is neither
538 EFileShareReadersOrWriters|EFileRead nor EFileShareReadersOnly
539 nor EFileRead then Tcb capability is required.
543 TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileOpen, MODULEUID, aFs.Handle(), aMode, aName);
545 aMode &= ~EFileBigFile;
546 TInt r = CreateSubSession(aFs,EFsFileOpen,TIpcArgs(&aName,aMode));
548 TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileOpenReturn, MODULEUID, r, SubSessionHandle());
554 EFSRV_EXPORT_C void RFile::Close()
558 Any open files are closed when the file server session is closed.
560 Close() is guaranteed to return, and provides no indication whether
561 it completed successfully or not. When closing a file you have written to,
562 you should ensure that data is committed to the file by invoking RFile::Flush()
563 before closing. If Flush() completes successfully, Close() is essentially a
567 TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileClose, MODULEUID, Session().Handle(), SubSessionHandle());
569 #if defined (SYMBIAN_FTRACE_ENABLE) && defined(__DLL__)
570 // Need to close the handle to the trace LDD if this is an auto-close subsession
571 // as these close their parent session by calling RHandleBase::Close(), i.e. they
572 // bypass RFs::Close() which would normally be responsible for closing the LDD
573 TInt h = Session().Handle() ^ CObjectIx::ENoClose;
574 if ( h != NULL && (!(h & CObjectIx::ENoClose)) )
580 CloseSubSession(EFsFileSubClose);
582 TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileCloseReturn, MODULEUID);
586 EFSRV_EXPORT_C TInt RFile::Create(RFs& aFs,const TDesC& aName,TUint aMode)
588 Creates and opens a new file for writing.
590 If the file already exists, an error is returned.
592 If the resulting path does not exist, then the operation cannot proceed and
593 the function returns an error code.
597 1. To close the file, use Close()
599 2. It automatically sets the file's archive attribute.
601 @param aFs The file server session.
602 @param aName The name of the file. Any path components (i.e. drive letter
603 or directory), which are not specified, are taken from
604 the session path. The file name shall not contain wild cards
605 ('?' or '*' characters) and illegal characters like
606 '<', '>', ':', '"', '/', '|' and '\000'. Backslash '\\' character
607 is allowed only as a path delimiter. The filename containing only
608 white space characters (See TChar::IsSpace()) is also illegal.
610 @param aMode The mode in which the file is opened. The access mode is
611 automatically set to EFileWrite. See TFileMode.
613 @return KErrNone if successful, otherwise one of the other system-wide
618 @capability Dependent If the path in aName starts with /Sys then capability Tcb is required
619 @capability Dependent If the path in aName starts with /Resource then capability Tcb is required
620 @capability Dependent If the path in aName starts with /Private and does not match this process'
621 SID then AllFiles capability is required.
625 aMode &= ~EFileBigFile;
627 TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileCreate, MODULEUID, aFs.Handle(), aMode, aName);
629 TInt r = CreateSubSession(aFs,EFsFileCreate,TIpcArgs(&aName,aMode));
631 TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileCreateReturn, MODULEUID, r, SubSessionHandle());
639 EFSRV_EXPORT_C TInt RFile::Replace(RFs& aFs,const TDesC& aName,TUint aMode)
641 Opens a file for writing, replacing the content of any existing file of the
642 same name if it exists, or creating a new file if it does not exist.
644 If the resulting path exists, then:
646 - the length of an existing file with the same filename is re-set to zero
648 - a new file is created, if no existing file with the same filename can be found.
650 If the resulting path does not exist, then the operation cannot proceed and
651 the function returns an error code.
655 - To close the file, use Close(), defined in the base class RFsBase.
657 - It automatically sets the file's archive attribute.
659 @param aFs The file server session.
660 @param aName The name of the file. Any path components (i.e. drive letter
661 or directory), which are not specified, are taken from
662 the session path. The file name shall not contain wild cards
663 ('?' or '*' characters) and illegal characters like
664 '<', '>', ':', '"', '/', '|' and '\000'. Backslash '\\' character
665 is allowed only as a path delimiter. The filename containing only
666 white space characters (See TChar::IsSpace()) is also illegal.
668 @param aMode The mode in which the file is opened. The access mode is
669 automatically set to EFileWrite. See TFileMode.
671 @return KErrNone if successful, otherwise one of the other system-wide
676 @capability Dependent If the path in aName starts with /Sys then capability Tcb is required
677 @capability Dependent If the path in aName starts with /Resource then capability Tcb is required
678 @capability Dependent If the path in aName starts with /Private and does not match this process'
679 SID then AllFiles capability is required.
683 TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileReplace, MODULEUID, aFs.Handle(), aMode, aName);
684 aMode &= ~EFileBigFile;
685 TInt r = CreateSubSession(aFs,EFsFileReplace,TIpcArgs(&aName,aMode));
686 TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileReplaceReturn, MODULEUID, r, SubSessionHandle());
693 EFSRV_EXPORT_C TInt RFile::Temp(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aMode)
695 Creates and opens a temporary file with a unique name for writing and reading.
699 1. To close the file, use Close()
701 @param aFs The file server session.
702 @param aPath The directory in which the file is created.
703 @param aName On return, contains the full path and file name of the file.
704 The filename is guaranteed to be unique within the directory
706 @param aMode The mode in which the file is opened. The access mode is
707 automatically set to EFileWrite. See TFileMode.
709 @return KErrNone if successful, otherwise one of the other system-wide
714 @capability Dependent If aPath starts with /Sys then capability Tcb is required
715 @capability Dependent If aPath starts with /Resource then capability Tcb is required
716 @capability Dependent If aPath starts with /Private and does not match this process'
717 SID then AllFiles capability is required.
720 TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileTemp, MODULEUID, aFs.Handle(), aPath, aMode);
721 aMode &= ~EFileBigFile;
722 TInt r = CreateSubSession(aFs,EFsFileTemp,TIpcArgs(&aPath,aMode,&aName));
723 TRACERETMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileTempReturn, MODULEUID, r, SubSessionHandle(), aName);
730 EFSRV_EXPORT_C TInt RFile::Read(TDes8& aDes) const
732 Reads from the file at the current position.
734 This is a synchronous function.
736 Note that when an attempt is made to read beyond the end of the file,
737 no error is returned.
738 The descriptor's length is set to the number of bytes read into
739 it. Therefore, when reading through a file,the end of file has been reached
740 when the descriptor length, as returned by TDesC8::Length(), is zero.
742 @param aDes Descriptor into which binary data is read. Any existing contents
743 are overwritten. On return, its length is set to the number of
745 @return KErrNone if successful, otherwise one of the other system-wide error
751 TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileRead1, MODULEUID, Session().Handle(), SubSessionHandle(), aDes.MaxLength());
753 TInt r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),I64LOW(KCurrentPosition64)));
755 TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead1Return, MODULEUID, r, aDes.Length());
763 EFSRV_EXPORT_C void RFile::Read(TDes8& aDes,TRequestStatus& aStatus) const
765 Reads from the file at the current position.
767 This is an asynchronous function.
769 Note that when an attempt is made to read beyond the end of the file,
770 no error is returned.
771 The descriptor's length is set to the number of bytes read into
772 it. Therefore, when reading through a file,the end of file has been reached
773 when the descriptor length, as returned by TDesC8::Length(), is zero.
775 @param aDes Descriptor into which binary data is read. Any existing contents
776 are overwritten. On return, its length is set to the number of
778 NB: this function is asynchronous and the request that it
779 represents may not complete until some time after the call
780 to the function has returned. It is important, therefore, that
781 this descriptor remain valid, or remain in scope, until you have
782 been notified that the request is complete.
784 @param aStatus Request status. On completion contains:
785 KErrNone, if successful, otherwise one of the other system-wide error codes.
790 TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileRead2, MODULEUID, Session().Handle(), SubSessionHandle(), aDes.MaxLength(), &aStatus);
792 RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),I64LOW(KCurrentPosition64)),aStatus);
794 TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead2Return, MODULEUID);
800 EFSRV_EXPORT_C TInt RFile::Read(TDes8& aDes,TInt aLength) const
802 Reads the specified number of bytes of binary data from the file at the current position.
804 This is a synchronous function.
806 Note that when an attempt is made to read beyond the end of the file,
807 no error is returned.
808 The descriptor's length is set to the number of bytes read into
809 it. Therefore, when reading through a file,the end of file has been reached
810 when the descriptor length, as returned by TDesC8::Length(), is zero.
811 Assuming aLength is less than the maximum length of the descriptor, the only circumstances
812 in which Read() can return fewer bytes than requested, is when the end of
813 file is reached or if an error occurs.
815 @param aDes Descriptor into which binary data is read. Any existing
816 contents are overwritten. On return, its length is set to
817 the number of bytes read.
819 @param aLength The number of bytes to be read from the file into the descriptor.
820 If an attempt is made to read more bytes than the descriptor's
821 maximum length, the function returns KErrOverflow.
822 This value must not be negative, otherwise the function
823 returns KErrArgument.
825 @return KErrNone if successful, otherwise one of the other system-wide error
829 TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileRead1, MODULEUID, Session().Handle(), SubSessionHandle(), aLength);
836 else if(aLength>aDes.MaxLength())
838 return(KErrOverflow);
840 TInt r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,I64LOW(KCurrentPosition64)));
842 TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead1Return, MODULEUID, r, aDes.Length());
850 EFSRV_EXPORT_C void RFile::Read(TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const
852 Reads a specified number of bytes of binary data from the file at the current position.
854 This is an asynchronous function.
856 Note that when an attempt is made to read beyond the end of the file,
857 no error is returned.
858 The descriptor's length is set to the number of bytes read into it.
859 Therefore, when reading through a file, the end of file has been reached
860 when the descriptor length, as returned by TDesC8::Length(), is zero.
861 Assuming aLength is less than the maximum length of the descriptor, the only
862 circumstances in which Read() can return fewer bytes than requested is when
863 the end of file is reached or if an error has occurred.
865 @param aDes Descriptor into which binary data is read. Any existing
866 contents are overwritten. On return, its length is set to the
867 number of bytes read.
868 NB: this function is asynchronous and the request that it
869 represents may not complete until some time after the call
870 to the function has returned. It is important, therefore, that
871 this descriptor remain valid, or remain in scope, until you have
872 been notified that the request is complete.
874 @param aLength The number of bytes to be read from the file into the descriptor.
875 If an attempt is made to read more bytes than the descriptor's
876 maximum length, then the function updates aStatus parameter with KErrOverflow.
877 It must not be negative otherwise the function updates aStatus with KErrArgument.
879 @param aStatus Request status. On completion contains KErrNone if successful,
880 otherwise one of the other system-wide error codes.
883 TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileRead2, MODULEUID, Session().Handle(), SubSessionHandle(), aLength, &aStatus);
888 TRequestStatus* req=(&aStatus);
889 User::RequestComplete(req,KErrNone);
892 else if(aLength>aDes.MaxLength())
894 TRequestStatus* req=(&aStatus);
895 User::RequestComplete(req,KErrOverflow);
899 RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,I64LOW(KCurrentPosition64)),aStatus);
901 TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead2Return, MODULEUID);
907 EFSRV_EXPORT_C TInt RFile::Read(TInt aPos,TDes8& aDes) const
909 Reads from the file at the specified offset within the file
911 This is a synchronous function.
913 Note that when an attempt is made to read beyond the end of the file,
914 no error is returned.
915 The descriptor's length is set to the number of bytes read into it.
916 Therefore, when reading through a file, the end of file has been reached
917 when the descriptor length, as returned by TDesC8::Length(), is zero.
919 @param aPos Position of first byte to be read. This is an offset from
920 the start of the file. If no position is specified, reading
921 begins at the current file position.
922 If aPos is beyond the end of the file, the function returns
923 a zero length descriptor.
925 @param aDes The descriptor into which binary data is read. Any existing content
926 is overwritten. On return, its length is set to the number of
929 @return KErrNone if successful, otherwise one of the other system-wide error
932 @panic FSCLIENT 19 if aPos is negative.
935 TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileRead3, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.MaxLength());
937 __ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
939 TInt r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),aPos));
941 TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead3Return, MODULEUID, r, aDes.Length());
949 EFSRV_EXPORT_C void RFile::Read(TInt aPos,TDes8& aDes,TRequestStatus& aStatus) const
951 Reads from the file at the specified offset within the file.
953 This is an asynchronous function.
955 Note that when an attempt is made to read beyond the end of the file,
956 no error is returned.
957 The descriptor's length is set to the number of bytes read into it.
958 Therefore, when reading through a file, the end of file has been reached
959 when the descriptor length, as returned by TDesC8::Length(), is zero.
961 @param aPos Position of first byte to be read. This is an offset from
962 the start of the file. If no position is specified,
963 reading begins at the current file position.
964 If aPos is beyond the end of the file, the function returns
965 a zero length descriptor.
967 @param aDes The descriptor into which binary data is read. Any existing
968 content is overwritten. On return, its length is set to
969 the number of bytes read.
970 NB: this function is asynchronous and the request that it
971 represents may not complete until some time after the call
972 to the function has returned. It is important, therefore, that
973 this descriptor remain valid, or remain in scope, until you have
974 been notified that the request is complete.
976 @param aStatus The request status. On completion, contains an error code of KErrNone
977 if successful, otherwise one of the other system-wide error codes.
979 @panic FSCLIENT 19 if aPos is negative.
982 TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileRead4, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.MaxLength(), &aStatus);
984 __ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
985 RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),aPos),aStatus);
987 TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead4Return, MODULEUID);
993 EFSRV_EXPORT_C TInt RFile::Read(TInt aPos,TDes8& aDes,TInt aLength) const
995 Reads the specified number of bytes of binary data from the file at a specified
996 offset within the file.
998 This is a synchronous function.
1000 Note that when an attempt is made to read beyond the end of the file,
1001 no error is returned.
1002 The descriptor's length is set to the number of bytes read into it.
1003 Therefore, when reading through a file, the end of file has been reached
1004 when the descriptor length, as returned by TDesC8::Length(), is zero.
1005 Assuming aLength is less than the maximum length of the descriptor, the only
1006 circumstances in which Read() can return fewer bytes than requested is when
1007 the end of file is reached or if an error has occurred.
1009 @param aPos Position of first byte to be read. This is an offset from
1010 the start of the file. If no position is specified,
1011 reading begins at the current file position.
1012 If aPos is beyond the end of the file, the function returns
1013 a zero length descriptor.
1015 @param aDes The descriptor into which binary data is read. Any existing
1016 contents are overwritten. On return, its length is set to
1017 the number of bytes read.
1018 @param aLength The number of bytes to read from the file into the descriptor.
1019 If an attempt is made to read more bytes than the descriptor's
1020 maximum length, then the function updates aStatus parameter with KErrOverflow.
1021 It must not be negative otherwise the function updates aStatus with KErrArgument.
1023 @return KErrNone if successful, otherwise one of the other system-wide
1026 @panic FSCLIENT 19 if aPos is negative.
1029 TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileRead3, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength);
1031 __ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
1037 else if(aLength>aDes.MaxLength())
1039 return(KErrOverflow);
1042 TInt r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,aPos));
1044 TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead3Return, MODULEUID, r, aDes.Length());
1052 EFSRV_EXPORT_C void RFile::Read(TInt aPos,TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const
1054 Reads the specified number of bytes of binary data from the file at a specified
1055 offset within the file.
1057 This is an asynchronous function.
1059 Note that when an attempt is made to read beyond the end of the file,
1060 no error is returned.
1061 The descriptor's length is set to the number of bytes read into it.
1062 Therefore, when reading through a file, the end of file has been reached
1063 when the descriptor length, as returned by TDesC8::Length(), is zero.
1064 Assuming aLength is less than the maximum length of the descriptor, the only
1065 circumstances in which Read() can return fewer bytes than requested is when
1066 the end of file is reached or if an error has occurred.
1068 @param aPos Position of first byte to be read. This is an offset from
1069 the start of the file. If no position is specified,
1070 reading begins at the current file position.
1071 If aPos is beyond the end of the file, the function returns
1072 a zero length descriptor.
1074 @param aDes The descriptor into which binary data is read. Any existing
1075 contents are overwritten. On return, its length is set to
1076 the number of bytes read.
1077 NB: this function is asynchronous and the request that it
1078 represents may not complete until some time after the call
1079 to the function has returned. It is important, therefore, that
1080 this descriptor remain valid, or remain in scope, until you have
1081 been notified that the request is complete.
1083 @param aLength The number of bytes to read from the file into the descriptor.
1084 If an attempt is made to read more bytes than the descriptor's
1085 maximum length, then the function returns KErrOverflow.
1086 It must not be negative otherwise the function returns KErrArgument.
1088 @param aStatus Request status. On completion contains KErrNone if successful,
1089 otherwise one of the other system-wide error codes.
1091 @panic FSCLIENT 19 if aPos is negative.
1094 TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileRead4, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength, &aStatus);
1096 __ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
1100 TRequestStatus* req=(&aStatus);
1101 User::RequestComplete(req,KErrNone);
1104 else if(aLength>aDes.MaxLength())
1106 TRequestStatus* req=(&aStatus);
1107 User::RequestComplete(req,KErrOverflow);
1111 RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,aPos),aStatus);
1113 TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead4Return, MODULEUID);
1119 EFSRV_EXPORT_C void RFile::ReadCancel(TRequestStatus& aStatus) const
1121 Cancels a specific outstanding asynchronous read request.
1123 The outstanding request completes with KErrCancel.
1125 @param aStat The request status object identified with the original
1129 if(aStatus != KRequestPending)
1131 SendReceive(EFsFileReadCancel, TIpcArgs(&aStatus));
1137 EFSRV_EXPORT_C void RFile::ReadCancel() const
1139 Cancels all outstanding asynchronous read requests for this subsession.
1141 All outstanding requests complete with KErrCancel.
1144 SendReceive(EFsFileReadCancel, TIpcArgs(NULL));
1150 EFSRV_EXPORT_C TInt RFile::Write(const TDesC8& aDes)
1152 Writes to the file at the current offset within the file.
1154 This is a synchronous function.
1156 NB Attempting to extend the file to 2 GByte or greater will fail with KErrTooBig
1158 @param aDes The descriptor from which binary data is written.
1159 The function writes the entire contents of aDes to the file.
1161 @return KErrNone if successful, otherwise one of the other system-wide error
1165 TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1, MODULEUID, Session().Handle(), SubSessionHandle(), aDes.Length());
1166 TInt r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),I64LOW(KCurrentPosition64)));
1167 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1Return, MODULEUID, r);
1172 EFSRV_EXPORT_C void RFile::Write(const TDesC8& aDes,TRequestStatus& aStatus)
1174 Writes to the file at the current offset within the file.
1176 This is an asynchronous function.
1178 NB Attempting to extend the file to 2 GByte or greater will fail with KErrTooBig
1180 @param aDes The descriptor from which binary data is written.
1181 The function writes the entire contents of aDes to the file.
1182 NB: this function is asynchronous and the request that it
1183 represents may not complete until some time after the call
1184 to the function has returned. It is important, therefore, that
1185 this descriptor remain valid, or remain in scope, until you have
1186 been notified that the request is complete.
1188 @param aStatus Request status. On completion contains KErrNone if successful,
1189 otherwise one of the other system-wide error codes.
1192 TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2, MODULEUID, Session().Handle(), SubSessionHandle(), aDes.Length(), &aStatus);
1194 RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),I64LOW(KCurrentPosition64)),aStatus);
1195 TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2Return, MODULEUID);
1201 EFSRV_EXPORT_C TInt RFile::Write(const TDesC8& aDes,TInt aLength)
1203 Writes a portion of a descriptor to the file at the current offset within
1206 This is a synchronous function.
1208 NB Attempting to extend the file to 2 GByte or greater will fail with KErrTooBig
1210 @param aDes The descriptor from which binary data is written.
1211 @param aLength The number of bytes to be written from the descriptor.
1212 This must not be greater than the length of the descriptor.
1213 It must not be negative.
1215 @return KErrNone if successful; KErrArgument if aLength is negative;
1216 otherwise one of the other system-wide error codes.
1218 @panic FSCLIENT 27 in debug mode, if aLength is greater than the length
1219 of the descriptor aDes.
1222 TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1, MODULEUID, Session().Handle(), SubSessionHandle(), aLength);
1224 __ASSERT_DEBUG(aDes.Length()>=aLength,Panic(EBadLength));
1225 TInt r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,I64LOW(KCurrentPosition64)));
1227 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1Return, MODULEUID, r);
1234 EFSRV_EXPORT_C void RFile::Write(const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus)
1236 Writes a portion of a descriptor to the file at the current offset
1239 This is an asynchronous function.
1241 NB Attempting to extend the file to 2 GByte or greater will fail with KErrTooBig
1243 @param aDes The descriptor from which binary data is written.
1244 NB: this function is asynchronous and the request that it
1245 represents may not complete until some time after the call
1246 to the function has returned. It is important, therefore, that
1247 this descriptor remain valid, or remain in scope, until you have
1248 been notified that the request is complete.
1250 @param aLength The number of bytes to be written from the descriptor.
1251 This must not be greater than the length of the descriptor.
1252 It must not be negative.
1254 @param aStatus Request status. On completion contains KErrNone if successful;
1255 KErrArgument if aLength is negative;
1256 otherwise one of the other system-wide error codes.
1260 TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2, MODULEUID, Session().Handle(), SubSessionHandle(), aLength, &aStatus);
1262 RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,I64LOW(KCurrentPosition64)),aStatus);
1264 TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2Return, MODULEUID);
1271 EFSRV_EXPORT_C TInt RFile::Write(TInt aPos,const TDesC8& aDes)
1273 Writes to the file at the specified offset within the file
1275 This is a synchronous function.
1277 NB Attempting to extend the file to 2 GByte or greater will fail with KErrTooBig
1279 @param aPos The offset from the start of the file at which the first
1281 If a position beyond the end of the file is specified, then
1282 the write operation begins at the end of the file.
1283 If the position has been locked, then the write fails.
1285 @param aDes The descriptor from which binary data is written. The function writes
1286 the entire contents of aDes to the file.
1288 @return KErrNone if successful, otherwise one of the other system-wide error
1291 @panic FSCLIENT 19 if aPos is negative.
1294 TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileWrite3, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.Length());
1296 __ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
1297 TInt r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),aPos));
1299 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite3Return, MODULEUID, r);
1306 EFSRV_EXPORT_C void RFile::Write(TInt aPos,const TDesC8& aDes,TRequestStatus& aStatus)
1308 Writes to the file at the specified offset within the file
1310 This is an asynchronous function.
1312 NB Attempting to extend the file to 2 GByte or greater will fail with KErrTooBig
1314 @param aPos The offset from the start of the file at which the first
1316 If a position beyond the end of the file is specified, then
1317 the write operation begins at the end of the file.
1318 If the position has been locked, then the write fails.
1320 @param aDes The descriptor from which binary data is written. The function
1321 writes the entire contents of aDes to the file.
1322 NB: this function is asynchronous and the request that it
1323 represents may not complete until some time after the call
1324 to the function has returned. It is important, therefore, that
1325 this descriptor remain valid, or remain in scope, until you have
1326 been notified that the request is complete.
1328 @param aStatus Request status. On completion contains KErrNone if successful,
1329 otherwise one of the other system-wide error codes.
1331 @panic FSCLIENT 19 if aPos is negative.
1334 TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileWrite4, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.Length(), &aStatus);
1336 __ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
1337 RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),aPos),aStatus);
1338 TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite4Return, MODULEUID);
1344 EFSRV_EXPORT_C TInt RFile::Write(TInt aPos,const TDesC8& aDes,TInt aLength)
1346 Writes the specified number of bytes to the file at the specified offset within the file.
1348 This is a synchronous function.
1350 NB Attempting to extend the file to 2 GByte or greater will fail with KErrTooBig
1352 @param aPos The offset from the start of the file at which the first
1354 If a position beyond the end of the file is specified, then
1355 the write operation begins at the end of the file.
1356 If the position has been locked, then the write fails.
1358 @param aDes The descriptor from which binary data is written.
1359 @param aLength The number of bytes to be written from aDes .
1360 It must not be negative.
1362 @return KErrNone if successful; KErrArgument if aLength is negative;
1363 otherwise one of the other system-wide error codes.
1365 @panic FSCLIENT 19 if aPos is negative.
1368 TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1, MODULEUID, Session().Handle(), SubSessionHandle(), aLength);
1370 __ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
1371 TInt r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,aPos));
1373 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1Return, MODULEUID, r);
1380 EFSRV_EXPORT_C void RFile::Write(TInt aPos,const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus)
1382 Writes the specified number of bytes to the file at the specified offset within the file.
1384 This is an asynchronous function.
1386 NB Attempting to extend the file to 2 GByte or greater will fail with KErrTooBig
1388 @param aPos The offset from the start of the file at which the first
1390 If a position beyond the end of the file is specified, then
1391 the write operation begins at the end of the file.
1392 If the position has been locked, then the write fails.
1394 @param aDes The descriptor from which binary data is written.
1395 NB: this function is asynchronous and the request that it
1396 represents may not complete until some time after the call
1397 to the function has returned. It is important, therefore, that
1398 this descriptor remain valid, or remain in scope, until you have
1399 been notified that the request is complete.
1401 @param aLength The number of bytes to be written from aDes.
1402 It must not be negative.
1404 @param aStatus Request status. On completion contains KErrNone if successful;
1405 KErrArgument if aLength is negative;
1406 otherwise one of the other system-wide error codes.
1408 @panic FSCLIENT 19 if aPos is negative.
1411 TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength, &aStatus);
1413 __ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
1414 RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,aPos),aStatus);
1415 TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2Return, MODULEUID);
1421 EFSRV_EXPORT_C TInt RFile::Lock(TInt aPos,TInt aLength) const
1423 Locks a region within the file as defined by a range of bytes.
1425 This ensures that those bytes are accessible
1426 only through the RFile object which claims the lock. To re-allow access by
1427 other programs to the locked region, it must either be unlocked or the file
1428 closed. Locking can be used to synchronize operations on a file when more
1429 than one program has access to the file in EFileShareAny mode.
1431 More than one distinct region of a file can be locked, but an error is returned
1432 if more than one lock is placed on the same region. Different RFile objects
1433 can lock different parts of the same file as long as the file is opened in
1434 EFileShareAny mode. The locked region may extend beyond the end of a file;
1435 this prevents the file from being extended by other programs.
1437 @param aPos Position in file from which to lock; this is the offset from
1438 the beginning of the file.
1439 @param aLength Number of bytes to lock.
1441 @return KErrNone if successful; KErrArgument if aPos+aLength>2G-1 boundary;
1442 otherwise one of the other system-wide error codes.
1444 @panic FSCLIENT 17 if aLength is not greater than zero,
1445 @panic FSCLIENT 19 if aPos is negative.
1449 TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileLock, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength);
1451 __ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
1453 TInt r = SendReceive(EFsFileLock,TIpcArgs(aPos,aLength));
1455 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileLockReturn, MODULEUID, r);
1462 EFSRV_EXPORT_C TInt RFile::UnLock(TInt aPos,TInt aLength) const
1464 Unlocks a region within the file as defined by a range of bytes.
1466 A lock can only be removed by the RFile object which claimed the lock.
1468 A portion of a locked region cannot be unlocked. The entire locked region
1469 must be unlocked otherwise an error is returned. If any byte within
1470 the specified range of bytes to unlock is not locked, an error is returned.
1472 @param aPos Position in file from which to unlock; this is the offset from
1473 the beginning of the file.
1474 @param aLength Number of bytes to unlock.
1476 @return KErrNone if successful; KErrArgument if aPos+aLength>2G-1 boundary;
1477 otherwise one of the other system-wide error codes.
1479 @panic FSCLIENT 18 if aLength is not greater than zero,
1480 @panic FSCLIENT 19 if aPos is negative.
1483 TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileUnLock, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength);
1485 __ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
1486 TInt r = SendReceive(EFsFileUnLock,TIpcArgs(aPos,aLength));
1488 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileUnLockReturn, MODULEUID, r);
1495 EFSRV_EXPORT_C TInt RFile::Seek(TSeek aMode,TInt& aPos) const
1497 Sets the the current file position.
1499 The function can also be used to get the current file
1500 position without changing it. The file position is the position at which
1501 reading and writing takes place. The start of the file is position zero.
1503 To retrieve the current file position without changing it, specify ESeekCurrent
1504 for the seek mode, and zero for the offset.
1506 If the seek mode is ESeekStart, then:
1508 1. the function does not modify the aPos argument,
1510 2. the function returns an error if the offset specified is negative.
1512 If the seek mode is ESeekAddress, an error is returned if:
1514 1. the file is not in ROM,
1516 2. the offset specified is greater than the size of the file.
1518 @param aMode Seek mode. Controls the destination of the seek operation.
1519 @param aPos Offset from location specified in aMode. Can be negative.
1520 On return contains the new file position.
1521 If the seek mode is either ESeekCurrent or ESeekEnd and the offset
1522 specifies a position before the start of the file
1523 or beyond the end of the file, then on return, aPos is set to
1524 the new file position (either the start or the end of the file).
1525 If the seek mode is ESeekAddress, aPos returns the address of
1526 the byte at the specified offset within the file.
1528 @return KErrNone if successful, otherwise one of the other system-wide error
1532 TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileSeek, MODULEUID, Session().Handle(), SubSessionHandle(), aMode, aPos, 0);
1534 TInt64 newPos = aPos;
1535 TPckg<TInt64> pkNewPos(newPos);
1536 TInt r = SendReceive(EFsFileSeek|KIpcArgSlot2Desc,TIpcArgs(aPos,aMode,&pkNewPos));
1538 aPos = I64LOW(newPos);
1540 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileSeekReturn, MODULEUID, r);
1547 EFSRV_EXPORT_C TInt RFile::Flush()
1549 Commits data to the storage device and flushes internal buffers without closing
1552 Although RFile::Close() also flushes internal buffers, it is often useful
1553 to call Flush() before a file is closed. This is because Close() returns no
1554 error information, so there is no way of telling whether the final data was
1555 written to the file successfully or not. Once data has been flushed, Close()
1556 is effectively a no-operation.
1558 @return KErrNone if successful, otherwise one of the other system-wide error
1562 TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileFlush, MODULEUID, Session().Handle(), SubSessionHandle(), NULL);
1564 TInt r = RSubSessionBase::SendReceive(EFsFileFlush);
1566 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileFlushReturn, MODULEUID, r);
1573 EFSRV_EXPORT_C void RFile::Flush(TRequestStatus& aStatus)
1575 Commits data to the storage device and flushes internal buffers without closing
1578 Although RFile::Close() also flushes internal buffers, it is often useful
1579 to call Flush() before a file is closed. This is because Close() returns no
1580 error information, so there is no way of telling whether the final data was
1581 written to the file successfully or not. Once data has been flushed, Close()
1582 is effectively a no-operation.
1584 @param aStatus Request status. On completion contains KErrNone if successful,
1585 otherwise one of the other system-wide error codes.
1588 TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileFlush, MODULEUID, Session().Handle(), SubSessionHandle(), &aStatus);
1590 RSubSessionBase::SendReceive(EFsFileFlush, aStatus);
1592 TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileFlushReturn, MODULEUID);
1598 EFSRV_EXPORT_C TInt RFile::Size(TInt& aSize) const
1600 Gets the current file size.
1602 @param aSize On return, the size of the file in bytes.
1604 @return KErrNone if successful, otherwise one of the other system-wide error
1608 TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileSize, MODULEUID, Session().Handle(), SubSessionHandle());
1610 TInt64 size = aSize;
1611 TPckg<TInt64> pkSize(size);
1612 TInt r = SendReceive(EFsFileSize|KIpcArgSlot0Desc,TIpcArgs(&pkSize));
1615 aSize = I64LOW(size);
1616 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
1617 if (size > KMaxTInt)
1618 return (KErrTooBig);
1621 TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileSizeReturn, MODULEUID, r, aSize);
1628 EFSRV_EXPORT_C TInt RFile::SetSize(TInt aSize)
1632 If the size of the file is reduced, data may be lost from
1633 the end of the file.
1637 1. The current file position remains unchanged unless SetSize() reduces the size
1638 of the file in such a way that the current file position is now beyond
1639 the end of the file. In this case, the current file position is set to
1642 2. If the file was not opened for writing, an error is returned.
1644 @param aSize The new size of the file, in bytes. This value must not be negative, otherwise the function raises a panic.
1646 @return KErrNone if successful, otherwise one of the other system-wide error
1649 @panic FSCLIENT 20 If aSize is negative.
1653 TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileSetSize, MODULEUID, Session().Handle(), SubSessionHandle(), aSize, 0);
1655 TInt r = SendReceive(EFsFileSetSize,TIpcArgs(aSize));
1657 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileSetSizeReturn, MODULEUID, r);
1664 EFSRV_EXPORT_C TInt RFile::Att(TUint& aVal) const
1666 Gets the file's attributes.
1668 @param aVal A bitmask which, on return, contains the file’s attributes.
1669 For more information, see KEntryAttNormal and the other
1670 file/directory attributes.
1672 @return KErrNone if successful, otherwise one of the other system-wide error
1675 @see KEntryAttNormal
1678 TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileAtt, MODULEUID, Session().Handle(), SubSessionHandle());
1680 TPtr8 a((TUint8*)&aVal,sizeof(TUint));
1682 TInt r = SendReceive(EFsFileAtt,TIpcArgs(&a));
1684 TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileAttReturn, MODULEUID, r, aVal);
1691 EFSRV_EXPORT_C TInt RFile::SetAtt(TUint aSetAttMask,TUint aClearAttMask)
1693 Sets or clears file attributes using two bitmasks.
1695 The first mask controls which attributes are set.
1696 The second controls which attributes are cleared.
1700 1. The file must have been opened for writing, or an error is returned.
1702 2. A panic is raised if any attribute is specified in both bitmasks.
1704 3. An attempt to set or clear the KEntryAttDir, KEntryAttVolume or KEntryAttRemote
1705 attributes have no effect.
1707 4. The new attribute values take effect when the file is flushed or closed (which
1710 @param aSetAttMask A bitmask indicating the file attributes to be set
1711 @param aClearAttMask A bitmask indicating the attributes to be cleared. For
1712 more information see KEntryAttNormal, and the other
1713 file/directory attributes.
1715 @return KErrNone if successful, otherwise one of the other system-wide error
1718 @panic FSCLIENT 21 if the same attribute bit is set in both bitmasks.
1721 TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileSetAtt, MODULEUID, Session().Handle(), SubSessionHandle(), aSetAttMask, aClearAttMask);
1723 __ASSERT_ALWAYS((aSetAttMask&aClearAttMask)==0,Panic(EAttributesIllegal));
1725 TInt r = SendReceive(EFsFileSetAtt,TIpcArgs(aSetAttMask,aClearAttMask));
1727 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileSetAttReturn, MODULEUID, r);
1734 EFSRV_EXPORT_C TInt RFile::Modified(TTime& aTime) const
1736 Gets local date and time the file was last modified, in universal time.
1738 @param aTime On return, contains the date and time the file was last modified in UTC.
1740 @return KErrNone if successful, otherwise one of the other system-wide error
1744 TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileModified, MODULEUID, Session().Handle(), SubSessionHandle());
1746 TPtr8 t((TUint8*)&aTime,sizeof(TTime));
1747 TInt r = SendReceive(EFsFileModified,TIpcArgs(&t));
1749 TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileModifiedReturn, MODULEUID, r, I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()));
1756 EFSRV_EXPORT_C TInt RFile::SetModified(const TTime& aTime)
1758 Sets the date and time the file was last modified. UTC date and time should be used.
1762 1. The file must have been opened for writing, or an error is returned.
1764 2. The new modified time takes effect when the file is flushed or closed (which
1767 @param aTime The new date and time the file was last modified, in universal time.
1769 @return KErrNone if successful, otherwise one of the other system-wide error
1773 TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileSetModified, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()));
1775 TPtrC8 t((TUint8*)&aTime,sizeof(TTime));
1776 TInt r = SendReceive(EFsFileSetModified,TIpcArgs(&t));
1778 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileSetModifiedReturn, MODULEUID, r);
1785 EFSRV_EXPORT_C TInt RFile::Set(const TTime& aTime,TUint aMask,TUint aVal)
1787 Sets the file’s attributes, and the date and time it was last modified.
1789 It combines the functionality of SetAtt() and SetModified()
1791 An attempt to set or clear the KEntryAttDir, KEntryAttVolume or KEntryAttRemote
1792 attributes have no effect.
1794 @param aTime The new date and time the file was last modified. UTC date and time should be used.
1795 @param aMask A bitmask indicating the file attributes to be set
1796 @param aVal A bitmask indicating the attributes to be cleared. For
1797 more information see KEntryAttNormal, and the other
1798 file/directory attributes.
1800 @return KErrNone if successful, otherwise one of the other system-wide error
1803 @panic FSCLIENT 21 if the same attribute bit is set in both bitmasks.
1805 @see RFile::SetModified
1809 TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileSet, MODULEUID,
1810 Session().Handle(), SubSessionHandle(), I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()), aMask, aVal);
1812 __ASSERT_ALWAYS((aVal&aMask)==0,Panic(EAttributesIllegal));
1813 TPtrC8 t((TUint8*)&aTime,sizeof(TTime));
1814 TInt r = SendReceive(EFsFileSet,TIpcArgs(&t,aMask,aVal));
1816 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileSetReturn, MODULEUID, r);
1823 EFSRV_EXPORT_C TInt RFile::ChangeMode(TFileMode aNewMode)
1825 Switches an open file's access mode between EFileShareExclusive and EFileShareReadersOnly.
1827 This allows or disallows read-only access without having to close and re-open the file.
1829 @param aNewMode The new access mode.
1831 @return KErrNone, if successful;
1832 KErrArgument, if aNewMode has any value other than the two specified;
1833 KErrAccessDenied, if:
1834 a) the function is called when the current file share
1835 mode is EFileShareAny;
1836 b) the file has multiple readers, and an attempt is made
1837 to change the share mode to EFileShareExclusive;
1838 c) the file has been opened for writing in EFileShareExclusive mode, and an
1839 attempt is made to change the access mode to EFileShareReadersOnly.
1841 @capability Dependent If the path starts with /Resource then capability DiskAdmin is required
1845 TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileChangeMode, MODULEUID, Session().Handle(), SubSessionHandle(), aNewMode);
1847 if (aNewMode!=EFileShareExclusive && aNewMode!=EFileShareReadersOnly)
1848 return(KErrArgument);
1849 TInt r = SendReceive(EFsFileChangeMode,TIpcArgs(aNewMode));
1851 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileChangeModeReturn, MODULEUID, r);
1858 EFSRV_EXPORT_C TInt RFile::Rename(const TDesC& aNewName)
1862 If aNewName specifies a different directory to the one in which
1863 the file is currently located, then the file is moved.
1865 No other process may have access to the file, that is, the file must have
1866 been opened in EFileShareExclusive share mode, or an error is returned. The
1867 file must have been opened for writing (using EFileWrite access mode). An
1868 error is returned if a file with the new filename already exists in the target
1871 The file or directory may not be moved to another device by this means, either
1872 explicitly (by another drive specified in the name) or implicitly (because
1873 the directory has been mapped to another device with RFs::SetSubst()).
1875 Note that the function builds up the new file specification by using all
1876 of the path components specified
1877 in aNewName (directory path, filename and extension),
1878 then adding any missing components from the current file specification, and
1879 finally adding any missing components from the session path. A consequence
1880 of this is that you cannot rename a file to remove its extension. An alternative
1881 to this function is RFs::Rename() which renames the file using the new name
1884 @param aNewName The new file name and/or directory path. No part may contain
1885 wildcard characters or an error is returned.
1887 @return KErrNone if successful, otherwise one of the other system-wide error
1890 @capability Dependent If aNewName starts with /Sys then capability Tcb is required
1891 @capability Dependent If aNewName starts with /Resource then capability Tcb is required
1892 @capability Dependent If aNewName starts with /Private and does not match this process'
1893 SID then AllFiles capability is required.
1897 TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileRename, MODULEUID, Session().Handle(), SubSessionHandle(), aNewName);
1899 TInt r = SendReceive(EFsFileRename,TIpcArgs(&aNewName));
1901 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileRenameReturn, MODULEUID, r);
1908 EFSRV_EXPORT_C TInt RFile::Drive(TInt &aDriveNumber, TDriveInfo &aDriveInfo) const
1910 Gets information about the drive on which this file resides.
1912 @param aDriveNumber On return, the drive number.
1914 @param aDriveInfo On return, contains information describing the drive
1915 and the medium mounted on it. The value of TDriveInfo::iType
1916 shows whether the drive contains media.
1918 @return KErrNone, if successful, otherwise one of the other
1919 system-wide error codes
1924 TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileDrive, MODULEUID, Session().Handle(), SubSessionHandle());
1926 TPckg<TInt> pki(aDriveNumber);
1927 TPckg<TDriveInfo> pkdi(aDriveInfo);
1928 TInt r = SendReceive(EFsFileDrive,TIpcArgs(&pki,&pkdi));
1930 TRACERET4(UTF::EBorder, UTraceModuleEfsrv::EFileDriveReturn, MODULEUID, r, aDriveInfo.iDriveAtt, aDriveInfo.iMediaAtt, aDriveInfo.iType);
1935 TInt RFile::Clamp(RFileClamp& aHandle)
1937 Instructs the File Server that the file is not to be modified on storage media.
1939 @param aHandle On return, a handle to the file.
1941 @return KErrNone, if successful, otherwise one of the other
1942 system-wide error codes
1947 TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileClamp, MODULEUID, Session().Handle(), SubSessionHandle());
1949 TPckg<RFileClamp> pkHandle(aHandle);
1950 TInt r = SendReceive(EFsFileClamp,TIpcArgs(& pkHandle));
1952 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileClampReturn, MODULEUID, r);
1957 Fetches the Block Map of a file. Each file in the file system will consist of
1958 a number of groups of blocks. Each group represents a number of contiguous blocks.
1959 Such a group is represented by the TBlockMapEntry class. The full Block Map representing
1960 the file may be determined by repeatedly calling RFile::BlockMap until KErrCompletion is
1965 1. If the Block Map for the whole file is not required, then a start and end position
1966 for a section of the file can be specified. Both of these parameters specify offsets
1967 from the start of the file in bytes.
1969 @param aInfo A structure describing a group of block maps.
1971 @param aStartPos A start position for a desired section of the file.
1973 @param aEndPos An end position for a desired section of the file. If not passed, then the end of the
1976 @return KErrNone until the end of the file or the file section is successfully reached;
1977 KErrCompletion if the end of the file is reached;
1978 KErrNotSupported if the file system does not support Block Mapping or the media is either removable or not pageable.
1980 EFSRV_EXPORT_C TInt RFile::BlockMap(SBlockMapInfo& aInfo, TInt64& aStartPos, TInt64 aEndPos, TInt aBlockMapUsage) const
1982 TRACE7(UTF::EBorder, UTraceModuleEfsrv::EFileBlockMap, MODULEUID,
1983 Session().Handle(), SubSessionHandle(), I64LOW(aStartPos), I64HIGH(aEndPos), I64LOW(aEndPos), I64HIGH(aEndPos), aBlockMapUsage);
1986 args.iStartPos = aStartPos;
1987 args.iEndPos = aEndPos;
1988 TPckg<SBlockMapInfo> pkInfo(aInfo);
1989 TPckg<SBlockMapArgs> pkArgs(args);
1990 TInt r = SendReceive(EFsBlockMap, TIpcArgs(&pkInfo, &pkArgs, aBlockMapUsage));
1992 aStartPos = args.iStartPos;
1994 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileBlockMapReturn, MODULEUID, r);
1999 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
2001 Opens an existing file for reading or writing.
2003 If the file does not already exist, an error is returned.
2005 This is equivalent to calling RFile::Open except that this function
2006 can open files of size greater than 2GB - 1 also.
2010 1. To close the file, use Close()
2012 2. Attempting to open a file with the read-only attribute using the EFileWrite
2013 access mode results in an error.
2015 3. After a file has been opened, the current write position is set to the start
2017 If necessary, use RFile64::Seek() to move to a different position within
2020 4. It enables big file support to handle files whose size are greater then 2GB-1
2022 @param aFs The file server session.
2023 @param aName The name of the file. Any path components (i.e. drive letter
2024 or directory), which are not specified, are taken from
2026 @param aMode The mode in which the file is opened. See TFileMode.
2028 @return KErrNone if successful, otherwise one of the other system-wide
2034 @capability Dependent If the path for aName is /Sys and aMode is neither
2035 EFileShareReadersOnly nor EFileRead then Tcb capability is required.
2036 @capability Dependent If the path for aName is /Sys and aMode is either
2037 EFileShareReadersOnly or EFileRead then Allfiles capability is required.
2038 @capability Dependent If the path for aName begins with /Private and does not match this process'
2039 SID then AllFiles capability is required.
2040 @capability Dependent If the path for aName begins with /Resource and aMode is neither
2041 EFileShareReadersOrWriters|EFileRead nor EFileShareReadersOnly
2042 nor EFileRead then Tcb capability is required.
2045 EFSRV_EXPORT_C TInt RFile64::Open(RFs& aFs,const TDesC& aName,TUint aFileMode)
2047 TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileOpen, MODULEUID, aFs.Handle(), aFileMode, aName);
2049 TInt r = CreateSubSession(aFs,EFsFileOpen,TIpcArgs(&aName,aFileMode|EFileBigFile));
2051 TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileOpenReturn, MODULEUID, r, SubSessionHandle());
2056 Creates and opens a new file for writing.
2058 If the file already exists, an error is returned.
2060 If the resulting path does not exist, then the operation cannot proceed and
2061 the function returns an error code.
2063 This is equivalent to calling RFile::Create except that the file created with
2064 this function can grow beyond 2GB - 1 also.
2068 1. To close the file, use Close()
2070 2. It automatically sets the file's archive attribute.
2072 3. It enables big file support to handle files whose size are greater then 2GB-1
2075 @param aFs The file server session.
2076 @param aName The name of the file. Any path components (i.e. drive letter
2077 or directory), which are not specified, are taken from
2079 @param aMode The mode in which the file is opened. The access mode is
2080 automatically set to EFileWrite. See TFileMode.
2082 @return KErrNone if successful, otherwise one of the other system-wide
2085 @see RFile::Create()
2088 @capability Dependent If the path in aName starts with /Sys then capability Tcb is required
2089 @capability Dependent If the path in aName starts with /Resource then capability Tcb is required
2090 @capability Dependent If the path in aName starts with /Private and does not match this process'
2091 SID then AllFiles capability is required.
2094 EFSRV_EXPORT_C TInt RFile64::Create(RFs& aFs,const TDesC& aName,TUint aFileMode)
2096 TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileCreate, MODULEUID, aFs.Handle(), aFileMode, aName);
2098 TInt r = CreateSubSession(aFs,EFsFileCreate,TIpcArgs(&aName,aFileMode|EFileBigFile));
2100 TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileCreateReturn, MODULEUID, r, SubSessionHandle());
2105 Opens a file for writing, replacing the content of any existing file of the
2106 same name if it exists, or creating a new file if it does not exist.
2108 This is equivalent to calling RFile::Replace except that the file created or replaced
2109 with this function can grow beyond 2GB - 1 also.
2112 If the resulting path exists, then:
2114 - the length of an existing file with the same filename is re-set to zero
2116 - a new file is created, if no existing file with the same filename can be found.
2118 If the resulting path does not exist, then the operation cannot proceed and
2119 the function returns an error code.
2123 - To close the file, use Close(), defined in the base class RFsBase.
2125 - It automatically sets the file's archive attribute.
2127 - It enables big file support to handle files whose size are greater then 2GB-1
2130 @param aFs The file server session.
2131 @param aName The name of the file. Any path components (i.e. drive letter
2132 or directory), which are not specified, are taken from
2134 @param aMode The mode in which the file is opened. The access mode is
2135 automatically set to EFileWrite. See TFileMode.
2137 @return KErrNone if successful, otherwise one of the other system-wide
2141 @see RFile::Replace()
2143 @capability Dependent If the path in aName starts with /Sys then capability Tcb is required
2144 @capability Dependent If the path in aName starts with /Resource then capability Tcb is required
2145 @capability Dependent If the path in aName starts with /Private and does not match this process'
2146 SID then AllFiles capability is required.
2149 EFSRV_EXPORT_C TInt RFile64::Replace(RFs& aFs,const TDesC& aName,TUint aFileMode)
2151 TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileReplace, MODULEUID, aFs.Handle(), aFileMode, aName);
2153 TInt r = CreateSubSession(aFs,EFsFileReplace,TIpcArgs(&aName,aFileMode|EFileBigFile));
2155 TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileReplaceReturn, MODULEUID, r, SubSessionHandle());
2161 Creates and opens a temporary file with a unique name for writing and reading.
2162 This is equivalent to calling RFile::Temp except that the file created
2163 with this function can grow beyond 2GB - 1 also.
2168 1. To close the file, use Close()
2169 2. It enables big file support to handle files whose size are greater then 2GB-1
2171 @param aFs The file server session.
2172 @param aPath The directory in which the file is created.
2173 @param aName On return, contains the full path and file name of the file.
2174 The filename is guaranteed to be unique within the directory
2176 @param aMode The mode in which the file is opened. The access mode is
2177 automatically set to EFileWrite. See TFileMode.
2179 @return KErrNone if successful, otherwise one of the other system-wide
2185 @capability Dependent If aPath starts with /Sys then capability Tcb is required
2186 @capability Dependent If aPath starts with /Resource then capability Tcb is required
2187 @capability Dependent If aPath starts with /Private and does not match this process'
2188 SID then AllFiles capability is required.
2190 EFSRV_EXPORT_C TInt RFile64::Temp(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aFileMode)
2192 TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileTemp, MODULEUID, aFs.Handle(), aPath, aFileMode);
2193 TInt r = CreateSubSession(aFs,EFsFileTemp,TIpcArgs(&aPath,aFileMode|EFileBigFile,&aName));
2194 TRACERETMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileTempReturn, MODULEUID, r, SubSessionHandle(), aName);
2200 Allows a server to adopt an already open file from a client.
2201 The client's RFs and RFile or RFile64 handles are contained in message slots within aMsg.
2203 Assumes that the client's RFs and RFile or RFile64 handles have been sent to the server
2204 using TransferToServer().
2206 This is equivalent to calling RFile::AdoptFromClient
2207 except that the file adopted can be enlarged to sizes beyond 2GB-1.
2210 If a RFile handle is received from the client then enlarging the file beyond
2211 2GB-1 might result in inconsistent behaviour by the client, since it(client) would
2212 not be able to handle files of size greater than 2GB-1.
2214 If a RFile64 handle is received from the client then enlarging the file beyond
2215 2GB-1 should not cause any issues since the client would be
2216 capable of handling files of size greater than 2GB-1.
2218 This RFile or RFile64 will own it's RFs session so that when the sub-session (RFile or RFile64)
2219 is closed so will the RFs session.
2221 @param aMsg The message received from the client
2222 @param aFsHandleIndex The index that identifies the message slot
2223 of a file server session (RFs) handle
2224 @param aFileHandleIndex The index that identifies the message slot
2225 of the sub-session (RFile or RFile64) handle of the already opened file
2227 @return KErrNone if successful, otherwise one of the other system-wide
2230 EFSRV_EXPORT_C TInt RFile64::AdoptFromClient(const RMessage2& aMsg, TInt aFsHandleIndex, TInt aFileHandleIndex)
2232 TInt fileHandle = NULL;
2235 if (aFileHandleIndex == 0)
2236 fileHandle = aMsg.Int0();
2237 else if (aFileHandleIndex == 1)
2238 fileHandle = aMsg.Int1();
2239 else if (aFileHandleIndex == 2)
2240 fileHandle = aMsg.Int2();
2241 else if (aFileHandleIndex == 3)
2242 fileHandle = aMsg.Int3();
2246 #ifdef SYMBIAN_FTRACE_ENABLE
2248 if (aFsHandleIndex == 0)
2249 handle = aMsg.Int0();
2250 else if (aFsHandleIndex == 1)
2251 handle = aMsg.Int1();
2252 else if (aFsHandleIndex == 2)
2253 handle = aMsg.Int2();
2254 else if (aFsHandleIndex == 3)
2255 handle = aMsg.Int3();
2256 TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClient, MODULEUID, handle, fileHandle, aFsHandleIndex, aFileHandleIndex);
2261 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClientReturn, MODULEUID, r);
2265 // Duplicates the file server (RFs) session handle identified by an
2266 // existing handle contained in the message slot at index aFsHandleIndex
2268 r = fs.Open(aMsg, aFsHandleIndex, KFileServerPolicy);
2271 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClientReturn, MODULEUID, r);
2275 //return CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle));
2276 // Slot 1: Indicate Large File Supportis required.
2277 r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle, KFileAdopt64));
2279 TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClientReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
2286 Allows a client to adopt an already open file from a server.
2288 Assumes that the server's RFs and RFile or RFile64 handles have been sent to the
2289 client using TransferToClient().
2291 This is equivalent to calling RFile::AdoptFromServer
2292 except that the file adopted can be enlarged to sizes beyond 2GB-1.
2295 If a RFile handle is received from the server then enlarging the file beyond
2296 2GB-1 might result in inconsistent behaviour by the server, since it(server) would
2297 not be able to handle files of size greater than 2GB-1.
2299 If a RFile64 handle is received from the server then enlarging the file beyond
2300 2GB-1 should not cause any issues since the server would be capable of
2301 handling files of size greater than 2GB-1.
2303 This RFile or RFile64 will own it's RFs session so that when the sub-session (RFile or RFile64)
2304 is closed so will the RFs session.
2306 @param aFsHandle The file server session (RFs) handle
2307 @param aFileHandle The file (RFile or RFile64) handle of the already opened file
2309 @return KErrNone if successful, otherwise one of the other system-wide
2312 EFSRV_EXPORT_C TInt RFile64::AdoptFromServer(TInt aFsHandle, TInt aFileHandle)
2314 TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromServer, MODULEUID, aFsHandle, aFileHandle);
2317 TInt r = fs.SetReturnedHandle(aFsHandle, KFileServerPolicy);
2320 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromServerReturn, MODULEUID, r);
2324 //return(CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(aFileHandle)));
2325 // Slot 1: Indicate Large File Supportis required.
2326 r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(aFileHandle, KFileAdopt64));
2328 TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromServerReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
2335 Allows a server to adopt an already open file from a client process.
2336 The client's file-server (RFs) and file (RFile or RFile64) handles are contained in
2337 this process's environment data slots.
2339 Assumes that the client's RFs and RFile or RFile64 handles have been sent to the server process
2340 using TransferToProcess().
2342 This is equivalent to calling RFile::AdoptFromCreator
2343 except that the file adopted can be enlarged to sizes beyond 2GB-1.
2346 If a RFile handle is received from the client then enlarging the file beyond
2347 2GB-1 might result in inconsistent behaviour by the client, since it(client) would
2348 not be able to handle files of size greater than 2GB-1.
2350 If a RFile64 handle is received from the client then enlarging the file beyond
2351 2GB-1 should not cause any issues since the client would be capable of
2352 handling files of size greater than 2GB-1.
2354 This RFile or RFile64 will own it's RFs session so that when the sub-session (RFile or RFile64)
2355 is closed so will the RFs session.
2357 @param aFsHandleIndex An index that identifies the slot in the process
2358 environment data that contains the file server session (RFs) handle
2359 @param aFileHandleIndex An index that identifies the slot in the process
2360 environment data that contains the sub-session (RFile or RFile64) handle
2361 of the already opened file
2363 @return KErrNone if successful, otherwise one of the other system-wide
2366 EFSRV_EXPORT_C TInt RFile64::AdoptFromCreator(TInt aFsHandleIndex, TInt aFileHandleIndex)
2369 TInt r = User::GetTIntParameter(aFileHandleIndex, fileHandle);
2371 TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreator, MODULEUID, fileHandle, aFsHandleIndex, aFileHandleIndex);
2375 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreatorReturn, MODULEUID, r);
2380 // Duplicates the file server (RFs) session handle identified by an
2381 // existing handle contained in the environment slot at index aFsHandleIndex
2383 r = fs.Open(aFsHandleIndex, KFileServerPolicy);
2386 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreatorReturn, MODULEUID, r);
2390 //return(CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle)));
2391 // Slot 1: Indicate Large File Supportis required.
2392 r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle, KFileAdopt64));
2394 TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreatorReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
2401 Reads from the file at the specified offset within the file
2403 This is a synchronous function.
2405 This is equivalent to calling RFile::Read(TInt, TDes8&) except that this function
2406 accepts TInt64, instead of TInt, as its first parameter. This allows to specify
2407 the read position beyond 2GB-1.
2409 @see RFile::Read(TInt aPos, TDes8& aDes)
2411 Note that when an attempt is made to read beyond the end of the file,
2412 no error is returned.
2413 The descriptor's length is set to the number of bytes read into it.
2414 Therefore, when reading through a file, the end of file has been reached
2415 when the descriptor length, as returned by TDesC8::Length(), is zero.
2417 @param aPos Position of first byte to be read. This is an offset from
2418 the start of the file. If no position is specified, reading
2419 begins at the current file position.
2420 If aPos is beyond the end of the file, the function returns
2421 a zero length descriptor.
2423 @param aDes The descriptor into which binary data is read. Any existing content
2424 is overwritten. On return, its length is set to the number of
2427 @return KErrNone if successful, otherwise one of the other system-wide error
2430 @panic FSCLIENT 19 if aPos is negative.
2432 EFSRV_EXPORT_C TInt RFile64::Read(TInt64 aPos, TDes8& aDes) const
2434 TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileRead3, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aDes.MaxLength());
2436 __ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
2439 if (!(I64HIGH(aPos+1)))
2441 r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),I64LOW(aPos)));
2445 TPckgC<TInt64> pkPos(aPos);
2446 r = SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.MaxLength(),&pkPos));
2449 TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead3Return, MODULEUID, r, aDes.Length());
2456 Reads from the file at the specified offset within the file.
2458 This is an asynchronous function.
2460 This is equivalent to calling RFile::Read(TInt, TDes8&, TRequestStatus&) except
2461 that this function accepts TInt64, instead of TInt, as its first parameter.
2462 This allows to specify the read position beyond 2GB-1.
2464 @see RFile::Read(TInt aPos, TDes8& aDes, TRequestStatus& aStatus)
2466 Note that when an attempt is made to read beyond the end of the file,
2467 no error is returned.
2468 The descriptor's length is set to the number of bytes read into it.
2469 Therefore, when reading through a file, the end of file has been reached
2470 when the descriptor length, as returned by TDesC8::Length(), is zero.
2472 @param aPos Position of first byte to be read. This is an offset from
2473 the start of the file. If no position is specified,
2474 reading begins at the current file position.
2475 If aPos is beyond the end of the file, the function returns
2476 a zero length descriptor.
2478 @param aDes The descriptor into which binary data is read. Any existing
2479 content is overwritten. On return, its length is set to
2480 the number of bytes read.
2481 NB: this function is asynchronous and the request that it
2482 represents may not complete until some time after the call
2483 to the function has returned. It is important, therefore, that
2484 this descriptor remain valid, or remain in scope, until you have
2485 been notified that the request is complete.
2487 @param aStatus The request status. On completion, contains an error code of KErrNone
2488 if successful, otherwise one of the other system-wide error codes.
2490 @panic FSCLIENT 19 if aPos is negative.
2492 EFSRV_EXPORT_C void RFile64::Read(TInt64 aPos, TDes8& aDes, TRequestStatus& aStatus) const
2494 TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileRead4, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aDes.MaxLength(), &aStatus);
2496 __ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
2497 if (!(I64HIGH(aPos+1)))
2499 RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),I64LOW(aPos)),aStatus);
2503 TPckgC<TInt64> pkPos(aPos);
2504 RSubSessionBase::SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.MaxLength(),&pkPos),aStatus);
2507 TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead4Return, MODULEUID);
2512 Reads the specified number of bytes of binary data from the file at a specified
2513 offset within the file.
2515 This is a synchronous function.
2517 This is equivalent to calling RFile::Read(TInt, TDes8&, TInt) except
2518 that this function accepts TInt64, instead of TInt, as its first parameter.
2519 This allows to specify the read position beyond 2GB-1.
2521 @see RFile::Read(TInt aPos, TDes8& aDes, TInt aLength)
2523 Note that when an attempt is made to read beyond the end of the file,
2524 no error is returned.
2525 The descriptor's length is set to the number of bytes read into it.
2526 Therefore, when reading through a file, the end of file has been reached
2527 when the descriptor length, as returned by TDesC8::Length(), is zero.
2528 Assuming aLength is less than the maximum length of the descriptor, the only
2529 circumstances in which Read() can return fewer bytes than requested is when
2530 the end of file is reached or if an error has occurred.
2532 @param aPos Position of first byte to be read. This is an offset from
2533 the start of the file. If no position is specified,
2534 reading begins at the current file position.
2535 If aPos is beyond the end of the file, the function returns
2536 a zero length descriptor.
2538 @param aDes The descriptor into which binary data is read. Any existing
2539 contents are overwritten. On return, its length is set to
2540 the number of bytes read.
2541 @param aLength The number of bytes to read from the file into the descriptor.
2542 If an attempt is made to read more bytes than the descriptor's
2543 maximum length, then the function updates aStatus parameter with KErrOverflow.
2544 It must not be negative otherwise the function updates aStatus with KErrArgument.
2546 @return KErrNone if successful, otherwise one of the other system-wide
2549 @panic FSCLIENT 19 if aPos is negative.
2551 EFSRV_EXPORT_C TInt RFile64::Read(TInt64 aPos, TDes8& aDes, TInt aLength) const
2553 TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileRead3, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aLength);
2555 __ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
2561 else if(aLength>aDes.MaxLength())
2563 return(KErrOverflow);
2567 if (!(I64HIGH(aPos+1)))
2569 r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,I64LOW(aPos)));
2573 TPckgC<TInt64> pkPos(aPos);
2574 r = SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos));
2577 TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead3Return, MODULEUID, r, aDes.Length());
2584 Reads the specified number of bytes of binary data from the file at a specified
2585 offset within the file.
2587 This is an asynchronous function.
2589 This is equivalent to calling RFile::Read(TInt, TDes8&, TInt, TRequestStatus&) except
2590 that this function accepts TInt64, instead of TInt, as its first parameter.
2591 This allows to specify the read position beyond 2GB-1.
2593 @see RFile::Read(TInt aPos, TDes8& aDes,TInt aLength,TRequestStatus& aStatus)
2595 Note that when an attempt is made to read beyond the end of the file,
2596 no error is returned.
2597 The descriptor's length is set to the number of bytes read into it.
2598 Therefore, when reading through a file, the end of file has been reached
2599 when the descriptor length, as returned by TDesC8::Length(), is zero.
2600 Assuming aLength is less than the maximum length of the descriptor, the only
2601 circumstances in which Read() can return fewer bytes than requested is when
2602 the end of file is reached or if an error has occurred.
2604 @param aPos Position of first byte to be read. This is an offset from
2605 the start of the file. If no position is specified,
2606 reading begins at the current file position.
2607 If aPos is beyond the end of the file, the function returns
2608 a zero length descriptor.
2610 @param aDes The descriptor into which binary data is read. Any existing
2611 contents are overwritten. On return, its length is set to
2612 the number of bytes read.
2613 NB: this function is asynchronous and the request that it
2614 represents may not complete until some time after the call
2615 to the function has returned. It is important, therefore, that
2616 this descriptor remain valid, or remain in scope, until you have
2617 been notified that the request is complete.
2619 @param aLength The number of bytes to read from the file into the descriptor.
2620 If an attempt is made to read more bytes than the descriptor's
2621 maximum length, then the function returns KErrOverflow.
2622 It must not be negative otherwise the function returns KErrArgument.
2624 @param aStatus Request status. On completion contains KErrNone if successful,
2625 otherwise one of the other system-wide error codes.
2627 @panic FSCLIENT 19 if aPos is negative.
2629 EFSRV_EXPORT_C void RFile64::Read(TInt64 aPos, TDes8& aDes, TInt aLength,TRequestStatus& aStatus) const
2631 TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileRead4, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aLength, &aStatus);
2633 __ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
2637 TRequestStatus* req=(&aStatus);
2638 User::RequestComplete(req,KErrNone);
2641 else if(aLength>aDes.MaxLength())
2643 TRequestStatus* req=(&aStatus);
2644 User::RequestComplete(req,KErrOverflow);
2648 if (!(I64HIGH(aPos+1)))
2650 RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,I64LOW(aPos)),aStatus);
2654 TPckgC<TInt64> pkPos(aPos);
2655 RSubSessionBase::SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos),aStatus);
2658 TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead4Return, MODULEUID);
2663 Writes to the file at the specified offset within the file
2665 This is a synchronous function.
2667 This is equivalent to calling RFile::Write(TInt, TDes8&) except
2668 that this function accepts TInt64, instead of TInt, as its first parameter.
2669 This allows to specify the write position beyond 2GB-1.
2671 @see RFile::Write(TInt aPos, TDes8& aDes)
2674 @param aPos The offset from the start of the file at which the first
2676 If a position beyond the end of the file is specified, then
2677 the write operation begins at the end of the file.
2678 If the position has been locked, then the write fails.
2680 @param aDes The descriptor from which binary data is written. The function writes
2681 the entire contents of aDes to the file.
2683 @return KErrNone if successful, otherwise one of the other system-wide error
2686 @panic FSCLIENT 19 if aPos is negative.
2688 EFSRV_EXPORT_C TInt RFile64::Write(TInt64 aPos, const TDesC8& aDes)
2690 TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileWrite3, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aDes.Length());
2692 __ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
2695 if (!(I64HIGH(aPos+1)))
2697 r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),I64LOW(aPos)));
2701 TPckgC<TInt64> pkPos(aPos);
2702 r = SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.Length(),&pkPos));
2705 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite3Return, MODULEUID, r);
2711 Writes to the file at the specified offset within the file
2713 This is an asynchronous function.
2715 This is equivalent to calling RFile::Write(TInt, TDes8&, TRequestStatus&) except
2716 that this function accepts TInt64, instead of TInt, as its first parameter.
2717 This allows to specify the write position beyond 2GB-1.
2719 @see RFile::Write(TInt aPos, TDes8& aDes, TRequestStatus& aStatus)
2722 @param aPos The offset from the start of the file at which the first
2724 If a position beyond the end of the file is specified, then
2725 the write operation begins at the end of the file.
2726 If the position has been locked, then the write fails.
2728 @param aDes The descriptor from which binary data is written. The function
2729 writes the entire contents of aDes to the file.
2730 NB: this function is asynchronous and the request that it
2731 represents may not complete until some time after the call
2732 to the function has returned. It is important, therefore, that
2733 this descriptor remain valid, or remain in scope, until you have
2734 been notified that the request is complete.
2736 @param aStatus Request status. On completion contains KErrNone if successful,
2737 otherwise one of the other system-wide error codes.
2739 @panic FSCLIENT 19 if aPos is negative.
2741 EFSRV_EXPORT_C void RFile64::Write(TInt64 aPos, const TDesC8& aDes,TRequestStatus& aStatus)
2743 TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileWrite4, MODULEUID, Session().Handle(), SubSessionHandle(), aDes.Length(), &aStatus);
2745 __ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
2747 if (!(I64HIGH(aPos+1)))
2749 RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),I64LOW(aPos)),aStatus);
2753 TPckgC<TInt64> pkPos(aPos);
2754 RSubSessionBase::SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.Length(),&pkPos),aStatus);
2757 TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite4Return, MODULEUID);
2762 Writes the specified number of bytes to the file at the specified offset within the file.
2764 This is a synchronous function.
2766 This is equivalent to calling RFile::Write(TInt, TDes8&, TInt) except
2767 that this function accepts TInt64, instead of TInt, as its first parameter.
2768 This allows to specify the write position beyond 2GB-1.
2770 @see RFile::Write(TInt aPos, TDes8& aDes, TInt aLength)
2772 @param aPos The offset from the start of the file at which the first
2774 If a position beyond the end of the file is specified, then
2775 the write operation begins at the end of the file.
2776 If the position has been locked, then the write fails.
2778 @param aDes The descriptor from which binary data is written.
2779 @param aLength The number of bytes to be written from aDes .
2780 It must not be negative.
2782 @return KErrNone if successful; KErrArgument if aLength is negative;
2783 otherwise one of the other system-wide error codes.
2785 @panic FSCLIENT 19 if aPos is negative.
2787 EFSRV_EXPORT_C TInt RFile64::Write(TInt64 aPos, const TDesC8& aDes,TInt aLength)
2789 TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1, MODULEUID, Session().Handle(), SubSessionHandle(), aLength);
2791 __ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
2794 if (!(I64HIGH(aPos+1)))
2796 r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,I64LOW(aPos)));
2800 TPckgC<TInt64> pkPos(aPos);
2801 r = SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos));
2804 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1Return, MODULEUID, r);
2810 Writes the specified number of bytes to the file at the specified offset within the file.
2812 This is an asynchronous function.
2814 This is equivalent to calling RFile::Write(TInt, TDes8&, TInt, TRequestStatus&) except
2815 that this function accepts TInt64, instead of TInt, as its first parameter.
2816 This allows to specify the write position beyond 2GB-1.
2818 @see RFile::Write(TInt aPos, TDes8& aDes, TInt aLength, TRequestStatus &aStatus)
2820 @param aPos The offset from the start of the file at which the first
2822 If a position beyond the end of the file is specified, then
2823 the write operation begins at the end of the file.
2824 If the position has been locked, then the write fails.
2826 @param aDes The descriptor from which binary data is written.
2827 NB: this function is asynchronous and the request that it
2828 represents may not complete until some time after the call
2829 to the function has returned. It is important, therefore, that
2830 this descriptor remain valid, or remain in scope, until you have
2831 been notified that the request is complete.
2833 @param aLength The number of bytes to be written from aDes.
2834 It must not be negative.
2836 @param aStatus Request status. On completion contains KErrNone if successful;
2837 KErrArgument if aLength is negative;
2838 otherwise one of the other system-wide error codes.
2840 @panic FSCLIENT 19 if aPos is negative.
2842 EFSRV_EXPORT_C void RFile64::Write(TInt64 aPos, const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus)
2844 TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aLength, &aStatus);
2846 __ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
2848 if (!(I64HIGH(aPos+1)))
2850 RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,I64LOW(aPos)),aStatus);
2854 TPckgC<TInt64> pkPos(aPos);
2855 RSubSessionBase::SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos),aStatus);
2858 TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2Return, MODULEUID);
2863 Sets the the current file position.
2865 The function can also be used to get the current file
2866 position without changing it. The file position is the position at which
2867 reading and writing takes place. The start of the file is position zero.
2869 To retrieve the current file position without changing it, specify ESeekCurrent
2870 for the seek mode, and zero for the offset.
2872 This is equivalent to calling RFile::Seek except that this function accepts
2873 a reference to TInt64, instead of TInt, as its second parameter.
2874 This allows to seek to positions beyond 2GB-1.
2878 If the seek mode is ESeekStart, then:
2880 1. the function does not modify the aPos argument,
2882 2. the function returns an error if the offset specified is negative.
2884 If the seek mode is ESeekAddress, an error is returned if:
2886 1. the file is not in ROM,
2888 2. the offset specified is greater than the size of the file.
2890 @param aMode Seek mode. Controls the destination of the seek operation.
2891 @param aPos Offset from location specified in aMode. Can be negative.
2892 On return contains the new file position.
2893 If the seek mode is either ESeekCurrent or ESeekEnd and the offset
2894 specifies a position before the start of the file
2895 or beyond the end of the file, then on return, aPos is set to
2896 the new file position (either the start or the end of the file).
2897 If the seek mode is ESeekAddress, aPos returns the address of
2898 the byte at the specified offset within the file.
2900 @return KErrNone if successful, otherwise one of the other system-wide error
2903 EFSRV_EXPORT_C TInt RFile64::Seek(TSeek aMode, TInt64& aPos) const
2905 TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileSeek, MODULEUID, Session().Handle(), SubSessionHandle(), aMode, aPos, 0);
2907 TPckgC<TInt64> pkOffset(aPos);
2908 TPckg<TInt64> pkNewPos(aPos);
2909 TInt r = SendReceive(EFsFileSeek|KIpcArgSlot0Desc|KIpcArgSlot2Desc,TIpcArgs(&pkOffset,aMode,&pkNewPos));
2911 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileSeekReturn, MODULEUID, r);
2917 Gets the current file size.
2919 This is equivalent to calling RFile::Size except that this function accepts
2920 a reference to TInt64, instead of TInt, as its first parameter.
2921 This allows to query file sizes, which are greater than 2GB-1
2926 @param aSize On return, the size of the file in bytes.
2928 @return KErrNone if successful, otherwise one of the other system-wide error
2931 EFSRV_EXPORT_C TInt RFile64::Size(TInt64& aSize) const
2933 TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileSize2, MODULEUID, Session().Handle(), SubSessionHandle());
2935 TPckg<TInt64> pkSize(aSize);
2936 TInt r = SendReceive(EFsFileSize|KIpcArgSlot0Desc,TIpcArgs(&pkSize));
2938 TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileSize2Return, MODULEUID, r, I64LOW(aSize), I64HIGH(aSize));
2946 If the size of the file is reduced, data may be lost from
2947 the end of the file.
2949 This is equivalent to calling RFile::SetSize except that this function accepts
2950 a reference to TInt64, instead of TInt, as its first parameter.
2951 This allows to set file sizes to greater than 2GB-1
2953 @see RFile::SetSize()
2958 1. The current file position remains unchanged unless SetSize() reduces the size
2959 of the file in such a way that the current file position is now beyond
2960 the end of the file. In this case, the current file position is set to
2963 2. If the file was not opened for writing, an error is returned.
2965 @param aSize The new size of the file, in bytes. This value must not be negative, otherwise the function raises a panic.
2967 @return KErrNone if successful, otherwise one of the other system-wide error
2970 @panic FSCLIENT 20 If aSize is negative.
2972 EFSRV_EXPORT_C TInt RFile64::SetSize(TInt64 aSize)
2974 TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileSetSize, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aSize), I64HIGH(aSize));
2976 TPckgC<TInt64> pkSize(aSize);
2977 TInt r = SendReceive(EFsFileSetSize|KIpcArgSlot0Desc, TIpcArgs(&pkSize));
2979 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileSetSizeReturn, MODULEUID, r);
2985 Locks a region within the file as defined by a range of bytes.
2987 This ensures that those bytes are accessible
2988 only through the RFile object which claims the lock. To re-allow access by
2989 other programs to the locked region, it must either be unlocked or the file
2990 closed. Locking can be used to synchronize operations on a file when more
2991 than one program has access to the file in EFileShareAny mode.
2993 More than one distinct region of a file can be locked, but an error is returned
2994 if more than one lock is placed on the same region. Different RFile objects
2995 can lock different parts of the same file as long as the file is opened in
2996 EFileShareAny mode. The locked region may extend beyond the end of a file;
2997 this prevents the file from being extended by other programs.
2999 This is equivalent to calling RFile::Lock except that this function accepts
3000 TInt64 parameters instead of TInt parameters.
3001 This allows to to lock positions in file beyond 2GB-1.
3005 @param aPos Position in file from which to lock; this is the offset from
3006 the beginning of the file.
3007 @param aLength Number of bytes to lock.
3009 @return KErrNone if successful, otherwise one of the other system-wide error
3012 @panic FSCLIENT 17 if aLength is not greater than zero,
3014 EFSRV_EXPORT_C TInt RFile64::Lock(TInt64 aPos, TInt64 aLength) const
3016 TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileLock, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aLength);
3018 __ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
3019 TPckgC<TInt64> pkPos(aPos);
3020 TPckgC<TInt64> pkLength(aLength);
3024 if(aPos <= KMaxTInt && aLength <= KMaxTInt)
3025 r = SendReceive(EFsFileLock,TIpcArgs(I64LOW(aPos), I64LOW(aLength)));
3026 else if(aPos <= KMaxTInt)
3027 r = SendReceive(EFsFileLock|KIpcArgSlot1Desc,TIpcArgs(I64LOW(aPos), &pkLength));
3028 else if(aLength <= KMaxTInt)
3029 r = SendReceive(EFsFileLock|KIpcArgSlot0Desc,TIpcArgs(&pkPos, I64LOW(aLength)));
3031 r = SendReceive(EFsFileLock|KIpcArgSlot0Desc|KIpcArgSlot1Desc,TIpcArgs(&pkPos, &pkLength));
3032 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileLockReturn, MODULEUID, r);
3038 Unlocks a region within the file as defined by a range of bytes.
3040 A lock can only be removed by the RFile object which claimed the lock.
3042 A portion of a locked region cannot be unlocked. The entire locked region
3043 must be unlocked otherwise an error is returned. If any byte within
3044 the specified range of bytes to unlock is not locked, an error is returned.
3046 This is equivalent to calling RFile::UnLock except that this function accepts
3047 TInt64 parameters instead of TInt parameters.
3048 This allows to to unlock positions in file beyond 2GB-1.
3050 @see RFile::UnLock()
3052 @param aPos Position in file from which to unlock; this is the offset from
3053 the beginning of the file.
3054 @param aLength Number of bytes to unlock.
3056 @return KErrNone if successful, otherwise one of the other system-wide error
3059 @panic FSCLIENT 18 if aLength is not greater than zero,
3061 EFSRV_EXPORT_C TInt RFile64::UnLock(TInt64 aPos, TInt64 aLength) const
3063 TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileUnLock, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aLength);
3065 __ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
3067 TPckgC<TInt64> pkPos(aPos);
3068 TPckgC<TInt64> pkLength(aLength);
3072 if(aPos <= KMaxTInt && aLength <= KMaxTInt)
3073 r = SendReceive(EFsFileUnLock,TIpcArgs(I64LOW(aPos), I64LOW(aLength)));
3074 else if(aPos <= KMaxTInt)
3075 r = SendReceive(EFsFileUnLock|KIpcArgSlot1Desc,TIpcArgs(I64LOW(aPos), &pkLength));
3076 else if(aLength <= KMaxTInt)
3077 r = SendReceive(EFsFileUnLock|KIpcArgSlot0Desc,TIpcArgs(&pkPos, I64LOW(aLength)));
3079 r = SendReceive(EFsFileUnLock|KIpcArgSlot0Desc|KIpcArgSlot1Desc,TIpcArgs(&pkPos, &pkLength));
3081 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileUnLockReturn, MODULEUID, r);
3087 Reads from the file at the specified offset within the file
3089 This is a synchronous function.
3091 This is equivalent to calling RFile::Read(TInt, TDes8&) or RFile64::Read(TInt64, TDes8&)
3092 except that this function accepts TUint, instead of TInt or TInt64, as its first parameter.
3094 This function is provided for gradual migration of a client from 32-bit RFile APIs
3095 to 64-bit RFile64 APIs. It is protected under _F32_STRICT_64_BIT_MIGRATION
3096 macro. If the macro is defined, then it hides this overload, which would then throw
3097 compile-time errors for any user code that uses TUint parameter for RFile64::Read.
3100 @see RFile::Read(TInt aPos, TDes8& aDes)
3101 @see RFile64::Read(TInt aPos, TDes8& aDes)
3103 Note that when an attempt is made to read beyond the end of the file,
3104 no error is returned.
3105 The descriptor's length is set to the number of bytes read into it.
3106 Therefore, when reading through a file, the end of file has been reached
3107 when the descriptor length, as returned by TDesC8::Length(), is zero.
3109 @param aPos Position of first byte to be read. This is an offset from
3110 the start of the file. If no position is specified, reading
3111 begins at the current file position.
3112 If aPos is beyond the end of the file, the function returns
3113 a zero length descriptor.
3115 @param aDes The descriptor into which binary data is read. Any existing content
3116 is overwritten. On return, its length is set to the number of
3119 @return KErrNone if successful, otherwise one of the other system-wide error
3123 EFSRV_EXPORT_C TInt RFile64::Read(TUint aPos,TDes8& aDes) const
3125 TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileRead3, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.MaxLength());
3130 r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),aPos));
3135 TPckgC<TInt64> pkPos(pos);
3136 r = SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.MaxLength(),&pkPos));
3139 TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead3Return, MODULEUID, r, aDes.Length());
3146 Reads from the file at the specified offset within the file.
3148 This is an asynchronous function.
3150 This is equivalent to calling RFile::Read(TInt, TDes8&, TRequestStatus&) or
3151 RFile64::Read(TInt64, TDes8&, TRequestStatus&) except that this function
3152 accepts TUint, instead of TInt or TInt64, as its first parameter.
3154 This function is provided for gradual migration of a client from 32-bit RFile APIs
3155 to 64-bit RFile64 APIs. It is protected under _F32_STRICT_64_BIT_MIGRATION
3156 macro. If the macro is defined, then it hides this overload, which would then throw
3157 compile-time errors for any user code that uses TUint parameter for RFile64::Read.
3159 @see RFile::Read(TInt aPos, TDes8& aDes, TRequestStatus& aStatus)
3160 @see RFile64::Read(TInt aPos, TDes8& aDes, TRequestStatus& aStatus)
3162 Note that when an attempt is made to read beyond the end of the file,
3163 no error is returned.
3164 The descriptor's length is set to the number of bytes read into it.
3165 Therefore, when reading through a file, the end of file has been reached
3166 when the descriptor length, as returned by TDesC8::Length(), is zero.
3168 @param aPos Position of first byte to be read. This is an offset from
3169 the start of the file. If no position is specified,
3170 reading begins at the current file position.
3171 If aPos is beyond the end of the file, the function returns
3172 a zero length descriptor.
3174 @param aDes The descriptor into which binary data is read. Any existing
3175 content is overwritten. On return, its length is set to
3176 the number of bytes read.
3177 NB: this function is asynchronous and the request that it
3178 represents may not complete until some time after the call
3179 to the function has returned. It is important, therefore, that
3180 this descriptor remain valid, or remain in scope, until you have
3181 been notified that the request is complete.
3183 @param aStatus The request status. On completion, contains an error code of KErrNone
3184 if successful, otherwise one of the other system-wide error codes.
3187 EFSRV_EXPORT_C void RFile64::Read(TUint aPos,TDes8& aDes,TRequestStatus& aStatus) const
3189 TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileRead4, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.MaxLength(), &aStatus);
3193 RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),aPos),aStatus);
3198 TPckgC<TInt64> pkPos(pos);
3199 RSubSessionBase::SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.MaxLength(),&pkPos),aStatus);
3202 TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead4Return, MODULEUID);
3207 Reads the specified number of bytes of binary data from the file at a specified
3208 offset within the file.
3210 This is a synchronous function.
3212 This is equivalent to calling RFile::Read(TInt, TDes8&, TInt) or
3213 RFile64::Read(TInt64, TDes8&, TInt) except that this function
3214 accepts TUint, instead of TInt or TInt64, as its first parameter.
3216 This function is provided for gradual migration of a client from 32-bit RFile APIs
3217 to 64-bit RFile64 APIs. It is protected under _F32_STRICT_64_BIT_MIGRATION
3218 macro. If the macro is defined, then it hides this overload, which would then throw
3219 compile-time errors for any user code that uses TUint parameter for RFile64::Read.
3222 @see RFile::Read(TInt aPos, TDes8& aDes,TInt aLength)
3223 @see RFile64::Read(TInt aPos, TDes8& aDes,TInt aLength)
3225 Note that when an attempt is made to read beyond the end of the file,
3226 no error is returned.
3227 The descriptor's length is set to the number of bytes read into it.
3228 Therefore, when reading through a file, the end of file has been reached
3229 when the descriptor length, as returned by TDesC8::Length(), is zero.
3230 Assuming aLength is less than the maximum length of the descriptor, the only
3231 circumstances in which Read() can return fewer bytes than requested is when
3232 the end of file is reached or if an error has occurred.
3234 @param aPos Position of first byte to be read. This is an offset from
3235 the start of the file. If no position is specified,
3236 reading begins at the current file position.
3237 If aPos is beyond the end of the file, the function returns
3238 a zero length descriptor.
3240 @param aDes The descriptor into which binary data is read. Any existing
3241 contents are overwritten. On return, its length is set to
3242 the number of bytes read.
3243 @param aLength The number of bytes to read from the file into the descriptor.
3244 If an attempt is made to read more bytes than the descriptor's
3245 maximum length, then the function updates aStatus parameter with KErrOverflow.
3246 It must not be negative otherwise the function updates aStatus with KErrArgument.
3248 @return KErrNone if successful, otherwise one of the other system-wide
3252 EFSRV_EXPORT_C TInt RFile64::Read(TUint aPos,TDes8& aDes,TInt aLength) const
3254 TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileRead3, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength);
3261 else if(aLength>aDes.MaxLength())
3263 return(KErrOverflow);
3269 r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,aPos));
3274 TPckgC<TInt64> pkPos(pos);
3275 r = SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos));
3278 TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead3Return, MODULEUID, r, aDes.Length());
3285 Reads the specified number of bytes of binary data from the file at a specified
3286 offset within the file.
3288 This is an asynchronous function.
3290 This is equivalent to calling RFile::Read(TInt, TDes8&, TInt,TRequestStatus&) or
3291 RFile64::Read(TInt64, TDes8&, TInt, TRequestStatus&) except that this function
3292 accepts TUint, instead of TInt or TInt64, as its first parameter.
3294 This function is provided for gradual migration of a client from 32-bit RFile APIs
3295 to 64-bit RFile64 APIs. It is protected under _F32_STRICT_64_BIT_MIGRATION
3296 macro. If the macro is defined, then it hides this overload, which would then throw
3297 compile-time errors for any user code that uses TUint parameter for RFile64::Read.
3300 @see RFile::Read(TInt aPos, TDes8& aDes,TInt aLength,TRequestStatus& aStatus)
3301 @see RFile64::Read(TInt aPos, TDes8& aDes,TInt aLength,TRequestStatus& aStatus)
3303 Note that when an attempt is made to read beyond the end of the file,
3304 no error is returned.
3305 The descriptor's length is set to the number of bytes read into it.
3306 Therefore, when reading through a file, the end of file has been reached
3307 when the descriptor length, as returned by TDesC8::Length(), is zero.
3308 Assuming aLength is less than the maximum length of the descriptor, the only
3309 circumstances in which Read() can return fewer bytes than requested is when
3310 the end of file is reached or if an error has occurred.
3312 @param aPos Position of first byte to be read. This is an offset from
3313 the start of the file. If no position is specified,
3314 reading begins at the current file position.
3315 If aPos is beyond the end of the file, the function returns
3316 a zero length descriptor.
3318 @param aDes The descriptor into which binary data is read. Any existing
3319 contents are overwritten. On return, its length is set to
3320 the number of bytes read.
3321 NB: this function is asynchronous and the request that it
3322 represents may not complete until some time after the call
3323 to the function has returned. It is important, therefore, that
3324 this descriptor remain valid, or remain in scope, until you have
3325 been notified that the request is complete.
3327 @param aLength The number of bytes to read from the file into the descriptor.
3328 If an attempt is made to read more bytes than the descriptor's
3329 maximum length, then the function returns KErrOverflow.
3330 It must not be negative otherwise the function returns KErrArgument.
3332 @param aStatus Request status. On completion contains KErrNone if successful,
3333 otherwise one of the other system-wide error codes.
3336 EFSRV_EXPORT_C void RFile64::Read(TUint aPos,TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const
3338 TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileRead4, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength, &aStatus);
3343 TRequestStatus* req=(&aStatus);
3344 User::RequestComplete(req,KErrNone);
3347 else if(aLength>aDes.MaxLength())
3349 TRequestStatus* req=(&aStatus);
3350 User::RequestComplete(req,KErrOverflow);
3356 RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,aPos),aStatus);
3361 TPckgC<TInt64> pkPos(pos);
3362 RSubSessionBase::SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos),aStatus);
3365 TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead4Return, MODULEUID);
3370 Writes to the file at the specified offset within the file
3372 This is a synchronous function.
3374 This is equivalent to calling RFile::Write(TInt, TDes8&) or
3375 RFile64::Write(TInt64, TDes8&) except that this function
3376 accepts TUint, instead of TInt or TInt64, as its first parameter.
3378 This function is provided for gradual migration of a client from 32-bit RFile APIs
3379 to 64-bit RFile64 APIs. It is protected under _F32_STRICT_64_BIT_MIGRATION
3380 macro. If the macro is defined, then it hides this overload, which would then throw
3381 compile-time errors for any user code that uses TUint parameter for RFile64::Read.
3384 @see RFile::Write(TInt aPos, TDes8& aDes)
3385 @see RFile64::Write(TInt aPos, TDes8& aDes)
3388 @param aPos The offset from the start of the file at which the first
3390 If a position beyond the end of the file is specified, then
3391 the write operation begins at the end of the file.
3392 If the position has been locked, then the write fails.
3394 @param aDes The descriptor from which binary data is written. The function writes
3395 the entire contents of aDes to the file.
3397 @return KErrNone if successful, otherwise one of the other system-wide error
3401 EFSRV_EXPORT_C TInt RFile64::Write(TUint aPos,const TDesC8& aDes)
3403 TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileWrite3, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.Length());
3408 r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),aPos));
3413 TPckgC<TInt64> pkPos(pos);
3414 r = SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.Length(),&pkPos));
3417 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite3Return, MODULEUID, r);
3423 Writes to the file at the specified offset within the file
3425 This is an asynchronous function.
3427 This is equivalent to calling RFile::Write(TInt, TDes8&,TRequestStatus&) or
3428 RFile64::Write(TInt64, TDes8&,TRequestStatus&) except that this function
3429 accepts TUint, instead of TInt or TInt64, as its first parameter.
3431 This function is provided for gradual migration of a client from 32-bit RFile APIs
3432 to 64-bit RFile64 APIs. It is protected under _F32_STRICT_64_BIT_MIGRATION
3433 macro. If the macro is defined, then it hides this overload, which would then throw
3434 compile-time errors for any user code that uses TUint parameter for RFile64::Read.
3437 @see RFile::Write(TInt aPos, TDes8& aDes,TRequestStatus& aStatus)
3438 @see RFile64::Write(TInt aPos, TDes8& aDes,TRequestStatus& aStatus)
3441 @param aPos The offset from the start of the file at which the first
3443 If a position beyond the end of the file is specified, then
3444 the write operation begins at the end of the file.
3445 If the position has been locked, then the write fails.
3447 @param aDes The descriptor from which binary data is written. The function
3448 writes the entire contents of aDes to the file.
3449 NB: this function is asynchronous and the request that it
3450 represents may not complete until some time after the call
3451 to the function has returned. It is important, therefore, that
3452 this descriptor remain valid, or remain in scope, until you have
3453 been notified that the request is complete.
3455 @param aStatus Request status. On completion contains KErrNone if successful,
3456 otherwise one of the other system-wide error codes.
3459 EFSRV_EXPORT_C void RFile64::Write(TUint aPos,const TDesC8& aDes,TRequestStatus& aStatus)
3461 TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileWrite4, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.Length(), &aStatus);
3465 RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),aPos),aStatus);
3470 TPckgC<TInt64> pkPos(pos);
3471 RSubSessionBase::SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.Length(),&pkPos),aStatus);
3473 TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite4Return, MODULEUID);
3478 Writes the specified number of bytes to the file at the specified offset within the file.
3480 This is a synchronous function.
3482 This is equivalent to calling RFile::Write(TInt, TDes8&,TInt) or
3483 RFile64::Write(TInt64, TDes8&,TInt) except that this function
3484 accepts TUint, instead of TInt or TInt64, as its first parameter.
3486 This function is provided for gradual migration of a client from 32-bit RFile APIs
3487 to 64-bit RFile64 APIs. It is protected under _F32_STRICT_64_BIT_MIGRATION
3488 macro. If the macro is defined, then it hides this overload, which would then throw
3489 compile-time errors for any user code that uses TUint parameter for RFile64::Read.
3492 @see RFile::Write(TInt aPos, TDes8& aDes,TInt aLength)
3493 @see RFile64::Write(TInt aPos, TDes8& aDes,TInt aLength)
3495 @param aPos The offset from the start of the file at which the first
3497 If a position beyond the end of the file is specified, then
3498 the write operation begins at the end of the file.
3499 If the position has been locked, then the write fails.
3501 @param aDes The descriptor from which binary data is written.
3502 @param aLength The number of bytes to be written from aDes .
3503 It must not be negative.
3505 @return KErrNone if successful; KErrArgument if aLength is negative;
3506 otherwise one of the other system-wide error codes.
3509 EFSRV_EXPORT_C TInt RFile64::Write(TUint aPos,const TDesC8& aDes,TInt aLength)
3511 TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1, MODULEUID, Session().Handle(), SubSessionHandle(), aLength);
3516 r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,aPos));
3521 TPckgC<TInt64> pkPos(pos);
3522 r = SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos));
3525 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1Return, MODULEUID, r);
3531 Writes the specified number of bytes to the file at the specified offset within the file.
3533 This is an asynchronous function.
3535 This is equivalent to calling RFile::Write(TInt, TDes8&,TInt,TRequestStatus&) or
3536 RFile64::Write(TInt64, TDes8&,TInt,TRequestStatus&) except that this function
3537 accepts TUint, instead of TInt or TInt64, as its first parameter.
3539 This function is provided for gradual migration of a client from 32-bit RFile APIs
3540 to 64-bit RFile64 APIs. It is protected under _F32_STRICT_64_BIT_MIGRATION
3541 macro. If the macro is defined, then it hides this overload, which would then throw
3542 compile-time errors for any user code that uses TUint parameter for RFile64::Read.
3545 @see RFile::Write(TInt aPos, TDes8& aDes, TInt aLength, TRequestStatus& aStatus)
3546 @see RFile64::Write(TInt aPos, TDes8& aDes,TInt aLength, TRequestStatus& aStatus)
3549 @param aPos The offset from the start of the file at which the first
3551 If a position beyond the end of the file is specified, then
3552 the write operation begins at the end of the file.
3553 If the position has been locked, then the write fails.
3555 @param aDes The descriptor from which binary data is written.
3556 NB: this function is asynchronous and the request that it
3557 represents may not complete until some time after the call
3558 to the function has returned. It is important, therefore, that
3559 this descriptor remain valid, or remain in scope, until you have
3560 been notified that the request is complete.
3562 @param aLength The number of bytes to be written from aDes.
3563 It must not be negative.
3565 @param aStatus Request status. On completion contains KErrNone if successful;
3566 KErrArgument if aLength is negative;
3567 otherwise one of the other system-wide error codes.
3570 EFSRV_EXPORT_C void RFile64::Write(TUint aPos,const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus)
3572 TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength, &aStatus);
3576 RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,aPos),aStatus);
3581 TPckgC<TInt64> pkPos(pos);
3582 RSubSessionBase::SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos),aStatus);
3584 TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2Return, MODULEUID);
3587 EFSRV_EXPORT_C TInt RFile64::Open(RFs& /*aFs*/,const TDesC& /*aName*/,TUint /*aFileMode*/)
3588 {Panic(ENotImplemented);return (KErrNotSupported);}
3589 EFSRV_EXPORT_C TInt RFile64::Create(RFs& /*aFs*/,const TDesC& /*aName*/,TUint /*aFileMode*/)
3590 {Panic(ENotImplemented);return (KErrNotSupported);}
3591 EFSRV_EXPORT_C TInt RFile64::Replace(RFs& /*aFs*/,const TDesC& /*aName*/,TUint /*aFileMode*/)
3592 {Panic(ENotImplemented);return (KErrNotSupported);}
3593 EFSRV_EXPORT_C TInt RFile64::Temp(RFs& /*aFs*/,const TDesC& /*aPath*/,TFileName& /*aName*/,TUint /*aFileMode*/)
3594 {Panic(ENotImplemented);return (KErrNotSupported);}
3595 EFSRV_EXPORT_C TInt RFile64::AdoptFromClient(const RMessage2& /*aMsg*/, TInt /*aFsHandleIndex*/, TInt /*aFileHandleIndex*/)
3596 {Panic(ENotImplemented);return (KErrNotSupported);}
3597 EFSRV_EXPORT_C TInt RFile64::AdoptFromServer(TInt /*aFsHandle*/, TInt /*aFileHandle*/)
3598 {Panic(ENotImplemented);return (KErrNotSupported);}
3599 EFSRV_EXPORT_C TInt RFile64::AdoptFromCreator(TInt /*aFsHandleIndex*/, TInt /*aFileHandleIndex*/)
3600 {Panic(ENotImplemented);return (KErrNotSupported);}
3601 EFSRV_EXPORT_C TInt RFile64::Read(TInt64 /*aPos*/, TDes8& /*aDes*/) const
3602 {Panic(ENotImplemented);return (KErrNotSupported);}
3603 EFSRV_EXPORT_C void RFile64::Read(TInt64 /*aPos*/, TDes8& /*aDes*/, TRequestStatus& /*aStatus*/) const
3604 {Panic(ENotImplemented);}
3605 EFSRV_EXPORT_C TInt RFile64::Read(TInt64 /*aPos*/, TDes8& /*aDes*/, TInt /*aLength*/) const
3606 {Panic(ENotImplemented);return (KErrNotSupported);}
3607 EFSRV_EXPORT_C void RFile64::Read(TInt64 /*aPos*/, TDes8& /*aDes*/, TInt /*aLength*/,TRequestStatus& /*aStatus*/) const
3608 {Panic(ENotImplemented);}
3609 EFSRV_EXPORT_C TInt RFile64::Write(TInt64 /*aPos*/, const TDesC8& /*aDes*/)
3610 {Panic(ENotImplemented);return (KErrNotSupported);}
3611 EFSRV_EXPORT_C void RFile64::Write(TInt64 /*aPos*/, const TDesC8& /*aDes*/,TRequestStatus& /*aStatus*/)
3612 {Panic(ENotImplemented);}
3613 EFSRV_EXPORT_C TInt RFile64::Write(TInt64 /*aPos*/, const TDesC8& /*aDes*/, TInt /*aLength*/)
3614 {Panic(ENotImplemented);return (KErrNotSupported);}
3615 EFSRV_EXPORT_C void RFile64::Write(TInt64 /*aPos*/, const TDesC8& /*aDes*/,TInt /*aLength*/,TRequestStatus& /*aStatus*/)
3616 {Panic(ENotImplemented);}
3617 EFSRV_EXPORT_C TInt RFile64::Seek(TSeek /*aMode*/, TInt64& /*aPos*/) const
3618 {Panic(ENotImplemented);return (KErrNotSupported);}
3619 EFSRV_EXPORT_C TInt RFile64::Size(TInt64& /*aSize*/) const
3620 {Panic(ENotImplemented);return (KErrNotSupported);}
3621 EFSRV_EXPORT_C TInt RFile64::SetSize(TInt64 /*aSize*/)
3622 {Panic(ENotImplemented);return (KErrNotSupported);}
3623 EFSRV_EXPORT_C TInt RFile64::Lock(TInt64 /*aPos*/, TInt64 /*aLength*/) const
3624 {Panic(ENotImplemented);return (KErrNotSupported);}
3625 EFSRV_EXPORT_C TInt RFile64::UnLock(TInt64 /*aPos*/, TInt64 /*aLength*/) const
3626 {Panic(ENotImplemented);return (KErrNotSupported);}
3627 EFSRV_EXPORT_C TInt RFile64::Read(TUint /*aPos*/,TDes8& /*aDes*/) const
3628 {Panic(ENotImplemented);return (KErrNotSupported);}
3629 EFSRV_EXPORT_C void RFile64::Read(TUint /*aPos*/,TDes8& /*aDes*/,TRequestStatus& /*aStatus*/) const
3630 {Panic(ENotImplemented);}
3631 EFSRV_EXPORT_C TInt RFile64::Read(TUint /*aPos*/,TDes8& /*aDes*/,TInt /*aLength*/) const
3632 {Panic(ENotImplemented);return (KErrNotSupported);}
3633 EFSRV_EXPORT_C void RFile64::Read(TUint /*aPos*/,TDes8& /*aDes*/,TInt /*aLength*/,TRequestStatus& /*aStatus*/) const
3634 {Panic(ENotImplemented);}
3635 EFSRV_EXPORT_C TInt RFile64::Write(TUint /*aPos*/,const TDesC8& /*aDes*/)
3636 {Panic(ENotImplemented);return (KErrNotSupported);}
3637 EFSRV_EXPORT_C void RFile64::Write(TUint /*aPos*/,const TDesC8& /*aDes*/,TRequestStatus& /*aStatus*/)
3638 {Panic(ENotImplemented);}
3639 EFSRV_EXPORT_C TInt RFile64::Write(TUint /*aPos*/,const TDesC8& /*aDes*/,TInt /*aLength*/)
3640 {Panic(ENotImplemented);return (KErrNotSupported);}
3641 EFSRV_EXPORT_C void RFile64::Write(TUint /*aPos*/, const TDesC8& /*aDes*/,TInt /*aLength*/,TRequestStatus& /*aStatus*/)
3642 {Panic(ENotImplemented);}