284 iReason=KErrNone; |
285 iReason=KErrNone; |
285 |
286 |
286 if (!aMount.IsDismounted() && !aMount.ProxyDriveDismounted()) |
287 if (!aMount.IsDismounted() && !aMount.ProxyDriveDismounted()) |
287 { |
288 { |
288 aMount.SetDrive(this); |
289 aMount.SetDrive(this); |
289 TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBReMount, EF32TraceUidFileSys, DriveNumber()); |
290 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBREMOUNT1, "drive %d", DriveNumber()); |
290 |
291 |
291 //-- actually, this is asking CMountCB to see if it belongs to the current media. |
292 //-- actually, this is asking CMountCB to see if it belongs to the current media. |
292 iReason = aMount.ReMount(); |
293 iReason = aMount.ReMount(); |
293 |
294 |
294 TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBReMountRet, EF32TraceUidFileSys, iReason); |
295 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBREMOUNT1RET, "success %d", iReason); |
295 |
296 |
296 if (iReason == KErrNone) // ReMount succeeded |
297 if (iReason == KErrNone) // ReMount succeeded |
297 { |
298 { |
298 aMount.Open(); |
299 aMount.Open(); |
299 iCurrentMount = &aMount; |
300 iCurrentMount = &aMount; |
325 { |
326 { |
326 CFileSystem* pMountsFs = NULL; //-- reference to the filesystem that will be producing CMountCB |
327 CFileSystem* pMountsFs = NULL; //-- reference to the filesystem that will be producing CMountCB |
327 |
328 |
328 apMount = NULL; |
329 apMount = NULL; |
329 |
330 |
330 TRACE2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewMountL, EF32TraceUidFileSys, &FSys(), DriveNumber()); |
331 OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWMOUNTL, "this %x drive %d", (TUint) &FSys(), (TUint) DriveNumber()); |
331 |
332 |
332 //-- construct a new CmountCB object. |
333 //-- construct a new CmountCB object. |
333 //-- on return pMountsFs will be the pointer to the factory object of CFileSystem that produced this mount |
334 //-- on return pMountsFs will be the pointer to the factory object of CFileSystem that produced this mount |
334 apMount = FSys().NewMountExL(this, &pMountsFs, aForceMount, aFsNameHash); |
335 apMount = FSys().NewMountExL(this, &pMountsFs, aForceMount, aFsNameHash); |
335 |
336 |
336 TRACE2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewMountLRet, EF32TraceUidFileSys, KErrNone, apMount); |
337 OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWMOUNTLRET, "r %d CMountCB %x", (TUint) KErrNone, (TUint) apMount); |
337 __PRINT2(_L("TDrive::MountMediaL created mount:0x%x FileSys:0x%x"), apMount, pMountsFs); |
338 __PRINT2(_L("TDrive::MountMediaL created mount:0x%x FileSys:0x%x"), apMount, pMountsFs); |
338 |
339 |
339 ASSERT(pMountsFs && apMount); |
340 ASSERT(pMountsFs && apMount); |
340 |
341 |
341 apMount->SetMountNumber(iMountNumber++); |
342 apMount->SetMountNumber(iMountNumber++); |
400 |
401 |
401 @return standard error code. |
402 @return standard error code. |
402 */ |
403 */ |
403 TInt TDrive::MountControl(TInt aLevel, TInt aOption, TAny* aParam) |
404 TInt TDrive::MountControl(TInt aLevel, TInt aOption, TAny* aParam) |
404 { |
405 { |
405 TRACE4(UTF::EBorder, UTraceModuleFileSys::ECMountCBMountControl, EF32TraceUidFileSys, DriveNumber(), aLevel, aOption, aParam); |
406 OstTraceExt4(TRACE_FILESYSTEM, FSYS_ECMOUNTCBMOUNTCONTROL, "drive %d aLevel %d aOption %x aParam %x", (TUint) DriveNumber(), (TUint) aLevel, (TUint) aOption, (TUint) aParam); |
406 TInt r = CurrentMount().MountControl(aLevel, aOption, aParam); |
407 TInt r = CurrentMount().MountControl(aLevel, aOption, aParam); |
407 TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBMountControlRet, EF32TraceUidFileSys, r); |
408 |
408 |
409 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBMOUNTCONTROLRET, "r %d", r); |
409 return r; |
410 return r; |
410 } |
411 } |
411 |
412 |
412 //---------------------------------------------------------------------------- |
413 //---------------------------------------------------------------------------- |
413 /** |
414 /** |
432 |
433 |
433 //-- 1. Try mount-specific request first. If the mount is still performing free space calculations, |
434 //-- 1. Try mount-specific request first. If the mount is still performing free space calculations, |
434 //-- the caller will be suspended until aFreeSpaceRequired bytes is available or scanning process finishes |
435 //-- the caller will be suspended until aFreeSpaceRequired bytes is available or scanning process finishes |
435 { |
436 { |
436 TUint64 freeSpaceReq = aFreeSpaceRequired; |
437 TUint64 freeSpaceReq = aFreeSpaceRequired; |
437 TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBFreeSpace, EF32TraceUidFileSys, DriveNumber()); |
438 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBFREESPACE, "drive %d", DriveNumber()); |
438 nRes = CurrentMount().RequestFreeSpace(freeSpaceReq); |
439 nRes = CurrentMount().RequestFreeSpace(freeSpaceReq); |
439 TRACERET3(UTF::EBorder, UTraceModuleFileSys::ECMountCBFreeSpaceRet, EF32TraceUidFileSys, nRes, I64LOW(freeSpaceReq), I64HIGH(freeSpaceReq)); |
440 OstTraceExt3(TRACE_FILESYSTEM, FSYS_ECMOUNTCBFREESPACERET, "r %d FreeSpace %x:%x", (TUint) nRes, (TUint) I64HIGH(freeSpaceReq), (TUint) I64LOW(freeSpaceReq)); |
440 if(nRes == KErrNone) |
441 if(nRes == KErrNone) |
441 { |
442 { |
442 return (freeSpaceReq >= aFreeSpaceRequired) ? KErrNone : KErrDiskFull; |
443 return (freeSpaceReq >= aFreeSpaceRequired) ? KErrNone : KErrDiskFull; |
443 } |
444 } |
444 } |
445 } |
464 TInt nRes; |
465 TInt nRes; |
465 |
466 |
466 nRes = CheckMount(); |
467 nRes = CheckMount(); |
467 if(nRes != KErrNone) |
468 if(nRes != KErrNone) |
468 return nRes; |
469 return nRes; |
469 |
|
470 //-- 1. Try mount-specific request first. It won't block this call as CMountCB::VolumeL() can do if some background activity is going on the mount |
470 //-- 1. Try mount-specific request first. It won't block this call as CMountCB::VolumeL() can do if some background activity is going on the mount |
471 TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBVolumeSize, EF32TraceUidFileSys, DriveNumber()); |
471 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBVOLUMESIZE, "drive %d", DriveNumber()); |
472 nRes = CurrentMount().MountedVolumeSize(aSize); |
472 nRes = CurrentMount().MountedVolumeSize(aSize); |
473 TRACERET3(UTF::EBorder, UTraceModuleFileSys::ECMountCBVolumeSize, EF32TraceUidFileSys, nRes, I64LOW(aSize), I64HIGH(aSize)); |
473 OstTraceExt3(TRACE_FILESYSTEM, FSYS_ECMOUNTCBVOLUMESIZERET, "r %d aSize %x:%x", (TUint) nRes, (TUint) I64HIGH(aSize), (TUint) I64LOW(aSize)); |
474 if(nRes == KErrNone) |
474 if(nRes == KErrNone) |
475 return nRes; |
475 return nRes; |
476 |
476 |
477 //-- given Mount doesn't support this functionality, use legacy method |
477 //-- given Mount doesn't support this functionality, use legacy method |
478 TVolumeInfo volInfo; |
478 TVolumeInfo volInfo; |
501 nRes = CheckMount(); |
501 nRes = CheckMount(); |
502 if(nRes != KErrNone) |
502 if(nRes != KErrNone) |
503 return nRes; |
503 return nRes; |
504 |
504 |
505 //-- 1. Try mount-specific request first. It won't block this call as CMountCB::VolumeL() can do |
505 //-- 1. Try mount-specific request first. It won't block this call as CMountCB::VolumeL() can do |
506 TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBCurrentFreeSpace, EF32TraceUidFileSys, DriveNumber()); |
506 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBCURRENTFREESPACE, "drive %d", DriveNumber()); |
507 nRes = CurrentMount().GetCurrentFreeSpaceAvailable(aFreeDiskSpace); |
507 nRes = CurrentMount().GetCurrentFreeSpaceAvailable(aFreeDiskSpace); |
508 TRACERET3(UTF::EBorder, UTraceModuleFileSys::ECMountCBCurrentFreeSpaceRet, EF32TraceUidFileSys, nRes, I64LOW(aFreeDiskSpace), I64HIGH(aFreeDiskSpace)); |
508 OstTraceExt3(TRACE_FILESYSTEM, FSYS_ECMOUNTCBCURRENTFREESPACERET, "r %d FreeSpace %x:%x", (TUint) nRes, (TUint) I64HIGH(aFreeDiskSpace), (TUint) I64LOW(aFreeDiskSpace)); |
509 if(nRes == KErrNone) |
509 if(nRes == KErrNone) |
510 return nRes; |
510 return nRes; |
511 |
511 |
512 //-- given Mount doesn't support this functionality, use legacy method |
512 //-- given Mount doesn't support this functionality, use legacy method |
513 TVolumeInfo volInfo; |
513 TVolumeInfo volInfo; |
541 return(r); |
541 return(r); |
542 |
542 |
543 if(IsWriteProtected()) |
543 if(IsWriteProtected()) |
544 return(KErrAccessDenied); |
544 return(KErrAccessDenied); |
545 |
545 |
546 TRACE4(UTF::EBorder, UTraceModuleFileSys::ECMountCBFinaliseMount2, EF32TraceUidFileSys, DriveNumber(), aOperation, aParam1, aParam2); |
546 OstTraceExt4(TRACE_FILESYSTEM, FSYS_ECMOUNTCBFINALISEMOUNT2, "drive %d aOperation %d aParam1 %x aParam2 %x", (TUint) DriveNumber(), (TUint) aOperation, (TUint) aParam1, (TUint) aParam2); |
547 TRAP(r,CurrentMount().FinaliseMountL(aOperation, aParam1, aParam2)); |
547 TRAP(r,CurrentMount().FinaliseMountL(aOperation, aParam1, aParam2)); |
548 TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBFinaliseMount2Ret, EF32TraceUidFileSys, r); |
548 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBFINALISEMOUNT2RET, "r %d", r); |
549 |
549 |
550 // Pass FinaliseDrive notification down to media driver |
550 // Pass FinaliseDrive notification down to media driver |
551 TInt driveNumber = DriveNumber(); |
551 TInt driveNumber = DriveNumber(); |
552 if (LocalDrives::IsValidDriveMapping(driveNumber) && !LocalDrives::IsProxyDrive(driveNumber)) |
552 if (LocalDrives::IsValidDriveMapping(driveNumber) && !LocalDrives::IsProxyDrive(driveNumber)) |
553 { |
553 { |
576 return(r); |
576 return(r); |
577 |
577 |
578 if(IsWriteProtected()) |
578 if(IsWriteProtected()) |
579 return(KErrAccessDenied); |
579 return(KErrAccessDenied); |
580 |
580 |
581 TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBFinaliseMount1, EF32TraceUidFileSys, DriveNumber()); |
581 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBFINALISEMOUNT1, "drive %d", DriveNumber()); |
582 TRAP(r,CurrentMount().FinaliseMountL()); |
582 TRAP(r,CurrentMount().FinaliseMountL()); |
583 TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBFinaliseMount1Ret, EF32TraceUidFileSys, r); |
583 |
|
584 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBFINALISEMOUNT1RET, "r %d", r); |
584 |
585 |
585 return r; |
586 return r; |
586 } |
587 } |
587 |
588 |
588 |
589 |
898 anInfo.iBattery=EBatNotSupported; |
898 anInfo.iBattery=EBatNotSupported; |
899 anInfo.iConnectionBusType=EConnectionBusInternal; |
899 anInfo.iConnectionBusType=EConnectionBusInternal; |
900 |
900 |
901 if(iFSys) |
901 if(iFSys) |
902 { |
902 { |
903 TRACE2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemDriveInfo, EF32TraceUidFileSys, &FSys(), DriveNumber()); |
903 OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMDRIVEINFO, "this %x aDriveNumber %d", (TUint) &FSys(), (TUint) DriveNumber()); |
904 FSys().DriveInfo(anInfo,DriveNumber()); |
904 FSys().DriveInfo(anInfo,DriveNumber()); |
905 TRACE3(UTF::EBorder, UTraceModuleFileSys::ECFileSystemDriveInfoRet, EF32TraceUidFileSys, |
905 OstTraceExt3(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMDRIVEINFORET, "type %d driveAtt %x mediaAtt %x", (TUint) anInfo.iType, (TUint) anInfo.iDriveAtt, (TUint) anInfo.iMediaAtt); |
906 anInfo.iType, anInfo.iDriveAtt, anInfo.iMediaAtt); |
|
907 } |
906 } |
908 |
907 |
909 anInfo.iDriveAtt=Att(); |
908 anInfo.iDriveAtt=Att(); |
910 } |
909 } |
911 |
910 |
921 CMountCB& m=CurrentMount(); |
920 CMountCB& m=CurrentMount(); |
922 aVolume.iName=m.VolumeName(); |
921 aVolume.iName=m.VolumeName(); |
923 aVolume.iUniqueID=m.iUniqueID; |
922 aVolume.iUniqueID=m.iUniqueID; |
924 aVolume.iSize=m.iSize; |
923 aVolume.iSize=m.iSize; |
925 |
924 |
926 TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBVolumeL, EF32TraceUidFileSys, DriveNumber()); |
925 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBVOLUMEL, "drive %d", DriveNumber()); |
927 TRAP(r,m.VolumeL(aVolume)) |
926 TRAP(r,m.VolumeL(aVolume)) |
928 TRACE7(UTF::EBorder, UTraceModuleFileSys::ECMountCBVolumeLRet, EF32TraceUidFileSys, |
927 OstTraceExt5(TRACE_FILESYSTEM, FSYS_ECMOUNTCBVOLUMELRETA, "r %d iSize %x:%x iFree %x:%x", (TUint) r, (TUint) I64HIGH(aVolume.iSize), (TUint) I64LOW(aVolume.iSize), (TUint) I64HIGH(aVolume.iFree), (TUint) I64LOW(aVolume.iFree)); |
929 r, aVolume.iUniqueID, I64LOW(aVolume.iSize), I64HIGH(aVolume.iSize), |
928 OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECMOUNTCBVOLUMELRETB, "iUniqueID %x iFileCacheFlags %x", (TUint) aVolume.iUniqueID, (TUint) aVolume.iFileCacheFlags); |
930 I64LOW(aVolume.iFree), I64HIGH(aVolume.iFree), aVolume.iFileCacheFlags); |
|
931 |
|
932 } |
929 } |
933 return(r); |
930 return(r); |
934 } |
931 } |
935 |
932 |
936 |
933 |
940 // |
937 // |
941 { |
938 { |
942 __CHECK_DRIVETHREAD(iDriveNumber); |
939 __CHECK_DRIVETHREAD(iDriveNumber); |
943 aBuf=aName.AllocL(); |
940 aBuf=aName.AllocL(); |
944 TPtr volumeName=aBuf->Des(); |
941 TPtr volumeName=aBuf->Des(); |
945 |
942 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBSETVOLUMEL, "drive %d", DriveNumber()); |
946 TRACEMULT2(UTF::EBorder, UTraceModuleFileSys::ECMountCBSetVolumeL, EF32TraceUidFileSys, DriveNumber(), aName); |
943 OstTraceData(TRACE_FILESYSTEM, FSYS_EVOLUMENAME, "VolumeName %S", aName.Ptr(), aName.Length()<<1); |
|
944 |
947 CurrentMount().SetVolumeL(volumeName); |
945 CurrentMount().SetVolumeL(volumeName); |
948 TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBSetVolumeLRet, EF32TraceUidFileSys, KErrNone); |
946 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBSETVOLUMELRET, "r %d", KErrNone); |
949 |
|
950 |
|
951 delete &CurrentMount().VolumeName(); |
947 delete &CurrentMount().VolumeName(); |
952 CurrentMount().SetVolumeName(aBuf); |
948 CurrentMount().SetVolumeName(aBuf); |
953 } |
949 } |
954 |
950 |
955 TInt TDrive::SetVolume(const TDesC& aName) |
951 TInt TDrive::SetVolume(const TDesC& aName) |
980 return(r); |
976 return(r); |
981 if(IsWriteProtected()) |
977 if(IsWriteProtected()) |
982 return(KErrAccessDenied); |
978 return(KErrAccessDenied); |
983 TParse newDirName; |
979 TParse newDirName; |
984 newDirName.Set(aName,NULL,NULL); |
980 newDirName.Set(aName,NULL,NULL); |
985 |
981 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBMKDIRL, "drive %d", DriveNumber()); |
986 TRACEMULT2(UTF::EBorder, UTraceModuleFileSys::ECMountCBMkDirL, EF32TraceUidFileSys, DriveNumber(), aName); |
982 OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBMKDIRLYS_EDIRNAME, "Dir %S", aName.Ptr(), aName.Length()<<1); |
987 TRAP(r,CurrentMount().MkDirL(newDirName.FullName())) |
983 TRAP(r,CurrentMount().MkDirL(newDirName.FullName())) |
988 TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBMkDirLRet, EF32TraceUidFileSys, r); |
984 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBMKDIRLRET, "r %d", r); |
989 |
|
990 return(r); |
985 return(r); |
991 } |
986 } |
992 |
|
993 TInt TDrive::RmDir(const TDesC& aName) |
987 TInt TDrive::RmDir(const TDesC& aName) |
994 // |
988 // |
995 // Remove a directory. |
989 // Remove a directory. |
996 // |
990 // |
997 { |
991 { |
1004 return(r); |
998 return(r); |
1005 if (entry.IsDir()==EFalse) |
999 if (entry.IsDir()==EFalse) |
1006 return(KErrPathNotFound); |
1000 return(KErrPathNotFound); |
1007 if ((entry.iAtt&KEntryAttReadOnly) || IsWriteProtected()) |
1001 if ((entry.iAtt&KEntryAttReadOnly) || IsWriteProtected()) |
1008 return(KErrAccessDenied); |
1002 return(KErrAccessDenied); |
1009 |
1003 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBRMDIRL, "drive %d", DriveNumber()); |
1010 TRACEMULT2(UTF::EBorder, UTraceModuleFileSys::ECMountCBRmDirL, EF32TraceUidFileSys, DriveNumber(), aName); |
1004 OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBRMDIRLYS_EDIRNAME, "Dir %S", aName.Ptr(), aName.Length()<<1); |
1011 TRAP(r,CurrentMount().RmDirL(aName)) |
1005 TRAP(r,CurrentMount().RmDirL(aName)) |
1012 TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBRmDirLRet, EF32TraceUidFileSys, r); |
1006 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBRMDIRLRET, "r %d", r); |
1013 |
|
1014 return(r); |
1007 return(r); |
1015 } |
1008 } |
1016 |
1009 |
1017 /* |
1010 /* |
1018 Delete files allowing wild cards. |
1011 Delete files allowing wild cards. |
1029 // remove from closed queue - NB this isn't strictly necessary if file is read-only or write-protected... |
1022 // remove from closed queue - NB this isn't strictly necessary if file is read-only or write-protected... |
1030 LocateClosedFile(aName, EFalse); |
1023 LocateClosedFile(aName, EFalse); |
1031 |
1024 |
1032 if (IsWriteProtected()) |
1025 if (IsWriteProtected()) |
1033 return(KErrAccessDenied); |
1026 return(KErrAccessDenied); |
1034 |
1027 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBDELETEL1, "drive %d", DriveNumber()); |
1035 //-- filesystems' CMountCB::DeleteL() implementations shall check the entry attributes themeselves. |
1028 OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBDELETEL1_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1); |
1036 TRACEMULT2(UTF::EBorder, UTraceModuleFileSys::ECMountCBDeleteL, EF32TraceUidFileSys, DriveNumber(), aName); |
|
1037 TRAP(r,CurrentMount().DeleteL(aName)) |
1029 TRAP(r,CurrentMount().DeleteL(aName)) |
1038 TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBDeleteLRet, EF32TraceUidFileSys, r); |
1030 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBDELETEL1_RET, "r %d", r); |
1039 |
|
1040 return r; |
1031 return r; |
1041 } |
1032 } |
1042 |
1033 |
1043 TInt TDrive::CheckMountAndEntryNames(const TDesC& anOldName,const TDesC& aNewName) |
1034 TInt TDrive::CheckMountAndEntryNames(const TDesC& anOldName,const TDesC& aNewName) |
1044 // |
1035 // |
1105 return(KErrAccessDenied); |
1096 return(KErrAccessDenied); |
1106 |
1097 |
1107 // remove from closed queue |
1098 // remove from closed queue |
1108 LocateClosedFile(anOldName, EFalse); |
1099 LocateClosedFile(anOldName, EFalse); |
1109 LocateClosedFile(aNewName, EFalse); |
1100 LocateClosedFile(aNewName, EFalse); |
1110 |
1101 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBRENAMEL, "drive %d", DriveNumber()); |
1111 TRACEMULT3(UTF::EBorder, UTraceModuleFileSys::ECMountCBRenameL, EF32TraceUidFileSys, DriveNumber(), oldEntryName,newEntryName); |
1102 OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBRENAMELYS_EOLDNAME, "OldName %S", oldEntryName.Ptr(), oldEntryName.Length()<<1); |
|
1103 OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBRENAMELYS_ENEWNAME, "NewName %S", newEntryName.Ptr(), newEntryName.Length()<<1); |
1112 TRAP(r,CurrentMount().RenameL(oldEntryName,newEntryName)) |
1104 TRAP(r,CurrentMount().RenameL(oldEntryName,newEntryName)) |
1113 TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBRenameLRet, EF32TraceUidFileSys, r); |
1105 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBRENAMELRET, "r %d", r); |
1114 |
|
1115 return(r); |
1106 return(r); |
1116 } |
1107 } |
1117 |
1108 |
1118 TInt TDrive::Replace(const TDesC& anOldName,const TDesC& aNewName) |
1109 TInt TDrive::Replace(const TDesC& anOldName,const TDesC& aNewName) |
1119 // |
1110 // |
1143 return(KErrInUse); |
1134 return(KErrInUse); |
1144 |
1135 |
1145 // remove from closed queue |
1136 // remove from closed queue |
1146 LocateClosedFile(anOldName, EFalse); |
1137 LocateClosedFile(anOldName, EFalse); |
1147 LocateClosedFile(aNewName, EFalse); |
1138 LocateClosedFile(aNewName, EFalse); |
1148 |
1139 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBREPLACEL, "drive %d", DriveNumber()); |
1149 TRACEMULT3(UTF::EBorder, UTraceModuleFileSys::ECMountCBReplaceL, EF32TraceUidFileSys, DriveNumber(), anOldName, aNewName); |
1140 OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBREPLACEL_EOLDNAME, "OldName %S", anOldName.Ptr(), anOldName.Length()<<1); |
|
1141 OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBREPLACEL_ENEWNAME, "NewName %S", aNewName.Ptr(), aNewName.Length()<<1); |
1150 TRAP(r,CurrentMount().ReplaceL(anOldName,aNewName)) |
1142 TRAP(r,CurrentMount().ReplaceL(anOldName,aNewName)) |
1151 TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBReplaceLRet, EF32TraceUidFileSys, r); |
1143 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBREPLACELRET, "r %d", r); |
1152 |
|
1153 return(r); |
1144 return(r); |
1154 } |
1145 } |
1155 |
1146 |
1156 TInt TDrive::Entry(const TDesC& aName,TEntry& anEntry) |
1147 TInt TDrive::Entry(const TDesC& aName,TEntry& anEntry) |
1157 // |
1148 // |
1177 // |
1168 // |
1178 // Get entry details |
1169 // Get entry details |
1179 // |
1170 // |
1180 { |
1171 { |
1181 FlushCachedFileInfoL(); |
1172 FlushCachedFileInfoL(); |
1182 |
1173 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBENTRYL, "drive %d", DriveNumber()); |
1183 TRACEMULT2(UTF::EBorder, UTraceModuleFileSys::ECMountCBEntryL, EF32TraceUidFileSys, DriveNumber(), aName); |
1174 OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBENTRYL_EFILEPATH, "FilePath %S", aName.Ptr(), aName.Length()<<1); |
1184 CurrentMount().EntryL(aName,anEntry); |
1175 CurrentMount().EntryL(aName,anEntry); |
1185 TRACE5(UTF::EBorder, UTraceModuleFileSys::ECMountCBEntryLRet, EF32TraceUidFileSys, |
1176 OstTraceExt5(TRACE_FILESYSTEM, FSYS_ECMOUNTCBENTRYLRET, "att %x modified %x:%x size %x:%x", (TUint) anEntry.iAtt, (TUint) I64HIGH(anEntry.iModified.Int64()), (TUint) I64LOW(anEntry.iModified.Int64()), (TUint) I64HIGH(anEntry.FileSize()), (TUint) anEntry.FileSize()); |
1186 KErrNone, anEntry.iAtt, |
|
1187 I64LOW(anEntry.iModified.Int64()), I64HIGH(anEntry.iModified.Int64()), |
|
1188 anEntry.iSize); |
|
1189 |
|
1190 } |
1177 } |
1191 |
1178 |
1192 TInt TDrive::CheckAttributes(const TDesC& aName,TUint& aSetAttMask,TUint& aClearAttMask) |
1179 TInt TDrive::CheckAttributes(const TDesC& aName,TUint& aSetAttMask,TUint& aClearAttMask) |
1193 // |
1180 // |
1194 // Validate the changes against the current entry attributes |
1181 // Validate the changes against the current entry attributes |
1222 if (IsWriteProtected()) |
1209 if (IsWriteProtected()) |
1223 return(KErrAccessDenied); |
1210 return(KErrAccessDenied); |
1224 TTime nullTime(0); |
1211 TTime nullTime(0); |
1225 if (aTime!=nullTime) |
1212 if (aTime!=nullTime) |
1226 aSetAttMask|=KEntryAttModified; |
1213 aSetAttMask|=KEntryAttModified; |
1227 |
1214 OstTraceExt5(TRACE_FILESYSTEM, FSYS_ECMOUNTCBSETENTRYL, "drive %d aTime %x:%x aSetAttMask %x aClearAttMask %x", (TUint) DriveNumber(), (TUint) I64HIGH(aTime.Int64()), (TUint) I64LOW(aTime.Int64()), (TUint) aSetAttMask, (TUint) aClearAttMask); |
1228 TRACEMULT6(UTF::EBorder, UTraceModuleFileSys::ECMountCBSetEntryL, EF32TraceUidFileSys, |
1215 OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBSETENTRYL_EFILEPATH, "FilePath %S", aName.Ptr(), aName.Length()<<1); |
1229 DriveNumber(), aName, I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()), aSetAttMask, aClearAttMask); |
|
1230 TRAP(r,CurrentMount().SetEntryL(entryName,aTime,aSetAttMask,aClearAttMask)) |
1216 TRAP(r,CurrentMount().SetEntryL(entryName,aTime,aSetAttMask,aClearAttMask)) |
1231 TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBSetEntryLRet, EF32TraceUidFileSys, r); |
1217 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBSETENTRYLRET, "r %d", r); |
1232 |
|
1233 return(r); |
1218 return(r); |
1234 } |
1219 } |
1235 |
1220 |
1236 TInt TDrive::FileTemp(CFsRequest* aRequest,TInt& aHandle,const TDesC& aPath,TDes& aName,TUint aMode) |
1221 TInt TDrive::FileTemp(CFsRequest* aRequest,TInt& aHandle,const TDesC& aPath,TDes& aName,TUint aMode) |
1237 // |
1222 // |
1363 aFileCB=pFile; |
1348 aFileCB=pFile; |
1364 pFileCache = pFile->FileCache(); |
1349 pFileCache = pFile->FileCache(); |
1365 } |
1350 } |
1366 else |
1351 else |
1367 { |
1352 { |
1368 TRACE2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewFileL, EF32TraceUidFileSys, &FSys(), DriveNumber()); |
1353 OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWFILEL, "this %x drive %d", (TUint) &FSys(), (TUint) DriveNumber()); |
1369 |
|
1370 //-- construct CFileCB object, belonging to the corresponding mount |
1354 //-- construct CFileCB object, belonging to the corresponding mount |
1371 pFile = aFileCB = CurrentMount().NewFileL(); |
1355 pFile = aFileCB = CurrentMount().NewFileL(); |
1372 |
1356 |
1373 TRACERET2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewFileLRet, EF32TraceUidFileSys, r, pFile); |
1357 OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWFILELRET, "r %d CFileCB %x", (TUint) r, (TUint) pFile); |
1374 TDrive* createdDrive=!aRequest->SubstedDrive() ? this : aRequest->SubstedDrive(); |
1358 TDrive* createdDrive=!aRequest->SubstedDrive() ? this : aRequest->SubstedDrive(); |
1375 |
1359 |
1376 HBufC* fileName = CreateFileNameL(aName); |
1360 HBufC* fileName = CreateFileNameL(aName); |
1377 |
1361 |
1378 pFile->InitL(this, createdDrive, fileName); |
1362 pFile->InitL(this, createdDrive, fileName); |
1399 aHandle=aRequest->Session()->Handles().AddL(pFileShare,ETrue); |
1383 aHandle=aRequest->Session()->Handles().AddL(pFileShare,ETrue); |
1400 |
1384 |
1401 |
1385 |
1402 if (openFile) |
1386 if (openFile) |
1403 { |
1387 { |
1404 TRACEMULT5(UTF::EBorder, UTraceModuleFileSys::ECMountCBFileOpenL, EF32TraceUidFileSys, DriveNumber(), aName, aMode, (TUint) anOpen, (TUint) pFile); |
1388 OstTraceExt4(TRACE_FILESYSTEM, FSYS_ECMOUNTCBFILEOPENL, "drive %d aMode %x anOpen %d aFile %x", (TUint) DriveNumber(), (TUint) aMode, (TUint) anOpen, (TUint) pFile); |
|
1389 OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBFILEOPENL_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1); |
1405 CurrentMount().FileOpenL(aName,aMode,anOpen,pFile); |
1390 CurrentMount().FileOpenL(aName,aMode,anOpen,pFile); |
1406 TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBFileOpenLRet, EF32TraceUidFileSys, KErrNone); |
1391 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBFILEOPENLRET, "r %d", KErrNone); |
1407 |
|
1408 // Delete on close may now be safely flagged if required. |
1392 // Delete on close may now be safely flagged if required. |
1409 // The file did not exist on the media prior to the |
1393 // The file did not exist on the media prior to the |
1410 // CMountCB::FileOpenL() call for the case of a create. |
1394 // CMountCB::FileOpenL() call for the case of a create. |
1411 if ((aMode & EDeleteOnClose) && (anOpen==EFileCreate)) |
1395 if ((aMode & EDeleteOnClose) && (anOpen==EFileCreate)) |
1412 pFile->SetDeleteOnClose(); |
1396 pFile->SetDeleteOnClose(); |
1473 void TDrive::DirOpenL(CSessionFs* aSession,TInt& aHandle,const TDesC& aName,TUint anAtt,const TUidType& aUidType,CDirCB*& aDir) |
1457 void TDrive::DirOpenL(CSessionFs* aSession,TInt& aHandle,const TDesC& aName,TUint anAtt,const TUidType& aUidType,CDirCB*& aDir) |
1474 // |
1458 // |
1475 // Open a directory listing. Leave on error. |
1459 // Open a directory listing. Leave on error. |
1476 // |
1460 // |
1477 { |
1461 { |
1478 TRACE2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewDirL, EF32TraceUidFileSys, &FSys(), DriveNumber()); |
1462 OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWDIRL, "this %x drive %d", (TUint) &FSys(), (TUint) DriveNumber()); |
1479 |
|
1480 CDirCB* pD = aDir = CurrentMount().NewDirL(); //-- construct CDirCB object, belonging to the corresponding mount |
1463 CDirCB* pD = aDir = CurrentMount().NewDirL(); //-- construct CDirCB object, belonging to the corresponding mount |
1481 |
1464 |
1482 TRACE2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewDirLRet, EF32TraceUidFileSys, KErrNone, pD); |
1465 OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWDIRLRET, "r %d CDirCB %x", (TUint) KErrNone, (TUint) pD); |
1483 pD->InitL(this); |
1466 pD->InitL(this); |
1484 // modify resource counter after initialisation to ensure correct cleanup |
1467 // modify resource counter after initialisation to ensure correct cleanup |
1485 AddResource(CurrentMount()); |
1468 AddResource(CurrentMount()); |
1486 pD->iAtt=anAtt; |
1469 pD->iAtt=anAtt; |
1487 pD->iUidType=aUidType; |
1470 pD->iUidType=aUidType; |
1488 Dirs->AddL(pD,ETrue); |
1471 Dirs->AddL(pD,ETrue); |
1489 aHandle=aSession->Handles().AddL(pD,ETrue); |
1472 aHandle=aSession->Handles().AddL(pD,ETrue); |
1490 |
1473 OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECMOUNTCBDIROPENL, "drive %d aDir %x", (TUint) DriveNumber(), (TUint) pD); |
1491 TRACEMULT3(UTF::EBorder, UTraceModuleFileSys::ECMountCBDirOpenL, EF32TraceUidFileSys, DriveNumber(), aName, (TUint) pD); |
1474 OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBDIROPENL_EDIRNAME, "Dir %S", aName.Ptr(), aName.Length()<<1); |
1492 CurrentMount().DirOpenL(aName,pD); |
1475 CurrentMount().DirOpenL(aName,pD); |
1493 TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBDirOpenLRet, EF32TraceUidFileSys, KErrNone); |
1476 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBDIROPENLRET, "r %d", KErrNone); |
1494 } |
1477 } |
1495 |
1478 |
1496 TInt TDrive::DirOpen(CSessionFs* aSession,TInt& aHandle,const TDesC& aName,TUint anAtt,const TUidType& aUidType) |
1479 TInt TDrive::DirOpen(CSessionFs* aSession,TInt& aHandle,const TDesC& aName,TUint anAtt,const TUidType& aUidType) |
1497 // |
1480 // |
1498 // Open a directory listing. |
1481 // Open a directory listing. |
1547 __PRINT(_L("TDrive::ReadSection")); |
1530 __PRINT(_L("TDrive::ReadSection")); |
1548 TInt r=CheckMountAndEntryName(aName); |
1531 TInt r=CheckMountAndEntryName(aName); |
1549 if (r!=KErrNone) |
1532 if (r!=KErrNone) |
1550 return(r); |
1533 return(r); |
1551 TPtrC entryName(StripBackSlash(aName)); |
1534 TPtrC entryName(StripBackSlash(aName)); |
1552 |
|
1553 TRACETHREADID(aMessage); |
1535 TRACETHREADID(aMessage); |
1554 TRACEMULT7(UTF::EBorder, UTraceModuleFileSys::ECMountCBReadFileSectionL, EF32TraceUidFileSys, |
1536 OstTraceExt5(TRACE_FILESYSTEM, FSYS_ECMOUNTCBREADFILESECTIONL, "drive %d clientThreadId %x aPos %x:%x aLength %d", (TUint) DriveNumber(), (TUint) threadId, (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aLength); |
1555 DriveNumber(), aName, I64LOW(aPos), I64HIGH(aPos), (TUint) aTrg, aLength, I64LOW(threadId)); |
1537 OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBREADFILESECTIONL_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1); |
1556 TRAP(r,ReadSectionL(entryName,aPos,aTrg,aLength,aMessage)); |
1538 TRAP(r,ReadSectionL(entryName,aPos,aTrg,aLength,aMessage)); |
1557 TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBReadFileSectionLRet, EF32TraceUidFileSys, r); |
1539 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBREADFILESECTIONLRET, "r %d", r); |
1558 |
|
1559 if (r==KErrHidden) |
1540 if (r==KErrHidden) |
1560 r=KErrNotFound; |
1541 r=KErrNotFound; |
1561 else if (r==KErrPathHidden) |
1542 else if (r==KErrPathHidden) |
1562 r=KErrPathNotFound; |
1543 r=KErrPathNotFound; |
1563 |
1544 |
1585 TInt r=CheckMount(); |
1566 TInt r=CheckMount(); |
1586 if (r==KErrNone) |
1567 if (r==KErrNone) |
1587 TRAP(r,FlushCachedFileInfoL()); |
1568 TRAP(r,FlushCachedFileInfoL()); |
1588 if (r==KErrNone) |
1569 if (r==KErrNone) |
1589 { |
1570 { |
1590 TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBCheckDisk1, EF32TraceUidFileSys, DriveNumber()); |
1571 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBCHECKDISK1, "drive %d", DriveNumber()); |
1591 r=CurrentMount().CheckDisk(); |
1572 r=CurrentMount().CheckDisk(); |
1592 TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBCheckDisk1Ret, EF32TraceUidFileSys, r); |
1573 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBCHECKDISK1RET, "r %d", r); |
1593 } |
1574 } |
1594 return(r); |
1575 return(r); |
1595 } |
1576 } |
1596 |
1577 |
1597 /** |
1578 /** |
1602 TInt r=CheckMount(); |
1583 TInt r=CheckMount(); |
1603 if (r==KErrNone) |
1584 if (r==KErrNone) |
1604 TRAP(r,FlushCachedFileInfoL()); |
1585 TRAP(r,FlushCachedFileInfoL()); |
1605 if (r==KErrNone) |
1586 if (r==KErrNone) |
1606 { |
1587 { |
1607 TRACE4(UTF::EBorder, UTraceModuleFileSys::ECMountCBCheckDisk2, EF32TraceUidFileSys, DriveNumber(), aOperation, aParam1, aParam2); |
1588 OstTraceExt4(TRACE_FILESYSTEM, FSYS_ECMOUNTCBCHECKDISK2, "drive %d aOperation %d aParam1 %x aParam2 %x", (TUint) DriveNumber(), (TUint) aOperation, (TUint) aParam1, (TUint) aParam2); |
1608 r=CurrentMount().CheckDisk(aOperation, aParam1, aParam2); |
1589 r=CurrentMount().CheckDisk(aOperation, aParam1, aParam2); |
1609 TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBCheckDisk2Ret, EF32TraceUidFileSys, r); |
1590 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBCHECKDISK2RET, "r %d", r); |
1610 } |
1591 } |
1611 |
1592 |
1612 return(r); |
1593 return(r); |
1613 } |
1594 } |
1614 |
1595 |
1626 return r; |
1607 return r; |
1627 |
1608 |
1628 // Empty closed file queue |
1609 // Empty closed file queue |
1629 TClosedFileUtils::Remove(DriveNumber()); |
1610 TClosedFileUtils::Remove(DriveNumber()); |
1630 |
1611 |
1631 TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBScanDrive1, EF32TraceUidFileSys, DriveNumber()); |
1612 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBSCANDRIVE1, "drive %d", DriveNumber()); |
1632 r = CurrentMount().ScanDrive(); |
1613 r = CurrentMount().ScanDrive(); |
1633 TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBScanDrive1Ret, EF32TraceUidFileSys, r); |
1614 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBSCANDRIVE1RET, "r %d", r); |
1634 |
|
1635 return r; |
1615 return r; |
1636 } |
1616 } |
1637 |
1617 |
1638 |
1618 |
1639 /** |
1619 /** |
1653 return r; |
1633 return r; |
1654 |
1634 |
1655 // Empty closed file queue |
1635 // Empty closed file queue |
1656 TClosedFileUtils::Remove(DriveNumber()); |
1636 TClosedFileUtils::Remove(DriveNumber()); |
1657 |
1637 |
1658 TRACE4(UTF::EBorder, UTraceModuleFileSys::ECMountCBScanDrive2, EF32TraceUidFileSys, DriveNumber(), aOperation, aParam1, aParam2); |
1638 OstTraceExt4(TRACE_FILESYSTEM, FSYS_ECMOUNTCBSCANDRIVE2, "drive %d aOperation %d aParam1 %x aParam2 %x", (TUint) DriveNumber(), (TUint) aOperation, (TUint) aParam1, (TUint) aParam2); |
1659 r = CurrentMount().ScanDrive(aOperation, aParam1, aParam2); |
1639 r = CurrentMount().ScanDrive(aOperation, aParam1, aParam2); |
1660 TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBScanDrive2Ret, EF32TraceUidFileSys, r); |
1640 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBSCANDRIVE2RET, "r %d", r); |
1661 |
|
1662 return r; |
1641 return r; |
1663 } |
1642 } |
1664 |
1643 |
1665 |
1644 |
1666 TInt TDrive::GetShortName(const TDesC& aName,TDes& aShortName) |
1645 TInt TDrive::GetShortName(const TDesC& aName,TDes& aShortName) |
1670 { |
1649 { |
1671 TInt r=CheckMountAndEntryName(aName); |
1650 TInt r=CheckMountAndEntryName(aName); |
1672 if (r!=KErrNone) |
1651 if (r!=KErrNone) |
1673 return(r); |
1652 return(r); |
1674 TPtrC entryName(StripBackSlash(aName)); |
1653 TPtrC entryName(StripBackSlash(aName)); |
1675 |
1654 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBGETSHORTNAMEL, "drive %d", DriveNumber()); |
1676 TRACEMULT2(UTF::EBorder, UTraceModuleFileSys::ECMountCBGetShortNameL, EF32TraceUidFileSys, DriveNumber(), entryName); |
1655 OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBGETSHORTNAMEL_ELONGNAME, "LongName %S", entryName.Ptr(), entryName.Length()<<1); |
1677 TRAP(r,CurrentMount().GetShortNameL(entryName,aShortName)); |
1656 TRAP(r,CurrentMount().GetShortNameL(entryName,aShortName)); |
1678 TRACERETMULT2(UTF::EBorder, UTraceModuleFileSys::ECMountCBGetShortNameLRet, EF32TraceUidFileSys, r, aShortName); |
1657 OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBGETSHORTNAMEL_ESHORTNAME, "ShortName %S", aShortName.Ptr(), aShortName.Length()<<1); |
1679 |
1658 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBGETSHORTNAMEL_ECMOUNTCBGETSHORTNAMELRET, "r %d", r); |
1680 return(r); |
1659 return(r); |
1681 } |
1660 } |
1682 |
1661 |
1683 TInt TDrive::GetLongName(const TDesC& aShortName,TDes& aLongName) |
1662 TInt TDrive::GetLongName(const TDesC& aShortName,TDes& aLongName) |
1684 // |
1663 // |
1687 { |
1666 { |
1688 TInt r=CheckMountAndEntryName(aShortName); |
1667 TInt r=CheckMountAndEntryName(aShortName); |
1689 if (r!=KErrNone) |
1668 if (r!=KErrNone) |
1690 return(r); |
1669 return(r); |
1691 TPtrC entryName(StripBackSlash(aShortName)); |
1670 TPtrC entryName(StripBackSlash(aShortName)); |
1692 |
1671 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBGETLONGNAMEL, "drive %d", DriveNumber()); |
1693 TRACEMULT2(UTF::EBorder, UTraceModuleFileSys::ECMountCBGetLongNameL, EF32TraceUidFileSys, DriveNumber(), entryName); |
1672 OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBGETLONGNAMEL_ESHORTNAME, "ShortName %S", entryName.Ptr(), entryName.Length()<<1); |
1694 TRAP(r,CurrentMount().GetLongNameL(entryName,aLongName)); |
1673 TRAP(r,CurrentMount().GetLongNameL(entryName,aLongName)); |
1695 TRACERETMULT2(UTF::EBorder, UTraceModuleFileSys::ECMountCBGetLongNameLRet, EF32TraceUidFileSys, r, aLongName); |
1674 OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBGETLONGNAMEL_ELONGNAME, "LongName %S", aLongName.Ptr(), aLongName.Length()<<1); |
1696 |
1675 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBGETLONGNAMELRET, "r %d", r); |
1697 return(r); |
1676 return(r); |
1698 } |
1677 } |
1699 |
1678 |
1700 |
1679 |
1701 /** |
1680 /** |
1855 __CHECK_DRIVETHREAD(iDriveNumber); |
1834 __CHECK_DRIVETHREAD(iDriveNumber); |
1856 if(iFSys==NULL) |
1835 if(iFSys==NULL) |
1857 return(KErrNotReady); |
1836 return(KErrNotReady); |
1858 TInt r; |
1837 TInt r; |
1859 CMountCB* pM=NULL; |
1838 CMountCB* pM=NULL; |
1860 TRACE2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewMountL, EF32TraceUidFileSys, &FSys(), DriveNumber()); |
1839 OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWMOUNTL1, "this %x drive %d", (TUint) &FSys(), (TUint) DriveNumber()); |
1861 TRAP(r,pM=FSys().NewMountL()); |
1840 TRAP(r,pM=FSys().NewMountL()); |
1862 TRACERET2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewMountLRet, EF32TraceUidFileSys, r, pM); |
1841 OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWMOUNTL1RET, "r %d CMountCB %x", (TUint) r, (TUint) pM); |
1863 if(r!=KErrNone) |
1842 if(r!=KErrNone) |
1864 return(r); |
1843 return(r); |
1865 pM->SetDrive(this); |
1844 pM->SetDrive(this); |
1866 |
1845 OstTraceExt4(TRACE_FILESYSTEM, FSYS_ECMOUNTCBFORCEREMOUNTDRIVE, "drive %d aMountInfo %x aMountInfoMessageHandle %x aFlags %x", (TUint) DriveNumber(), (TUint) aMountInfo, (TUint) aMountInfoMessageHandle, (TUint) aFlags); |
1867 TRACE4(UTF::EBorder, UTraceModuleFileSys::ECMountCBForceRemountDrive, EF32TraceUidFileSys, |
|
1868 DriveNumber(), aMountInfo, aMountInfoMessageHandle, aFlags); |
|
1869 r=pM->ForceRemountDrive(aMountInfo,aMountInfoMessageHandle,aFlags); |
1846 r=pM->ForceRemountDrive(aMountInfo,aMountInfoMessageHandle,aFlags); |
1870 TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBForceRemountDriveRet, EF32TraceUidFileSys, r); |
1847 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBFORCEREMOUNTDRIVERET, "r %d", r); |
1871 |
|
1872 pM->Close(); |
1848 pM->Close(); |
1873 return(r); |
1849 return(r); |
1874 } |
1850 } |
1875 |
|
1876 TBool TDrive::IsExtensionMounted(CProxyDriveFactory* aFactory) |
1851 TBool TDrive::IsExtensionMounted(CProxyDriveFactory* aFactory) |
1877 // |
1852 // |
1878 // return ETrue if extension mounted on the drive |
1853 // return ETrue if extension mounted on the drive |
1879 // |
1854 // |
1880 { |
1855 { |
1907 __CHECK_DRIVETHREAD(iDriveNumber); |
1881 __CHECK_DRIVETHREAD(iDriveNumber); |
1908 // must be a secondary extension |
1882 // must be a secondary extension |
1909 if(iFSys==NULL) |
1883 if(iFSys==NULL) |
1910 return(KErrNotReady); |
1884 return(KErrNotReady); |
1911 TBool extSupported = iFSys->IsExtensionSupported(); |
1885 TBool extSupported = iFSys->IsExtensionSupported(); |
1912 TRACE1(UTF::EBorder, UTraceModuleFileSys::ECFileSystemIsExtensionSupported, EF32TraceUidFileSys, extSupported); |
1886 OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMISEXTENSIONSUPPORTED1, "%x r %d", (TUint) iFSys, (TUint) extSupported); |
1913 if(!extSupported) |
1887 if(!extSupported) |
1914 return(KErrNotSupported); |
1888 return(KErrNotSupported); |
1915 if(IsExtensionMounted(aFactory)) |
1889 if(IsExtensionMounted(aFactory)) |
1916 return(KErrAlreadyExists); |
1890 return(KErrAlreadyExists); |
1917 if(iCurrentMount && (CurrentMount().LockStatus()!=0 || Mount().Count()>1)) |
1891 if(iCurrentMount && (CurrentMount().LockStatus()!=0 || Mount().Count()>1)) |
1995 __CHECK_DRIVETHREAD(iDriveNumber); |
1969 __CHECK_DRIVETHREAD(iDriveNumber); |
1996 if(iFSys==NULL) |
1970 if(iFSys==NULL) |
1997 return(KErrNotReady); |
1971 return(KErrNotReady); |
1998 TInt r; |
1972 TInt r; |
1999 CMountCB* pM=NULL; |
1973 CMountCB* pM=NULL; |
2000 TRACE2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewMountL, EF32TraceUidFileSys, &FSys(), DriveNumber()); |
1974 OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWMOUNTL2, "this %x drive %d", (TUint) &FSys(), (TUint) DriveNumber()); |
2001 TRAP(r,pM=FSys().NewMountL()); |
1975 TRAP(r,pM=FSys().NewMountL()); |
2002 TRACERET2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewMountLRet, EF32TraceUidFileSys, r, pM); |
1976 OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWMOUNTL2RET, "r %d CMountCB %x", (TUint) r, (TUint) pM); |
2003 if(r!=KErrNone) |
1977 if(r!=KErrNone) |
2004 return(r); |
1978 return(r); |
2005 pM->SetDrive(this); |
1979 pM->SetDrive(this); |
2006 |
1980 |
2007 TRACE2(UTF::EBorder, UTraceModuleFileSys::ECMountCBLock, EF32TraceUidFileSys, DriveNumber(), aStore); |
1981 OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECMOUNTCBLOCK, "drive %d aStore %d", (TUint) DriveNumber(), (TUint) aStore); |
2008 r=pM->Lock(aOld,aNew,aStore); |
1982 r=pM->Lock(aOld,aNew,aStore); |
2009 TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBLockRet, EF32TraceUidFileSys, r); |
1983 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBLOCKRET, "r %d", r); |
2010 |
|
2011 pM->Close(); |
1984 pM->Close(); |
2012 return(r); |
1985 return(r); |
2013 } |
1986 } |
2014 |
1987 |
2015 TInt TDrive::UnlockDevice(TMediaPassword& aPassword,TBool aStore) |
1988 TInt TDrive::UnlockDevice(TMediaPassword& aPassword,TBool aStore) |
2021 __CHECK_DRIVETHREAD(iDriveNumber); |
1994 __CHECK_DRIVETHREAD(iDriveNumber); |
2022 if(iFSys==NULL) |
1995 if(iFSys==NULL) |
2023 return(KErrNotReady); |
1996 return(KErrNotReady); |
2024 TInt r; |
1997 TInt r; |
2025 CMountCB* pM=NULL; |
1998 CMountCB* pM=NULL; |
2026 TRACE2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewMountL, EF32TraceUidFileSys, &FSys(), DriveNumber()); |
1999 OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWMOUNTL3, "this %x drive %d", (TUint) &FSys(), (TUint) DriveNumber()); |
2027 TRAP(r,pM=FSys().NewMountL()); |
2000 TRAP(r,pM=FSys().NewMountL()); |
2028 TRACERET2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewMountLRet, EF32TraceUidFileSys, r, pM); |
2001 OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWMOUNTL3RET, "r %d CMountCB %x", (TUint) r, (TUint) pM); |
2029 if(r!=KErrNone) |
2002 if(r!=KErrNone) |
2030 return(r); |
2003 return(r); |
2031 |
2004 |
2032 // reset mount failure count - which is likely to be non-zero if drive is locked |
2005 // reset mount failure count - which is likely to be non-zero if drive is locked |
2033 iMountFailures = 0; |
2006 iMountFailures = 0; |
2034 |
2007 |
2035 pM->SetDrive(this); |
2008 pM->SetDrive(this); |
2036 |
2009 |
2037 TRACE2(UTF::EBorder, UTraceModuleFileSys::ECMountCBUnlock, EF32TraceUidFileSys, DriveNumber(), aStore); |
2010 OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECMOUNTCBUNLOCK, "drive %d aStore %d", (TUint) DriveNumber(), (TUint) aStore); |
2038 r=pM->Unlock(aPassword,aStore); |
2011 r=pM->Unlock(aPassword,aStore); |
2039 TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBUnlockRet, EF32TraceUidFileSys, r); |
2012 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBUNLOCKRET, "r %d", r); |
2040 |
|
2041 pM->Close(); |
2013 pM->Close(); |
2042 return(r); |
2014 return(r); |
2043 } |
2015 } |
2044 |
2016 |
2045 TInt TDrive::ClearDevicePassword(TMediaPassword& aPassword) |
2017 TInt TDrive::ClearDevicePassword(TMediaPassword& aPassword) |
2051 __CHECK_DRIVETHREAD(iDriveNumber); |
2023 __CHECK_DRIVETHREAD(iDriveNumber); |
2052 if(iFSys==NULL) |
2024 if(iFSys==NULL) |
2053 return(KErrNotReady); |
2025 return(KErrNotReady); |
2054 TInt r; |
2026 TInt r; |
2055 CMountCB* pM=NULL; |
2027 CMountCB* pM=NULL; |
2056 TRACE2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewMountL, EF32TraceUidFileSys, &FSys(), DriveNumber()); |
2028 OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWMOUNTL4, "this %x drive %d", (TUint) &FSys(), (TUint) DriveNumber()); |
2057 TRAP(r,pM=FSys().NewMountL()); |
2029 TRAP(r,pM=FSys().NewMountL()); |
2058 TRACERET2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewMountLRet, EF32TraceUidFileSys, r, pM); |
2030 OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWMOUNTL4RET, "r %d CMountCB %x", (TUint) r, (TUint) pM); |
2059 if(r!=KErrNone) |
2031 if(r!=KErrNone) |
2060 return(r); |
2032 return(r); |
2061 pM->SetDrive(this); |
2033 pM->SetDrive(this); |
2062 |
2034 |
2063 // ClearPassword() will only work if the card is already unlocked. |
2035 // ClearPassword() will only work if the card is already unlocked. |
2067 TDriveInfo info; |
2039 TDriveInfo info; |
2068 DriveInfo(info); |
2040 DriveInfo(info); |
2069 if (info.iMediaAtt & KMediaAttLocked) |
2041 if (info.iMediaAtt & KMediaAttLocked) |
2070 UnlockDevice(aPassword, EFalse); |
2042 UnlockDevice(aPassword, EFalse); |
2071 |
2043 |
2072 TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBClearPassword, EF32TraceUidFileSys, DriveNumber()); |
2044 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBCLEARPASSWORD, "drive %d", DriveNumber()); |
2073 r=pM->ClearPassword(aPassword); |
2045 r=pM->ClearPassword(aPassword); |
2074 TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBClearPasswordRet, EF32TraceUidFileSys, r); |
2046 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBCLEARPASSWORDRET, "r %d", r); |
2075 |
|
2076 pM->Close(); |
2047 pM->Close(); |
2077 return(r); |
2048 return(r); |
2078 } |
2049 } |
2079 |
2050 |
2080 TInt TDrive::EraseDevicePassword() |
2051 TInt TDrive::EraseDevicePassword() |
2086 __CHECK_DRIVETHREAD(iDriveNumber); |
2057 __CHECK_DRIVETHREAD(iDriveNumber); |
2087 if(iFSys==NULL) |
2058 if(iFSys==NULL) |
2088 return(KErrNotReady); |
2059 return(KErrNotReady); |
2089 TInt r; |
2060 TInt r; |
2090 CMountCB* pM=NULL; |
2061 CMountCB* pM=NULL; |
2091 TRACE2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewMountL, EF32TraceUidFileSys, &FSys(), DriveNumber()); |
2062 OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWMOUNTL5, "this %x drive %d", (TUint) &FSys(), (TUint) DriveNumber()); |
2092 TRAP(r,pM=FSys().NewMountL()); |
2063 TRAP(r,pM=FSys().NewMountL()); |
2093 TRACERET2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewMountLRet, EF32TraceUidFileSys, r, pM); |
2064 OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWMOUNTL5RET, "r %d CMountCB %x", (TUint) r, (TUint) pM); |
2094 if(r!=KErrNone) |
2065 if(r!=KErrNone) |
2095 return(r); |
2066 return(r); |
2096 pM->SetDrive(this); |
2067 pM->SetDrive(this); |
2097 |
2068 |
2098 TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBErasePassword, EF32TraceUidFileSys, DriveNumber()); |
2069 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBERASEPASSWORD, "drive %d", DriveNumber()); |
2099 r=pM->ErasePassword(); |
2070 r=pM->ErasePassword(); |
2100 TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBErasePasswordRet, EF32TraceUidFileSys, r); |
2071 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBERASEPASSWORDRET, "r %d", r); |
2101 |
|
2102 pM->Close(); |
2072 pM->Close(); |
2103 return(r); |
2073 return(r); |
2104 } |
2074 } |
2105 |
2075 |
2106 #else |
2076 #else |
2335 else |
2304 else |
2336 iDriveFlags &= ~EDismountDeferred; |
2305 iDriveFlags &= ~EDismountDeferred; |
2337 } |
2306 } |
2338 |
2307 |
2339 |
2308 |
2340 |
|
2341 TInt TDrive::ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2) |
2309 TInt TDrive::ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2) |
2342 // |
2310 // |
2343 // General purpose test interface - .FSY specific. |
2311 // General purpose test interface - .FSY specific. |
2344 // |
2312 // |
2345 { |
2313 { |
2346 TInt r=CheckMount(); |
2314 TInt r=CheckMount(); |
2347 if(r==KErrNone || (r==KErrInUse && iReason==KErrNone)) |
2315 if(r==KErrNone || (r==KErrInUse && iReason==KErrNone)) |
2348 { |
2316 { |
2349 TRACETHREADID(aMessage); |
2317 TRACETHREADID(aMessage); |
2350 TRACE5(UTF::EBorder, UTraceModuleFileSys::ECMountCBControlIO, EF32TraceUidFileSys, |
2318 OstTraceExt5(TRACE_FILESYSTEM, FSYS_ECMOUNTCBCONTROLIO, "drive %d aCommand %d aParam1 %x aParam2 %x clientThreadId %x", (TUint) DriveNumber(), (TUint) aCommand, (TUint) aParam1, (TUint) aParam2, (TUint) threadId); |
2351 DriveNumber(), aCommand, aParam1, aParam2, I64LOW(threadId)); |
|
2352 r=CurrentMount().ControlIO(aMessage,aCommand,aParam1,aParam2); |
2319 r=CurrentMount().ControlIO(aMessage,aCommand,aParam1,aParam2); |
2353 TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBControlIORet, EF32TraceUidFileSys, r); |
2320 OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBCONTROLIORET, "r %d", r); |
2354 } |
2321 } |
2355 return(r); |
2322 return(r); |
2356 } |
2323 } |
2357 |
2324 |
2358 |
2325 |
2565 */ |
2532 */ |
2566 CFormatCB* TDrive::FormatOpenL(CFsRequest* aRequest, TInt& aFmtHandle, TFormatMode aFmtMode, const TLDFormatInfo* apLDFormatInfo, const TVolFormatParam* apVolFormatParam) |
2533 CFormatCB* TDrive::FormatOpenL(CFsRequest* aRequest, TInt& aFmtHandle, TFormatMode aFmtMode, const TLDFormatInfo* apLDFormatInfo, const TVolFormatParam* apVolFormatParam) |
2567 { |
2534 { |
2568 ASSERT(!(apLDFormatInfo && apVolFormatParam)); //-- these parameters are mutually exclusive |
2535 ASSERT(!(apLDFormatInfo && apVolFormatParam)); //-- these parameters are mutually exclusive |
2569 |
2536 |
2570 TRACE2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewFormatL, EF32TraceUidFileSys, &FSys(), DriveNumber()); |
2537 OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWFORMATL, "this %x drive %d", (TUint) &FSys(), (TUint) DriveNumber()); |
2571 |
|
2572 CFormatCB* pFormat = CurrentMount().NewFormatL(); |
2538 CFormatCB* pFormat = CurrentMount().NewFormatL(); |
2573 |
2539 |
2574 TRACE2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewFormatLRet, EF32TraceUidFileSys, KErrNone, pFormat); |
2540 OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWFORMATLRET, "r %d CFormatCB %x", (TUint) KErrNone, (TUint) pFormat); |
2575 |
2541 |
2576 Formats->AddL(pFormat, ETrue); |
2542 Formats->AddL(pFormat, ETrue); |
2577 pFormat->InitL(this, aFmtMode); |
2543 pFormat->InitL(this, aFmtMode); |
2578 |
2544 |
2579 if(aFmtMode & ESpecialFormat) |
2545 if(aFmtMode & ESpecialFormat) |