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