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