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