userlibandfileserver/fileserver/sfsrv/cl_fman.cpp
branchRCL_3
changeset 44 3e88ff8f41d5
parent 43 c1f20ce4abcf
equal deleted inserted replaced
43:c1f20ce4abcf 44:3e88ff8f41d5
    13 // Description:
    13 // Description:
    14 //
    14 //
    15 
    15 
    16 #include "cl_std.h"
    16 #include "cl_std.h"
    17 
    17 
    18 #ifdef OST_TRACE_COMPILER_IN_USE
    18 #define RETURNIFERROR(a,b,t)  					\
    19 #include "cl_fmanTraces.h"
    19 	{											\
    20 #endif
    20 	if ((a=b)!=KErrNone)						\
    21 
    21 		{										\
       
    22 		if(iStatus)								\
       
    23 			User::RequestComplete(iStatus,a);	\
       
    24 		TInt _t = t;							\
       
    25 		if (_t)	{TRACE1(UTF::EBorder, t, MODULEUID, a);}	\
       
    26 		return(a);								\
       
    27 		}										\
       
    28 	}
       
    29 
       
    30 #define RETURNIFERRORD(a,b,t)  		 			\
       
    31 	TInt a; 									\
       
    32 	RETURNIFERROR(a,b,t)
    22 
    33 
    23 const TUint KRecurseFlag	=	0x40000000;
    34 const TUint KRecurseFlag	=	0x40000000;
    24 const TUint KScanDownFlag	=	0x20000000;
    35 const TUint KScanDownFlag	=	0x20000000;
    25 const TUint KFManBusyFlag	=	0x10000000;
    36 const TUint KFManBusyFlag	=	0x10000000;
    26 const TUint KOverWriteFlag	=	0x08000000;
    37 const TUint KOverWriteFlag	=	0x08000000;
   515 @param aFs File server session.
   526 @param aFs File server session.
   516 
   527 
   517 @return Newly created CFileMan object.
   528 @return Newly created CFileMan object.
   518 */
   529 */
   519 	{
   530 	{
   520 	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANNEWL1, "sess %x", aFs.Handle());
   531 	TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECFileManNewL1, MODULEUID, aFs.Handle());
   521 
   532 
   522 	CFileMan* fileMan=new(ELeave) CFileMan(aFs);
   533 	CFileMan* fileMan=new(ELeave) CFileMan(aFs);
   523 	CleanupStack::PushL(fileMan);
   534 	CleanupStack::PushL(fileMan);
   524 	fileMan->CFileBase::ConstructL();
   535 	fileMan->CFileBase::ConstructL();
   525 	CleanupStack::Pop();
   536 	CleanupStack::Pop();
   526 
   537 
   527 	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANNEWL1RETURN, "CFileMan* %x", fileMan);
   538 	TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECFileManNewL1Return, MODULEUID, fileMan);
   528 	return fileMan;
   539 	return fileMan;
   529 	}
   540 	}
   530 
   541 
   531 
   542 
   532 
   543 
   539 @param anObserver File management observer.
   550 @param anObserver File management observer.
   540 
   551 
   541 @return Newly created CFileMan object.
   552 @return Newly created CFileMan object.
   542 */
   553 */
   543 	{
   554 	{
   544 	OstTraceExt2(TRACE_BORDER, EFSRV_ECFILEMANNEWL2, "sess %x anObserver %x", (TUint) aFs.Handle(), (TUint) anObserver);
   555 	TRACE2(UTF::EBorder, UTraceModuleEfsrv::ECFileManNewL2, MODULEUID, aFs.Handle(), anObserver);
   545 
   556 
   546 	CFileMan* fileMan=new(ELeave) CFileMan(aFs);
   557 	CFileMan* fileMan=new(ELeave) CFileMan(aFs);
   547 	CleanupStack::PushL(fileMan);
   558 	CleanupStack::PushL(fileMan);
   548 	fileMan->CFileBase::ConstructL();
   559 	fileMan->CFileBase::ConstructL();
   549 	CleanupStack::Pop();
   560 	CleanupStack::Pop();
   550 	fileMan->SetObserver(anObserver);
   561 	fileMan->SetObserver(anObserver);
   551 
   562 
   552 	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANNEWL2RETURN, "CFileMan* %x", fileMan);
   563 	TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECFileManNewL2Return, MODULEUID, fileMan);
   553 	return fileMan;
   564 	return fileMan;
   554 	}
   565 	}
   555 
   566 
   556 
   567 
   557 
   568 
   563 	: CFileBase(aFs)
   574 	: CFileBase(aFs)
   564 	{
   575 	{
   565 	}
   576 	}
   566 CFileMan::~CFileMan()
   577 CFileMan::~CFileMan()
   567 	{
   578 	{
   568 	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANDESTRUCTOR, "this %x", this);
   579 	TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECFileManDestructor, MODULEUID, this);
   569 
   580 
   570 	OstTrace0(TRACE_BORDER, EFSRV_ECFILEMANDESTRUCTORRETURN, "");
   581 	TRACE0(UTF::EBorder, UTraceModuleEfsrv::ECFileManDestructorReturn, MODULEUID);
   571 	}
   582 	}
   572 
   583 
   573 
   584 
   574 EXPORT_C CFileMan::TAction CFileMan::CurrentAction()
   585 EXPORT_C CFileMan::TAction CFileMan::CurrentAction()
   575 /**
   586 /**
   576 Gets the action which CFileMan is currently carrying out.
   587 Gets the action which CFileMan is currently carrying out.
   577 
   588 
   578 @return The action which CFileMan is carrying out.
   589 @return The action which CFileMan is carrying out.
   579 */
   590 */
   580 	{
   591 	{
   581 	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANCURRENTACTION, "this %x", this);
   592 	TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECFileManCurrentAction, MODULEUID, this);
   582 
   593 
   583 	TAction action = ENone;
   594 	TAction action = ENone;
   584 
   595 
   585 	// Mapping table between internal and external action indicators.
   596 	// Mapping table between internal and external action indicators.
   586 	switch(iAction)
   597 	switch(iAction)
   615 		break;
   626 		break;
   616 	default:
   627 	default:
   617 		Panic(EFManUnknownAction);
   628 		Panic(EFManUnknownAction);
   618 		}
   629 		}
   619 
   630 
   620 	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANCURRENTACTIONRETURN, "action %d", action);
   631 	TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECFileManCurrentActionReturn, MODULEUID, action);
   621 	return (action);
   632 	return (action);
   622 	}
   633 	}
   623 
   634 
   624 
   635 
   625 
   636 
   633 
   644 
   634 @param aTrgName The full path and filename of the target file for
   645 @param aTrgName The full path and filename of the target file for
   635                 the current CFileMan operation
   646                 the current CFileMan operation
   636 */
   647 */
   637 	{
   648 	{
   638 	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANGETCURRENTTARGET, "this %x", this);
   649 	TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECFileManGetCurrentTarget, MODULEUID, this);
   639 
   650 
   640 	GetSrcAndTrg(iTmpParse, aTrgName);
   651 	GetSrcAndTrg(iTmpParse, aTrgName);
   641 
   652 
   642 	OstTrace0(TRACE_BORDER, EFSRV_ECFILEMANGETCURRENTTARGETRETURN, "");
   653 	TRACEMULT1(UTF::EBorder, UTraceModuleEfsrv::ECFileManGetCurrentTargetReturn, MODULEUID, aTrgName);
   643 	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANGETCURRENTTARGET_EFILENAME, "FileName %S", aTrgName.Ptr(), aTrgName.Length()<<1);
       
   644 	}
   654 	}
   645 
   655 
   646 
   656 
   647 
   657 
   648 
   658 
   655 
   665 
   656 @param aSrcName The full path and filename of the source file for the current
   666 @param aSrcName The full path and filename of the source file for the current
   657                 CFileMan operation.
   667                 CFileMan operation.
   658 */
   668 */
   659 	{
   669 	{
   660 	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANGETCURRENTSOURCE, "this %x", this);
   670 	TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECFileManGetCurrentSource, MODULEUID, this);
   661 
   671 
   662     TPtrC fullPath(FullPath());
   672     TPtrC fullPath(FullPath());
   663 	iTmpParse.Set(CurrentEntry().iName, &fullPath, NULL);
   673 	iTmpParse.Set(CurrentEntry().iName, &fullPath, NULL);
   664 	aSrcName = iTmpParse.FullName();
   674 	aSrcName = iTmpParse.FullName();
   665 
   675 
   666 	OstTrace0(TRACE_BORDER, EFSRV_ECFILEMANGETCURRENTSOURCERETURN, "");
   676 	TRACEMULT1(UTF::EBorder, UTraceModuleEfsrv::ECFileManGetCurrentSourceReturn, MODULEUID, aSrcName);
   667 	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANGETCURRENTSOURCE_EFILENAME, "FileName %S", aSrcName.Ptr(), aSrcName.Length()<<1);
       
   668 	}
   677 	}
   669 
   678 
   670 void CFileMan::GetSrcAndTrg(TParse& aSrcName,TFileName& aTrgName)
   679 void CFileMan::GetSrcAndTrg(TParse& aSrcName,TFileName& aTrgName)
   671 //
   680 //
   672 // Get the current target for the operation
   681 // Get the current target for the operation
   723 and may be used to support the increment of progress bars.
   732 and may be used to support the increment of progress bars.
   724 
   733 
   725 @return The number of bytes transferred.
   734 @return The number of bytes transferred.
   726 */
   735 */
   727 	{
   736 	{
   728 	OstTraceExt2(TRACE_BORDER, EFSRV_ECFILEMANBYTESTRANSFERREDBYCOPYSTEP, "this %x BytesTransferred %d", (TUint) this, (TUint) iBytesTransferred);
   737 	TRACE2(UTF::EBorder, UTraceModuleEfsrv::ECFileManBytesTransferredByCopyStep, MODULEUID, this, iBytesTransferred);
   729 
   738 
   730 	return(iBytesTransferred);
   739 	return(iBytesTransferred);
   731 	}
   740 	}
   732 
   741 
   733 
   742 
   893 					  this process' SID then AllFiles capability is required.
   902 					  this process' SID then AllFiles capability is required.
   894 @capability Dependent If aName is /Resource then Tcb capability is required.
   903 @capability Dependent If aName is /Resource then Tcb capability is required.
   895 
   904 
   896 */
   905 */
   897 	{
   906 	{
   898 	OstTraceExt5(TRACE_BORDER, EFSRV_ECFILEMANATTRIBS1A, "this %x aSetMask %x aClearMask %x aSwitches %d status %x", (TUint) this, (TUint) aSetMask, (TUint) aClearMask, (TUint) aSwitches, (TUint) &aStatus);
   907 	TRACEMULT8(UTF::EBorder, UTraceModuleEfsrv::ECFileManAttribs1, MODULEUID,
   899 	OstTraceExt2(TRACE_BORDER, EFSRV_ECFILEMANATTRIBS1B, "aTime %x:%x ", (TUint) I64HIGH(aTime.Int64()), (TUint) I64LOW(aTime.Int64()));
   908 		(TUint) this, aName, aSetMask, aClearMask, I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()), aSwitches, (TUint) &aStatus);
   900 	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANATTRIBS1A_EFILEPATH, "FilePath %S", aName.Ptr(), aName.Length()<<1);
       
   901 
   909 
   902 	TInt r;
   910 	TInt r;
   903 	if (iSwitches&KFManBusyFlag)
   911 	if (iSwitches&KFManBusyFlag)
   904 		{
   912 		{
   905 		r = KErrInUse;
   913 		r = KErrInUse;
   908 		{
   916 		{
   909 		iStatus=&aStatus;
   917 		iStatus=&aStatus;
   910 		r = Attribs(aName,aSetMask,aClearMask,aTime,aSwitches);
   918 		r = Attribs(aName,aSetMask,aClearMask,aTime,aSwitches);
   911 		}
   919 		}
   912 
   920 
   913 	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANATTRIBS1RETURN, "r %d", r);
   921 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManAttribs1Return, MODULEUID, r);
   914 
       
   915 	return r;
   922 	return r;
   916 	}
   923 	}
   917 
   924 
   918 
   925 
   919 
   926 
   965 					  this process' SID then AllFiles capability is required.
   972 					  this process' SID then AllFiles capability is required.
   966 @capability Dependent If aName is /Resource then Tcb capability is required.
   973 @capability Dependent If aName is /Resource then Tcb capability is required.
   967 
   974 
   968 */
   975 */
   969 	{
   976 	{
   970 	OstTraceExt4(TRACE_BORDER, EFSRV_ECFILEMANATTRIBS2A, "this %x aSetMask %x aClearMask %x aSwitches %x", (TUint) this, (TUint) aSetMask, (TUint) aClearMask, (TUint) aSwitches);
   977 	TRACEMULT7(UTF::EBorder, UTraceModuleEfsrv::ECFileManAttribs2, MODULEUID,
   971 	OstTraceExt2(TRACE_BORDER, EFSRV_ECFILEMANATTRIBS2B, "aTime %x:%x ", (TUint) I64HIGH(aTime.Int64()), (TUint) I64LOW(aTime.Int64()));
   978 		(TUint) this, aName, aSetMask, aClearMask, I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()), aSwitches);
   972 	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANATTRIBS2A_EFILEPATH, "FilePath %S", aName.Ptr(), aName.Length()<<1);
       
   973 
   979 
   974 	TInt ret;
   980 	TInt ret;
   975 	if (iSwitches&KFManBusyFlag)
   981 	if (iSwitches&KFManBusyFlag)
   976 		{
   982 		{
   977 		ret = KErrInUse;
   983 		ret = KErrInUse;
   978 		}
   984 		}
   979 	else
   985 	else
   980 		{
   986 		{
   981 		SetFlags(aSwitches&EOverWrite,aSwitches&ERecurse,ETrue,EFalse);
   987 		SetFlags(aSwitches&EOverWrite,aSwitches&ERecurse,ETrue,EFalse);
   982 		TInt r;
   988 		RETURNIFERRORD(r,iFs.Parse(aName,iSrcFile),UTraceModuleEfsrv::ECFileManAttribs2Return);
   983 		if ((r = iFs.Parse(aName,iSrcFile)) != KErrNone)
       
   984 			{
       
   985 			if(iStatus)
       
   986 				User::RequestComplete(iStatus,r);
       
   987 			OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANATTRIBS2RETURN1, "r %d", r);
       
   988 			return r;
       
   989 			}
       
   990 
       
   991 		iSetMask=aSetMask;
   989 		iSetMask=aSetMask;
   992 		iClearMask=aClearMask;
   990 		iClearMask=aClearMask;
   993 		iTime=aTime;
   991 		iTime=aTime;
   994 		iAction = EInternalAttribs;
   992 		iAction = EInternalAttribs;
   995 		iMatchEntry=KEntryAttMaskSupported; // all entries
   993 		iMatchEntry=KEntryAttMaskSupported; // all entries
   997 		TRAP(r,RunL());
   995 		TRAP(r,RunL());
   998 		ret=(r==KErrNone) ? iLastError : r;
   996 		ret=(r==KErrNone) ? iLastError : r;
   999 		DoSynchronize(r);
   997 		DoSynchronize(r);
  1000 		}
   998 		}
  1001 
   999 
  1002 	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANATTRIBS2RETURN2, "r %d", ret);
  1000 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManAttribs2Return, MODULEUID, ret);
  1003 
       
  1004 	return(ret);
  1001 	return(ret);
  1005 	}
  1002 	}
  1006 
  1003 
  1007 
  1004 
  1008 
  1005 
  1038 @capability Dependent If the path for aNew begins with /Sys then Tcb capability is required.
  1035 @capability Dependent If the path for aNew begins with /Sys then Tcb capability is required.
  1039 @capability Dependent If the path for aNew begins with /Resource then Tcb capability is required
  1036 @capability Dependent If the path for aNew begins with /Resource then Tcb capability is required
  1040 
  1037 
  1041 */
  1038 */
  1042 	{
  1039 	{
  1043 	OstTraceExt3(TRACE_BORDER, EFSRV_ECFILEMANCOPY1, "this %x aSwitches %x status %x", (TUint) this, (TUint) aSwitches, (TUint) &aStatus);
  1040 	TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::ECFileManCopy1, MODULEUID,
  1044 	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANCOPY1_EOLDNAME, "OldName %S", anOld.Ptr(), anOld.Length()<<1);
  1041 		(TUint) this, anOld, aNew, aSwitches, (TUint) &aStatus);
  1045 	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANCOPY1_ENEWNAME, "NewName %S", aNew.Ptr(), aNew.Length()<<1);
       
  1046 
  1042 
  1047 	TInt r;
  1043 	TInt r;
  1048 	if (iSwitches&KFManBusyFlag)
  1044 	if (iSwitches&KFManBusyFlag)
  1049 		r = KErrInUse;
  1045 		r = KErrInUse;
  1050 	else
  1046 	else
  1051 		{
  1047 		{
  1052 		iStatus=&aStatus;
  1048 		iStatus=&aStatus;
  1053 		r = Copy(anOld,aNew,aSwitches);
  1049 		r = Copy(anOld,aNew,aSwitches);
  1054 		}
  1050 		}
  1055 
  1051 
  1056 	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANCOPY1RETURN, "r %d", r);
  1052 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManCopy1Return, MODULEUID, r);
  1057 
       
  1058 	return(r);
  1053 	return(r);
  1059 	}
  1054 	}
  1060 
  1055 
  1061 
  1056 
  1062 
  1057 
  1092 
  1087 
  1093 If recursive operation is set, all intermediate directories will be created,
  1088 If recursive operation is set, all intermediate directories will be created,
  1094 including any directories in the path specified by aNew which do not
  1089 including any directories in the path specified by aNew which do not
  1095 already exist.
  1090 already exist.
  1096 
  1091 
  1097 If the source (anOld) is a FILE and the recursive operation is set,
  1092 If the source (anOld) is a file and the recursive operation is set,
  1098 then all the files with the same name as anOld in the source directory
  1093 then all the files with the same name as anOld in the source directory
  1099 including those in subdirectories will be copied to the destination.
  1094 including those in subdirectories will be copied to the destination.
  1100 
  1095 
  1101 For example, the initial directory structure is as follows:
  1096 For example, the initial directory structure is as follows:
  1102 C:\dir1\file.txt
  1097 C:\dir1\file.txt
  1181 @capability Dependent If the path for anOld begins with /Sys then Tcb capability is required.
  1176 @capability Dependent If the path for anOld begins with /Sys then Tcb capability is required.
  1182 @capability Dependent If the path for anOld begins with /Resource then Tcb capability is required
  1177 @capability Dependent If the path for anOld begins with /Resource then Tcb capability is required
  1183 
  1178 
  1184 */
  1179 */
  1185 	{
  1180 	{
  1186 	OstTraceExt2(TRACE_BORDER, EFSRV_ECFILEMANCOPY2, "this %x aSwitches %d", (TUint) this, (TUint) aSwitches);
  1181 	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::ECFileManCopy2, MODULEUID, (TUint) this, anOld, aNew, aSwitches);
  1187 	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANCOPY2_EOLDNAME, "OldName %S", anOld.Ptr(), anOld.Length()<<1);
       
  1188 	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANCOPY2_ENEWNAME, "NewName %S", aNew.Ptr(), aNew.Length()<<1);
       
  1189 
  1182 
  1190 	if (iSwitches&KFManBusyFlag)
  1183 	if (iSwitches&KFManBusyFlag)
  1191 		{
  1184 		{
  1192 		OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANCOPY2RETURN1, "r %d", KErrInUse);
  1185 		TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECFileManCopy2Return, MODULEUID, KErrInUse);
  1193 		return(KErrInUse);
  1186 		return(KErrInUse);
  1194 		}
  1187 		}
  1195 	SetFlags(aSwitches&EOverWrite,aSwitches&ERecurse,ETrue,EFalse);
  1188 	SetFlags(aSwitches&EOverWrite,aSwitches&ERecurse,ETrue,EFalse);
  1196 	TInt r;
  1189 	RETURNIFERRORD(r,iFs.Parse(anOld,iSrcFile),UTraceModuleEfsrv::ECFileManCopy2Return);
  1197 	if ((r = iFs.Parse(anOld,iSrcFile)) != KErrNone)
  1190 	RETURNIFERROR(r,iFs.Parse(aNew,_L("*"),iTrgFile),UTraceModuleEfsrv::ECFileManCopy2Return);
  1198 		{
       
  1199 		if(iStatus)
       
  1200 			User::RequestComplete(iStatus,r);
       
  1201 		OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANCOPY2RETURN2, "r %d", r);
       
  1202 		return r;
       
  1203 		}
       
  1204 
       
  1205 	if ((r = iFs.Parse(aNew,_L("*"),iTrgFile)) != KErrNone)
       
  1206 		{
       
  1207 		if(iStatus)
       
  1208 			User::RequestComplete(iStatus,r);
       
  1209 		OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANCOPY2RETURN3, "r %d", r);
       
  1210 		return r;
       
  1211 		}
       
  1212 
       
  1213 	CheckForDirectory();
  1191 	CheckForDirectory();
  1214 
  1192 
  1215 	if((iSwitches&KRecurseFlag) && iTrgFile.DriveAndPath().MatchF(iSrcFile.FullName()) != KErrNotFound)
  1193 	if((iSwitches&KRecurseFlag) && iTrgFile.DriveAndPath().MatchF(iSrcFile.FullName()) != KErrNotFound)
  1216 		{
  1194 		{
  1217 		OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANCOPY2RETURN4, "r %d", KErrArgument);
  1195 		TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECFileManCopy2Return, MODULEUID, KErrArgument);
  1218 		return(KErrArgument);
  1196 		return(KErrArgument);
  1219 		}
  1197 		}
  1220 
  1198 
  1221 	iAction = EInternalCopy;
  1199 	iAction = EInternalCopy;
  1222 	iMatchEntry=KEntryAttMaskSupported;
  1200 	iMatchEntry=KEntryAttMaskSupported;
  1223 	iNumberOfFilesProcessed = 0;
  1201 	iNumberOfFilesProcessed = 0;
  1224 	TRAP(r,RunL());
  1202 	TRAP(r,RunL());
  1225 	TInt ret=(r==KErrNone) ? iLastError : r;
  1203 	TInt ret=(r==KErrNone) ? iLastError : r;
  1226 	DoSynchronize(r);
  1204 	DoSynchronize(r);
  1227 
  1205 
  1228 	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANCOPY2RETURN5, "r %d", ret);
  1206 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManCopy2Return, MODULEUID, ret);
  1229 
       
  1230 	return(ret);
  1207 	return(ret);
  1231 	}
  1208 	}
  1232 
  1209 
  1233 
  1210 
  1234 
  1211 
  1264 @capability Dependent If aName is /Resource then Tcb capability is required.
  1241 @capability Dependent If aName is /Resource then Tcb capability is required.
  1265 
  1242 
  1266 @see KNullDesC
  1243 @see KNullDesC
  1267 */
  1244 */
  1268 	{
  1245 	{
  1269 	OstTraceExt3(TRACE_BORDER, EFSRV_ECFILEMANDELETE1, "this %x aSwitches %x status %x", (TUint) this, (TUint) aSwitches, (TUint) &aStatus);
  1246 	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::ECFileManDelete1, MODULEUID, (TUint) this, aName, aSwitches, (TUint) &aStatus);
  1270 	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANDELETE1_EFILEPATH, "FilePath %S", aName.Ptr(), aName.Length()<<1);
       
  1271 
  1247 
  1272 	TInt r;
  1248 	TInt r;
  1273 	if (iSwitches&KFManBusyFlag)
  1249 	if (iSwitches&KFManBusyFlag)
  1274 		{
  1250 		{
  1275 		r = KErrInUse;
  1251 		r = KErrInUse;
  1278 		{
  1254 		{
  1279 		iStatus=&aStatus;
  1255 		iStatus=&aStatus;
  1280 		r = Delete(aName,aSwitches);
  1256 		r = Delete(aName,aSwitches);
  1281 		}
  1257 		}
  1282 
  1258 
  1283 	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANDELETE1RETURN, "r %d", r);
  1259 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManDelete1Return, MODULEUID, r);
  1284 
       
  1285 	return(r);
  1260 	return(r);
  1286 	}
  1261 	}
  1287 
  1262 
  1288 
  1263 
  1289 
  1264 
  1326 @capability Dependent If aName is /Resource then Tcb capability is required.
  1301 @capability Dependent If aName is /Resource then Tcb capability is required.
  1327 
  1302 
  1328 @see KNullDesC
  1303 @see KNullDesC
  1329 */
  1304 */
  1330 	{
  1305 	{
  1331 	OstTraceExt2(TRACE_BORDER, EFSRV_ECFILEMANDELETE2, "this %x aSwitches %d", (TUint) this, (TUint) aSwitches);
  1306 	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::ECFileManDelete2, MODULEUID, (TUint) this, aName, aSwitches);
  1332 	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANDELETE2_EFILEPATH, "FilePath %S", aName.Ptr(), aName.Length()<<1);
       
  1333 
  1307 
  1334 	TInt ret;
  1308 	TInt ret;
  1335 	if (iSwitches&KFManBusyFlag)
  1309 	if (iSwitches&KFManBusyFlag)
  1336 		{
  1310 		{
  1337 		ret = KErrInUse;
  1311 		ret = KErrInUse;
  1338 		}
  1312 		}
  1339 	else
  1313 	else
  1340 		{
  1314 		{
  1341 		SetFlags(aSwitches&EOverWrite,aSwitches&ERecurse,ETrue,EFalse);
  1315 		SetFlags(aSwitches&EOverWrite,aSwitches&ERecurse,ETrue,EFalse);
  1342 		TInt r;
  1316 		RETURNIFERRORD(r,iFs.Parse(aName,iSrcFile),UTraceModuleEfsrv::ECFileManDelete2Return);
  1343 		if ((r = iFs.Parse(aName,iSrcFile)) != KErrNone)
       
  1344 			{
       
  1345 			if(iStatus)
       
  1346 				User::RequestComplete(iStatus,r);
       
  1347 			OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANDELETE2RETURN1, "() r %d", r);
       
  1348 			return r;
       
  1349 			}
       
  1350 
       
  1351 		iAction = EInternalDelete;
  1317 		iAction = EInternalDelete;
  1352 		iMatchEntry=KEntryAttHidden|KEntryAttMatchExclude|KEntryAttDir;
  1318 		iMatchEntry=KEntryAttHidden|KEntryAttMatchExclude|KEntryAttDir;
  1353 	//	Exclude directories and system files - include hidden files
  1319 	//	Exclude directories and system files - include hidden files
  1354 		iNumberOfFilesProcessed = 0;
  1320 		iNumberOfFilesProcessed = 0;
  1355 		TRAP(r,RunL());
  1321 		TRAP(r,RunL());
  1356 		ret=(r==KErrNone) ? iLastError : r;
  1322 		ret=(r==KErrNone) ? iLastError : r;
  1357 		DoSynchronize(r);
  1323 		DoSynchronize(r);
  1358 		}
  1324 		}
  1359 
  1325 
  1360 	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANDELETE2RETURN2, "() r %d", ret);
  1326 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManDelete2Return, MODULEUID, ret);
  1361 
       
  1362 	return(ret);
  1327 	return(ret);
  1363 	}
  1328 	}
  1364 
  1329 
  1365 
  1330 
  1366 
  1331 
  1400 @capability Dependent If the path in anOld starts with /Sys then Tcb capability is required.
  1365 @capability Dependent If the path in anOld starts with /Sys then Tcb capability is required.
  1401 @capability Dependent If the path in anOld starts with /Resource then Tcb capability is required.
  1366 @capability Dependent If the path in anOld starts with /Resource then Tcb capability is required.
  1402 
  1367 
  1403 */
  1368 */
  1404 	{
  1369 	{
  1405 	OstTraceExt3(TRACE_BORDER, EFSRV_ECFILEMANMOVE1, "this %x aSwitches %x status %x", (TUint) this, (TUint) aSwitches, (TUint) &aStatus);
  1370 	TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::ECFileManMove1, MODULEUID,
  1406 	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANMOVE1_EOLDNAME, "OldName %S", anOld.Ptr(), anOld.Length()<<1);
  1371 		(TUint) this, anOld, aNew, aSwitches, (TUint) &aStatus);
  1407 	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANMOVE1_ENEWNAME, "NewName %S", aNew.Ptr(), aNew.Length()<<1);
       
  1408 
  1372 
  1409 	TInt r;
  1373 	TInt r;
  1410 	if (iSwitches&KFManBusyFlag)
  1374 	if (iSwitches&KFManBusyFlag)
  1411 		{
  1375 		{
  1412 		r = KErrInUse;
  1376 		r = KErrInUse;
  1415 		{
  1379 		{
  1416 		iStatus=&aStatus;
  1380 		iStatus=&aStatus;
  1417 		r = Move(anOld,aNew,aSwitches);
  1381 		r = Move(anOld,aNew,aSwitches);
  1418 		}
  1382 		}
  1419 
  1383 
  1420 	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANMOVE1RETURN, "r %d", r);
  1384 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManMove1Return, MODULEUID, r);
  1421 
       
  1422 	return r;
  1385 	return r;
  1423 	}
  1386 	}
  1424 
  1387 
  1425 
  1388 
  1426 
  1389 
  1496 CFileMan* fm(CFileMan::NewL(iFs)); // Where iFs is an RFs handle
  1459 CFileMan* fm(CFileMan::NewL(iFs)); // Where iFs is an RFs handle
  1497 ...
  1460 ...
  1498 fm->Move(_L("C:\\a\\b"), _L("C:\\x\\y\\"), CFileMan::ERecurse);
  1461 fm->Move(_L("C:\\a\\b"), _L("C:\\x\\y\\"), CFileMan::ERecurse);
  1499 @endcode
  1462 @endcode
  1500 
  1463 
  1501 If the source (anOld) is a FILE and the recursive operation is set,
  1464 If the source (anOld) is a file and the recursive operation is set,
  1502 then all the files with the same name as anOld in the source directory
  1465 then all the files with the same name as anOld in the source directory
  1503 including those in subdirectories will be moved to the destination.
  1466 including those in subdirectories will be moved to the destination.
  1504 
  1467 
  1505 For example, the initial directory structure is as follows:
  1468 For example, the initial directory structure is as follows:
  1506 C:\src\file.txt
  1469 C:\src\file.txt
  1556 @capability Dependent If the path in anOld starts with /Resource then Tcb capability is required.
  1519 @capability Dependent If the path in anOld starts with /Resource then Tcb capability is required.
  1557 
  1520 
  1558 @see CFileBase::GetLastError()
  1521 @see CFileBase::GetLastError()
  1559 */
  1522 */
  1560 	{
  1523 	{
  1561 	OstTraceExt2(TRACE_BORDER, EFSRV_ECFILEMANMOVE2, "this %x aSwitches %d", (TUint) this, (TUint) aSwitches);
  1524 	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::ECFileManMove2, MODULEUID,
  1562 	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANMOVE2_EOLDNAME, "OldName %S", anOld.Ptr(), anOld.Length()<<1);
  1525 		(TUint) this, anOld, aNew, aSwitches);
  1563 	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANMOVE2_ENEWNAME, "NewName %S", aNew.Ptr(), aNew.Length()<<1);
       
  1564 
  1526 
  1565 
  1527 
  1566 	if (iSwitches&KFManBusyFlag)
  1528 	if (iSwitches&KFManBusyFlag)
  1567 		{
  1529 		{
  1568 		OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANMOVE2RETURN1, "r %d", KErrInUse);
  1530 		TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECFileManMove2Return, MODULEUID, KErrInUse);
  1569 		return(KErrInUse);
  1531 		return(KErrInUse);
  1570 		}
  1532 		}
  1571 
  1533 
  1572 	iNumberOfFilesProcessed = 0;
  1534 	iNumberOfFilesProcessed = 0;
  1573 
  1535 
  1574 	TInt r;
  1536 	RETURNIFERRORD(r,iFs.Parse(anOld,iSrcFile),UTraceModuleEfsrv::ECFileManMove2Return);
  1575 	if ((r = iFs.Parse(anOld,iSrcFile)) != KErrNone)
  1537 	RETURNIFERROR(r,iFs.Parse(aNew,_L("*"),iTrgFile),UTraceModuleEfsrv::ECFileManMove2Return);
  1576 		{
       
  1577 		if(iStatus)
       
  1578 			User::RequestComplete(iStatus,r);
       
  1579 		OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANMOVE2RETURN2, "r %d", r);
       
  1580 		return r;
       
  1581 		}
       
  1582 
       
  1583 	if ((r = iFs.Parse(aNew,_L("*"),iTrgFile)) != KErrNone)
       
  1584 		{
       
  1585 		if(iStatus)
       
  1586 			User::RequestComplete(iStatus,r);
       
  1587 		OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANMOVE2RETURN3, "r %d", r);
       
  1588 		return r;
       
  1589 		}
       
  1590 
       
  1591 
  1538 
  1592 	TInt ret = KErrNone;
  1539 	TInt ret = KErrNone;
  1593 	TBool aComplete = EFalse;
  1540 	TBool aComplete = EFalse;
  1594 	if(SrcTrgDrivesIdentical())
  1541 	if(SrcTrgDrivesIdentical())
  1595 		{
  1542 		{
  1604 		{
  1551 		{
  1605 		if (iStatus)
  1552 		if (iStatus)
  1606 			{
  1553 			{
  1607 			User::RequestComplete(iStatus, ret);
  1554 			User::RequestComplete(iStatus, ret);
  1608 			}
  1555 			}
  1609 		OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANMOVE2RETURN4, "r %d", ret);
  1556 		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManMove2Return, MODULEUID, ret);
  1610 		return(ret);
  1557 		return(ret);
  1611 		}
  1558 		}
  1612 
  1559 
  1613 	iMatchEntry = KEntryAttMaskSupported;
  1560 	iMatchEntry = KEntryAttMaskSupported;
  1614 	if((aSwitches&ERecurse)==0 && iMovingContents)
  1561 	if((aSwitches&ERecurse)==0 && iMovingContents)
  1619 	// Do the Move or Rename Operation
  1566 	// Do the Move or Rename Operation
  1620 	TRAP(r,RunL());
  1567 	TRAP(r,RunL());
  1621 	ret = (r==KErrNone) ? iLastError : r;
  1568 	ret = (r==KErrNone) ? iLastError : r;
  1622 	DoSynchronize(r);
  1569 	DoSynchronize(r);
  1623 
  1570 
  1624 	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANMOVE2RETURN5, "r %d", ret);
  1571 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManMove2Return, MODULEUID, ret);
  1625 
       
  1626 	return(ret);
  1572 	return(ret);
  1627 	}
  1573 	}
  1628 
  1574 
  1629 
  1575 
  1630 TBool CFileMan::SrcTrgDrivesIdentical()
  1576 TBool CFileMan::SrcTrgDrivesIdentical()
  1924 	iAction = EInternalCopyForMove;
  1870 	iAction = EInternalCopyForMove;
  1925 	SetFlags(aSwitches & EOverWrite, recurse, scanDown, EFalse);
  1871 	SetFlags(aSwitches & EOverWrite, recurse, scanDown, EFalse);
  1926 	return(KErrNone);
  1872 	return(KErrNone);
  1927 	}
  1873 	}
  1928 
  1874 
       
  1875 TInt CFileMan::RenameInvalidEntry(const TDesC& /*aName*/,const TDesC& /*aNewName*/,TUint /*aSwitches*/)
       
  1876 //
       
  1877 // Start rename operation
       
  1878 //
       
  1879 	{
       
  1880 	return KErrNotSupported;
       
  1881 	}
       
  1882 
       
  1883 
  1929 
  1884 
  1930 
  1885 
  1931 EXPORT_C TInt CFileMan::Rename(const TDesC& aName,const TDesC& aNewName,TUint aSwitches,TRequestStatus& aStatus)
  1886 EXPORT_C TInt CFileMan::Rename(const TDesC& aName,const TDesC& aNewName,TUint aSwitches,TRequestStatus& aStatus)
  1932 /**
  1887 /**
  1933 Renames one or more files.
  1888 Renames one or more files.
  1958 					  this process' SID then AllFiles capability is required.
  1913 					  this process' SID then AllFiles capability is required.
  1959 @capability Dependent If either aName or aNewName is /Resource then Tcb capability is required.
  1914 @capability Dependent If either aName or aNewName is /Resource then Tcb capability is required.
  1960 
  1915 
  1961 */
  1916 */
  1962 	{
  1917 	{
  1963 	OstTraceExt3(TRACE_BORDER, EFSRV_ECFILEMANRENAME1, "this %x aSwitches %x status %x", (TUint) this, (TUint) aSwitches, (TUint) &aStatus);
  1918 	TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::ECFileManRename1, MODULEUID,
  1964 	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANRENAME1_EOLDNAME, "OldName %S", aName.Ptr(), aName.Length()<<1);
  1919 		(TUint) this, aName, aNewName, aSwitches, (TUint) &aStatus);
  1965 	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANRENAME1_ENEWNAME, "NewName %S", aNewName.Ptr(), aNewName.Length()<<1);
       
  1966 
  1920 
  1967 	TInt r;
  1921 	TInt r;
  1968 	if (iSwitches&KFManBusyFlag)
  1922 	if (iSwitches&KFManBusyFlag)
  1969 		{
  1923 		{
  1970 		r = KErrInUse;
  1924 		r = KErrInUse;
  1973 		{
  1927 		{
  1974 		iStatus=&aStatus;
  1928 		iStatus=&aStatus;
  1975 		r = Rename(aName,aNewName,aSwitches);
  1929 		r = Rename(aName,aNewName,aSwitches);
  1976 		}
  1930 		}
  1977 
  1931 
  1978 	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANRENAME1RETURN, "r %d", r);
  1932 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManRename1Return, MODULEUID, r);
  1979 
       
  1980 	return(r);
  1933 	return(r);
  1981 	}
  1934 	}
  1982 
  1935 
  1983 
  1936 
  1984 
  1937 
  2140 					  this process' SID then AllFiles capability is required.
  2093 					  this process' SID then AllFiles capability is required.
  2141 @capability Dependent If either aName or aNewName is /Resource then Tcb capability is required.
  2094 @capability Dependent If either aName or aNewName is /Resource then Tcb capability is required.
  2142 
  2095 
  2143 */
  2096 */
  2144 	{
  2097 	{
  2145 	OstTraceExt2(TRACE_BORDER, EFSRV_ECFILEMANRENAME2, "this %x aSwitches %d", (TUint) this, (TUint) aSwitches);
  2098 	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::ECFileManRename2, MODULEUID,
  2146 	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANRENAME2_EOLDNAME, "OldName %S", aName.Ptr(), aName.Length()<<1);
  2099 		(TUint) this, aName, aNewName, aSwitches);
  2147 	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANRENAME2_ENEWNAME, "NewName %S", aNewName.Ptr(), aNewName.Length()<<1);
       
  2148 
  2100 
  2149 	TInt ret;
  2101 	TInt ret;
  2150 	if (iSwitches&KFManBusyFlag)
  2102 	if (iSwitches&KFManBusyFlag)
  2151 		{
  2103 		{
  2152 		ret = KErrInUse;
  2104 		ret = KErrInUse;
  2153 		}
  2105 		}
  2154 	else
  2106 	else
  2155 		{
  2107 		{
  2156 		SetFlags(aSwitches&EOverWrite,EFalse,ETrue,EFalse);
  2108 		SetFlags(aSwitches&EOverWrite,EFalse,ETrue,EFalse);
  2157 		TInt r;
  2109 		RETURNIFERRORD(r,iFs.Parse(aName,iSrcFile),UTraceModuleEfsrv::ECFileManRename2Return);
  2158 		if ((r = iFs.Parse(aName,iSrcFile)) != KErrNone)
  2110 		RETURNIFERROR(r,iFs.Parse(aNewName,_L("*"),iTrgFile),UTraceModuleEfsrv::ECFileManRename2Return);
  2159 			{
       
  2160 			if(iStatus)
       
  2161 				User::RequestComplete(iStatus,r);
       
  2162 			OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANRENAME2RETURN1, "r %d", r);
       
  2163 			return r;
       
  2164 			}
       
  2165 
       
  2166 		if ((r = iFs.Parse(aNewName,_L("*"),iTrgFile)) != KErrNone)
       
  2167 			{
       
  2168 			if(iStatus)
       
  2169 				User::RequestComplete(iStatus,r);
       
  2170 			OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANRENAME2RETURN2, "r %d", r);
       
  2171 			return r;
       
  2172 			}
       
  2173 
  2111 
  2174 		iAction = EInternalRename;
  2112 		iAction = EInternalRename;
  2175 		iMatchEntry=KEntryAttMaskSupported;
  2113 		iMatchEntry=KEntryAttMaskSupported;
  2176 		iNumberOfFilesProcessed = 0;
  2114 		iNumberOfFilesProcessed = 0;
  2177 		TRAP(r,RunL());
  2115 		TRAP(r,RunL());
  2178 		ret=(r==KErrNone) ? iLastError : r;
  2116 		ret=(r==KErrNone) ? iLastError : r;
  2179 		DoSynchronize(r);
  2117 		DoSynchronize(r);
  2180 		}
  2118 		}
  2181 
  2119 
  2182 	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANRENAME2RETURN3, "r %d", ret);
  2120 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManRename2Return, MODULEUID, ret);
  2183 
       
  2184 	return(ret);
  2121 	return(ret);
  2185 	}
  2122 	}
  2186 
  2123 
  2187 
  2124 
  2188 EXPORT_C TInt CFileMan::RmDir(const TDesC& aDirName,TRequestStatus& aStatus)
  2125 EXPORT_C TInt CFileMan::RmDir(const TDesC& aDirName,TRequestStatus& aStatus)
  2208 					  then AllFiles capability is required.
  2145 					  then AllFiles capability is required.
  2209 @capability Dependent If aDirName starts with /Resource then Tcb capability is required.
  2146 @capability Dependent If aDirName starts with /Resource then Tcb capability is required.
  2210 
  2147 
  2211 */
  2148 */
  2212 	{
  2149 	{
  2213 	OstTraceExt2(TRACE_BORDER, EFSRV_ECFILEMANRMDIR1, "this %x status %x", (TUint) this, (TUint) &aStatus);
  2150 	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::ECFileManRmDir1, MODULEUID, (TUint) this, aDirName, (TUint) &aStatus);
  2214 	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANRMDIR1_EDIRNAME, "Dir %S", aDirName.Ptr(), aDirName.Length()<<1);
       
  2215 
  2151 
  2216 	TInt r;
  2152 	TInt r;
  2217 	if (iSwitches&KFManBusyFlag)
  2153 	if (iSwitches&KFManBusyFlag)
  2218 		{
  2154 		{
  2219 		r = KErrInUse;
  2155 		r = KErrInUse;
  2222 		{
  2158 		{
  2223 		iStatus=&aStatus;
  2159 		iStatus=&aStatus;
  2224 		r = RmDir(aDirName);
  2160 		r = RmDir(aDirName);
  2225 		}
  2161 		}
  2226 
  2162 
  2227 	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANRMDIR1RETURN, "r %d", r);
  2163 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManRmDir1Return, MODULEUID, r);
  2228 
       
  2229 	return r;
  2164 	return r;
  2230 	}
  2165 	}
  2231 
  2166 
  2232 
  2167 
  2233 EXPORT_C TInt CFileMan::RmDir(const TDesC& aDirName)
  2168 EXPORT_C TInt CFileMan::RmDir(const TDesC& aDirName)
  2258 @capability Dependent If aDirName starts with /Resource then Tcb capability is required.
  2193 @capability Dependent If aDirName starts with /Resource then Tcb capability is required.
  2259 
  2194 
  2260 
  2195 
  2261 */
  2196 */
  2262 	{
  2197 	{
  2263 	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANRMDIR2, "this %x", (TUint) this);
  2198 	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::ECFileManRmDir2, MODULEUID, (TUint) this, aDirName);
  2264 	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANRMDIR2_EDIRNAME, "Dir %S", aDirName.Ptr(), aDirName.Length()<<1);
       
  2265 
  2199 
  2266 	TInt ret;
  2200 	TInt ret;
  2267 	if (iSwitches&KFManBusyFlag)
  2201 	if (iSwitches&KFManBusyFlag)
  2268 		{
  2202 		{
  2269 		ret = KErrInUse;
  2203 		ret = KErrInUse;
  2270 		}
  2204 		}
  2271 	else
  2205 	else
  2272 		{
  2206 		{
  2273 		SetFlags(ETrue,ETrue,EFalse,EFalse);
  2207 		SetFlags(ETrue,ETrue,EFalse,EFalse);
  2274 		TInt r;
  2208 		RETURNIFERRORD(r,iFs.Parse(aDirName,iTrgFile),UTraceModuleEfsrv::ECFileManRmDir2Return);
  2275 		if ((r = iFs.Parse(aDirName,iTrgFile)) != KErrNone)
       
  2276 			{
       
  2277 			if(iStatus)
       
  2278 				User::RequestComplete(iStatus,r);
       
  2279 			OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANRMDIR2RETURN1, "r %d", r);
       
  2280 			return r;
       
  2281 			}
       
  2282 
       
  2283 		iSrcFile.Set(iTrgFile.DriveAndPath(),NULL,NULL);
  2209 		iSrcFile.Set(iTrgFile.DriveAndPath(),NULL,NULL);
  2284 		iAction = EInternalRmDir;
  2210 		iAction = EInternalRmDir;
  2285 		iMatchEntry=KEntryAttMaskSupported;
  2211 		iMatchEntry=KEntryAttMaskSupported;
  2286 		iNumberOfFilesProcessed = 0;
  2212 		iNumberOfFilesProcessed = 0;
  2287 		TRAP(r,RunL());
  2213 		TRAP(r,RunL());
  2288 		DoSynchronize(r);
  2214 		DoSynchronize(r);
  2289 		ret = (r!=KErrNone) ? iLastError : KErrNone;
  2215 		ret = (r!=KErrNone) ? iLastError : KErrNone;
  2290 		}
  2216 		}
  2291 
  2217 
  2292 	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANRMDIR2RETURN2, "r %d", ret);
  2218 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManRmDir2Return, MODULEUID, ret);
  2293 
       
  2294 	return ret;
  2219 	return ret;
  2295 	}
  2220 	}
  2296 
  2221 
  2297 
  2222 
  2298 void CFileMan::DoOperationL()
  2223 void CFileMan::DoOperationL()
  2686 @capability Dependent If the path for aNew begins with /Private and does not match
  2611 @capability Dependent If the path for aNew begins with /Private and does not match
  2687 					  this process' SID then AllFiles capability is required.
  2612 					  this process' SID then AllFiles capability is required.
  2688 @capability Dependent If the path for aNew begins with /Resource then Tcb capability is required.
  2613 @capability Dependent If the path for aNew begins with /Resource then Tcb capability is required.
  2689 */
  2614 */
  2690 	{
  2615 	{
  2691 	OstTraceExt3(TRACE_BORDER, EFSRV_ECFILEMANCOPY3, "this %x anOldSubs %x aSwitches %x", (TUint) this, (TUint) anOld.SubSessionHandle(), (TUint) aSwitches);
  2616 	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::ECFileManCopy3, MODULEUID,
  2692 	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANCOPY3_ENEWNAME, "NewName %S", aNew.Ptr(), aNew.Length()<<1);
  2617 		(TUint) this, anOld.SubSessionHandle(), aNew, aSwitches);
  2693 
  2618 
  2694 	TInt ret;
  2619 	TInt ret;
  2695 	if (iSwitches&KFManBusyFlag)
  2620 	if (iSwitches&KFManBusyFlag)
  2696 		{
  2621 		{
  2697 		ret = KErrInUse;
  2622 		ret = KErrInUse;
  2709 		// need to signal to CFileBase that we're copying from a handle
  2634 		// need to signal to CFileBase that we're copying from a handle
  2710 		// and that iSrcFile is invalid
  2635 		// and that iSrcFile is invalid
  2711 		iSwitches|= KCopyFromHandle;
  2636 		iSwitches|= KCopyFromHandle;
  2712 
  2637 
  2713 		TInt r;
  2638 		TInt r;
  2714 		if ((r = iFs.Parse(aNew, iTrgFile)) != KErrNone)
  2639 		RETURNIFERROR(r, iFs.Parse(aNew, iTrgFile),UTraceModuleEfsrv::ECFileManCopy3Return);
  2715 			{
       
  2716 			if(iStatus)
       
  2717 				User::RequestComplete(iStatus,r);
       
  2718 			OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANCOPY3RETURN1, "r %d", r);
       
  2719 			return r;
       
  2720 			}
       
  2721 
  2640 
  2722 		// Need to duplicate the RFile handle so that any threads owned
  2641 		// Need to duplicate the RFile handle so that any threads owned
  2723 		// by this process can use it - i.e. the worker thread
  2642 		// by this process can use it - i.e. the worker thread
  2724 		if ((r = iSrcFileHandle.Duplicate(anOld, EOwnerProcess)) != KErrNone)
  2643 		RETURNIFERROR(r, iSrcFileHandle.Duplicate(anOld, EOwnerProcess),UTraceModuleEfsrv::ECFileManCopy3Return);
  2725 			{
       
  2726 			if(iStatus)
       
  2727 				User::RequestComplete(iStatus,r);
       
  2728 			OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANCOPY3RETURN2, "r %d", r);
       
  2729 			return r;
       
  2730 			}
       
  2731 
  2644 
  2732 		iAction = EInternalCopyFromHandle;
  2645 		iAction = EInternalCopyFromHandle;
  2733 		iNumberOfFilesProcessed = 0;
  2646 		iNumberOfFilesProcessed = 0;
  2734 		TRAP(r,RunL());
  2647 		TRAP(r,RunL());
  2735 		ret=(r==KErrNone) ? iLastError : r;
  2648 		ret=(r==KErrNone) ? iLastError : r;
  2736 		DoSynchronize(r);
  2649 		DoSynchronize(r);
  2737 		}
  2650 		}
  2738 
  2651 
  2739 	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANCOPY3RETURN3, "r %d", ret);
  2652 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManCopy3Return, MODULEUID, ret);
  2740 
       
  2741 	return(ret);
  2653 	return(ret);
  2742 	}
  2654 	}
  2743 
  2655 
  2744 EXPORT_C TInt CFileMan::Copy(const RFile& anOld,const TDesC& aNew,TUint aSwitches,TRequestStatus& aStatus)
  2656 EXPORT_C TInt CFileMan::Copy(const RFile& anOld,const TDesC& aNew,TUint aSwitches,TRequestStatus& aStatus)
  2745 /**
  2657 /**
  2771 @capability Dependent If the path for aNew begins with /Private and does not match
  2683 @capability Dependent If the path for aNew begins with /Private and does not match
  2772 					  this process' SID then AllFiles capability is required.
  2684 					  this process' SID then AllFiles capability is required.
  2773 @capability Dependent If the path for aNew begins with /Resource then Tcb capability is required.
  2685 @capability Dependent If the path for aNew begins with /Resource then Tcb capability is required.
  2774 */
  2686 */
  2775 	{
  2687 	{
  2776 	OstTraceExt4(TRACE_BORDER, EFSRV_ECFILEMANCOPY4, "this %x anOldSubs %x aSwitches %dstatus %x", (TUint) this, (TUint) anOld.SubSessionHandle(), (TUint) aSwitches, (TUint) &aStatus);
  2688 	TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::ECFileManCopy4, MODULEUID,
  2777 	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANCOPY4_ENEWNAME, "NewName %S", aNew.Ptr(), aNew.Length()<<1);
  2689 		(TUint) this, anOld.SubSessionHandle(), aNew, aSwitches, (TUint) &aStatus);
  2778 
  2690 
  2779 	TInt r;
  2691 	TInt r;
  2780 	if (iSwitches&KFManBusyFlag)
  2692 	if (iSwitches&KFManBusyFlag)
  2781 		{
  2693 		{
  2782 		r = KErrInUse;
  2694 		r = KErrInUse;
  2785 		{
  2697 		{
  2786 		iStatus=&aStatus;
  2698 		iStatus=&aStatus;
  2787 		r = Copy(anOld,aNew,aSwitches);
  2699 		r = Copy(anOld,aNew,aSwitches);
  2788 		}
  2700 		}
  2789 
  2701 
  2790 	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANCOPY4RETURN, "r %d", r);
  2702 	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManCopy4Return, MODULEUID, r);
  2791 
       
  2792 	return(r);
  2703 	return(r);
  2793 	}
  2704 	}
  2794 
  2705 
  2795 void CFileMan::DoCopyFromHandleL()
  2706 void CFileMan::DoCopyFromHandleL()
  2796 //
  2707 //
  2848 #else
  2759 #else
  2849 TInt CFileMan::DoCopy(const RFile64& aSrcFile, RFile64& aDstFile, TInt& aRet)
  2760 TInt CFileMan::DoCopy(const RFile64& aSrcFile, RFile64& aDstFile, TInt& aRet)
  2850 	{
  2761 	{
  2851 	TInt64 rem;
  2762 	TInt64 rem;
  2852 #endif
  2763 #endif
  2853 	TInt r;
  2764 	RETURNIFERRORD(r,aSrcFile.Size(rem),EFalse);
  2854 	if ((r = aSrcFile.Size(rem)) != KErrNone)
  2765 	RETURNIFERROR(r, aDstFile.SetSize(rem),EFalse);
  2855 		{
       
  2856 		if(iStatus)
       
  2857 			User::RequestComplete(iStatus,r);
       
  2858 		return r;
       
  2859 		}
       
  2860 
       
  2861 
       
  2862 	if ((r = aDstFile.SetSize(rem)) != KErrNone)
       
  2863 		{
       
  2864 		if(iStatus)
       
  2865 			User::RequestComplete(iStatus,r);
       
  2866 		return r;
       
  2867 		}
       
  2868 
  2766 
  2869 	HBufC8* bufPtr = NULL;
  2767 	HBufC8* bufPtr = NULL;
  2870 	bufPtr = AllocateBuffer(rem);
  2768 	bufPtr = AllocateBuffer(rem);
  2871 	if (bufPtr == NULL)
  2769 	if (bufPtr == NULL)
  2872 		return KErrNoMemory;
  2770 		return KErrNoMemory;