268 inline void TDrive::SetNotifyOff() |
268 inline void TDrive::SetNotifyOff() |
269 { |
269 { |
270 __IS_DRIVETHREAD(); |
270 __IS_DRIVETHREAD(); |
271 iDriveFlags |= ENotifyOff; |
271 iDriveFlags |= ENotifyOff; |
272 } |
272 } |
273 /** |
273 |
274 |
274 /** |
275 Locks the drive.This function acquires iLock mutex. |
275 Locks the drive.This function acquires iLock mutex. |
276 |
|
277 */ |
276 */ |
278 inline void TDrive::Lock() |
277 inline void TDrive::Lock() |
279 {iLock.Wait();} |
278 {iLock.Wait();} |
280 /** |
279 |
281 |
280 /** |
282 UnLocks the drive.This function signals the iLock mutex. |
281 UnLocks the drive.This function signals the iLock mutex. |
283 |
282 */ |
284 */ |
|
285 |
|
286 inline void TDrive::UnLock() |
283 inline void TDrive::UnLock() |
287 {iLock.Signal();} |
284 {iLock.Signal();} |
288 |
285 |
289 |
286 |
290 /** |
287 /** |
291 |
|
292 Gets the reserved space of a drive |
|
293 |
|
294 @return Amount of space reserved in bytes. |
288 @return Amount of space reserved in bytes. |
295 |
289 */ |
296 */ |
|
297 |
|
298 inline TInt TDrive::ReservedSpace() const |
290 inline TInt TDrive::ReservedSpace() const |
299 {return iReservedSpace;} |
291 { |
300 |
292 return iReservedSpace; |
301 /** |
293 } |
302 |
294 |
303 Reserves a space of a drive. |
295 /** |
304 |
296 Reserves space on a drive. The amount of 'reserved space' is subtracted |
305 @param aReservedSpace Amount of space to reserve in bytes. |
297 from the amount of available free space on the volume reported by file system, when the user |
306 |
298 queries it. |
|
299 |
|
300 @param aReservedSpace Amount of space to reserve in bytes. |
307 */ |
301 */ |
308 inline void TDrive::SetReservedSpace(const TInt aReservedSpace) |
302 inline void TDrive::SetReservedSpace(const TInt aReservedSpace) |
309 {iReservedSpace=aReservedSpace; } |
303 { |
310 |
304 iReservedSpace=aReservedSpace; |
311 /** |
305 } |
312 |
306 |
313 Sets the rugged flag in the drive object. |
307 /** |
314 |
308 Sets the 'rugged mode' flag in the drive object. The file system associated with this TDrive object |
315 @param Flag to set or clear the rugged flag. |
309 can use this flag for changing its behaviour. |
316 @see IsRugged() |
310 For example, FAT file system if this flag is set, operates in 'Rugged FAT' mode, when the performance is |
317 |
311 sacrificed for the sake of reliability. |
318 */ |
312 |
319 |
313 @param aIsRugged the 'rugged mode' flag. |
|
314 */ |
320 inline void TDrive::SetRugged(TBool aIsRugged) |
315 inline void TDrive::SetRugged(TBool aIsRugged) |
321 { |
316 { |
322 if (!aIsRugged) |
317 if (!aIsRugged) |
323 iDriveFlags |= ENotRugged; |
318 iDriveFlags |= ENotRugged; |
324 else |
319 else |
325 iDriveFlags &= ~ENotRugged; |
320 iDriveFlags &= ~ENotRugged; |
326 } |
321 } |
327 |
322 |
328 /** |
323 /** |
329 |
324 @return 'Is rugged' flag. |
330 Returns whether the current drive is running as rugged Fat |
325 See TDrive::SetRugged() |
331 or not.If IsRugged flag is set then in the event of power |
326 */ |
332 failure fat/metadata will be in a valid state if the scandrive |
|
333 utility is run immediately after. |
|
334 |
|
335 @return Is rugged fat flag. |
|
336 */ |
|
337 |
|
338 inline TBool TDrive::IsRugged() const |
327 inline TBool TDrive::IsRugged() const |
339 {return !(iDriveFlags & ENotRugged); } |
328 { |
|
329 return !(iDriveFlags & ENotRugged); |
|
330 } |
340 |
331 |
341 |
332 |
342 /** |
333 /** |
343 @return ETrue if the drive is synchronous, i.e. runs in the main file server thread. |
334 @return ETrue if the drive is synchronous, i.e. runs in the main file server thread. |
344 */ |
335 */ |
449 */ |
440 */ |
450 inline void CMountCB::SetNotifyOff() |
441 inline void CMountCB::SetNotifyOff() |
451 {Drive().SetNotifyOff();} |
442 {Drive().SetNotifyOff();} |
452 |
443 |
453 |
444 |
454 |
445 //--------------------------------------------------------------------------------------------------------------------------------- |
455 |
446 |
456 /** |
447 /** |
457 Locks the mount by incrementing the internal lock counter. |
448 |
458 |
449 Increment mount's lock counter. This happens on following events: |
459 The mount becomes locked on formatting or on the opening of a resource |
450 - RemoveResource() call, when file (share) or directory is closed |
460 (a file or a directory) or raw disk subsession. |
451 - AddDiskAccess() call, when disk access object (like Format or RawDisk access) is opened on the mount. |
461 A format, resource or raw disk subsession can only be opened if the mount |
452 |
462 is not locked. |
453 See also: CMountCB::LockStatus() |
463 */ |
454 */ |
464 inline void CMountCB::IncLock() |
455 inline void CMountCB::IncLock() |
465 {iLockMount++;} |
456 { |
466 |
457 iLockMount++; |
467 |
458 } |
468 |
459 |
469 |
460 |
470 /** |
461 //--------------------------------------------------------------------------------------------------------------------------------- |
471 Unlocks the mount by decrementing the internal lock counter. |
462 |
472 |
463 /** |
473 The mount becomes locked on formatting or on the opening of a resource |
464 Decrement mount's lock counter. This happens on following events: |
474 (a file or a directory) or raw disk subsession. |
465 |
475 A format, resource or raw disk subsession can only be opened if the mount |
466 AddResource() call when file (share) or directory is opened on the mount |
476 is not locked. |
467 RemoveDiskAccess() call when disk access object (like Format or RawDisk access) is closed. |
|
468 |
|
469 See also: CMountCB::LockStatus() |
477 */ |
470 */ |
478 inline void CMountCB::DecLock() |
471 inline void CMountCB::DecLock() |
479 {iLockMount--;} |
472 { |
480 |
473 iLockMount--; |
481 |
474 } |
482 |
475 |
483 |
476 //--------------------------------------------------------------------------------------------------------------------------------- |
484 /** |
477 |
485 Gets the current lock status. |
478 /** |
486 |
479 @return value of the Mount's lock counter value. |
487 It delivers the current lock status by returning the internal lock counter. |
480 |
488 |
481 The meaning of 'iLockMount' is overloaded a bit, it's value is: |
489 @return The current lock status. |
482 0 when there are no files, directories, formats and any other objects opened on the mount |
|
483 >0 when there are disk access objects opened (raw disk access or format) |
|
484 <0 when there are files or directories opened on the mount, and the value reflects their total number |
490 */ |
485 */ |
491 inline TInt CMountCB::LockStatus() const |
486 inline TInt CMountCB::LockStatus() const |
492 {return(iLockMount);} |
487 { |
493 |
488 return iLockMount; |
494 |
489 } |
495 |
490 |
496 |
491 |
|
492 |
|
493 //--------------------------------------------------------------------------------------------------------------------------------- |
497 /** |
494 /** |
498 Tests whether the mount is currently locked. |
495 Tests whether the mount is currently locked. |
499 |
496 |
500 A mount is locked when the internal lock counter is greater than zero. |
497 A mount is locked when the internal lock counter is greater than zero. |
501 On creation, the lock counter is set to zero. |
498 This happens when a format, resource or raw disk subsession is opened on the mount. |
502 |
499 |
503 The mount becomes locked on formatting or on the opening of a resource |
500 See also: CMountCB::LockStatus() |
504 (a file or a directory) or raw disk subsession. |
501 |
505 A format, resource or raw disk subsession can only be opened if the mount |
502 @return True if the mount is locked by having disk access objects opened |
506 is not locked. |
|
507 |
|
508 @return True if the mount is locked, false, otherwise. |
|
509 */ |
503 */ |
510 inline TBool CMountCB::Locked() const |
504 inline TBool CMountCB::Locked() const |
511 {return iLockMount>0; } |
505 { |
|
506 return iLockMount > 0; |
|
507 } |
512 |
508 |
513 |
509 |
514 |
510 |
515 |
511 |
516 /** |
512 /** |
535 |
531 |
536 |
532 |
537 /** |
533 /** |
538 */ |
534 */ |
539 inline TInt64 CMountCB::Size() const |
535 inline TInt64 CMountCB::Size() const |
540 {return(iSize);} |
536 { |
|
537 return iSize; |
|
538 } |
541 |
539 |
542 |
540 |
543 |
541 |
544 |
542 |
545 /** |
543 /** |
546 Set the unique mount number |
544 Set the unique mount number |
547 @param aMountNumber - The unique mount number |
545 @param aMountNumber - The unique mount number |
548 */ |
546 */ |
549 const TInt KMountDismounted = 0x80000000; |
547 const TInt KMountDismounted = 0x80000000; |
|
548 |
550 inline void CMountCB::SetMountNumber(TInt aMountNumber) |
549 inline void CMountCB::SetMountNumber(TInt aMountNumber) |
551 { iMountNumber = (aMountNumber &~ KMountDismounted); } |
550 { |
552 |
551 iMountNumber = (aMountNumber & ~KMountDismounted); |
553 |
552 } |
554 |
553 |
555 |
554 |
556 /** |
555 |
557 Set the mount to be dismounted |
556 |
|
557 /** |
|
558 Set the mount flag indicating that it is in 'dismounted' state. |
|
559 The CMountCB object in this case is still alive, but any attempts to access resources on this |
|
560 mount result in KErrDismounted. |
558 */ |
561 */ |
559 inline void CMountCB::SetDismounted(TBool aDismounted) |
562 inline void CMountCB::SetDismounted(TBool aDismounted) |
560 { |
563 { |
561 if(aDismounted) |
564 if(aDismounted) |
562 iMountNumber |= KMountDismounted; |
565 iMountNumber |= KMountDismounted; |
566 |
569 |
567 |
570 |
568 |
571 |
569 |
572 |
570 /** |
573 /** |
571 Returns the unique mount number |
|
572 @return The unique mount number |
574 @return The unique mount number |
573 */ |
575 */ |
574 inline TInt CMountCB::MountNumber() const |
576 inline TInt CMountCB::MountNumber() const |
575 { return(iMountNumber &~ KMountDismounted); } |
577 { |
576 |
578 return(iMountNumber &~ KMountDismounted); |
577 |
579 } |
578 |
580 |
579 |
581 |
580 /** |
582 |
581 Returns ETrue if the mount is flagged as dismounted. |
583 |
|
584 /** |
582 @return ETrue if the mount is flagged as dismounted |
585 @return ETrue if the mount is flagged as dismounted |
583 */ |
586 */ |
584 inline TBool CMountCB::IsDismounted() const |
587 inline TBool CMountCB::IsDismounted() const |
585 { return(iMountNumber & KMountDismounted); } |
588 { |
|
589 return(iMountNumber & KMountDismounted); |
|
590 } |
586 |
591 |
587 |
592 |
588 |
593 |
589 /** |
594 /** |
590 Retrieves TBusLocalDrive object associated with the mount |
595 Retrieves TBusLocalDrive object associated with the mount |