equal
deleted
inserted
replaced
549 } |
549 } |
550 |
550 |
551 return; |
551 return; |
552 } |
552 } |
553 |
553 |
554 if(LockStatus() != 0) |
554 if(Locked()) |
555 {//-- can't finalise the volume if it has opened objects and not in the consistent state. |
555 {//-- can't finalise the volume if it has opened disk access objects, like Format or RawAccess |
556 //-- Theoretically, we can finalise the mount if we have files opened only for read, but at present, |
|
557 //-- it's impossible to detect such situation. |
|
558 User::Leave(KErrInUse); |
556 User::Leave(KErrInUse); |
559 } |
557 } |
560 |
558 |
561 if(State() != EInit_R && State() != EInit_W) |
559 if(State() != EInit_R && State() != EInit_W) |
562 {//-- can't finalise the mount because it can be in an inconsistent state; e.g. corrupt. |
560 {//-- can't finalise the mount because it can be in an inconsistent state; e.g. corrupt. |
611 /** |
609 /** |
612 @return ETrue if "VolumeClean" flag is supported i.e. this is not FAT12 |
610 @return ETrue if "VolumeClean" flag is supported i.e. this is not FAT12 |
613 */ |
611 */ |
614 TBool CFatMountCB::VolCleanFlagSupported() const |
612 TBool CFatMountCB::VolCleanFlagSupported() const |
615 { |
613 { |
616 const TFatType fatType=FatType(); |
614 const TFatType fatType=FatType(); |
617 |
615 |
618 ASSERT(fatType == EFat12 || fatType == EFat16 || fatType == EFat32); |
616 ASSERT(fatType == EFat12 || fatType == EFat16 || fatType == EFat32); |
619 return (fatType != EFat12); |
617 return (fatType != EFat12); |
|
618 } |
|
619 |
|
620 |
|
621 //----------------------------------------------------------------------------------------- |
|
622 /** |
|
623 @return Volume size in bytes according to the number of usable clusters. |
|
624 This approach is not applicable to RAM drive, because its size isn't fixed and can be adjusted by the system. |
|
625 */ |
|
626 TUint64 CFatMountCB::VolumeSizeInBytes() const |
|
627 { |
|
628 ASSERT(ConsistentState()); |
|
629 ASSERT(!iRamDrive); |
|
630 return ((TUint64)UsableClusters()) << ClusterSizeLog2(); |
620 } |
631 } |
621 |
632 |
622 //----------------------------------------------------------------------------------------- |
633 //----------------------------------------------------------------------------------------- |
623 |
634 |
624 |
635 |
679 |
690 |
680 #endif |
691 #endif |
681 |
692 |
682 |
693 |
683 const TUint32 freeClusters = FAT().NumberOfFreeClusters(bSyncOp); |
694 const TUint32 freeClusters = FAT().NumberOfFreeClusters(bSyncOp); |
684 |
695 aVolume.iFree = (TInt64)freeClusters << ClusterSizeLog2(); |
685 __PRINT1(_L("CFatMountCB::VolumeL() free clusters:%d"), freeClusters); |
696 __PRINT1(_L("CFatMountCB::VolumeL() free clusters:%d"), freeClusters); |
686 |
697 |
687 aVolume.iFree = (TInt64)freeClusters << ClusterSizeLog2(); |
698 |
688 |
699 if(drvInfo.iType==EMediaRam) |
689 if (drvInfo.iType==EMediaRam) |
700 {//-- a special case. RAM drive size is variable and adjustable. It should be calculated from aVolume.iFree and CMountCB::iFree |
|
701 ASSERT(iRamDrive); |
690 aVolume.iSize=aVolume.iFree+iSize; |
702 aVolume.iSize=aVolume.iFree+iSize; |
691 |
703 aVolume.iSize-=ClusterBasePosition(); // Allow for bytes used by FAT etc |
692 aVolume.iSize-=ClusterBasePosition(); // Allow for bytes used by FAT etc |
704 aVolume.iSize=(aVolume.iSize >> ClusterSizeLog2()) << ClusterSizeLog2(); //-- round down to cluster size |
693 aVolume.iSize=(aVolume.iSize >> ClusterSizeLog2()) << ClusterSizeLog2(); //-- round down to cluster size |
705 } |
|
706 else |
|
707 {//-- normal case; the volume size is determined by amount of usable clusters |
|
708 aVolume.iSize = VolumeSizeInBytes(); |
|
709 } |
694 |
710 |
695 } |
711 } |
696 |
712 |
697 |
713 |
698 //----------------------------------------------------------------------------------------- |
714 //----------------------------------------------------------------------------------------- |
4275 return KErrCorrupt; |
4291 return KErrCorrupt; |
4276 |
4292 |
4277 TInt nRes; |
4293 TInt nRes; |
4278 |
4294 |
4279 if(LockStatus()!=0) |
4295 if(LockStatus()!=0) |
4280 { |
4296 {//-- can't run if the volume has opened objects, like files, directories, formats etc. |
4281 __PRINT(_L("CFatMountCB::ScanDrive() locked!\n")); |
4297 __PRINT(_L("CFatMountCB::ScanDrive() locked!\n")); |
4282 return KErrInUse; |
4298 return KErrInUse; |
4283 } |
4299 } |
4284 |
4300 |
4285 if(iRamDrive) |
4301 if(iRamDrive) |