59 |
59 |
60 return (aClusterNo >= KFatFirstSearchCluster) && (aClusterNo < UsableClusters()+KFatFirstSearchCluster); |
60 return (aClusterNo >= KFatFirstSearchCluster) && (aClusterNo < UsableClusters()+KFatFirstSearchCluster); |
61 } |
61 } |
62 |
62 |
63 |
63 |
64 inline TInt CFatMountCB::RootDirectorySector() const |
64 inline TUint32 CFatMountCB::RootDirectorySector() const |
65 {return iVolParam.RootDirectorySector();} |
65 { |
66 |
66 return iVolParam.RootDirectorySector(); |
67 inline TUint CFatMountCB::RootDirEnd() const |
67 } |
68 {return iVolParam.RootDirEnd();} |
68 |
|
69 inline TUint32 CFatMountCB::RootDirEnd() const |
|
70 { |
|
71 return iVolParam.RootDirEnd(); |
|
72 } |
69 |
73 |
70 inline TUint32 CFatMountCB::RootClusterNum() const |
74 inline TUint32 CFatMountCB::RootClusterNum() const |
71 {return iVolParam.RootClusterNum(); } |
75 { |
72 |
76 return iVolParam.RootClusterNum(); |
73 |
77 } |
74 inline TInt CFatMountCB::StartCluster(const TFatDirEntry & anEntry) const |
78 |
|
79 |
|
80 inline TUint32 CFatMountCB::StartCluster(const TFatDirEntry & anEntry) const |
75 { |
81 { |
76 if(Is32BitFat()) |
82 if(Is32BitFat()) |
77 return anEntry.StartCluster(); |
83 return anEntry.StartCluster(); |
78 else |
84 else |
79 return 0xFFFF&anEntry.StartCluster(); |
85 return anEntry.StartCluster() & 0xFFFF; |
80 } |
86 } |
81 |
87 |
82 /** |
88 /** |
83 returns true for root dir on Fat12/16 (fixed root dir versions of Fat) false on fat32 |
89 returns true for root dir on Fat12/16 (fixed root dir versions of Fat) false on fat32 |
84 this function is used to handle special cases for reading/writing the root directory on FAT via the use of cluster zero. |
90 this function is used to handle special cases for reading/writing the root directory on FAT via the use of cluster zero. |
85 |
91 |
86 @param aEntry position on volume being queried |
92 @param entryPos directory entry position |
87 @return Whether Root dir position or not |
93 @return ETrue if entryPos belongs to the FAT12/16 root directory |
88 */ |
94 */ |
89 TBool CFatMountCB::IsRootDir(const TEntryPos &aEntry) const |
95 TBool CFatMountCB::IsRootDir(const TEntryPos &entryPos) const |
90 { |
96 { |
91 if(Is32BitFat()) |
97 //-- for FAT12/16 cluster 0 means "root directory" |
92 return EFalse; |
98 return !(Is32BitFat() || entryPos.iCluster); |
93 else |
|
94 return((aEntry.iCluster==0) ? (TBool)ETrue : (TBool)EFalse); |
|
95 } |
99 } |
96 /** |
100 /** |
97 Indicates the root directory cluster, For Fat12/16 root is always indicated by cluster number zero, on Fat32 the is a root cluster number |
101 Indicates the root directory cluster, For Fat12/16 root is always indicated by cluster number zero, on Fat32 the is a root cluster number |
98 @return The root cluster indicator |
102 @return The root cluster indicator |
99 */ |
103 */ |
100 TInt CFatMountCB::RootIndicator() const |
104 TUint32 CFatMountCB::RootIndicator() const |
101 { |
105 { |
102 if(Is32BitFat()) |
106 if(Is32BitFat()) |
103 return iVolParam.RootClusterNum(); |
107 return iVolParam.RootClusterNum(); |
104 else |
108 else |
105 return 0; |
109 return 0; |
106 } |
110 } |
107 |
111 |
108 |
112 |
109 /** @return Log2 of cluster size on volume */ |
113 /** @return Log2 of cluster size on volume */ |
110 TInt CFatMountCB::ClusterSizeLog2() const |
114 TUint32 CFatMountCB::ClusterSizeLog2() const |
111 {return(iVolParam.ClusterSizeLog2());} |
115 { |
|
116 return(iVolParam.ClusterSizeLog2()); |
|
117 } |
112 |
118 |
113 /** @return Log2 of media sector size */ |
119 /** @return Log2 of media sector size */ |
114 TInt CFatMountCB::SectorSizeLog2() const |
120 TUint32 CFatMountCB::SectorSizeLog2() const |
115 {return(iVolParam.SectorSizeLog2());} |
121 { |
|
122 return(iVolParam.SectorSizeLog2()); |
|
123 } |
116 |
124 |
117 /** @return sector per cluster */ |
125 /** @return sector per cluster */ |
118 TInt CFatMountCB::SectorsPerCluster() const |
126 TUint32 CFatMountCB::SectorsPerCluster() const |
119 {return(1<<(iVolParam.ClusterSizeLog2()-iVolParam.SectorSizeLog2()));} |
127 { |
|
128 return(1<<(iVolParam.ClusterSizeLog2()-iVolParam.SectorSizeLog2())); |
|
129 } |
120 |
130 |
121 /** @return the base position of a cluster */ |
131 /** @return the base position of a cluster */ |
122 TInt CFatMountCB::ClusterBasePosition() const |
132 TUint32 CFatMountCB::ClusterBasePosition() const |
123 {return(iFirstFreeByte);} |
133 { |
|
134 return(iFirstFreeByte); |
|
135 } |
124 |
136 |
125 /** @return the offset into a cluster of a byte address */ |
137 /** @return the offset into a cluster of a byte address */ |
126 TInt CFatMountCB::ClusterRelativePos(TInt aPos) const |
138 TUint32 CFatMountCB::ClusterRelativePos(TUint32 aPos) const |
127 {return(aPos&((1<<ClusterSizeLog2())-1));} |
139 { |
|
140 return(aPos & ((1<<ClusterSizeLog2())-1)); |
|
141 } |
128 |
142 |
129 /** |
143 /** |
130 Calculates the maximum number of clusters |
144 Calculates the maximum number of clusters |
131 @return maximum number of clusters |
145 @return maximum number of clusters |
132 */ |
146 */ |
133 TUint32 CFatMountCB::MaxClusterNumber() const |
147 TUint32 CFatMountCB::MaxClusterNumber() const |
134 {return(TotalSectors()>>(ClusterSizeLog2()-SectorSizeLog2()));} |
148 {return(TotalSectors()>>(ClusterSizeLog2()-SectorSizeLog2()));} |
135 |
149 |
136 /** @return the the total sectors on volume */ |
150 /** @return the the total sectors on volume */ |
137 TInt CFatMountCB::TotalSectors() const |
151 TUint32 CFatMountCB::TotalSectors() const |
138 {return iVolParam.TotalSectors();} |
152 { |
|
153 return iVolParam.TotalSectors(); |
|
154 } |
139 |
155 |
140 /** @return total size of a Fat in bytes */ |
156 /** @return total size of a Fat in bytes */ |
141 TInt CFatMountCB::FatSizeInBytes() const |
157 TUint32 CFatMountCB::FatSizeInBytes() const |
142 {return iVolParam.FatSizeInBytes();} |
158 { |
|
159 return iVolParam.FatSizeInBytes(); |
|
160 } |
143 |
161 |
144 /** @return first sector of the Fat */ |
162 /** @return first sector of the Fat */ |
145 TUint32 CFatMountCB::FirstFatSector() const |
163 TUint32 CFatMountCB::FirstFatSector() const |
146 {return iVolParam.FirstFatSector();} |
164 { |
|
165 return iVolParam.FirstFatSector(); |
|
166 } |
147 |
167 |
148 /** @return the byte offset of the Fat */ |
168 /** @return the byte offset of the Fat */ |
149 TInt CFatMountCB::StartOfFatInBytes() const |
169 TUint32 CFatMountCB::StartOfFatInBytes() const |
150 {return(FirstFatSector()<<SectorSizeLog2());} |
170 { |
|
171 return(FirstFatSector()<<SectorSizeLog2()); |
|
172 } |
151 |
173 |
152 /** @return Number of Fats used by the volume */ |
174 /** @return Number of Fats used by the volume */ |
153 TInt CFatMountCB::NumberOfFats() const |
175 TUint32 CFatMountCB::NumberOfFats() const |
154 {return iVolParam.NumberOfFats();} |
176 { |
|
177 return iVolParam.NumberOfFats(); |
|
178 } |
155 |
179 |
156 |
180 |
157 /** @return refrence to the fat table owned by the mount */ |
181 /** @return refrence to the fat table owned by the mount */ |
158 CFatTable& CFatMountCB::FAT() const |
182 CFatTable& CFatMountCB::FAT() const |
159 {return(*iFatTable);} |
183 { |
|
184 return(*iFatTable); |
|
185 } |
|
186 |
160 /** |
187 /** |
161 @return refrence to the file system object that has produced this CFatMountCB |
188 @return refrence to the file system object that has produced this CFatMountCB |
162 */ |
189 */ |
163 CFatFileSystem& CFatMountCB::FatFileSystem() const |
190 CFatFileSystem& CFatMountCB::FatFileSystem() const |
164 { |
191 { |
482 @return cluster size |
513 @return cluster size |
483 */ |
514 */ |
484 TInt CFatFileCB::ClusterSizeLog2() |
515 TInt CFatFileCB::ClusterSizeLog2() |
485 {return(FatMount().ClusterSizeLog2());} |
516 {return(FatMount().ClusterSizeLog2());} |
486 |
517 |
487 /* |
518 |
488 Note: this replaces SeekIndex() which was only used in sl_mnt |
519 //--------------------------------------------------------------------------------------------------------------------------------- |
489 to verify whether the seek index had been created/initialised |
520 TBool CFatFileCB::FileSizeModified() const |
490 */ |
521 { |
491 inline TBool CFatFileCB::IsSeekIndex() const |
522 return iFileSizeModified; |
492 {return (iSeekIndex==NULL?(TBool)EFalse:(TBool)ETrue); } |
523 } |
|
524 |
|
525 void CFatFileCB::IndicateFileSizeModified(TBool aModified) |
|
526 { |
|
527 iFileSizeModified = aModified; |
|
528 } |
|
529 |
|
530 //----------------------------------------------------------------------------- |
|
531 /** @return ETrue if file attributes' 'Modified' flag is set*/ |
|
532 TBool CFatFileCB::FileAttModified() const |
|
533 { |
|
534 return (Att() & KEntryAttModified); |
|
535 } |
|
536 |
|
537 /** |
|
538 Set or reset a flag indicating that file attributes had beed modified |
|
539 @param aModified ETrue means that attributes are modified |
|
540 */ |
|
541 |
|
542 void CFatFileCB::IndicateFileAttModified(TBool aModified) |
|
543 { |
|
544 if(aModified) |
|
545 iAtt |= KEntryAttModified; |
|
546 else |
|
547 iAtt &= ~KEntryAttModified; |
|
548 } |
|
549 |
|
550 TUint32 CFatFileCB::FCB_StartCluster() const |
|
551 { |
|
552 return iStartCluster; |
|
553 } |
|
554 |
|
555 |
|
556 void CFatFileCB::FCB_SetStartCluster(TUint32 aVal) |
|
557 { |
|
558 ASSERT(aVal == 0 || (aVal >= KFatFirstSearchCluster)); |
|
559 iStartCluster = aVal; |
|
560 } |
|
561 |
|
562 /** @return file size from CFileCB */ |
|
563 TUint32 CFatFileCB::FCB_FileSize() const |
|
564 { |
|
565 return Size(); |
|
566 } |
|
567 |
|
568 /** set file size in the CFileCB*/ |
|
569 void CFatFileCB::FCB_SetFileSize(TUint32 aVal) |
|
570 { |
|
571 SetSize(aVal); |
|
572 } |
|
573 |
|
574 TBool CFatFileCB::FileTimeModified() const |
|
575 { |
|
576 return iFileTimeModified; |
|
577 } |
|
578 |
|
579 void CFatFileCB::IndicateFileTimeModified(TBool aModified) |
|
580 { |
|
581 iFileTimeModified = aModified; |
|
582 } |
|
583 |
493 |
584 |
494 |
585 |
495 //--------------------------------------------------------------------------------------------------------------------------------- |
586 //--------------------------------------------------------------------------------------------------------------------------------- |
496 // class CFatDirCB |
587 // class CFatDirCB |
497 |
588 |