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) |
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 |
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; |
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 |
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 |
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; |
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; |
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 { |
1913 this process' SID then AllFiles capability is required. |
1967 this process' SID then AllFiles capability is required. |
1914 @capability Dependent If either aName or aNewName is /Resource then Tcb capability is required. |
1968 @capability Dependent If either aName or aNewName is /Resource then Tcb capability is required. |
1915 |
1969 |
1916 */ |
1970 */ |
1917 { |
1971 { |
1918 TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::ECFileManRename1, MODULEUID, |
1972 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); |
1973 OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANRENAME1_EOLDNAME, "OldName %S", aName.Ptr(), aName.Length()<<1); |
|
1974 OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANRENAME1_ENEWNAME, "NewName %S", aNewName.Ptr(), aNewName.Length()<<1); |
1920 |
1975 |
1921 TInt r; |
1976 TInt r; |
1922 if (iSwitches&KFManBusyFlag) |
1977 if (iSwitches&KFManBusyFlag) |
1923 { |
1978 { |
1924 r = KErrInUse; |
1979 r = KErrInUse; |
2093 this process' SID then AllFiles capability is required. |
2149 this process' SID then AllFiles capability is required. |
2094 @capability Dependent If either aName or aNewName is /Resource then Tcb capability is required. |
2150 @capability Dependent If either aName or aNewName is /Resource then Tcb capability is required. |
2095 |
2151 |
2096 */ |
2152 */ |
2097 { |
2153 { |
2098 TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::ECFileManRename2, MODULEUID, |
2154 OstTraceExt2(TRACE_BORDER, EFSRV_ECFILEMANRENAME2, "this %x aSwitches %d", (TUint) this, (TUint) aSwitches); |
2099 (TUint) this, aName, aNewName, aSwitches); |
2155 OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANRENAME2_EOLDNAME, "OldName %S", aName.Ptr(), aName.Length()<<1); |
|
2156 OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANRENAME2_ENEWNAME, "NewName %S", aNewName.Ptr(), aNewName.Length()<<1); |
2100 |
2157 |
2101 TInt ret; |
2158 TInt ret; |
2102 if (iSwitches&KFManBusyFlag) |
2159 if (iSwitches&KFManBusyFlag) |
2103 { |
2160 { |
2104 ret = KErrInUse; |
2161 ret = KErrInUse; |
2105 } |
2162 } |
2106 else |
2163 else |
2107 { |
2164 { |
2108 SetFlags(aSwitches&EOverWrite,EFalse,ETrue,EFalse); |
2165 SetFlags(aSwitches&EOverWrite,EFalse,ETrue,EFalse); |
2109 RETURNIFERRORD(r,iFs.Parse(aName,iSrcFile),UTraceModuleEfsrv::ECFileManRename2Return); |
2166 TInt r; |
2110 RETURNIFERROR(r,iFs.Parse(aNewName,_L("*"),iTrgFile),UTraceModuleEfsrv::ECFileManRename2Return); |
2167 if ((r = iFs.Parse(aName,iSrcFile)) != KErrNone) |
|
2168 { |
|
2169 if(iStatus) |
|
2170 User::RequestComplete(iStatus,r); |
|
2171 OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANRENAME2RETURN1, "r %d", r); |
|
2172 return r; |
|
2173 } |
|
2174 |
|
2175 if ((r = iFs.Parse(aNewName,_L("*"),iTrgFile)) != KErrNone) |
|
2176 { |
|
2177 if(iStatus) |
|
2178 User::RequestComplete(iStatus,r); |
|
2179 OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANRENAME2RETURN2, "r %d", r); |
|
2180 return r; |
|
2181 } |
2111 |
2182 |
2112 iAction = EInternalRename; |
2183 iAction = EInternalRename; |
2113 iMatchEntry=KEntryAttMaskSupported; |
2184 iMatchEntry=KEntryAttMaskSupported; |
2114 iNumberOfFilesProcessed = 0; |
2185 iNumberOfFilesProcessed = 0; |
2115 TRAP(r,RunL()); |
2186 TRAP(r,RunL()); |
2116 ret=(r==KErrNone) ? iLastError : r; |
2187 ret=(r==KErrNone) ? iLastError : r; |
2117 DoSynchronize(r); |
2188 DoSynchronize(r); |
2118 } |
2189 } |
2119 |
2190 |
2120 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManRename2Return, MODULEUID, ret); |
2191 OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANRENAME2RETURN3, "r %d", ret); |
|
2192 |
2121 return(ret); |
2193 return(ret); |
2122 } |
2194 } |
2123 |
2195 |
2124 |
2196 |
2125 EXPORT_C TInt CFileMan::RmDir(const TDesC& aDirName,TRequestStatus& aStatus) |
2197 EXPORT_C TInt CFileMan::RmDir(const TDesC& aDirName,TRequestStatus& aStatus) |
2145 then AllFiles capability is required. |
2217 then AllFiles capability is required. |
2146 @capability Dependent If aDirName starts with /Resource then Tcb capability is required. |
2218 @capability Dependent If aDirName starts with /Resource then Tcb capability is required. |
2147 |
2219 |
2148 */ |
2220 */ |
2149 { |
2221 { |
2150 TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::ECFileManRmDir1, MODULEUID, (TUint) this, aDirName, (TUint) &aStatus); |
2222 OstTraceExt2(TRACE_BORDER, EFSRV_ECFILEMANRMDIR1, "this %x status %x", (TUint) this, (TUint) &aStatus); |
|
2223 OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANRMDIR1_EDIRNAME, "Dir %S", aDirName.Ptr(), aDirName.Length()<<1); |
2151 |
2224 |
2152 TInt r; |
2225 TInt r; |
2153 if (iSwitches&KFManBusyFlag) |
2226 if (iSwitches&KFManBusyFlag) |
2154 { |
2227 { |
2155 r = KErrInUse; |
2228 r = KErrInUse; |
2193 @capability Dependent If aDirName starts with /Resource then Tcb capability is required. |
2267 @capability Dependent If aDirName starts with /Resource then Tcb capability is required. |
2194 |
2268 |
2195 |
2269 |
2196 */ |
2270 */ |
2197 { |
2271 { |
2198 TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::ECFileManRmDir2, MODULEUID, (TUint) this, aDirName); |
2272 OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANRMDIR2, "this %x", (TUint) this); |
|
2273 OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANRMDIR2_EDIRNAME, "Dir %S", aDirName.Ptr(), aDirName.Length()<<1); |
2199 |
2274 |
2200 TInt ret; |
2275 TInt ret; |
2201 if (iSwitches&KFManBusyFlag) |
2276 if (iSwitches&KFManBusyFlag) |
2202 { |
2277 { |
2203 ret = KErrInUse; |
2278 ret = KErrInUse; |
2204 } |
2279 } |
2205 else |
2280 else |
2206 { |
2281 { |
2207 SetFlags(ETrue,ETrue,EFalse,EFalse); |
2282 SetFlags(ETrue,ETrue,EFalse,EFalse); |
2208 RETURNIFERRORD(r,iFs.Parse(aDirName,iTrgFile),UTraceModuleEfsrv::ECFileManRmDir2Return); |
2283 TInt r; |
|
2284 if ((r = iFs.Parse(aDirName,iTrgFile)) != KErrNone) |
|
2285 { |
|
2286 if(iStatus) |
|
2287 User::RequestComplete(iStatus,r); |
|
2288 OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANRMDIR2RETURN1, "r %d", r); |
|
2289 return r; |
|
2290 } |
|
2291 |
2209 iSrcFile.Set(iTrgFile.DriveAndPath(),NULL,NULL); |
2292 iSrcFile.Set(iTrgFile.DriveAndPath(),NULL,NULL); |
2210 iAction = EInternalRmDir; |
2293 iAction = EInternalRmDir; |
2211 iMatchEntry=KEntryAttMaskSupported; |
2294 iMatchEntry=KEntryAttMaskSupported; |
2212 iNumberOfFilesProcessed = 0; |
2295 iNumberOfFilesProcessed = 0; |
2213 TRAP(r,RunL()); |
2296 TRAP(r,RunL()); |
2214 DoSynchronize(r); |
2297 DoSynchronize(r); |
2215 ret = (r!=KErrNone) ? iLastError : KErrNone; |
2298 ret = (r!=KErrNone) ? iLastError : KErrNone; |
2216 } |
2299 } |
2217 |
2300 |
2218 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManRmDir2Return, MODULEUID, ret); |
2301 OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANRMDIR2RETURN2, "r %d", ret); |
|
2302 |
2219 return ret; |
2303 return ret; |
2220 } |
2304 } |
2221 |
2305 |
2222 |
2306 |
2223 void CFileMan::DoOperationL() |
2307 void CFileMan::DoOperationL() |
2611 @capability Dependent If the path for aNew begins with /Private and does not match |
2695 @capability Dependent If the path for aNew begins with /Private and does not match |
2612 this process' SID then AllFiles capability is required. |
2696 this process' SID then AllFiles capability is required. |
2613 @capability Dependent If the path for aNew begins with /Resource then Tcb capability is required. |
2697 @capability Dependent If the path for aNew begins with /Resource then Tcb capability is required. |
2614 */ |
2698 */ |
2615 { |
2699 { |
2616 TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::ECFileManCopy3, MODULEUID, |
2700 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); |
2701 OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANCOPY3_ENEWNAME, "NewName %S", aNew.Ptr(), aNew.Length()<<1); |
2618 |
2702 |
2619 TInt ret; |
2703 TInt ret; |
2620 if (iSwitches&KFManBusyFlag) |
2704 if (iSwitches&KFManBusyFlag) |
2621 { |
2705 { |
2622 ret = KErrInUse; |
2706 ret = KErrInUse; |
2634 // need to signal to CFileBase that we're copying from a handle |
2718 // need to signal to CFileBase that we're copying from a handle |
2635 // and that iSrcFile is invalid |
2719 // and that iSrcFile is invalid |
2636 iSwitches|= KCopyFromHandle; |
2720 iSwitches|= KCopyFromHandle; |
2637 |
2721 |
2638 TInt r; |
2722 TInt r; |
2639 RETURNIFERROR(r, iFs.Parse(aNew, iTrgFile),UTraceModuleEfsrv::ECFileManCopy3Return); |
2723 if ((r = iFs.Parse(aNew, iTrgFile)) != KErrNone) |
|
2724 { |
|
2725 if(iStatus) |
|
2726 User::RequestComplete(iStatus,r); |
|
2727 OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANCOPY3RETURN1, "r %d", r); |
|
2728 return r; |
|
2729 } |
2640 |
2730 |
2641 // Need to duplicate the RFile handle so that any threads owned |
2731 // Need to duplicate the RFile handle so that any threads owned |
2642 // by this process can use it - i.e. the worker thread |
2732 // by this process can use it - i.e. the worker thread |
2643 RETURNIFERROR(r, iSrcFileHandle.Duplicate(anOld, EOwnerProcess),UTraceModuleEfsrv::ECFileManCopy3Return); |
2733 if ((r = iSrcFileHandle.Duplicate(anOld, EOwnerProcess)) != KErrNone) |
|
2734 { |
|
2735 if(iStatus) |
|
2736 User::RequestComplete(iStatus,r); |
|
2737 OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANCOPY3RETURN2, "r %d", r); |
|
2738 return r; |
|
2739 } |
2644 |
2740 |
2645 iAction = EInternalCopyFromHandle; |
2741 iAction = EInternalCopyFromHandle; |
2646 iNumberOfFilesProcessed = 0; |
2742 iNumberOfFilesProcessed = 0; |
2647 TRAP(r,RunL()); |
2743 TRAP(r,RunL()); |
2648 ret=(r==KErrNone) ? iLastError : r; |
2744 ret=(r==KErrNone) ? iLastError : r; |
2649 DoSynchronize(r); |
2745 DoSynchronize(r); |
2650 } |
2746 } |
2651 |
2747 |
2652 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManCopy3Return, MODULEUID, ret); |
2748 OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANCOPY3RETURN3, "r %d", ret); |
|
2749 |
2653 return(ret); |
2750 return(ret); |
2654 } |
2751 } |
2655 |
2752 |
2656 EXPORT_C TInt CFileMan::Copy(const RFile& anOld,const TDesC& aNew,TUint aSwitches,TRequestStatus& aStatus) |
2753 EXPORT_C TInt CFileMan::Copy(const RFile& anOld,const TDesC& aNew,TUint aSwitches,TRequestStatus& aStatus) |
2657 /** |
2754 /** |
2683 @capability Dependent If the path for aNew begins with /Private and does not match |
2780 @capability Dependent If the path for aNew begins with /Private and does not match |
2684 this process' SID then AllFiles capability is required. |
2781 this process' SID then AllFiles capability is required. |
2685 @capability Dependent If the path for aNew begins with /Resource then Tcb capability is required. |
2782 @capability Dependent If the path for aNew begins with /Resource then Tcb capability is required. |
2686 */ |
2783 */ |
2687 { |
2784 { |
2688 TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::ECFileManCopy4, MODULEUID, |
2785 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); |
2786 OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANCOPY4_ENEWNAME, "NewName %S", aNew.Ptr(), aNew.Length()<<1); |
2690 |
2787 |
2691 TInt r; |
2788 TInt r; |
2692 if (iSwitches&KFManBusyFlag) |
2789 if (iSwitches&KFManBusyFlag) |
2693 { |
2790 { |
2694 r = KErrInUse; |
2791 r = KErrInUse; |
2759 #else |
2857 #else |
2760 TInt CFileMan::DoCopy(const RFile64& aSrcFile, RFile64& aDstFile, TInt& aRet) |
2858 TInt CFileMan::DoCopy(const RFile64& aSrcFile, RFile64& aDstFile, TInt& aRet) |
2761 { |
2859 { |
2762 TInt64 rem; |
2860 TInt64 rem; |
2763 #endif |
2861 #endif |
2764 RETURNIFERRORD(r,aSrcFile.Size(rem),EFalse); |
2862 TInt r; |
2765 RETURNIFERROR(r, aDstFile.SetSize(rem),EFalse); |
2863 if ((r = aSrcFile.Size(rem)) != KErrNone) |
|
2864 { |
|
2865 if(iStatus) |
|
2866 User::RequestComplete(iStatus,r); |
|
2867 return r; |
|
2868 } |
|
2869 |
|
2870 |
|
2871 if ((r = aDstFile.SetSize(rem)) != KErrNone) |
|
2872 { |
|
2873 if(iStatus) |
|
2874 User::RequestComplete(iStatus,r); |
|
2875 return r; |
|
2876 } |
2766 |
2877 |
2767 HBufC8* bufPtr = NULL; |
2878 HBufC8* bufPtr = NULL; |
2768 bufPtr = AllocateBuffer(rem); |
2879 bufPtr = AllocateBuffer(rem); |
2769 if (bufPtr == NULL) |
2880 if (bufPtr == NULL) |
2770 return KErrNoMemory; |
2881 return KErrNoMemory; |