2219 |
2219 |
2220 |
2220 |
2221 |
2221 |
2222 |
2222 |
2223 /** |
2223 /** |
2224 Dismounts the current mount. This is method is called from outside, so do some finalisation work on mount. |
2224 Gracefully dismounts the current mount. This is method is called from outside, so do some finalisation work on mount. |
2225 After calling this function there is no current mount on the drive. |
2225 After calling this function there is no current mount on the drive. |
|
2226 |
2226 */ |
2227 */ |
2227 EXPORT_C void TDrive::Dismount() |
2228 EXPORT_C void TDrive::Dismount() |
2228 { |
2229 { |
2229 __PRINT1(_L("TDrive::Dismount() iCurrentMount:0x%x"),iCurrentMount); |
2230 __PRINT1(_L("TDrive::Dismount() iCurrentMount:0x%x"),iCurrentMount); |
2230 |
2231 |
2231 iMountFailures = 0; |
2232 iMountFailures = 0; |
2232 if (!iCurrentMount) |
2233 if (!iCurrentMount) |
2233 return; |
2234 return; |
2234 |
2235 |
|
2236 //-- try to do the best flushing file caches |
2235 TRAP_IGNORE(FlushCachedFileInfoL()); |
2237 TRAP_IGNORE(FlushCachedFileInfoL()); |
2236 |
2238 |
2237 //-- try our best to finalise the mount (the mount can decide to do some job during finalisation, e.g. write some data) |
2239 //-- try our best to finalise the mount (the mount can decide to do some job during finalisation, e.g. write some data) |
2238 TRAP_IGNORE(iCurrentMount->FinaliseMountL()); |
2240 //-- finalise the mount in RO mode, we are dismounting the FS anyway |
|
2241 TRAP_IGNORE(iCurrentMount->FinaliseMountL(RFs::EFinal_RO)); |
2239 |
2242 |
2240 DoDismount(); |
2243 DoDismount(); |
2241 } |
2244 } |
2242 |
2245 |
2243 |
2246 |
2244 |
2247 |
2245 |
2248 |
2246 /** |
2249 /** |
2247 Forcibly dismounts the current mount and prevents it being remounted. |
2250 Dismounts the current mount by force. |
2248 After calling this function there is no current mount on the drive. |
|
2249 */ |
2251 */ |
2250 void TDrive::ForceDismount() |
2252 void TDrive::ForceDismount() |
2251 { |
2253 { |
2252 __PRINT1(_L("TDrive::ForceDismount() iCurrentMount:0x%x"),iCurrentMount); |
2254 __PRINT1(_L("TDrive::ForceDismount() iCurrentMount:0x%x"),iCurrentMount); |
2253 |
2255 |
2255 |
2257 |
2256 if(!iCurrentMount) |
2258 if(!iCurrentMount) |
2257 return; |
2259 return; |
2258 |
2260 |
2259 TRAP_IGNORE(FlushCachedFileInfoL()); |
2261 TRAP_IGNORE(FlushCachedFileInfoL()); |
2260 iCurrentMount->SetDismounted(); //! this affects TDrive::ReMount() |
2262 |
|
2263 //-- try our best to finalise the mount (the mount can decide to do some job during finalisation, e.g. write some data) |
|
2264 //-- finalise the mount in RO mode, we are dismounting the FS anyway |
|
2265 TRAP_IGNORE(iCurrentMount->FinaliseMountL(RFs::EFinal_RO)); |
|
2266 |
|
2267 //-- mark the mount as 'Dismounted'; this invalidates all object handles until the mount is successfully "remounted". |
|
2268 //-- if there are still some objects opened on this mount, CMountCB::Close() won't destroy it until all objects are closed. |
|
2269 iCurrentMount->SetDismounted(); |
|
2270 |
2261 DoDismount(); |
2271 DoDismount(); |
2262 } |
2272 } |
2263 |
2273 |
2264 /** |
2274 /** |
2265 An internal method. Dismounts and closes a current mount. |
2275 An internal method. Dismounts and closes a current mount. |