userlibandfileserver/fileserver/sfsrv/cl_file.cpp
branchRCL_3
changeset 257 3e88ff8f41d5
parent 256 c1f20ce4abcf
equal deleted inserted replaced
256:c1f20ce4abcf 257:3e88ff8f41d5
    14 // f32\sfsrv\cl_file.cpp
    14 // f32\sfsrv\cl_file.cpp
    15 // 
    15 // 
    16 //
    16 //
    17 
    17 
    18 #include "cl_std.h"
    18 #include "cl_std.h"
    19 #ifdef OST_TRACE_COMPILER_IN_USE
    19 
    20 #include "cl_fileTraces.h"
       
    21 #endif
       
    22 static _LIT_SECURITY_POLICY_S1(KFileServerPolicy,KFileServerUidValue,ECapabilityTCB);
    20 static _LIT_SECURITY_POLICY_S1(KFileServerPolicy,KFileServerUidValue,ECapabilityTCB);
    23 
    21 
    24 EFSRV_EXPORT_C TInt RFile::Adopt(RFs& aFs, TInt aHandle)
    22 EFSRV_EXPORT_C TInt RFile::Adopt(RFs& aFs, TInt aHandle)
    25 /**
    23 /**
    26 Adopts an already open file.
    24 Adopts an already open file.
    34 
    32 
    35 @deprecated
    33 @deprecated
    36 */
    34 */
    37 	{
    35 	{
    38 
    36 
    39 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEADOPT, "sess %x subs %x", (TUint) aFs.Handle(), (TUint) aHandle);
    37 	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileAdopt, MODULEUID, aFs.Handle(), aHandle);
       
    38 
    40 	// duplicate the sub-session handle; don't panic if it's invalid.
    39 	// duplicate the sub-session handle; don't panic if it's invalid.
    41 	RFile file;
    40 	RFile file;
    42 	TInt r = file.CreateSubSession(aFs, EFsFileDuplicate, TIpcArgs(aHandle, EFalse));
    41 	TInt r = file.CreateSubSession(aFs, EFsFileDuplicate, TIpcArgs(aHandle, EFalse));
    43 	if (r == KErrArgument)
    42 	if (r == KErrArgument)
    44 		{
    43 		{
    45 		OstTrace1(TRACE_BORDER, EFSRV_EFILEADOPTRETURN1, "r %d", KErrBadHandle);
    44 		TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptReturn, MODULEUID, KErrBadHandle);
    46 		return KErrBadHandle;
    45 		return KErrBadHandle;
    47 		}
    46 		}
    48 	else if (r != KErrNone)
    47 	else if (r != KErrNone)
    49 		{
    48 		{
    50 		OstTrace1(TRACE_BORDER, EFSRV_EFILEADOPTRETURN2, "r %d", r);
    49 		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptReturn, MODULEUID, r);
    51 		return r;
    50 		return r;
    52 		}
    51 		}
    53 	// adopt the duplicated handle
    52 	// adopt the duplicated handle
    54 	r = CreateAutoCloseSubSession(aFs, EFsFileAdopt, TIpcArgs(file.SubSessionHandle(), KFileAdopt32));
    53 	r = CreateAutoCloseSubSession(aFs, EFsFileAdopt, TIpcArgs(file.SubSessionHandle(), KFileAdopt32));
    55 	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEADOPTRETURN3, "r %d sess %x subs %x", (TUint) r, (TUint) Session().Handle(), (TUint) SubSessionHandle());
    54 
       
    55 	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
       
    56 
    56 	return r;
    57 	return r;
    57 	}
    58 	}
    58 
    59 
    59 
    60 
    60 
    61 
    74             
    75             
    75 @return KErrNone if successful, otherwise one of the other system-wide
    76 @return KErrNone if successful, otherwise one of the other system-wide
    76         error codes.
    77         error codes.
    77 */
    78 */
    78 	{
    79 	{
    79 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEADOPTFROMSERVER, "sess %x subs %x", (TUint) aFsHandle, (TUint) aFileHandle);
    80 	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromServer, MODULEUID, aFsHandle, aFileHandle);
       
    81 
    80 	RFs fs;
    82 	RFs fs;
    81 	TInt r = fs.SetReturnedHandle(aFsHandle, KFileServerPolicy);
    83 	TInt r = fs.SetReturnedHandle(aFsHandle, KFileServerPolicy);
    82 	if (r != KErrNone)
    84 	if (r != KErrNone)
    83 		{
    85 		{
    84 		OstTrace1(TRACE_BORDER, EFSRV_EFILEADOPTFROMSERVERRETURN1, "r %d", r);
    86 		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromServerReturn, MODULEUID, r);
    85 		return r;
    87 		return r;
    86 		}
    88 		}
    87 	r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(aFileHandle, KFileAdopt32));
    89 	r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(aFileHandle, KFileAdopt32));
    88 	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEADOPTFROMSERVERRETURN2, "r %d sess %x subs %x", (TUint) r, (TUint) Session().Handle(), (TUint) SubSessionHandle());
    90 
       
    91 	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromServerReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
       
    92 
    89 	return r;
    93 	return r;
    90 	}
    94 	}
    91 
    95 
    92 
    96 
    93 EFSRV_EXPORT_C TInt RFile::AdoptFromClient(const RMessage2& aMsg, TInt aFsHandleIndex, TInt aFileHandleIndex)
    97 EFSRV_EXPORT_C TInt RFile::AdoptFromClient(const RMessage2& aMsg, TInt aFsHandleIndex, TInt aFileHandleIndex)
   124 	else if (aFileHandleIndex == 3)
   128 	else if (aFileHandleIndex == 3)
   125 		fileHandle = aMsg.Int3();
   129 		fileHandle = aMsg.Int3();
   126 	else
   130 	else
   127 		r = KErrArgument;
   131 		r = KErrArgument;
   128 
   132 
   129 #ifdef OST_TRACE_COMPILER_IN_USE
   133 #ifdef SYMBIAN_FTRACE_ENABLE
   130 	TInt handle = NULL;
   134 	TInt handle = NULL;
   131 	if (aFsHandleIndex == 0)
   135 	if (aFsHandleIndex == 0)
   132 		handle = aMsg.Int0();
   136 		handle = aMsg.Int0();
   133 	else if (aFsHandleIndex == 1)
   137 	else if (aFsHandleIndex == 1)
   134    		handle = aMsg.Int1();
   138    		handle = aMsg.Int1();
   135 	else if (aFsHandleIndex == 2)
   139 	else if (aFsHandleIndex == 2)
   136 		handle = aMsg.Int2();
   140 		handle = aMsg.Int2();
   137 	else if (aFsHandleIndex == 3)
   141 	else if (aFsHandleIndex == 3)
   138 		handle = aMsg.Int3();
   142 		handle = aMsg.Int3();
   139 	OstTraceExt4(TRACE_BORDER, EFSRV_EFILEADOPTFROMCLIENT, "sess %x subs %x aFsHandleIndex %d aFileHandleIndex %d ", (TUint) handle, (TUint) fileHandle, (TUint) aFsHandleIndex, (TUint) aFileHandleIndex);
   143 	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClient, MODULEUID, handle, fileHandle, aFsHandleIndex, aFileHandleIndex);
   140 #endif
   144 #endif
   141 
   145 
   142 	if (r != KErrNone)
   146 	if (r != KErrNone)
   143 		{
   147 		{
   144 		OstTrace1(TRACE_BORDER, EFSRV_EFILEADOPTFROMCLIENTRETURN1, "r %d", r);
   148 		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClientReturn, MODULEUID, r);
   145 		return r;
   149 		return r;
   146 		}
   150 		}
   147 
   151 
   148 	// Duplicates the file server (RFs) session handle identified by an 
   152 	// Duplicates the file server (RFs) session handle identified by an 
   149 	// existing handle contained in the message slot at index aFsHandleIndex
   153 	// existing handle contained in the message slot at index aFsHandleIndex
   150 	RFs fs;
   154 	RFs fs;
   151 	r = fs.Open(aMsg, aFsHandleIndex, KFileServerPolicy);
   155 	r = fs.Open(aMsg, aFsHandleIndex, KFileServerPolicy);
   152 	if (r != KErrNone)
   156 	if (r != KErrNone)
   153 		{
   157 		{
   154 		OstTrace1(TRACE_BORDER, EFSRV_EFILEADOPTFROMCLIENTRETURN2, "r %d", r);
   158 		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClientReturn, MODULEUID, r);
   155 		return r;
   159 		return r;
   156 		}
   160 		}
   157 
   161 
   158 	r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle, KFileAdopt32));
   162 	r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle, KFileAdopt32));
   159 	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEADOPTFROMCLIENTRETURN3, "r %d sess %x subs %x", (TUint) r, (TUint) Session().Handle(), (TUint) SubSessionHandle());
   163 
       
   164 	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClientReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
       
   165 
   160 	return r;
   166 	return r;
   161 	}
   167 	}
   162 
   168 
   163 
   169 
   164 EFSRV_EXPORT_C TInt RFile::AdoptFromCreator(TInt aFsHandleIndex, TInt aFileHandleIndex)
   170 EFSRV_EXPORT_C TInt RFile::AdoptFromCreator(TInt aFsHandleIndex, TInt aFileHandleIndex)
   185 	{
   191 	{
   186 	TInt fileHandle = NULL;
   192 	TInt fileHandle = NULL;
   187 
   193 
   188 	TInt r = User::GetTIntParameter(aFileHandleIndex,  fileHandle);
   194 	TInt r = User::GetTIntParameter(aFileHandleIndex,  fileHandle);
   189 
   195 
   190 	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEADOPTFROMCREATOR, "subs %x aFsHandleIndex %d aFileHandleIndex %d", (TUint) fileHandle, (TUint) aFsHandleIndex, (TUint) aFileHandleIndex);
   196 	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreator, MODULEUID, fileHandle, aFsHandleIndex, aFileHandleIndex);
       
   197 
   191 	if (r != KErrNone)
   198 	if (r != KErrNone)
   192 		{
   199 		{
   193 		OstTrace1(TRACE_BORDER, EFSRV_EFILEADOPTFROMCREATORRETURN1, "r %d", r);
   200 		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreatorReturn, MODULEUID, r);
   194 		return r;
   201 		return r;
   195 		}
   202 		}
   196 
   203 
   197 
   204 
   198 	// Duplicates the file server (RFs) session handle identified by an 
   205 	// Duplicates the file server (RFs) session handle identified by an 
   199 	// existing handle contained in the environment slot at index aFsHandleIndex
   206 	// existing handle contained in the environment slot at index aFsHandleIndex
   200 	RFs fs;
   207 	RFs fs;
   201 	r = fs.Open(aFsHandleIndex, KFileServerPolicy);
   208 	r = fs.Open(aFsHandleIndex, KFileServerPolicy);
   202 	if (r != KErrNone)
   209 	if (r != KErrNone)
   203 		{
   210 		{
   204 		OstTrace1(TRACE_BORDER, EFSRV_EFILEADOPTFROMCREATORRETURN2, "r %d", r);
   211 		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreatorReturn, MODULEUID, r);
   205 		return r;
   212 		return r;
   206 		}
   213 		}
   207 
   214 
   208 	r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle, KFileAdopt32));
   215 	r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle, KFileAdopt32));
   209 	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEADOPTFROMCREATORRETURN3, "r %d sess %x subs %x", (TUint) r, (TUint) Session().Handle(), (TUint) SubSessionHandle());
   216 
       
   217 	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreatorReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
       
   218 
   210 	return r;
   219 	return r;
   211 	}
   220 	}
   212 
   221 
   213 
   222 
   214 
   223 
   226 
   235 
   227 @return	one of the other system-wide error codes.
   236 @return	one of the other system-wide error codes.
   228 */
   237 */
   229 EFSRV_EXPORT_C TInt RFile::Duplicate(const RFile& aFile, TOwnerType aType)
   238 EFSRV_EXPORT_C TInt RFile::Duplicate(const RFile& aFile, TOwnerType aType)
   230 	{
   239 	{
   231 	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEDUPLICATE, "sess %x subs %x aType %d", (TUint) aFile.Session().Handle(), (TUint) aFile.SubSessionHandle(), (TUint) aType);
   240 	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileDuplicate, MODULEUID, aFile.Session().Handle(), aFile.SubSessionHandle(), aType);
       
   241 
   232 	RFs fs;
   242 	RFs fs;
   233 	fs.SetHandle(aFile.Session().Handle());
   243 	fs.SetHandle(aFile.Session().Handle());
   234 
   244 
   235 	// Need to make a duplicate of the session handle in the current thread, 
   245 	// Need to make a duplicate of the session handle in the current thread, 
   236 	// otherwise closing one session will close both sub-sessions.
   246 	// otherwise closing one session will close both sub-sessions.
   237 	TInt r = fs.Duplicate(RThread(), aType);
   247 	TInt r = fs.Duplicate(RThread(), aType);
   238 	if (r != KErrNone)
   248 	if (r != KErrNone)
   239 		{
   249 		{
   240 		OstTrace1(TRACE_BORDER, EFSRV_EFILEDUPLICATERETURN1, "r %d", r);
   250 		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileDuplicateReturn, MODULEUID, r);
   241 		return r;
   251 		return r;
   242 		}
   252 		}
   243 	
   253 	
   244 	// duplicate the sub-session handle
   254 	// duplicate the sub-session handle
   245 	TInt dupSubSessionHandle;
   255 	TInt dupSubSessionHandle;
   246 	r = aFile.DuplicateHandle(dupSubSessionHandle);
   256 	r = aFile.DuplicateHandle(dupSubSessionHandle);
   247 	if (r != KErrNone)
   257 	if (r != KErrNone)
   248 		{
   258 		{
   249 		OstTrace1(TRACE_BORDER, EFSRV_EFILEDUPLICATERETURN2, "r %d", r);
   259 		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileDuplicateReturn, MODULEUID, r);
   250 		return r;
   260 		return r;
   251 		}
   261 		}
   252 
   262 
   253 	// adopt the duplicated sub-session handle
   263 	// adopt the duplicated sub-session handle
   254 	r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(dupSubSessionHandle, KFileDuplicate));
   264 	r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(dupSubSessionHandle, KFileDuplicate));
   255 
   265 
   256 	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEDUPLICATERETURN3, "r %d sess %x subs %x", (TUint) r, (TUint) Session().Handle(), (TUint) SubSessionHandle());
   266 	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileDuplicateReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
       
   267 
   257 	return r;
   268 	return r;
   258 	}
   269 	}
   259 
   270 
   260 
   271 
   261 // Makes a duplicate of this file (RFile) handle in the current thread and 
   272 // Makes a duplicate of this file (RFile) handle in the current thread and 
   308 		error codes.
   319 		error codes.
   309 
   320 
   310 */
   321 */
   311 EFSRV_EXPORT_C TInt RFile::TransferToServer(TIpcArgs& aIpcArgs, TInt aFsHandleIndex, TInt aFileHandleIndex) const
   322 EFSRV_EXPORT_C TInt RFile::TransferToServer(TIpcArgs& aIpcArgs, TInt aFsHandleIndex, TInt aFileHandleIndex) const
   312 	{
   323 	{
   313 	OstTraceExt4(TRACE_BORDER, EFSRV_EFILETRANSFERTOSERVER, "sess %x subs %x aFsHandleIndex %d aFileHandleIndex %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aFsHandleIndex, (TUint) aFileHandleIndex);
   324 	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToServer, MODULEUID, Session().Handle(), SubSessionHandle(), aFsHandleIndex, aFileHandleIndex);
       
   325 
   314 	if ((aFsHandleIndex < 0) || (aFsHandleIndex > (KMaxMessageArguments-2)))
   326 	if ((aFsHandleIndex < 0) || (aFsHandleIndex > (KMaxMessageArguments-2)))
   315 		{
   327 		{
   316 		OstTrace1(TRACE_BORDER, EFSRV_EFILETRANSFERTOSERVERRETURN1, "r %d",  (TUint) KErrArgument);
   328 		TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToServerReturn, MODULEUID,  (TUint) KErrArgument);
   317 		return KErrArgument;
   329 		return KErrArgument;
   318 		}
   330 		}
   319 
   331 
   320 	TInt dupSubSessionHandle;
   332 	TInt dupSubSessionHandle;
   321 	TInt r = DuplicateHandle(dupSubSessionHandle);
   333 	TInt r = DuplicateHandle(dupSubSessionHandle);
   322 	if (r == KErrNone)
   334 	if (r == KErrNone)
   323 		{
   335 		{
   324 		aIpcArgs.Set(aFsHandleIndex, Session());
   336 		aIpcArgs.Set(aFsHandleIndex, Session());
   325 		aIpcArgs.Set(aFileHandleIndex, dupSubSessionHandle);
   337 		aIpcArgs.Set(aFileHandleIndex, dupSubSessionHandle);
   326 		}
   338 		}
   327 	OstTrace1(TRACE_BORDER, EFSRV_EFILETRANSFERTOSERVERRETURN2, "r %d", r);
   339 
       
   340 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToServerReturn, MODULEUID, r);
   328 	return r;
   341 	return r;
   329 	}
   342 	}
   330 
   343 
   331 /**
   344 /**
   332 Transfers an already open file from a server to a client.
   345 Transfers an already open file from a server to a client.
   353 @return KErrNone if successful, otherwise one of the other system-wide
   366 @return KErrNone if successful, otherwise one of the other system-wide
   354         error codes.
   367         error codes.
   355 */
   368 */
   356 EFSRV_EXPORT_C TInt RFile::TransferToClient(const RMessage2& aMsg, TInt aFileHandleIndex) const
   369 EFSRV_EXPORT_C TInt RFile::TransferToClient(const RMessage2& aMsg, TInt aFileHandleIndex) const
   357 	{
   370 	{
   358 	OstTraceExt3(TRACE_BORDER, EFSRV_EFILETRANSFERTOCLIENT, "sess %x subs %x aFileHandleIndex %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aFileHandleIndex);
   371 	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToClient, MODULEUID, Session().Handle(), SubSessionHandle(), aFileHandleIndex);
       
   372 
   359 	if (TUint(aFileHandleIndex) >= TUint(KMaxMessageArguments))
   373 	if (TUint(aFileHandleIndex) >= TUint(KMaxMessageArguments))
   360 		{
   374 		{
   361 		OstTrace1(TRACE_BORDER, EFSRV_EFILETRANSFERTOCLIENTRETURN1, "r %d",  (TUint) KErrArgument);
   375 		TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToClientReturn, MODULEUID,  (TUint) KErrArgument);
   362 		return KErrArgument;
   376 		return KErrArgument;
   363 		}
   377 		}
   364 
   378 
   365 	TInt dupSubSessionHandle;
   379 	TInt dupSubSessionHandle;
   366 	TInt r = DuplicateHandle(dupSubSessionHandle);
   380 	TInt r = DuplicateHandle(dupSubSessionHandle);
   367 	if (r == KErrNone)
   381 	if (r == KErrNone)
   368 		r = aMsg.Write(aFileHandleIndex, TPckgC<TInt>(dupSubSessionHandle));
   382 		r = aMsg.Write(aFileHandleIndex, TPckgC<TInt>(dupSubSessionHandle));
   369 
   383 
   370 	if (r != KErrNone)
   384 	if (r != KErrNone)
   371 		{
   385 		{
   372 		OstTrace1(TRACE_BORDER, EFSRV_EFILETRANSFERTOCLIENTRETURN2, "r %d", r);
   386 		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToClientReturn, MODULEUID, r);
   373 		return r;
   387 		return r;
   374 		}
   388 		}
   375 
   389 
   376 	aMsg.Complete(Session());
   390 	aMsg.Complete(Session());
   377 	
   391 	
   378 	OstTrace1(TRACE_BORDER, EFSRV_EFILETRANSFERTOCLIENTRETURN3, "r %d", r);
   392 	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToClientReturn, MODULEUID, r);
       
   393 
   379 	return r;
   394 	return r;
   380 	}
   395 	}
   381 
   396 
   382 
   397 
   383 /**
   398 /**
   406         error codes.
   421         error codes.
   407 */
   422 */
   408 // NB slot 0 is reserved for the command line
   423 // NB slot 0 is reserved for the command line
   409 EFSRV_EXPORT_C TInt RFile::TransferToProcess(RProcess& aProcess, TInt aFsHandleIndex, TInt aFileHandleIndex) const
   424 EFSRV_EXPORT_C TInt RFile::TransferToProcess(RProcess& aProcess, TInt aFsHandleIndex, TInt aFileHandleIndex) const
   410 	{
   425 	{
   411 	OstTraceExt4(TRACE_BORDER, EFSRV_EFILETRANSFERTOPROCESS, "sess %x subs %x aFsHandleIndex %d aFileHandleIndex %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aFsHandleIndex, (TUint) aFileHandleIndex);
   426 	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToProcess, MODULEUID, Session().Handle(), SubSessionHandle(), aFsHandleIndex, aFileHandleIndex);
       
   427 
   412 	TInt dupSubSessionHandle;
   428 	TInt dupSubSessionHandle;
   413 	TInt r = DuplicateHandle(dupSubSessionHandle);
   429 	TInt r = DuplicateHandle(dupSubSessionHandle);
   414 
   430 
   415 	if (r == KErrNone)
   431 	if (r == KErrNone)
   416 		r = aProcess.SetParameter(aFsHandleIndex, RHandleBase(Session()));
   432 		r = aProcess.SetParameter(aFsHandleIndex, RHandleBase(Session()));
   417 	
   433 	
   418 	if (r == KErrNone)
   434 	if (r == KErrNone)
   419 		r = aProcess.SetParameter(aFileHandleIndex, dupSubSessionHandle);
   435 		r = aProcess.SetParameter(aFileHandleIndex, dupSubSessionHandle);
   420 	OstTrace1(TRACE_BORDER, EFSRV_EFILETRANSFERTOPROCESSRETURN, "r %d", r);
   436 
       
   437 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToProcessReturn, MODULEUID, r);
       
   438 
   421 	return r;
   439 	return r;
   422 	}
   440 	}
   423 
   441 
   424 
   442 
   425 EFSRV_EXPORT_C TInt RFile::Name(TDes& aName) const
   443 EFSRV_EXPORT_C TInt RFile::Name(TDes& aName) const
   435 @return KErrNone if successful, otherwise one of the other
   453 @return KErrNone if successful, otherwise one of the other
   436         system-wide error codes.
   454         system-wide error codes.
   437 
   455 
   438 */
   456 */
   439 	{
   457 	{
   440 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEGETNAME, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle());
   458 	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileName, MODULEUID, Session().Handle(), SubSessionHandle());
       
   459 
   441 	TInt r = SendReceive(EFsFileName, TIpcArgs(&aName));
   460 	TInt r = SendReceive(EFsFileName, TIpcArgs(&aName));
   442 	OstTraceData(TRACE_BORDER, EFSRV_EFILEGETNAME_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
   461 
   443 	OstTrace1(TRACE_BORDER, EFSRV_EFILEGETNAMERETURN, "r %d", r);
   462 	TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFileNameReturn, MODULEUID, r, aName);
       
   463 
   444 	return r;
   464 	return r;
   445 	}
   465 	}
   446 
   466 
   447 
   467 
   448 EFSRV_EXPORT_C TInt RFile::FullName(TDes& aName) const
   468 EFSRV_EXPORT_C TInt RFile::FullName(TDes& aName) const
   458 @return KErrNone if successful, otherwise one of the other
   478 @return KErrNone if successful, otherwise one of the other
   459         system-wide error codes.
   479         system-wide error codes.
   460 
   480 
   461 */
   481 */
   462 	{
   482 	{
   463 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEFULLNAME, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle());
   483 	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileFullName, MODULEUID, Session().Handle(), SubSessionHandle());
       
   484 
   464 	TInt r = SendReceive(EFsFileFullName, TIpcArgs(&aName));
   485 	TInt r = SendReceive(EFsFileFullName, TIpcArgs(&aName));
   465 	OstTraceData(TRACE_BORDER, EFSRV_EFILEFULLNAME_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
   486 
   466 	OstTrace1(TRACE_BORDER, EFSRV_EFILEFULLNAMERETURN, "r %d", r);
   487 	TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFileFullNameReturn, MODULEUID, r, aName);
       
   488 
   467 	return r;
   489 	return r;
   468 	}
   490 	}
   469 
   491 
   470 
   492 
   471 
   493 
   516  					  EFileShareReadersOrWriters|EFileRead nor EFileShareReadersOnly 
   538  					  EFileShareReadersOrWriters|EFileRead nor EFileShareReadersOnly 
   517  					  nor EFileRead then Tcb capability is required.
   539  					  nor EFileRead then Tcb capability is required.
   518 
   540 
   519 */
   541 */
   520 	{
   542 	{
   521 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEOPEN, "sess %x mode %x", (TUint) aFs.Handle(), (TUint) aMode);
   543 	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileOpen, MODULEUID, aFs.Handle(), aMode, aName);
   522 	OstTraceData(TRACE_BORDER, EFSRV_EFILEOPEN_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
   544 
   523 	aMode &= ~EFileBigFile;
   545 	aMode &= ~EFileBigFile;
   524 	TInt r = CreateSubSession(aFs,EFsFileOpen,TIpcArgs(&aName,aMode));
   546 	TInt r = CreateSubSession(aFs,EFsFileOpen,TIpcArgs(&aName,aMode));
   525 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEOPENRETURN, "r %d subs %x", (TUint) r, (TUint) SubSessionHandle());
   547 
       
   548 	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileOpenReturn, MODULEUID, r, SubSessionHandle());
       
   549 
   526 	return r;
   550 	return r;
   527 	}
   551 	}
   528 
   552 
   529 
   553 
   530 EFSRV_EXPORT_C void RFile::Close()
   554 EFSRV_EXPORT_C void RFile::Close()
   538 you should ensure that data is committed to the file by invoking RFile::Flush()
   562 you should ensure that data is committed to the file by invoking RFile::Flush()
   539 before closing. If Flush() completes successfully, Close() is essentially a
   563 before closing. If Flush() completes successfully, Close() is essentially a
   540 no-operation.
   564 no-operation.
   541 */
   565 */
   542 	{
   566 	{
   543 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILECLOSE, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle());
   567 	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileClose, MODULEUID, Session().Handle(), SubSessionHandle());
   544 	
   568 	
       
   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)) ) 
       
   575 		{
       
   576 		RFTRACE_CLOSE;
       
   577 		}
       
   578 #endif
       
   579 
   545 	CloseSubSession(EFsFileSubClose);
   580 	CloseSubSession(EFsFileSubClose);
   546 
   581 
   547 	OstTrace0(TRACE_BORDER, EFSRV_EFILECLOSERETURN, "");
   582 	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileCloseReturn, MODULEUID);
   548 	}
   583 	}
   549 
   584 
   550 
   585 
   551 EFSRV_EXPORT_C TInt RFile::Create(RFs& aFs,const TDesC& aName,TUint aMode)
   586 EFSRV_EXPORT_C TInt RFile::Create(RFs& aFs,const TDesC& aName,TUint aMode)
   552 /**
   587 /**
   586 					  SID then AllFiles capability is required.
   621 					  SID then AllFiles capability is required.
   587 
   622 
   588 */
   623 */
   589 	{
   624 	{
   590 	aMode &= ~EFileBigFile;
   625 	aMode &= ~EFileBigFile;
   591 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILECREATE, "sess %x mode %x", (TUint) aFs.Handle(), (TUint) aMode);
   626 
   592 	OstTraceData(TRACE_BORDER, EFSRV_EFILECREATE_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
   627 	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileCreate, MODULEUID, aFs.Handle(), aMode, aName);
       
   628 
   593 	TInt r = CreateSubSession(aFs,EFsFileCreate,TIpcArgs(&aName,aMode));
   629 	TInt r = CreateSubSession(aFs,EFsFileCreate,TIpcArgs(&aName,aMode));
   594 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILECREATERETURN, "r %d subs %x", (TUint) r, (TUint) SubSessionHandle());
   630 
       
   631 	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileCreateReturn, MODULEUID, r, SubSessionHandle());
       
   632 
   595 	return r;
   633 	return r;
   596 	}
   634 	}
   597 
   635 
   598 
   636 
   599 
   637 
   640 @capability Dependent If the path in aName starts with /Private and does not match this process'
   678 @capability Dependent If the path in aName starts with /Private and does not match this process'
   641 					  SID then AllFiles capability is required.
   679 					  SID then AllFiles capability is required.
   642 
   680 
   643 */
   681 */
   644 	{
   682 	{
   645 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEREPLACE, "sess %x mode %x", (TUint) aFs.Handle(), (TUint) aMode);
   683 	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileReplace, MODULEUID, aFs.Handle(), aMode, aName);
   646 	OstTraceData(TRACE_BORDER, EFSRV_EFILEREPLACE_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
       
   647 	aMode &= ~EFileBigFile;
   684 	aMode &= ~EFileBigFile;
   648 	TInt r = CreateSubSession(aFs,EFsFileReplace,TIpcArgs(&aName,aMode));
   685 	TInt r = CreateSubSession(aFs,EFsFileReplace,TIpcArgs(&aName,aMode));
   649 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEREPLACERETURN, "r %d subs %x", (TUint) r, (TUint) SubSessionHandle());
   686 	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileReplaceReturn, MODULEUID, r, SubSessionHandle());
   650 	return r;
   687 	return r;
   651 	}
   688 	}
   652 
   689 
   653 
   690 
   654 
   691 
   678 @capability Dependent If aPath starts with /Resource then capability Tcb is required
   715 @capability Dependent If aPath starts with /Resource then capability Tcb is required
   679 @capability Dependent If aPath starts with /Private and does not match this process'
   716 @capability Dependent If aPath starts with /Private and does not match this process'
   680 					  SID then AllFiles capability is required.
   717 					  SID then AllFiles capability is required.
   681 */
   718 */
   682 	{
   719 	{
   683    	OstTraceExt2(TRACE_BORDER, EFSRV_EFILETEMP, "sess %x aMode %x", (TUint) aFs.Handle(), (TUint) aMode);
   720    	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileTemp, MODULEUID, aFs.Handle(), aPath, aMode);
   684 	OstTraceData(TRACE_BORDER, EFSRV_EFILETEMP_EDIRNAME, "Dir %S", aPath.Ptr(), aPath.Length()<<1);
       
   685 	aMode &= ~EFileBigFile;
   721 	aMode &= ~EFileBigFile;
   686 	TInt r = CreateSubSession(aFs,EFsFileTemp,TIpcArgs(&aPath,aMode,&aName));
   722 	TInt r = CreateSubSession(aFs,EFsFileTemp,TIpcArgs(&aPath,aMode,&aName));
   687 	OstTraceData(TRACE_BORDER, EFSRV_EFILETEMP_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
   723 	TRACERETMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileTempReturn, MODULEUID, r, SubSessionHandle(), aName);
   688 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILETEMPRETURN, "r %d subs %x", (TUint) r, (TUint) SubSessionHandle());
       
   689 	
       
   690 	return r;
   724 	return r;
   691 	}
   725 	}
   692 
   726 
   693 
   727 
   694 
   728 
   712         codes.
   746         codes.
   713 
   747 
   714 @see TDesC8::Length
   748 @see TDesC8::Length
   715 */
   749 */
   716 	{
   750 	{
   717 	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEREAD1, "sess %x subs %x desmaxlen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aDes.MaxLength());
   751 	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileRead1, MODULEUID, Session().Handle(), SubSessionHandle(), aDes.MaxLength());
       
   752 
   718 	TInt r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),I64LOW(KCurrentPosition64)));
   753 	TInt r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),I64LOW(KCurrentPosition64)));
   719 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEREAD1RETURN, "r %d len %d", (TUint) r, (TUint) aDes.Length());
   754 
       
   755 	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead1Return, MODULEUID, r, aDes.Length());
       
   756 
   720 	return r;
   757 	return r;
   721 	}
   758 	}
   722 
   759 
   723 
   760 
   724 
   761 
   748        KErrNone, if successful, otherwise one of the other system-wide error codes.
   785        KErrNone, if successful, otherwise one of the other system-wide error codes.
   749 
   786 
   750 @see TDesC8::Length       
   787 @see TDesC8::Length       
   751 */
   788 */
   752 	{
   789 	{
   753 	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEREAD2, "sess %x subs %x maxdeslen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aDes.MaxLength());
   790 	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileRead2, MODULEUID, Session().Handle(), SubSessionHandle(), aDes.MaxLength(), &aStatus);
       
   791 
   754     RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),I64LOW(KCurrentPosition64)),aStatus);
   792     RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),I64LOW(KCurrentPosition64)),aStatus);
   755 
   793 
   756 	OstTrace0(TRACE_BORDER, EFSRV_EFILEREAD2RETURN, "");
   794 	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead2Return, MODULEUID);
   757 	}
   795 	}
   758 
   796 
   759 
   797 
   760 
   798 
   761 
   799 
   786                
   824                
   787 @return KErrNone if successful, otherwise one of the other system-wide error
   825 @return KErrNone if successful, otherwise one of the other system-wide error
   788         codes.
   826         codes.
   789 */
   827 */
   790 	{
   828 	{
   791 	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEREAD5, "sess %x subs %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aLength);
   829 	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileRead1, MODULEUID, Session().Handle(), SubSessionHandle(), aLength);
       
   830 
   792 	if (aLength==0)
   831 	if (aLength==0)
   793 		{
   832 		{
   794 		aDes.Zero();
   833 		aDes.Zero();
   795 		return(KErrNone);
   834 		return(KErrNone);
   796 		}
   835 		}
   797 	else if(aLength>aDes.MaxLength())
   836 	else if(aLength>aDes.MaxLength())
   798 		{
   837 		{
   799 		return(KErrOverflow);
   838 		return(KErrOverflow);
   800 		}
   839 		}
   801 	TInt r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,I64LOW(KCurrentPosition64)));
   840 	TInt r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,I64LOW(KCurrentPosition64)));
   802 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEREAD5RETURN, "r %d len %d", (TUint) r, (TUint) aDes.Length());
   841 
       
   842 	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead1Return, MODULEUID, r, aDes.Length());
       
   843 
   803 	return r;
   844 	return r;
   804 	}
   845 	}
   805 
   846 
   806 
   847 
   807 
   848 
   837                
   878                
   838 @param aStatus Request status. On completion contains KErrNone if successful, 
   879 @param aStatus Request status. On completion contains KErrNone if successful, 
   839                otherwise one of the other system-wide error codes.
   880                otherwise one of the other system-wide error codes.
   840 */
   881 */
   841 	{
   882 	{
   842 	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEREAD6, "sess %x subs %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aLength);
   883 	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileRead2, MODULEUID, Session().Handle(), SubSessionHandle(), aLength, &aStatus);
       
   884 
   843 	if (aLength==0)
   885 	if (aLength==0)
   844 		{
   886 		{
   845 		aDes.Zero();
   887 		aDes.Zero();
   846 		TRequestStatus* req=(&aStatus);
   888 		TRequestStatus* req=(&aStatus);
   847 		User::RequestComplete(req,KErrNone);
   889 		User::RequestComplete(req,KErrNone);
   853 		User::RequestComplete(req,KErrOverflow);
   895 		User::RequestComplete(req,KErrOverflow);
   854 		return;
   896 		return;
   855 		}
   897 		}
   856 		
   898 		
   857 	RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,I64LOW(KCurrentPosition64)),aStatus);
   899 	RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,I64LOW(KCurrentPosition64)),aStatus);
   858 	OstTrace0(TRACE_BORDER, EFSRV_EFILEREAD6RETURN, "");
   900 
       
   901 	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead2Return, MODULEUID);
   859 	}
   902 	}
   860 
   903 
   861 
   904 
   862 
   905 
   863 
   906 
   887         codes.
   930         codes.
   888 
   931 
   889 @panic FSCLIENT 19 if aPos is negative.        
   932 @panic FSCLIENT 19 if aPos is negative.        
   890 */
   933 */
   891 	{
   934 	{
   892 	OstTraceExt4(TRACE_BORDER, EFSRV_EFILEREAD3, "sess %x subs %x aPos %x maxdeslen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aDes.MaxLength());
   935 	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileRead3, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.MaxLength());
       
   936 
   893 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
   937 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
   894 
   938 
   895 	TInt r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),aPos));
   939 	TInt r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),aPos));
   896 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEREAD3RETURN, "r %d len %d", (TUint) r, (TUint) aDes.Length());
   940 
       
   941 	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead3Return, MODULEUID, r, aDes.Length());
       
   942 
   897 	return r;
   943 	return r;
   898 	}
   944 	}
   899 
   945 
   900 
   946 
   901 
   947 
   931                if successful, otherwise one of the other system-wide error codes.
   977                if successful, otherwise one of the other system-wide error codes.
   932 
   978 
   933 @panic FSCLIENT 19 if aPos is negative.        
   979 @panic FSCLIENT 19 if aPos is negative.        
   934 */
   980 */
   935 	{
   981 	{
   936 	OstTraceExt4(TRACE_BORDER, EFSRV_EFILEREAD4, "sess %x subs %x aPos %x maxdeslen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aDes.MaxLength());
   982 	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileRead4, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.MaxLength(), &aStatus);
       
   983 
   937 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
   984 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
   938 	RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),aPos),aStatus);
   985 	RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),aPos),aStatus);
   939 
   986 
   940 	OstTrace0(TRACE_BORDER, EFSRV_EFILEREAD4RETURN, "");
   987 	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead4Return, MODULEUID);
   941 	}
   988 	}
   942 
   989 
   943 
   990 
   944 
   991 
   945 
   992 
   977         error codes.
  1024         error codes.
   978 
  1025 
   979 @panic FSCLIENT 19 if aPos is negative.        
  1026 @panic FSCLIENT 19 if aPos is negative.        
   980 */
  1027 */
   981 	{
  1028 	{
   982 	OstTraceExt4(TRACE_BORDER, EFSRV_EFILEREAD7, "sess %x subs %x aPos %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength);
  1029 	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileRead3, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength);
       
  1030 
   983 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  1031 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
   984 	if (aLength==0)
  1032 	if (aLength==0)
   985 		{
  1033 		{
   986 		aDes.Zero();
  1034 		aDes.Zero();
   987 		return(KErrNone);
  1035 		return(KErrNone);
   990 		{
  1038 		{
   991 		return(KErrOverflow);
  1039 		return(KErrOverflow);
   992 		}
  1040 		}
   993 		
  1041 		
   994 	TInt r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,aPos));
  1042 	TInt r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,aPos));
   995 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEREAD7RETURN, "r %d len %d", (TUint) r, (TUint) aDes.Length());
  1043 
       
  1044 	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead3Return, MODULEUID, r, aDes.Length());
       
  1045 
   996 	return r;
  1046 	return r;
   997 	}
  1047 	}
   998 
  1048 
   999 
  1049 
  1000 
  1050 
  1039                otherwise one of the other system-wide error codes.
  1089                otherwise one of the other system-wide error codes.
  1040                
  1090                
  1041 @panic FSCLIENT 19 if aPos is negative.                       
  1091 @panic FSCLIENT 19 if aPos is negative.                       
  1042 */
  1092 */
  1043 	{
  1093 	{
  1044 	OstTraceExt4(TRACE_BORDER, EFSRV_EFILEREAD9, "sess %x subs %x aPos %x maxlen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength);
  1094 	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileRead4, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength, &aStatus);
       
  1095 
  1045 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  1096 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  1046 	if (aLength==0)
  1097 	if (aLength==0)
  1047 		{
  1098 		{
  1048 		aDes.Zero();
  1099 		aDes.Zero();
  1049 		TRequestStatus* req=(&aStatus);
  1100 		TRequestStatus* req=(&aStatus);
  1056 		User::RequestComplete(req,KErrOverflow);
  1107 		User::RequestComplete(req,KErrOverflow);
  1057 		return;
  1108 		return;
  1058 		}
  1109 		}
  1059 		
  1110 		
  1060 	RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,aPos),aStatus);
  1111 	RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,aPos),aStatus);
  1061 	OstTrace0(TRACE_BORDER, EFSRV_EFILEREAD9RETURN, "");
  1112 
       
  1113 	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead4Return, MODULEUID);
  1062 	}
  1114 	}
  1063 
  1115 
  1064 
  1116 
  1065 
  1117 
  1066 
  1118 
  1108 
  1160 
  1109 @return KErrNone if successful, otherwise one of the other system-wide error 
  1161 @return KErrNone if successful, otherwise one of the other system-wide error 
  1110         codes.
  1162         codes.
  1111 */
  1163 */
  1112 	{
  1164 	{
  1113 	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEWRITE1, "sess %x subs %x deslen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aDes.Length());
  1165 	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1, MODULEUID, Session().Handle(), SubSessionHandle(), aDes.Length());
  1114 	TInt r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),I64LOW(KCurrentPosition64)));
  1166 	TInt r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),I64LOW(KCurrentPosition64)));
  1115 	OstTrace1(TRACE_BORDER, EFSRV_EFILEWRITE1RETURN, "r %d", r);
  1167 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1Return, MODULEUID, r);
  1116 	return r;
  1168 	return r;
  1117 	}
  1169 	}
  1118 
  1170 
  1119 
  1171 
  1120 EFSRV_EXPORT_C void RFile::Write(const TDesC8& aDes,TRequestStatus& aStatus)
  1172 EFSRV_EXPORT_C void RFile::Write(const TDesC8& aDes,TRequestStatus& aStatus)
  1135             
  1187             
  1136 @param aStatus Request status. On completion contains KErrNone if successful, 
  1188 @param aStatus Request status. On completion contains KErrNone if successful, 
  1137                otherwise one of the other system-wide error codes.
  1189                otherwise one of the other system-wide error codes.
  1138 */
  1190 */
  1139 	{
  1191 	{
  1140 	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEWRITE2, "sess %x subs %x deslen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aDes.Length());
  1192 	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2, MODULEUID, Session().Handle(), SubSessionHandle(), aDes.Length(), &aStatus);
       
  1193 
  1141 	RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),I64LOW(KCurrentPosition64)),aStatus);
  1194 	RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),I64LOW(KCurrentPosition64)),aStatus);
  1142 	OstTrace0(TRACE_BORDER, EFSRV_EFILEWRITE2RETURN, "");
  1195 	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2Return, MODULEUID);
  1143 	}
  1196 	}
  1144 
  1197 
  1145 
  1198 
  1146 
  1199 
  1147 
  1200 
  1164         
  1217         
  1165 @panic FSCLIENT 27 in debug mode, if aLength is greater than the length
  1218 @panic FSCLIENT 27 in debug mode, if aLength is greater than the length
  1166        of the descriptor aDes.  
  1219        of the descriptor aDes.  
  1167 */
  1220 */
  1168 	{
  1221 	{
  1169 	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEWRITE5, "sess %x subs %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aLength);
  1222 	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1, MODULEUID, Session().Handle(), SubSessionHandle(), aLength);
       
  1223 
  1170 	__ASSERT_DEBUG(aDes.Length()>=aLength,Panic(EBadLength));
  1224 	__ASSERT_DEBUG(aDes.Length()>=aLength,Panic(EBadLength));
  1171 	TInt r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,I64LOW(KCurrentPosition64)));
  1225 	TInt r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,I64LOW(KCurrentPosition64)));
  1172 	OstTrace1(TRACE_BORDER, EFSRV_EFILEWRITE5RETURN, "r %d", r);
  1226 
       
  1227 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1Return, MODULEUID, r);
  1173 	return r;
  1228 	return r;
  1174 	}
  1229 	}
  1175 
  1230 
  1176 
  1231 
  1177 
  1232 
  1200 			   KErrArgument if aLength is negative; 
  1255 			   KErrArgument if aLength is negative; 
  1201 			   otherwise one of the other system-wide error codes.
  1256 			   otherwise one of the other system-wide error codes.
  1202 
  1257 
  1203 */
  1258 */
  1204 	{
  1259 	{
  1205 	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEWRITE9, "sess %x subs %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aLength);
  1260 	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2, MODULEUID, Session().Handle(), SubSessionHandle(), aLength, &aStatus);
  1206 		
  1261 		
  1207 	RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,I64LOW(KCurrentPosition64)),aStatus);
  1262 	RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,I64LOW(KCurrentPosition64)),aStatus);
  1208 	OstTrace0(TRACE_BORDER, EFSRV_EFILEWRITE9RETURN, "");
  1263 
       
  1264 	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2Return, MODULEUID);
  1209 	}
  1265 	}
  1210 
  1266 
  1211 
  1267 
  1212 
  1268 
  1213 
  1269 
  1233         codes.
  1289         codes.
  1234 
  1290 
  1235 @panic FSCLIENT 19 if aPos is negative.                       
  1291 @panic FSCLIENT 19 if aPos is negative.                       
  1236 */
  1292 */
  1237 	{
  1293 	{
  1238 	OstTraceExt4(TRACE_BORDER, EFSRV_EFILEWRITE3, "sess %x subs %x aPos %x len %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aDes.Length());
  1294 	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileWrite3, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.Length());
       
  1295 
  1239 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  1296 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  1240 	TInt r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),aPos));
  1297 	TInt r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),aPos));
  1241 	OstTrace1(TRACE_BORDER, EFSRV_EFILEWRITE3RETURN, "r %d", r);
  1298 
       
  1299 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite3Return, MODULEUID, r);
  1242 	return r;
  1300 	return r;
  1243 	}
  1301 	}
  1244 
  1302 
  1245 
  1303 
  1246 
  1304 
  1271                otherwise one of the other system-wide error codes.
  1329                otherwise one of the other system-wide error codes.
  1272 
  1330 
  1273 @panic FSCLIENT 19 if aPos is negative.                       
  1331 @panic FSCLIENT 19 if aPos is negative.                       
  1274 */
  1332 */
  1275 	{
  1333 	{
  1276 	OstTraceExt4(TRACE_BORDER, EFSRV_EFILEWRITE4, "sess %x subs %x aPos %x deslen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aDes.Length());
  1334 	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileWrite4, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.Length(), &aStatus);
       
  1335 
  1277 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  1336 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  1278 	RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),aPos),aStatus);
  1337 	RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),aPos),aStatus);
  1279 	OstTrace0(TRACE_BORDER, EFSRV_EFILEWRITE4RETURN, "");
  1338 	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite4Return, MODULEUID);
  1280 	}
  1339 	}
  1281 
  1340 
  1282 
  1341 
  1283 
  1342 
  1284 
  1343 
  1304 		otherwise one of the other system-wide error codes.
  1363 		otherwise one of the other system-wide error codes.
  1305         
  1364         
  1306 @panic FSCLIENT 19 if aPos is negative.                       
  1365 @panic FSCLIENT 19 if aPos is negative.                       
  1307 */
  1366 */
  1308 	{
  1367 	{
  1309 	OstTraceExt4(TRACE_BORDER, EFSRV_EFILEWRITE6, "sess %x subs %x aPos %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength);
  1368 	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1, MODULEUID, Session().Handle(), SubSessionHandle(), aLength);
       
  1369 
  1310 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  1370 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  1311 	TInt r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,aPos));
  1371 	TInt r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,aPos));
  1312 	OstTrace1(TRACE_BORDER, EFSRV_EFILEWRITE6RETURN, "r %d", r);
  1372 
       
  1373 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1Return, MODULEUID, r);
  1313 	return r;
  1374 	return r;
  1314 	}
  1375 	}
  1315 
  1376 
  1316 
  1377 
  1317 
  1378 
  1345 			   otherwise one of the other system-wide error codes.
  1406 			   otherwise one of the other system-wide error codes.
  1346 
  1407 
  1347 @panic FSCLIENT 19 if aPos is negative.                       
  1408 @panic FSCLIENT 19 if aPos is negative.                       
  1348 */
  1409 */
  1349 	{
  1410 	{
  1350 	OstTraceExt4(TRACE_BORDER, EFSRV_EFILEWRITE10, "sess %x subs %x aPos %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength);
  1411 	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength, &aStatus);
       
  1412 
  1351 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  1413 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  1352 	RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,aPos),aStatus);
  1414 	RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,aPos),aStatus);
  1353 	OstTrace0(TRACE_BORDER, EFSRV_EFILEWRITE10RETURN, "");
  1415 	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2Return, MODULEUID);
  1354 	}
  1416 	}
  1355 
  1417 
  1356 
  1418 
  1357 
  1419 
  1358 
  1420 
  1382 @panic FSCLIENT 17 if aLength is not greater than zero,
  1444 @panic FSCLIENT 17 if aLength is not greater than zero,
  1383 @panic FSCLIENT 19 if aPos is negative. 
  1445 @panic FSCLIENT 19 if aPos is negative. 
  1384 
  1446 
  1385 */
  1447 */
  1386 	{
  1448 	{
  1387 	OstTraceExt4(TRACE_BORDER, EFSRV_EFILELOCK, "RFile::Lock() sess %x subs %x aPos %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength);
  1449 	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileLock, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength);
       
  1450 
  1388 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  1451 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
       
  1452 
  1389 	TInt r = SendReceive(EFsFileLock,TIpcArgs(aPos,aLength));
  1453 	TInt r = SendReceive(EFsFileLock,TIpcArgs(aPos,aLength));
  1390 	OstTrace1(TRACE_BORDER, EFSRV_EFILELOCKRETURN, "r %d", r);
  1454 
       
  1455 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileLockReturn, MODULEUID, r);
  1391 	return r;
  1456 	return r;
  1392 	}
  1457 	}
  1393 
  1458 
  1394 
  1459 
  1395 
  1460 
  1413         
  1478         
  1414 @panic FSCLIENT 18 if aLength is not greater than zero,
  1479 @panic FSCLIENT 18 if aLength is not greater than zero,
  1415 @panic FSCLIENT 19 if aPos is negative. 
  1480 @panic FSCLIENT 19 if aPos is negative. 
  1416 */
  1481 */
  1417 	{
  1482 	{
  1418 	OstTraceExt4(TRACE_BORDER, EFSRV_EFILEUNLOCK, "RFile::UnLock() sess %x subs %x aPos %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength);
  1483 	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileUnLock, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength);
       
  1484 
  1419 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  1485 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  1420 	TInt r = SendReceive(EFsFileUnLock,TIpcArgs(aPos,aLength));
  1486 	TInt r = SendReceive(EFsFileUnLock,TIpcArgs(aPos,aLength));
  1421 	OstTrace1(TRACE_BORDER, EFSRV_EFILEUNLOCKRETURN, "r %d", r);
  1487 
       
  1488 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileUnLockReturn, MODULEUID, r);
  1422 	return r;
  1489 	return r;
  1423 	}
  1490 	}
  1424 
  1491 
  1425 
  1492 
  1426 
  1493 
  1460 
  1527 
  1461 @return KErrNone if successful, otherwise one of the other system-wide error 
  1528 @return KErrNone if successful, otherwise one of the other system-wide error 
  1462         codes.
  1529         codes.
  1463 */
  1530 */
  1464 	{
  1531 	{
  1465 	OstTraceExt4(TRACE_BORDER, EFSRV_EFILESEEK1, "sess %x subs %x aMode %x aPos %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aMode, (TUint) aPos);
  1532 	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileSeek, MODULEUID, Session().Handle(), SubSessionHandle(), aMode, aPos, 0);
       
  1533 
  1466 	TInt64 newPos = aPos;
  1534 	TInt64 newPos = aPos;
  1467 	TPckg<TInt64>  pkNewPos(newPos);
  1535 	TPckg<TInt64>  pkNewPos(newPos);
  1468 	TInt r = SendReceive(EFsFileSeek|KIpcArgSlot2Desc,TIpcArgs(aPos,aMode,&pkNewPos));
  1536 	TInt r = SendReceive(EFsFileSeek|KIpcArgSlot2Desc,TIpcArgs(aPos,aMode,&pkNewPos));
  1469 	if(KErrNone == r)
  1537 	if(KErrNone == r)
  1470 		aPos = I64LOW(newPos);
  1538 		aPos = I64LOW(newPos);
  1471 	OstTrace1(TRACE_BORDER, EFSRV_EFILESEEK1RETURN, "r %d", r);
  1539 
       
  1540 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileSeekReturn, MODULEUID, r);
  1472 	return r;
  1541 	return r;
  1473 	}
  1542 	}
  1474 
  1543 
  1475 
  1544 
  1476 
  1545 
  1488 
  1557 
  1489 @return KErrNone if successful, otherwise one of the other system-wide error 
  1558 @return KErrNone if successful, otherwise one of the other system-wide error 
  1490         codes.
  1559         codes.
  1491 */
  1560 */
  1492 	{
  1561 	{
  1493 	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEFLUSH1, "sess %x subs %x status %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) NULL);
  1562 	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileFlush, MODULEUID, Session().Handle(), SubSessionHandle(), NULL);
       
  1563 
  1494 	TInt r = RSubSessionBase::SendReceive(EFsFileFlush);
  1564 	TInt r = RSubSessionBase::SendReceive(EFsFileFlush);
  1495 	OstTrace1(TRACE_BORDER, EFSRV_EFILEFLUSH1RETURN, "r %d", r);
  1565 
       
  1566 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileFlushReturn, MODULEUID, r);
  1496 	return r;
  1567 	return r;
  1497 	}
  1568 	}
  1498 
  1569 
  1499 
  1570 
  1500 
  1571 
  1512 
  1583 
  1513 @param aStatus Request status. On completion contains KErrNone if successful, 
  1584 @param aStatus Request status. On completion contains KErrNone if successful, 
  1514                otherwise one of the other system-wide error codes.
  1585                otherwise one of the other system-wide error codes.
  1515 */
  1586 */
  1516 	{
  1587 	{
  1517 	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEFLUSH2, "sess %x subs %x status %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) &aStatus);
  1588 	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileFlush, MODULEUID, Session().Handle(), SubSessionHandle(), &aStatus);
       
  1589 
  1518 	RSubSessionBase::SendReceive(EFsFileFlush, aStatus);
  1590 	RSubSessionBase::SendReceive(EFsFileFlush, aStatus);
  1519 	OstTrace0(TRACE_BORDER, EFSRV_EFILEFLUSH2RETURN, "");
  1591 
       
  1592 	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileFlushReturn, MODULEUID);
  1520 	}
  1593 	}
  1521 
  1594 
  1522 
  1595 
  1523 
  1596 
  1524 
  1597 
  1530 
  1603 
  1531 @return KErrNone if successful, otherwise one of the other system-wide error 
  1604 @return KErrNone if successful, otherwise one of the other system-wide error 
  1532         codes.
  1605         codes.
  1533 */
  1606 */
  1534 	{
  1607 	{
  1535 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILESIZE, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle());
  1608 	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileSize, MODULEUID, Session().Handle(), SubSessionHandle());
       
  1609 
  1536 	TInt64 size = aSize;
  1610 	TInt64 size = aSize;
  1537 	TPckg<TInt64> pkSize(size);
  1611 	TPckg<TInt64> pkSize(size);
  1538 	TInt r = SendReceive(EFsFileSize|KIpcArgSlot0Desc,TIpcArgs(&pkSize));
  1612 	TInt r = SendReceive(EFsFileSize|KIpcArgSlot0Desc,TIpcArgs(&pkSize));
  1539 	if(KErrNone != r)
  1613 	if(KErrNone != r)
  1540 		return r;
  1614 		return r;
  1541 	aSize = I64LOW(size);
  1615 	aSize = I64LOW(size);
  1542 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
  1616 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
  1543 	if (size > KMaxTInt)
  1617 	if (size > KMaxTInt)
  1544 		return (KErrTooBig);
  1618 		return (KErrTooBig);
  1545 #endif
  1619 #endif
  1546 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILESIZERETURN, "r %d aSize %d", (TUint) r, (TUint) aSize);
  1620 
       
  1621 	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileSizeReturn, MODULEUID, r, aSize);
  1547 	return r;
  1622 	return r;
  1548 	}
  1623 	}
  1549 
  1624 
  1550 
  1625 
  1551 
  1626 
  1573 
  1648 
  1574 @panic FSCLIENT 20 If aSize is negative.
  1649 @panic FSCLIENT 20 If aSize is negative.
  1575 
  1650 
  1576 */
  1651 */
  1577 	{
  1652 	{
  1578 	OstTraceExt3(TRACE_BORDER, EFSRV_EFILESETSIZE1, "sess %x subs %x aSize %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aSize);
  1653 	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileSetSize, MODULEUID, Session().Handle(), SubSessionHandle(), aSize, 0);
       
  1654 
  1579 	TInt r = SendReceive(EFsFileSetSize,TIpcArgs(aSize));
  1655 	TInt r = SendReceive(EFsFileSetSize,TIpcArgs(aSize));
  1580 	OstTrace1(TRACE_BORDER, EFSRV_EFILESETSIZE1RETURN, "r %d", r);
  1656 
       
  1657 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileSetSizeReturn, MODULEUID, r);
  1581 	return r;
  1658 	return r;
  1582 	}
  1659 	}
  1583 
  1660 
  1584 
  1661 
  1585 
  1662 
  1596         codes.
  1673         codes.
  1597         
  1674         
  1598 @see KEntryAttNormal        
  1675 @see KEntryAttNormal        
  1599 */
  1676 */
  1600 	{
  1677 	{
  1601 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEATT, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle());
  1678 	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileAtt, MODULEUID, Session().Handle(), SubSessionHandle());
       
  1679 
  1602 	TPtr8 a((TUint8*)&aVal,sizeof(TUint));
  1680 	TPtr8 a((TUint8*)&aVal,sizeof(TUint));
  1603 	
  1681 	
  1604 	TInt r = SendReceive(EFsFileAtt,TIpcArgs(&a));
  1682 	TInt r = SendReceive(EFsFileAtt,TIpcArgs(&a));
  1605 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEATTRETURN, "r %d aVal %x", (TUint) r, (TUint) aVal);
  1683 
       
  1684 	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileAttReturn, MODULEUID, r, aVal);
  1606 	return r;
  1685 	return r;
  1607 	}
  1686 	}
  1608 
  1687 
  1609 
  1688 
  1610 
  1689 
  1637         codes.
  1716         codes.
  1638         
  1717         
  1639 @panic FSCLIENT 21 if the same attribute bit is set in both bitmasks.
  1718 @panic FSCLIENT 21 if the same attribute bit is set in both bitmasks.
  1640 */
  1719 */
  1641 	{
  1720 	{
  1642 	OstTraceExt4(TRACE_BORDER, EFSRV_EFILESETATT, "sess %x subs %x aSetAttMask %x aClearAttMask %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aSetAttMask, (TUint) aClearAttMask);
  1721 	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileSetAtt, MODULEUID, Session().Handle(), SubSessionHandle(), aSetAttMask, aClearAttMask);
       
  1722 
  1643 	__ASSERT_ALWAYS((aSetAttMask&aClearAttMask)==0,Panic(EAttributesIllegal));
  1723 	__ASSERT_ALWAYS((aSetAttMask&aClearAttMask)==0,Panic(EAttributesIllegal));
  1644 
  1724 
  1645 	TInt r = SendReceive(EFsFileSetAtt,TIpcArgs(aSetAttMask,aClearAttMask));
  1725 	TInt r = SendReceive(EFsFileSetAtt,TIpcArgs(aSetAttMask,aClearAttMask));
  1646 	OstTrace1(TRACE_BORDER, EFSRV_EFILESETATTRETURN, "r %d", r);
  1726 
       
  1727 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileSetAttReturn, MODULEUID, r);
  1647 	return r;
  1728 	return r;
  1648 	}
  1729 	}
  1649 
  1730 
  1650 
  1731 
  1651 
  1732 
  1658 
  1739 
  1659 @return KErrNone if successful, otherwise one of the other system-wide error 
  1740 @return KErrNone if successful, otherwise one of the other system-wide error 
  1660         codes.
  1741         codes.
  1661 */
  1742 */
  1662 	{
  1743 	{
  1663 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEMODIFIED, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle());
  1744 	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileModified, MODULEUID, Session().Handle(), SubSessionHandle());
       
  1745 
  1664 	TPtr8 t((TUint8*)&aTime,sizeof(TTime));
  1746 	TPtr8 t((TUint8*)&aTime,sizeof(TTime));
  1665 	TInt r = SendReceive(EFsFileModified,TIpcArgs(&t));
  1747 	TInt r = SendReceive(EFsFileModified,TIpcArgs(&t));
  1666 	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEMODIFIEDRETURN, "r %d aTime %x:%x ", (TUint) r, (TUint) I64HIGH(aTime.Int64()), (TUint) I64LOW(aTime.Int64()));
  1748 
       
  1749 	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileModifiedReturn, MODULEUID, r, I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()));
  1667 	return r;
  1750 	return r;
  1668 	}
  1751 	}
  1669 
  1752 
  1670 
  1753 
  1671 
  1754 
  1685 
  1768 
  1686 @return KErrNone if successful, otherwise one of the other system-wide error 
  1769 @return KErrNone if successful, otherwise one of the other system-wide error 
  1687         codes.
  1770         codes.
  1688 */
  1771 */
  1689 	{
  1772 	{
  1690 	OstTraceExt4(TRACE_BORDER, EFSRV_EFILESETMODIFIED, "sess %x subs %x aTime %x:%x ", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aTime.Int64()), (TUint) I64LOW(aTime.Int64()));
  1773 	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileSetModified, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()));
       
  1774 
  1691 	TPtrC8 t((TUint8*)&aTime,sizeof(TTime));
  1775 	TPtrC8 t((TUint8*)&aTime,sizeof(TTime));
  1692 	TInt r = SendReceive(EFsFileSetModified,TIpcArgs(&t));
  1776 	TInt r = SendReceive(EFsFileSetModified,TIpcArgs(&t));
  1693 	OstTrace1(TRACE_BORDER, EFSRV_EFILESETMODIFIEDRETURN, "r %d", r);
  1777 
       
  1778 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileSetModifiedReturn, MODULEUID, r);
  1694 	return r;
  1779 	return r;
  1695 	}
  1780 	}
  1696 
  1781 
  1697 
  1782 
  1698 
  1783 
  1719 
  1804 
  1720 @see RFile::SetModified
  1805 @see RFile::SetModified
  1721 @see RFile::SetAtt
  1806 @see RFile::SetAtt
  1722 */
  1807 */
  1723 	{
  1808 	{
  1724 	OstTraceExt4(TRACE_BORDER, EFSRV_EFILESETA, "sess %x subs %x aSetAttMask %x aClearAttMask %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aMask, (TUint) aVal);
  1809 	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileSet, MODULEUID, 
  1725 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILESETB, "aTime %x:%x ", (TUint) I64HIGH(aTime.Int64()), (TUint) I64LOW(aTime.Int64()));
  1810 		Session().Handle(), SubSessionHandle(), I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()), aMask, aVal);
       
  1811 
  1726 	__ASSERT_ALWAYS((aVal&aMask)==0,Panic(EAttributesIllegal));
  1812 	__ASSERT_ALWAYS((aVal&aMask)==0,Panic(EAttributesIllegal));
  1727 	TPtrC8 t((TUint8*)&aTime,sizeof(TTime));
  1813 	TPtrC8 t((TUint8*)&aTime,sizeof(TTime));
  1728 	TInt r = SendReceive(EFsFileSet,TIpcArgs(&t,aMask,aVal));
  1814 	TInt r = SendReceive(EFsFileSet,TIpcArgs(&t,aMask,aVal));
  1729 	OstTrace1(TRACE_BORDER, EFSRV_EFILESETRETURN, "r %d", r);
  1815 
       
  1816 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileSetReturn, MODULEUID, r);
  1730 	return r;
  1817 	return r;
  1731 	}
  1818 	}
  1732 
  1819 
  1733 
  1820 
  1734 
  1821 
  1753 
  1840 
  1754 @capability Dependent If the path starts with /Resource then capability DiskAdmin is required
  1841 @capability Dependent If the path starts with /Resource then capability DiskAdmin is required
  1755 
  1842 
  1756 */
  1843 */
  1757 	{
  1844 	{
  1758 	OstTraceExt3(TRACE_BORDER, EFSRV_EFILECHANGEMODE, "sess %x subs %x aNewMode %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aNewMode);
  1845 	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileChangeMode, MODULEUID, Session().Handle(), SubSessionHandle(), aNewMode);
       
  1846 
  1759 	if (aNewMode!=EFileShareExclusive && aNewMode!=EFileShareReadersOnly)
  1847 	if (aNewMode!=EFileShareExclusive && aNewMode!=EFileShareReadersOnly)
  1760 		return(KErrArgument);
  1848 		return(KErrArgument);
  1761 	TInt r = SendReceive(EFsFileChangeMode,TIpcArgs(aNewMode));
  1849 	TInt r = SendReceive(EFsFileChangeMode,TIpcArgs(aNewMode));
  1762 	OstTrace1(TRACE_BORDER, EFSRV_EFILECHANGEMODERETURN, "r %d", r);
  1850 
       
  1851 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileChangeModeReturn, MODULEUID, r);
  1763 	return r;
  1852 	return r;
  1764 	}
  1853 	}
  1765 
  1854 
  1766 
  1855 
  1767 
  1856 
  1803 @capability Dependent If aNewName starts with /Private and does not match this process'
  1892 @capability Dependent If aNewName starts with /Private and does not match this process'
  1804 					  SID then AllFiles capability is required.
  1893 					  SID then AllFiles capability is required.
  1805 
  1894 
  1806 */
  1895 */
  1807 	{
  1896 	{
  1808 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILERENAME, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle());
  1897 	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileRename, MODULEUID, Session().Handle(), SubSessionHandle(), aNewName);
  1809 	OstTraceData(TRACE_BORDER, EFSRV_EFILERENAME_ENEWNAME, "NewName %S", aNewName.Ptr(), aNewName.Length()<<1);
  1898 
  1810 	TInt r = SendReceive(EFsFileRename,TIpcArgs(&aNewName));
  1899 	TInt r = SendReceive(EFsFileRename,TIpcArgs(&aNewName));
  1811 	OstTrace1(TRACE_BORDER, EFSRV_EFILERENAMERETURN, "r %d", r);
  1900 
       
  1901 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileRenameReturn, MODULEUID, r);
  1812 	return r;
  1902 	return r;
  1813 	}
  1903 	}
  1814 
  1904 
  1815 
  1905 
  1816 
  1906 
  1829               system-wide error codes
  1919               system-wide error codes
  1830               
  1920               
  1831 @see RFs::Drive
  1921 @see RFs::Drive
  1832 */
  1922 */
  1833 	{
  1923 	{
  1834 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEDRIVE, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle());
  1924 	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileDrive, MODULEUID, Session().Handle(), SubSessionHandle());
       
  1925 
  1835 	TPckg<TInt> pki(aDriveNumber);
  1926 	TPckg<TInt> pki(aDriveNumber);
  1836 	TPckg<TDriveInfo> pkdi(aDriveInfo);
  1927 	TPckg<TDriveInfo> pkdi(aDriveInfo);
  1837 	TInt r = SendReceive(EFsFileDrive,TIpcArgs(&pki,&pkdi));
  1928 	TInt r = SendReceive(EFsFileDrive,TIpcArgs(&pki,&pkdi));
  1838 	OstTraceExt4(TRACE_BORDER, EFSRV_EFILEDRIVERETURN, "r %d driveAtt %x mediaAtt %x type %x", (TUint) r, (TUint) aDriveInfo.iDriveAtt, (TUint) aDriveInfo.iMediaAtt, (TUint) aDriveInfo.iType);
  1929 
       
  1930 	TRACERET4(UTF::EBorder, UTraceModuleEfsrv::EFileDriveReturn, MODULEUID, r, aDriveInfo.iDriveAtt, aDriveInfo.iMediaAtt, aDriveInfo.iType);
  1839 	return r;
  1931 	return r;
  1840 	}
  1932 	}
  1841 
  1933 
  1842 
  1934 
  1843 TInt RFile::Clamp(RFileClamp& aHandle)
  1935 TInt RFile::Clamp(RFileClamp& aHandle)
  1850 					system-wide error codes
  1942 					system-wide error codes
  1851               
  1943               
  1852 @see RFs::Unclamp
  1944 @see RFs::Unclamp
  1853 */
  1945 */
  1854 	{
  1946 	{
  1855 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILECLAMP, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle());
  1947 	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileClamp, MODULEUID, Session().Handle(), SubSessionHandle());
       
  1948 
  1856 	TPckg<RFileClamp> pkHandle(aHandle);
  1949 	TPckg<RFileClamp> pkHandle(aHandle);
  1857 	TInt r = SendReceive(EFsFileClamp,TIpcArgs(& pkHandle));
  1950 	TInt r = SendReceive(EFsFileClamp,TIpcArgs(& pkHandle));
  1858 	OstTrace1(TRACE_BORDER, EFSRV_EFILECLAMPRETURN, "r %d", r);
  1951 
       
  1952 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileClampReturn, MODULEUID, r);
  1859 	return r;
  1953 	return r;
  1860 	}
  1954 	}
  1861 
  1955 
  1862 /**
  1956 /**
  1863 Fetches the Block Map of a file. Each file in the file system will consist of
  1957 Fetches the Block Map of a file. Each file in the file system will consist of
  1883 					KErrCompletion if the end of the file is reached;
  1977 					KErrCompletion if the end of the file is reached;
  1884 					KErrNotSupported if the file system does not support Block Mapping or the media is either removable or not pageable.
  1978 					KErrNotSupported if the file system does not support Block Mapping or the media is either removable or not pageable.
  1885 */
  1979 */
  1886 EFSRV_EXPORT_C TInt RFile::BlockMap(SBlockMapInfo& aInfo, TInt64& aStartPos, TInt64 aEndPos, TInt aBlockMapUsage) const
  1980 EFSRV_EXPORT_C TInt RFile::BlockMap(SBlockMapInfo& aInfo, TInt64& aStartPos, TInt64 aEndPos, TInt aBlockMapUsage) const
  1887 	{
  1981 	{
  1888 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEBLOCKMAPA, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle());
  1982 	TRACE7(UTF::EBorder, UTraceModuleEfsrv::EFileBlockMap, MODULEUID, 
  1889 	OstTraceExt5(TRACE_BORDER, EFSRV_EFILEBLOCKMAPB, "RFile::BlockMap() aStartPos %x:%x aEndPos %x:%x aBlockMapusage %d", (TUint) I64HIGH(aStartPos), (TUint) I64LOW(aStartPos), (TUint) I64HIGH(aEndPos), (TUint) I64LOW(aEndPos), (TUint) aBlockMapUsage);
  1983 		Session().Handle(), SubSessionHandle(), I64LOW(aStartPos), I64HIGH(aEndPos), I64LOW(aEndPos), I64HIGH(aEndPos), aBlockMapUsage);
       
  1984 
  1890 	SBlockMapArgs args;
  1985 	SBlockMapArgs args;
  1891 	args.iStartPos = aStartPos;
  1986 	args.iStartPos = aStartPos;
  1892 	args.iEndPos = aEndPos;
  1987 	args.iEndPos = aEndPos;
  1893 	TPckg<SBlockMapInfo> pkInfo(aInfo);
  1988 	TPckg<SBlockMapInfo> pkInfo(aInfo);
  1894 	TPckg<SBlockMapArgs> pkArgs(args);
  1989 	TPckg<SBlockMapArgs> pkArgs(args);
  1895  	TInt r = SendReceive(EFsBlockMap, TIpcArgs(&pkInfo, &pkArgs, aBlockMapUsage));
  1990  	TInt r = SendReceive(EFsBlockMap, TIpcArgs(&pkInfo, &pkArgs, aBlockMapUsage));
  1896 	if(r==KErrNone)
  1991 	if(r==KErrNone)
  1897 		aStartPos = args.iStartPos;
  1992 		aStartPos = args.iStartPos;
  1898 	OstTrace1(TRACE_BORDER, EFSRV_EFILEBLOCKMAPRETURN, "r %d", r);
  1993 
       
  1994 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileBlockMapReturn, MODULEUID, r);
  1899 	return r;
  1995 	return r;
  1900 	}
  1996 	}
  1901 
  1997 
  1902 
  1998 
  1903 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
  1999 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
  1946                        nor EFileRead then Tcb capability is required.
  2042                        nor EFileRead then Tcb capability is required.
  1947 
  2043 
  1948 */
  2044 */
  1949 EFSRV_EXPORT_C TInt RFile64::Open(RFs& aFs,const TDesC& aName,TUint aFileMode)
  2045 EFSRV_EXPORT_C TInt RFile64::Open(RFs& aFs,const TDesC& aName,TUint aFileMode)
  1950 	{
  2046 	{
  1951 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64OPEN, "sess %x mode %x", (TUint) aFs.Handle(), (TUint) aFileMode);
  2047 	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileOpen, MODULEUID, aFs.Handle(), aFileMode, aName);
  1952 	OstTraceData(TRACE_BORDER, EFSRV_EFILE64OPEN_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
       
  1953 	
  2048 	
  1954 	TInt r = CreateSubSession(aFs,EFsFileOpen,TIpcArgs(&aName,aFileMode|EFileBigFile));
  2049 	TInt r = CreateSubSession(aFs,EFsFileOpen,TIpcArgs(&aName,aFileMode|EFileBigFile));
  1955 	
  2050 	
  1956 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64OPENRETURN, "r %d subs %x", (TUint) r, (TUint) SubSessionHandle());
  2051 	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileOpenReturn, MODULEUID, r, SubSessionHandle());
  1957 	return r;
  2052 	return r;
  1958 	}
  2053 	}
  1959 
  2054 
  1960 /**
  2055 /**
  1961 Creates and opens a new file for writing.
  2056 Creates and opens a new file for writing.
  1996                       SID then AllFiles capability is required.
  2091                       SID then AllFiles capability is required.
  1997 
  2092 
  1998 */
  2093 */
  1999 EFSRV_EXPORT_C TInt RFile64::Create(RFs& aFs,const TDesC& aName,TUint aFileMode)
  2094 EFSRV_EXPORT_C TInt RFile64::Create(RFs& aFs,const TDesC& aName,TUint aFileMode)
  2000 	{
  2095 	{
  2001 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64CREATE, "sess %x mode %x", (TUint) aFs.Handle(), (TUint) aFileMode);
  2096 	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileCreate, MODULEUID, aFs.Handle(), aFileMode, aName);
  2002 	OstTraceData(TRACE_BORDER, EFSRV_EFILE64CREATE_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
  2097 
  2003 	TInt r = CreateSubSession(aFs,EFsFileCreate,TIpcArgs(&aName,aFileMode|EFileBigFile));
  2098 	TInt r = CreateSubSession(aFs,EFsFileCreate,TIpcArgs(&aName,aFileMode|EFileBigFile));
  2004 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64CREATERETURN, "r %d subs %x", (TUint) r, (TUint) SubSessionHandle());
  2099 
       
  2100 	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileCreateReturn, MODULEUID, r, SubSessionHandle());
  2005 	return r;
  2101 	return r;
  2006 	}
  2102 	}
  2007 
  2103 
  2008 /**
  2104 /**
  2009 Opens a file for writing, replacing the content of any existing file of the
  2105 Opens a file for writing, replacing the content of any existing file of the
  2050                       SID then AllFiles capability is required.
  2146                       SID then AllFiles capability is required.
  2051 
  2147 
  2052 */
  2148 */
  2053 EFSRV_EXPORT_C TInt RFile64::Replace(RFs& aFs,const TDesC& aName,TUint aFileMode)
  2149 EFSRV_EXPORT_C TInt RFile64::Replace(RFs& aFs,const TDesC& aName,TUint aFileMode)
  2054 	{
  2150 	{
  2055 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64REPLACE, "sess %x mode %x", (TUint) aFs.Handle(), (TUint) aFileMode);
  2151 	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileReplace, MODULEUID, aFs.Handle(), aFileMode, aName);
  2056 	OstTraceData(TRACE_BORDER, EFSRV_EFILE64REPLACE_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
  2152 
  2057 	TInt r = CreateSubSession(aFs,EFsFileReplace,TIpcArgs(&aName,aFileMode|EFileBigFile));
  2153 	TInt r = CreateSubSession(aFs,EFsFileReplace,TIpcArgs(&aName,aFileMode|EFileBigFile));
  2058 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64REPLACERETURN, "r %d subs %x", (TUint) r, (TUint) SubSessionHandle());
  2154 
       
  2155 	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileReplaceReturn, MODULEUID, r, SubSessionHandle());
  2059 	return r;
  2156 	return r;
  2060 	}
  2157 	}
  2061 
  2158 
  2062 
  2159 
  2063 /**
  2160 /**
  2090 @capability Dependent If aPath starts with /Private and does not match this process'
  2187 @capability Dependent If aPath starts with /Private and does not match this process'
  2091                       SID then AllFiles capability is required.
  2188                       SID then AllFiles capability is required.
  2092 */
  2189 */
  2093 EFSRV_EXPORT_C TInt RFile64::Temp(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aFileMode)
  2190 EFSRV_EXPORT_C TInt RFile64::Temp(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aFileMode)
  2094 	{
  2191 	{
  2095    	OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64TEMP, "sess %x aMode %x", (TUint) aFs.Handle(), (TUint) aFileMode);
  2192    	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileTemp, MODULEUID, aFs.Handle(), aPath, aFileMode);
  2096 	OstTraceData(TRACE_BORDER, EFSRV_EFILE64TEMP_EDIRNAME, "Dir %S", aPath.Ptr(), aPath.Length()<<1);
       
  2097 	TInt r = CreateSubSession(aFs,EFsFileTemp,TIpcArgs(&aPath,aFileMode|EFileBigFile,&aName));
  2193 	TInt r = CreateSubSession(aFs,EFsFileTemp,TIpcArgs(&aPath,aFileMode|EFileBigFile,&aName));
  2098 	OstTraceData(TRACE_BORDER, EFSRV_EFILE64TEMP_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
  2194 	TRACERETMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileTempReturn, MODULEUID, r, SubSessionHandle(), aName);
  2099 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64TEMPRETURN, "r %d subs %x", (TUint) r, (TUint) SubSessionHandle());
       
  2100 	
       
  2101 	return r;
  2195 	return r;
  2102 	}
  2196 	}
  2103 
  2197 
  2104 
  2198 
  2105 /**
  2199 /**
  2147 	else if (aFileHandleIndex == 3)
  2241 	else if (aFileHandleIndex == 3)
  2148 		fileHandle = aMsg.Int3();
  2242 		fileHandle = aMsg.Int3();
  2149 	else
  2243 	else
  2150 		r = KErrArgument;
  2244 		r = KErrArgument;
  2151 
  2245 
  2152 #ifdef OST_TRACE_COMPILER_IN_USE
  2246 #ifdef SYMBIAN_FTRACE_ENABLE
  2153 	TInt handle = NULL;
  2247 	TInt handle = NULL;
  2154 	if (aFsHandleIndex == 0)
  2248 	if (aFsHandleIndex == 0)
  2155 		handle = aMsg.Int0();
  2249 		handle = aMsg.Int0();
  2156 	else if (aFsHandleIndex == 1)
  2250 	else if (aFsHandleIndex == 1)
  2157    		handle = aMsg.Int1();
  2251    		handle = aMsg.Int1();
  2158 	else if (aFsHandleIndex == 2)
  2252 	else if (aFsHandleIndex == 2)
  2159 		handle = aMsg.Int2();
  2253 		handle = aMsg.Int2();
  2160 	else if (aFsHandleIndex == 3)
  2254 	else if (aFsHandleIndex == 3)
  2161 		handle = aMsg.Int3();
  2255 		handle = aMsg.Int3();
  2162 	OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMCLIENT, "sess %x subs %x aFsHandleIndex %d aFileHandleIndex %d ", (TUint) handle, (TUint) fileHandle, (TUint) aFsHandleIndex, (TUint) aFileHandleIndex);
  2256 	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClient, MODULEUID, handle, fileHandle, aFsHandleIndex, aFileHandleIndex);
  2163 #endif
  2257 #endif
       
  2258 
  2164 	if (r != KErrNone)
  2259 	if (r != KErrNone)
  2165 		{
  2260 		{
  2166 		OstTrace1(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMCLIENTRETURN1, "r %d", r);
  2261 		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClientReturn, MODULEUID, r);
  2167 		return r;
  2262 		return r;
  2168 		}
  2263 		}
       
  2264 
  2169 	// Duplicates the file server (RFs) session handle identified by an 
  2265 	// Duplicates the file server (RFs) session handle identified by an 
  2170 	// existing handle contained in the message slot at index aFsHandleIndex
  2266 	// existing handle contained in the message slot at index aFsHandleIndex
  2171 	RFs fs;
  2267 	RFs fs;
  2172 	r = fs.Open(aMsg, aFsHandleIndex, KFileServerPolicy);
  2268 	r = fs.Open(aMsg, aFsHandleIndex, KFileServerPolicy);
  2173 	if (r != KErrNone)
  2269 	if (r != KErrNone)
  2174 		{
  2270 		{
  2175 		OstTrace1(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMCLIENTRETURN2, "r %d", r);
  2271 		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClientReturn, MODULEUID, r);
  2176 		return r;
  2272 		return r;
  2177 		}
  2273 		}
  2178 
  2274 
  2179 	//return CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle));
  2275 	//return CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle));
  2180 	// Slot 1: Indicate Large File Supportis required.
  2276 	// Slot 1: Indicate Large File Supportis required.
  2181 	r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle, KFileAdopt64));
  2277 	r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle, KFileAdopt64));
  2182 	OstTraceExt3(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMCLIENTRETURN3, "r %d sess %x subs %x", (TUint) r, (TUint) Session().Handle(), (TUint) SubSessionHandle());
  2278 
       
  2279 	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClientReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
       
  2280 
  2183 	return r;
  2281 	return r;
  2184 	}
  2282 	}
  2185 
  2283 
  2186 
  2284 
  2187 /**
  2285 /**
  2211 @return KErrNone if successful, otherwise one of the other system-wide
  2309 @return KErrNone if successful, otherwise one of the other system-wide
  2212         error codes.
  2310         error codes.
  2213 */
  2311 */
  2214 EFSRV_EXPORT_C TInt RFile64::AdoptFromServer(TInt aFsHandle, TInt aFileHandle)
  2312 EFSRV_EXPORT_C TInt RFile64::AdoptFromServer(TInt aFsHandle, TInt aFileHandle)
  2215 	{
  2313 	{
  2216 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMSERVER, "sess %x subs %x", (TUint) aFsHandle, (TUint) aFileHandle);
  2314 	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromServer, MODULEUID, aFsHandle, aFileHandle);
       
  2315 
  2217 	RFs fs;
  2316 	RFs fs;
  2218 	TInt r = fs.SetReturnedHandle(aFsHandle, KFileServerPolicy);
  2317 	TInt r = fs.SetReturnedHandle(aFsHandle, KFileServerPolicy);
  2219 	if (r != KErrNone)
  2318 	if (r != KErrNone)
  2220 		{
  2319 		{
  2221 		OstTrace1(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMSERVERRETURN1, "r %d", r);
  2320 		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromServerReturn, MODULEUID, r);
  2222 		return r;
  2321 		return r;
  2223 		}
  2322 		}
  2224 
  2323 
  2225 	//return(CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(aFileHandle)));
  2324 	//return(CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(aFileHandle)));
  2226 	// Slot 1: Indicate Large File Supportis required.
  2325 	// Slot 1: Indicate Large File Supportis required.
  2227 	r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(aFileHandle, KFileAdopt64));
  2326 	r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(aFileHandle, KFileAdopt64));
  2228 	OstTraceExt3(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMSERVERRETURN2, "r %d sess %x subs %x", (TUint) r, (TUint) Session().Handle(), (TUint) SubSessionHandle());
  2327 
       
  2328 	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromServerReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
       
  2329 
  2229 	return r;
  2330 	return r;
  2230 	}
  2331 	}
  2231 
  2332 
  2232 
  2333 
  2233 /**
  2334 /**
  2265 EFSRV_EXPORT_C TInt RFile64::AdoptFromCreator(TInt aFsHandleIndex, TInt aFileHandleIndex)
  2366 EFSRV_EXPORT_C TInt RFile64::AdoptFromCreator(TInt aFsHandleIndex, TInt aFileHandleIndex)
  2266 	{
  2367 	{
  2267 	TInt fileHandle;
  2368 	TInt fileHandle;
  2268 	TInt r = User::GetTIntParameter(aFileHandleIndex,  fileHandle);
  2369 	TInt r = User::GetTIntParameter(aFileHandleIndex,  fileHandle);
  2269 
  2370 
  2270 	OstTraceExt3(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMCREATOR, "subs %x aFsHandleIndex %d aFileHandleIndex %d", (TUint) fileHandle, (TUint) aFsHandleIndex, (TUint) aFileHandleIndex);
  2371 	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreator, MODULEUID, fileHandle, aFsHandleIndex, aFileHandleIndex);
       
  2372 
  2271 	if (r != KErrNone)
  2373 	if (r != KErrNone)
  2272 		{
  2374 		{
  2273 		OstTrace1(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMCREATORRETURN1, "r %d", r);
  2375 		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreatorReturn, MODULEUID, r);
  2274 		return r;
  2376 		return r;
  2275 		}
  2377 		}
  2276 
  2378 
  2277 
  2379 
  2278 	// Duplicates the file server (RFs) session handle identified by an 
  2380 	// Duplicates the file server (RFs) session handle identified by an 
  2279 	// existing handle contained in the environment slot at index aFsHandleIndex
  2381 	// existing handle contained in the environment slot at index aFsHandleIndex
  2280 	RFs fs;
  2382 	RFs fs;
  2281 	r = fs.Open(aFsHandleIndex, KFileServerPolicy);
  2383 	r = fs.Open(aFsHandleIndex, KFileServerPolicy);
  2282 	if (r != KErrNone)
  2384 	if (r != KErrNone)
  2283 		{
  2385 		{
  2284 		OstTrace1(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMCREATORRETURN2, "r %d", r);
  2386 		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreatorReturn, MODULEUID, r);
  2285 		return r;
  2387 		return r;
  2286 		}
  2388 		}
  2287 
  2389 
  2288 	//return(CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle)));
  2390 	//return(CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle)));
  2289 	// Slot 1: Indicate Large File Supportis required.
  2391 	// Slot 1: Indicate Large File Supportis required.
  2290 	r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle, KFileAdopt64));
  2392 	r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle, KFileAdopt64));
  2291 	OstTraceExt3(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMCREATORRETURN3, "r %d sess %x subs %x", (TUint) r, (TUint) Session().Handle(), (TUint) SubSessionHandle());
  2393 
       
  2394 	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreatorReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
       
  2395 
  2292 	return r;
  2396 	return r;
  2293 	}
  2397 	}
  2294 
  2398 
  2295 
  2399 
  2296 /**
  2400 /**
  2325 
  2429 
  2326 @panic FSCLIENT 19 if aPos is negative.        
  2430 @panic FSCLIENT 19 if aPos is negative.        
  2327 */
  2431 */
  2328 EFSRV_EXPORT_C TInt RFile64::Read(TInt64 aPos, TDes8& aDes) const
  2432 EFSRV_EXPORT_C TInt RFile64::Read(TInt64 aPos, TDes8& aDes) const
  2329 	{
  2433 	{
  2330 	OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64READ8, "RFile::Read() sess %x subs %x aPos %x:%x maxdeslen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aDes.MaxLength());
  2434 	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileRead3, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aDes.MaxLength());
       
  2435 
  2331 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  2436 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  2332 
  2437 
  2333 	TInt r;
  2438 	TInt r;
  2334 	if (!(I64HIGH(aPos+1)))
  2439 	if (!(I64HIGH(aPos+1)))
  2335 		{
  2440 		{
  2338 	else
  2443 	else
  2339 		{
  2444 		{
  2340 		TPckgC<TInt64> pkPos(aPos);
  2445 		TPckgC<TInt64> pkPos(aPos);
  2341  		r = SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.MaxLength(),&pkPos));
  2446  		r = SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.MaxLength(),&pkPos));
  2342 		}
  2447 		}
  2343 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64READ8RETURN, "r %d len %d", (TUint) r, (TUint) aDes.Length());
  2448 
       
  2449 	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead3Return, MODULEUID, r, aDes.Length());
       
  2450 
  2344 	return r;
  2451 	return r;
  2345 	}
  2452 	}
  2346 
  2453 
  2347 
  2454 
  2348 /**
  2455 /**
  2382 
  2489 
  2383 @panic FSCLIENT 19 if aPos is negative.        
  2490 @panic FSCLIENT 19 if aPos is negative.        
  2384 */
  2491 */
  2385 EFSRV_EXPORT_C void RFile64::Read(TInt64 aPos, TDes8& aDes, TRequestStatus& aStatus) const
  2492 EFSRV_EXPORT_C void RFile64::Read(TInt64 aPos, TDes8& aDes, TRequestStatus& aStatus) const
  2386 	{
  2493 	{
  2387 	OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64READ10, "RFile::Read() sess %x subs %x aPos %x:%x maxlen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aDes.MaxLength());
  2494 	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileRead4, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aDes.MaxLength(), &aStatus);
       
  2495 
  2388 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  2496 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  2389 	if (!(I64HIGH(aPos+1)))
  2497 	if (!(I64HIGH(aPos+1)))
  2390 		{
  2498 		{
  2391 		RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),I64LOW(aPos)),aStatus);
  2499 		RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),I64LOW(aPos)),aStatus);
  2392 		}
  2500 		}
  2393 	else
  2501 	else
  2394 		{
  2502 		{
  2395 		TPckgC<TInt64> pkPos(aPos);
  2503 		TPckgC<TInt64> pkPos(aPos);
  2396 		RSubSessionBase::SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.MaxLength(),&pkPos),aStatus);
  2504 		RSubSessionBase::SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.MaxLength(),&pkPos),aStatus);
  2397 		}
  2505 		}
  2398 	OstTrace0(TRACE_BORDER, EFSRV_EFILE64READ10RETURN, "");
  2506 
       
  2507 	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead4Return, MODULEUID);
  2399 	}
  2508 	}
  2400 
  2509 
  2401 
  2510 
  2402 /**
  2511 /**
  2403 Reads the specified number of bytes of binary data from the file at a specified 
  2512 Reads the specified number of bytes of binary data from the file at a specified 
  2439 
  2548 
  2440 @panic FSCLIENT 19 if aPos is negative.        
  2549 @panic FSCLIENT 19 if aPos is negative.        
  2441 */    	
  2550 */    	
  2442 EFSRV_EXPORT_C TInt RFile64::Read(TInt64 aPos, TDes8& aDes, TInt aLength) const
  2551 EFSRV_EXPORT_C TInt RFile64::Read(TInt64 aPos, TDes8& aDes, TInt aLength) const
  2443 	{
  2552 	{
  2444 	OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64READ15, "RFile::Read() sess %x subs %x aPos %x:%x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aLength);
  2553 	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileRead3, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aLength);
       
  2554 
  2445 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  2555 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  2446 	if (aLength==0)
  2556 	if (aLength==0)
  2447 		{
  2557 		{
  2448 		aDes.Zero();
  2558 		aDes.Zero();
  2449 		return(KErrNone);
  2559 		return(KErrNone);
  2461 	else
  2571 	else
  2462 		{
  2572 		{
  2463 		TPckgC<TInt64> pkPos(aPos);
  2573 		TPckgC<TInt64> pkPos(aPos);
  2464 		r = SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos));
  2574 		r = SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos));
  2465 		}
  2575 		}
  2466 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64READ15RETURN, "r %d len %d", (TUint) r, (TUint) aDes.Length());
  2576 
       
  2577 	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead3Return, MODULEUID, r, aDes.Length());
       
  2578 
  2467 	return r;
  2579 	return r;
  2468 	}
  2580 	}
  2469 
  2581 
  2470 
  2582 
  2471 /**
  2583 /**
  2514                
  2626                
  2515 @panic FSCLIENT 19 if aPos is negative.                       
  2627 @panic FSCLIENT 19 if aPos is negative.                       
  2516 */
  2628 */
  2517 EFSRV_EXPORT_C void RFile64::Read(TInt64 aPos, TDes8& aDes, TInt aLength,TRequestStatus& aStatus) const
  2629 EFSRV_EXPORT_C void RFile64::Read(TInt64 aPos, TDes8& aDes, TInt aLength,TRequestStatus& aStatus) const
  2518 	{
  2630 	{
  2519 	OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64READ11, "RFile::Read() sess %x subs %x aPos %x:%x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aLength);
  2631 	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileRead4, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aLength, &aStatus);
       
  2632 
  2520 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  2633 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  2521 	if (aLength==0)
  2634 	if (aLength==0)
  2522 		{
  2635 		{
  2523 		aDes.Zero();
  2636 		aDes.Zero();
  2524 		TRequestStatus* req=(&aStatus);
  2637 		TRequestStatus* req=(&aStatus);
  2539 	else
  2652 	else
  2540 		{
  2653 		{
  2541 		TPckgC<TInt64> pkPos(aPos);
  2654 		TPckgC<TInt64> pkPos(aPos);
  2542 		RSubSessionBase::SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos),aStatus);
  2655 		RSubSessionBase::SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos),aStatus);
  2543 		}
  2656 		}
  2544 	OstTrace0(TRACE_BORDER, EFSRV_EFILE64READ11RETURN, "");
  2657 
       
  2658 	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead4Return, MODULEUID);
  2545 	}
  2659 	}
  2546 
  2660 
  2547 
  2661 
  2548 /**
  2662 /**
  2549 Writes to the file at the specified offset within the file
  2663 Writes to the file at the specified offset within the file
  2571 
  2685 
  2572 @panic FSCLIENT 19 if aPos is negative.                       
  2686 @panic FSCLIENT 19 if aPos is negative.                       
  2573 */
  2687 */
  2574 EFSRV_EXPORT_C TInt RFile64::Write(TInt64 aPos, const TDesC8& aDes)
  2688 EFSRV_EXPORT_C TInt RFile64::Write(TInt64 aPos, const TDesC8& aDes)
  2575 	{
  2689 	{
  2576 	OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64WRITE13, "RFile::Write() sess %x subs %x aPos %x:%x deslen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aDes.Length());
  2690 	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileWrite3, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aDes.Length());
       
  2691 
  2577 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  2692 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  2578 
  2693 
  2579 	TInt r;
  2694 	TInt r;
  2580 	if (!(I64HIGH(aPos+1)))
  2695 	if (!(I64HIGH(aPos+1)))
  2581 		{
  2696 		{
  2584 	else
  2699 	else
  2585 		{
  2700 		{
  2586 		TPckgC<TInt64> pkPos(aPos);
  2701 		TPckgC<TInt64> pkPos(aPos);
  2587 		r = SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.Length(),&pkPos));
  2702 		r = SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.Length(),&pkPos));
  2588 		}
  2703 		}
  2589 	OstTrace1(TRACE_BORDER, EFSRV_EFILE64WRITE13RETURN, "r %d", r);
  2704 
       
  2705 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite3Return, MODULEUID, r);
  2590 	return r;
  2706 	return r;
  2591 	}
  2707 	}
  2592 
  2708 
  2593 
  2709 
  2594 /**
  2710 /**
  2622 
  2738 
  2623 @panic FSCLIENT 19 if aPos is negative.                       
  2739 @panic FSCLIENT 19 if aPos is negative.                       
  2624 */
  2740 */
  2625 EFSRV_EXPORT_C void RFile64::Write(TInt64 aPos, const TDesC8& aDes,TRequestStatus& aStatus)
  2741 EFSRV_EXPORT_C void RFile64::Write(TInt64 aPos, const TDesC8& aDes,TRequestStatus& aStatus)
  2626 	{
  2742 	{
  2627 	OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64WRITE15, "RFile::Write() sess %x subs %x pos %x:%x len %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aDes.Length());
  2743 	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileWrite4, MODULEUID, Session().Handle(), SubSessionHandle(), aDes.Length(), &aStatus);
       
  2744 
  2628 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  2745 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  2629 	
  2746 	
  2630 	if (!(I64HIGH(aPos+1)))
  2747 	if (!(I64HIGH(aPos+1)))
  2631 		{
  2748 		{
  2632 		RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),I64LOW(aPos)),aStatus);
  2749 		RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),I64LOW(aPos)),aStatus);
  2634 	else
  2751 	else
  2635 		{
  2752 		{
  2636 		TPckgC<TInt64> pkPos(aPos);
  2753 		TPckgC<TInt64> pkPos(aPos);
  2637 		RSubSessionBase::SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.Length(),&pkPos),aStatus);
  2754 		RSubSessionBase::SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.Length(),&pkPos),aStatus);
  2638 		}
  2755 		}
  2639 	OstTrace0(TRACE_BORDER, EFSRV_EFILE64WRITE15RETURN, "");
  2756 
       
  2757 	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite4Return, MODULEUID);
  2640 	}
  2758 	}
  2641 
  2759 
  2642 
  2760 
  2643 /**
  2761 /**
  2644 Writes the specified number of bytes to the file at the specified offset within the file.
  2762 Writes the specified number of bytes to the file at the specified offset within the file.
  2666         
  2784         
  2667 @panic FSCLIENT 19 if aPos is negative.                       
  2785 @panic FSCLIENT 19 if aPos is negative.                       
  2668 */
  2786 */
  2669 EFSRV_EXPORT_C TInt RFile64::Write(TInt64 aPos, const TDesC8& aDes,TInt aLength)
  2787 EFSRV_EXPORT_C TInt RFile64::Write(TInt64 aPos, const TDesC8& aDes,TInt aLength)
  2670 	{
  2788 	{
  2671 	OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64WRITE7, "RFile::Write() sess %x subs %x aPos %x:%x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aLength);
  2789 	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1, MODULEUID, Session().Handle(), SubSessionHandle(), aLength);
       
  2790 
  2672 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  2791 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  2673 	
  2792 	
  2674 	TInt r;
  2793 	TInt r;
  2675 	if (!(I64HIGH(aPos+1)))
  2794 	if (!(I64HIGH(aPos+1)))
  2676 		{
  2795 		{
  2679 	else
  2798 	else
  2680 		{
  2799 		{
  2681 		TPckgC<TInt64> pkPos(aPos);
  2800 		TPckgC<TInt64> pkPos(aPos);
  2682 		r = SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos));
  2801 		r = SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos));
  2683 		}
  2802 		}
  2684 	OstTrace1(TRACE_BORDER, EFSRV_EFILE64WRITE7RETURN, "r %d", r);
  2803 
       
  2804 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1Return, MODULEUID, r);
  2685 	return r;
  2805 	return r;
  2686 	}
  2806 	}
  2687 
  2807 
  2688 
  2808 
  2689 /**
  2809 /**
  2719 
  2839 
  2720 @panic FSCLIENT 19 if aPos is negative.                       
  2840 @panic FSCLIENT 19 if aPos is negative.                       
  2721 */
  2841 */
  2722 EFSRV_EXPORT_C void RFile64::Write(TInt64 aPos, const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus)
  2842 EFSRV_EXPORT_C void RFile64::Write(TInt64 aPos, const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus)
  2723 	{
  2843 	{
  2724 	OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64WRITE11, "RFile::Write() sess %x subs %x aPos %x:%x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aLength);
  2844 	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aLength, &aStatus);
       
  2845 
  2725 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  2846 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  2726 	
  2847 	
  2727 	if (!(I64HIGH(aPos+1)))
  2848 	if (!(I64HIGH(aPos+1)))
  2728 		{
  2849 		{
  2729 		RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,I64LOW(aPos)),aStatus);
  2850 		RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,I64LOW(aPos)),aStatus);
  2731 	else
  2852 	else
  2732 		{
  2853 		{
  2733 		TPckgC<TInt64> pkPos(aPos);
  2854 		TPckgC<TInt64> pkPos(aPos);
  2734 		RSubSessionBase::SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos),aStatus);
  2855 		RSubSessionBase::SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos),aStatus);
  2735 		}
  2856 		}
  2736 	OstTrace0(TRACE_BORDER, EFSRV_EFILE64WRITE11RETURN, "");
  2857 
       
  2858 	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2Return, MODULEUID);
  2737 	}
  2859 	}
  2738 
  2860 
  2739 
  2861 
  2740 /**
  2862 /**
  2741 Sets the the current file position.
  2863 Sets the the current file position.
  2778 @return KErrNone if successful, otherwise one of the other system-wide error 
  2900 @return KErrNone if successful, otherwise one of the other system-wide error 
  2779         codes.
  2901         codes.
  2780 */
  2902 */
  2781 EFSRV_EXPORT_C TInt RFile64::Seek(TSeek aMode, TInt64& aPos) const
  2903 EFSRV_EXPORT_C TInt RFile64::Seek(TSeek aMode, TInt64& aPos) const
  2782 	{
  2904 	{
  2783 	OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64SEEK2, "RFile::Seek() sess %x subs %x aMode %x aPos %x:%x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aMode, (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos));
  2905 	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileSeek, MODULEUID, Session().Handle(), SubSessionHandle(), aMode, aPos, 0);
       
  2906 
  2784 	TPckgC<TInt64> pkOffset(aPos);
  2907 	TPckgC<TInt64> pkOffset(aPos);
  2785 	TPckg<TInt64> pkNewPos(aPos);
  2908 	TPckg<TInt64> pkNewPos(aPos);
  2786  	TInt r = SendReceive(EFsFileSeek|KIpcArgSlot0Desc|KIpcArgSlot2Desc,TIpcArgs(&pkOffset,aMode,&pkNewPos));
  2909  	TInt r = SendReceive(EFsFileSeek|KIpcArgSlot0Desc|KIpcArgSlot2Desc,TIpcArgs(&pkOffset,aMode,&pkNewPos));
  2787 	OstTrace1(TRACE_BORDER, EFSRV_EFILE64SEEK2RETURN, "r %d", r);
  2910 
       
  2911 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileSeekReturn, MODULEUID, r);
  2788 	return r;
  2912 	return r;
  2789 	}
  2913 	}
  2790 
  2914 
  2791 
  2915 
  2792 /**
  2916 /**
  2804 @return KErrNone if successful, otherwise one of the other system-wide error 
  2928 @return KErrNone if successful, otherwise one of the other system-wide error 
  2805         codes.
  2929         codes.
  2806 */
  2930 */
  2807 EFSRV_EXPORT_C TInt RFile64::Size(TInt64& aSize) const
  2931 EFSRV_EXPORT_C TInt RFile64::Size(TInt64& aSize) const
  2808 	{
  2932 	{
  2809 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64SIZE2, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle());
  2933 	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileSize2, MODULEUID, Session().Handle(), SubSessionHandle());
       
  2934 
  2810 	TPckg<TInt64> pkSize(aSize);
  2935 	TPckg<TInt64> pkSize(aSize);
  2811 	TInt r = SendReceive(EFsFileSize|KIpcArgSlot0Desc,TIpcArgs(&pkSize));
  2936 	TInt r = SendReceive(EFsFileSize|KIpcArgSlot0Desc,TIpcArgs(&pkSize));
  2812 	OstTraceExt3(TRACE_BORDER, EFSRV_EFILE64SIZE2RETURN, "r %d aSize %x:%x", (TUint) r, (TUint) I64HIGH(aSize), (TUint) I64LOW(aSize));
  2937 
       
  2938 	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileSize2Return, MODULEUID, r, I64LOW(aSize), I64HIGH(aSize));
  2813 	return r;
  2939 	return r;
  2814 	}
  2940 	}
  2815 
  2941 
  2816 
  2942 
  2817 /**
  2943 /**
  2843 
  2969 
  2844 @panic FSCLIENT 20 If aSize is negative.
  2970 @panic FSCLIENT 20 If aSize is negative.
  2845 */
  2971 */
  2846 EFSRV_EXPORT_C TInt RFile64::SetSize(TInt64 aSize)
  2972 EFSRV_EXPORT_C TInt RFile64::SetSize(TInt64 aSize)
  2847 	{
  2973 	{
  2848 	OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64SETSIZE2, "sess %x subs %x aSize %x:%x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aSize), (TUint) I64LOW(aSize));
  2974 	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileSetSize, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aSize), I64HIGH(aSize));
       
  2975 
  2849 	TPckgC<TInt64> pkSize(aSize);
  2976 	TPckgC<TInt64> pkSize(aSize);
  2850 	TInt r = SendReceive(EFsFileSetSize|KIpcArgSlot0Desc, TIpcArgs(&pkSize));
  2977 	TInt r = SendReceive(EFsFileSetSize|KIpcArgSlot0Desc, TIpcArgs(&pkSize));
  2851 	OstTrace1(TRACE_BORDER, EFSRV_EFILE64SETSIZE2RETURN, "r %d", r);
  2978 
       
  2979 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileSetSizeReturn, MODULEUID, r);
  2852 	return r;
  2980 	return r;
  2853 	}
  2981 	}
  2854 
  2982 
  2855 
  2983 
  2856 /**
  2984 /**
  2883 
  3011 
  2884 @panic FSCLIENT 17 if aLength is not greater than zero,
  3012 @panic FSCLIENT 17 if aLength is not greater than zero,
  2885 */
  3013 */
  2886 EFSRV_EXPORT_C TInt RFile64::Lock(TInt64 aPos, TInt64 aLength) const
  3014 EFSRV_EXPORT_C TInt RFile64::Lock(TInt64 aPos, TInt64 aLength) const
  2887 	{
  3015 	{
  2888 	OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64LOCK, "RFile::Lock() sess %x subs %x aPos %x:%x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aLength);
  3016 	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileLock, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aLength);
       
  3017 
  2889 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  3018 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  2890 	TPckgC<TInt64> pkPos(aPos);
  3019 	TPckgC<TInt64> pkPos(aPos);
  2891 	TPckgC<TInt64> pkLength(aLength);
  3020 	TPckgC<TInt64> pkLength(aLength);
  2892 
  3021 
  2893 	TInt r;
  3022 	TInt r;
  2898 		r = SendReceive(EFsFileLock|KIpcArgSlot1Desc,TIpcArgs(I64LOW(aPos), &pkLength));
  3027 		r = SendReceive(EFsFileLock|KIpcArgSlot1Desc,TIpcArgs(I64LOW(aPos), &pkLength));
  2899 	else if(aLength <= KMaxTInt)
  3028 	else if(aLength <= KMaxTInt)
  2900 		r = SendReceive(EFsFileLock|KIpcArgSlot0Desc,TIpcArgs(&pkPos, I64LOW(aLength)));
  3029 		r = SendReceive(EFsFileLock|KIpcArgSlot0Desc,TIpcArgs(&pkPos, I64LOW(aLength)));
  2901 	else 
  3030 	else 
  2902 		r = SendReceive(EFsFileLock|KIpcArgSlot0Desc|KIpcArgSlot1Desc,TIpcArgs(&pkPos, &pkLength));
  3031 		r = SendReceive(EFsFileLock|KIpcArgSlot0Desc|KIpcArgSlot1Desc,TIpcArgs(&pkPos, &pkLength));
  2903 	OstTrace1(TRACE_BORDER, EFSRV_EFILE64LOCKRETURN, "r %d", r);
  3032 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileLockReturn, MODULEUID, r);
  2904 	return r;
  3033 	return r;
  2905 	}
  3034 	}
  2906 
  3035 
  2907 
  3036 
  2908 /**
  3037 /**
  2929         
  3058         
  2930 @panic FSCLIENT 18 if aLength is not greater than zero,
  3059 @panic FSCLIENT 18 if aLength is not greater than zero,
  2931 */
  3060 */
  2932 EFSRV_EXPORT_C TInt RFile64::UnLock(TInt64 aPos, TInt64 aLength) const
  3061 EFSRV_EXPORT_C TInt RFile64::UnLock(TInt64 aPos, TInt64 aLength) const
  2933 	{
  3062 	{
  2934 	OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64UNLOCK, "RFile::UnLock() sess %x subs %x aPos %x:%x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aLength);
  3063 	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileUnLock, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aLength);
       
  3064 
  2935 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  3065 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  2936 	
  3066 	
  2937 	TPckgC<TInt64> pkPos(aPos);
  3067 	TPckgC<TInt64> pkPos(aPos);
  2938 	TPckgC<TInt64> pkLength(aLength);
  3068 	TPckgC<TInt64> pkLength(aLength);
  2939 	
  3069 	
  2946 	else if(aLength <= KMaxTInt)
  3076 	else if(aLength <= KMaxTInt)
  2947 		r = SendReceive(EFsFileUnLock|KIpcArgSlot0Desc,TIpcArgs(&pkPos, I64LOW(aLength)));
  3077 		r = SendReceive(EFsFileUnLock|KIpcArgSlot0Desc,TIpcArgs(&pkPos, I64LOW(aLength)));
  2948 	else 
  3078 	else 
  2949 		r = SendReceive(EFsFileUnLock|KIpcArgSlot0Desc|KIpcArgSlot1Desc,TIpcArgs(&pkPos, &pkLength));
  3079 		r = SendReceive(EFsFileUnLock|KIpcArgSlot0Desc|KIpcArgSlot1Desc,TIpcArgs(&pkPos, &pkLength));
  2950 	
  3080 	
  2951 	OstTrace1(TRACE_BORDER, EFSRV_EFILE64UNLOCKRETURN, "r %d", r);
  3081 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileUnLockReturn, MODULEUID, r);
  2952 	return r;
  3082 	return r;
  2953 	}
  3083 	}
  2954 
  3084 
  2955 
  3085 
  2956 /**
  3086 /**
  2990         codes.
  3120         codes.
  2991 
  3121 
  2992 */
  3122 */
  2993 EFSRV_EXPORT_C TInt RFile64::Read(TUint aPos,TDes8& aDes) const
  3123 EFSRV_EXPORT_C TInt RFile64::Read(TUint aPos,TDes8& aDes) const
  2994 	{
  3124 	{
  2995 	OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64READ14, "sess %x subs %x aPos %x maxlen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aDes.MaxLength());
  3125 	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileRead3, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.MaxLength());
       
  3126 
  2996 	TInt r;
  3127 	TInt r;
  2997 	if(!(aPos + 1))
  3128 	if(!(aPos + 1))
  2998 		{
  3129 		{
  2999 		r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),aPos));
  3130 		r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),aPos));
  3000 		}
  3131 		}
  3002 		{
  3133 		{
  3003 		TInt64 pos = aPos;
  3134 		TInt64 pos = aPos;
  3004 		TPckgC<TInt64> pkPos(pos);
  3135 		TPckgC<TInt64> pkPos(pos);
  3005  		r = SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.MaxLength(),&pkPos));
  3136  		r = SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.MaxLength(),&pkPos));
  3006 		}
  3137 		}
  3007 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64READ14RETURN, "r %d len %d", (TUint) r, (TUint) aDes.Length());
  3138 
       
  3139 	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead3Return, MODULEUID, r, aDes.Length());
       
  3140 
  3008 	return r;
  3141 	return r;
  3009 	}
  3142 	}
  3010 
  3143 
  3011 
  3144 
  3012 /**
  3145 /**
  3051                if successful, otherwise one of the other system-wide error codes.
  3184                if successful, otherwise one of the other system-wide error codes.
  3052 
  3185 
  3053 */
  3186 */
  3054 EFSRV_EXPORT_C void RFile64::Read(TUint aPos,TDes8& aDes,TRequestStatus& aStatus) const
  3187 EFSRV_EXPORT_C void RFile64::Read(TUint aPos,TDes8& aDes,TRequestStatus& aStatus) const
  3055 	{
  3188 	{
  3056 	OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64READ12, "sess %x subs %x aPos %x maxlen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aDes.MaxLength());
  3189 	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileRead4, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.MaxLength(), &aStatus);
       
  3190 
  3057 	if(!(aPos + 1))
  3191 	if(!(aPos + 1))
  3058 		{
  3192 		{
  3059 		RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),aPos),aStatus);
  3193 		RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),aPos),aStatus);
  3060 		}
  3194 		}
  3061 	else
  3195 	else
  3062 		{
  3196 		{
  3063 		TInt64 pos = aPos;
  3197 		TInt64 pos = aPos;
  3064 		TPckgC<TInt64> pkPos(pos);
  3198 		TPckgC<TInt64> pkPos(pos);
  3065 		RSubSessionBase::SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.MaxLength(),&pkPos),aStatus);
  3199 		RSubSessionBase::SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.MaxLength(),&pkPos),aStatus);
  3066 		}
  3200 		}
  3067 	OstTrace0(TRACE_BORDER, EFSRV_EFILE64READ12RETURN, "");
  3201 
       
  3202 	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead4Return, MODULEUID);
  3068 	}
  3203 	}
  3069 
  3204 
  3070 
  3205 
  3071 /**
  3206 /**
  3072 Reads the specified number of bytes of binary data from the file at a specified 
  3207 Reads the specified number of bytes of binary data from the file at a specified 
  3114         error codes.
  3249         error codes.
  3115 
  3250 
  3116 */    
  3251 */    
  3117 EFSRV_EXPORT_C TInt RFile64::Read(TUint aPos,TDes8& aDes,TInt aLength) const
  3252 EFSRV_EXPORT_C TInt RFile64::Read(TUint aPos,TDes8& aDes,TInt aLength) const
  3118 	{
  3253 	{
  3119 	OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64READ16, "sess %x subs %x aPos %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength);
  3254 	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileRead3, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength);
       
  3255 
  3120 	if (aLength==0)
  3256 	if (aLength==0)
  3121 		{
  3257 		{
  3122 		aDes.Zero();
  3258 		aDes.Zero();
  3123 		return(KErrNone);
  3259 		return(KErrNone);
  3124 		}
  3260 		}
  3136 		{
  3272 		{
  3137 		TInt64 pos = aPos;
  3273 		TInt64 pos = aPos;
  3138 		TPckgC<TInt64> pkPos(pos);
  3274 		TPckgC<TInt64> pkPos(pos);
  3139 		r = SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos));
  3275 		r = SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos));
  3140 		}
  3276 		}
  3141 	OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64READ16RETURN, "r %d len %d", (TUint) r, (TUint) aDes.Length());
  3277 
       
  3278 	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead3Return, MODULEUID, r, aDes.Length());
       
  3279 
  3142 	return r;
  3280 	return r;
  3143 	}
  3281 	}
  3144 
  3282 
  3145 
  3283 
  3146 /**
  3284 /**
  3195                otherwise one of the other system-wide error codes.
  3333                otherwise one of the other system-wide error codes.
  3196                
  3334                
  3197 */
  3335 */
  3198 EFSRV_EXPORT_C void RFile64::Read(TUint aPos,TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const
  3336 EFSRV_EXPORT_C void RFile64::Read(TUint aPos,TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const
  3199 	{
  3337 	{
  3200 	OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64READ13, "sess %x subs %x aPos %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength);
  3338 	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileRead4, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength, &aStatus);
       
  3339 
  3201 	if (aLength==0)
  3340 	if (aLength==0)
  3202 		{
  3341 		{
  3203 		aDes.Zero();
  3342 		aDes.Zero();
  3204 		TRequestStatus* req=(&aStatus);
  3343 		TRequestStatus* req=(&aStatus);
  3205 		User::RequestComplete(req,KErrNone);
  3344 		User::RequestComplete(req,KErrNone);
  3220 		{
  3359 		{
  3221 		TInt64 pos = aPos;
  3360 		TInt64 pos = aPos;
  3222 		TPckgC<TInt64> pkPos(pos);
  3361 		TPckgC<TInt64> pkPos(pos);
  3223 		RSubSessionBase::SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos),aStatus);
  3362 		RSubSessionBase::SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos),aStatus);
  3224 		}
  3363 		}
  3225 	OstTrace0(TRACE_BORDER, EFSRV_EFILE64READ13RETURN, "");
  3364 
       
  3365 	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead4Return, MODULEUID);
  3226 	}
  3366 	}
  3227 
  3367 
  3228 
  3368 
  3229 /**
  3369 /**
  3230 Writes to the file at the specified offset within the file
  3370 Writes to the file at the specified offset within the file
  3258         codes.
  3398         codes.
  3259 
  3399 
  3260 */
  3400 */
  3261 EFSRV_EXPORT_C TInt RFile64::Write(TUint aPos,const TDesC8& aDes)
  3401 EFSRV_EXPORT_C TInt RFile64::Write(TUint aPos,const TDesC8& aDes)
  3262 	{
  3402 	{
  3263 	OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64WRITE14, "sess %x subs %x aPos %x len %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aDes.Length());
  3403 	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileWrite3, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.Length());
       
  3404 
  3264 	TInt r;
  3405 	TInt r;
  3265 	if(!(aPos + 1))
  3406 	if(!(aPos + 1))
  3266 		{
  3407 		{
  3267 		r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),aPos));
  3408 		r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),aPos));
  3268 		}
  3409 		}
  3270 		{
  3411 		{
  3271 		TInt64 pos = aPos;
  3412 		TInt64 pos = aPos;
  3272 		TPckgC<TInt64> pkPos(pos);
  3413 		TPckgC<TInt64> pkPos(pos);
  3273 		r = SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.Length(),&pkPos));
  3414 		r = SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.Length(),&pkPos));
  3274 		}
  3415 		}
  3275 	OstTrace1(TRACE_BORDER, EFSRV_EFILE64WRITE14RETURN, "r %d", r);
  3416 
       
  3417 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite3Return, MODULEUID, r);
  3276 	return r;
  3418 	return r;
  3277 	}
  3419 	}
  3278 
  3420 
  3279 
  3421 
  3280 /**
  3422 /**
  3314                otherwise one of the other system-wide error codes.
  3456                otherwise one of the other system-wide error codes.
  3315 
  3457 
  3316 */
  3458 */
  3317 EFSRV_EXPORT_C void RFile64::Write(TUint aPos,const TDesC8& aDes,TRequestStatus& aStatus)
  3459 EFSRV_EXPORT_C void RFile64::Write(TUint aPos,const TDesC8& aDes,TRequestStatus& aStatus)
  3318 	{
  3460 	{
  3319 	OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64WRITE16, "sess %x subs %x pos %x len %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aDes.Length());
  3461 	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileWrite4, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.Length(), &aStatus);
       
  3462 
  3320 	if(!(aPos + 1))
  3463 	if(!(aPos + 1))
  3321 		{
  3464 		{
  3322 		RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),aPos),aStatus);
  3465 		RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),aPos),aStatus);
  3323 		}
  3466 		}
  3324 	else
  3467 	else
  3325 		{
  3468 		{
  3326 		TInt64 pos = aPos;
  3469 		TInt64 pos = aPos;
  3327 		TPckgC<TInt64> pkPos(pos);
  3470 		TPckgC<TInt64> pkPos(pos);
  3328 		RSubSessionBase::SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.Length(),&pkPos),aStatus);
  3471 		RSubSessionBase::SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.Length(),&pkPos),aStatus);
  3329 		}
  3472 		}
  3330 	OstTrace0(TRACE_BORDER, EFSRV_EFILE64WRITE16RETURN, "");
  3473 	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite4Return, MODULEUID);
  3331 	}
  3474 	}
  3332 
  3475 
  3333 
  3476 
  3334 /**
  3477 /**
  3335 Writes the specified number of bytes to the file at the specified offset within the file.
  3478 Writes the specified number of bytes to the file at the specified offset within the file.
  3363         otherwise one of the other system-wide error codes.
  3506         otherwise one of the other system-wide error codes.
  3364         
  3507         
  3365 */
  3508 */
  3366 EFSRV_EXPORT_C TInt RFile64::Write(TUint aPos,const TDesC8& aDes,TInt aLength)
  3509 EFSRV_EXPORT_C TInt RFile64::Write(TUint aPos,const TDesC8& aDes,TInt aLength)
  3367 	{
  3510 	{
  3368 	OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64WRITE8, "sess %x subs %x aPos %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength);
  3511 	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1, MODULEUID, Session().Handle(), SubSessionHandle(), aLength);
       
  3512 
  3369 	TInt r;
  3513 	TInt r;
  3370 	if(!(aPos + 1))
  3514 	if(!(aPos + 1))
  3371 		{
  3515 		{
  3372 		r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,aPos));
  3516 		r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,aPos));
  3373 		}
  3517 		}
  3375 		{
  3519 		{
  3376 		TInt64 pos = aPos;
  3520 		TInt64 pos = aPos;
  3377 		TPckgC<TInt64> pkPos(pos);
  3521 		TPckgC<TInt64> pkPos(pos);
  3378 		r = SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos));
  3522 		r = SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos));
  3379 		}
  3523 		}
  3380 	OstTrace1(TRACE_BORDER, EFSRV_EFILE64WRITE8RETURN, "r %d", r);
  3524 
       
  3525 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1Return, MODULEUID, r);
  3381 	return r;
  3526 	return r;
  3382 	}
  3527 	}
  3383 
  3528 
  3384 
  3529 
  3385 /**
  3530 /**
  3422                otherwise one of the other system-wide error codes.
  3567                otherwise one of the other system-wide error codes.
  3423 
  3568 
  3424 */
  3569 */
  3425 EFSRV_EXPORT_C void RFile64::Write(TUint aPos,const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus)
  3570 EFSRV_EXPORT_C void RFile64::Write(TUint aPos,const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus)
  3426 	{
  3571 	{
  3427 	OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64WRITE12, "sess %x subs %x aPos %x len %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength);
  3572 	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength, &aStatus);
       
  3573 
  3428 	if(!(aPos + 1))
  3574 	if(!(aPos + 1))
  3429 		{
  3575 		{
  3430 		RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,aPos),aStatus);
  3576 		RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,aPos),aStatus);
  3431 		}
  3577 		}
  3432 	else
  3578 	else
  3433 		{
  3579 		{
  3434 		TInt64 pos = aPos;
  3580 		TInt64 pos = aPos;
  3435 		TPckgC<TInt64> pkPos(pos);
  3581 		TPckgC<TInt64> pkPos(pos);
  3436 		RSubSessionBase::SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos),aStatus);
  3582 		RSubSessionBase::SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos),aStatus);
  3437 		}
  3583 		}
  3438 	OstTrace0(TRACE_BORDER, EFSRV_EFILE64WRITE12RETURN, "");
  3584 	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2Return, MODULEUID);
  3439 	}
  3585 	}
  3440 #else
  3586 #else
  3441 EFSRV_EXPORT_C TInt RFile64::Open(RFs& /*aFs*/,const TDesC& /*aName*/,TUint /*aFileMode*/)
  3587 EFSRV_EXPORT_C TInt RFile64::Open(RFs& /*aFs*/,const TDesC& /*aName*/,TUint /*aFileMode*/)
  3442 	{Panic(ENotImplemented);return (KErrNotSupported);}
  3588 	{Panic(ENotImplemented);return (KErrNotSupported);}
  3443 EFSRV_EXPORT_C TInt RFile64::Create(RFs& /*aFs*/,const TDesC& /*aName*/,TUint /*aFileMode*/)
  3589 EFSRV_EXPORT_C TInt RFile64::Create(RFs& /*aFs*/,const TDesC& /*aName*/,TUint /*aFileMode*/)