userlibandfileserver/fileserver/sfat32/inc/fat_table32.inl
changeset 0 a41df078684a
child 6 0173bcd7697c
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // f32\sfat32\inc\fat_table32.inl
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20 */
       
    21 
       
    22 #ifndef FAT_TABLE_32_INL
       
    23 #define FAT_TABLE_32_INL
       
    24 
       
    25 
       
    26 //---------------------------------------------------------------------------------------------------------------------------------------
       
    27 
       
    28 /** @return interface to the FAT drive */
       
    29 TFatDriveInterface& CAtaFatTable::DriveInterface() const 
       
    30     {
       
    31     return iDriveInteface;
       
    32     }
       
    33 
       
    34 /** @return pointer to the owning mount. */
       
    35 CFatMountCB* CAtaFatTable::OwnerMount() const 
       
    36     {
       
    37     return iOwner;
       
    38     }
       
    39 
       
    40 
       
    41 /** @return state of this object. */
       
    42 CAtaFatTable::TState CAtaFatTable::State() const 
       
    43     {
       
    44     return iState;
       
    45     }
       
    46 
       
    47 /** sets the state of this object. */
       
    48 void CAtaFatTable::SetState(CAtaFatTable::TState aState)
       
    49     {
       
    50     //__PRINT3(_L("#=-= CAtaFatTable::SetState() drv:%d, %d->%d\n"), iOwner->DriveNumber(),iState,aState);
       
    51     iState = aState;
       
    52     }
       
    53 
       
    54 CAtaFatTable::TFatScanParam::TFatScanParam() 
       
    55              :iEntriesScanned(0), iFirstFree(0), iCurrFreeEntries(0), iCurrOccupiedEntries(0) 
       
    56     {
       
    57     } 
       
    58 
       
    59 //---------------------------------------------------------------------------------------------------------------------------------------
       
    60 
       
    61 /** @return object internal state */
       
    62 CFatHelperThreadBase::TState CFatHelperThreadBase::State() const 
       
    63     {
       
    64     return iState;
       
    65     }
       
    66 
       
    67 /** sustend the worker thread */
       
    68 void CFatHelperThreadBase::Suspend() const 
       
    69     {
       
    70     iThread.Suspend();
       
    71     }
       
    72 
       
    73 /** resumes the worker thread */
       
    74 void CFatHelperThreadBase::Resume() const 
       
    75     {
       
    76     iThread.Resume();
       
    77     }
       
    78 
       
    79 /** @return worker thread completion code (logon status) */    
       
    80 TInt CFatHelperThreadBase::ThreadCompletionCode() const
       
    81     {
       
    82     return iThreadStatus.Int();
       
    83     }
       
    84 
       
    85 /** @return ETrue if the thread is working, i.e. its logon status is KRequestPending*/
       
    86 TBool CFatHelperThreadBase::ThreadWorking() const
       
    87     {
       
    88     return ThreadCompletionCode() == KRequestPending;
       
    89     }
       
    90 
       
    91 /** 
       
    92     boost the priority of the worker thread or return it back to normal
       
    93     @param  aBoost ETrue to boss the priority, EFalse to "unboost"
       
    94 */    
       
    95 void CFatHelperThreadBase::BoostPriority(TBool aBoost) const
       
    96     {
       
    97     TThreadPriority priority;
       
    98     if(aBoost)
       
    99         {
       
   100         priority = (TThreadPriority)EHelperPriorityBoosted;
       
   101         iPriorityBoosted = ETrue;
       
   102         }
       
   103     else        
       
   104         {
       
   105         priority = (TThreadPriority)EHelperPriorityNormal;
       
   106         iPriorityBoosted = EFalse;
       
   107         }
       
   108 
       
   109     iThread.SetPriority(priority);
       
   110     
       
   111     }    
       
   112 
       
   113 /** @return ETrue if the thread's priority is boosted. */
       
   114 TBool CFatHelperThreadBase::IsPriorityBoosted() const
       
   115     {
       
   116     return iPriorityBoosted;
       
   117     }
       
   118 
       
   119 
       
   120 /** @return worker thread id. */
       
   121 TThreadId CFatHelperThreadBase::ThreadId() const 
       
   122     {
       
   123     return iThread.Id();
       
   124     }
       
   125 
       
   126 /** set the state of the object. See CFatHelperThreadBase::TState enum */
       
   127 void CFatHelperThreadBase::SetState(CFatHelperThreadBase::TState aState) 
       
   128     {
       
   129     iState = aState;
       
   130     }
       
   131 
       
   132 /** @return  ETrue if the worker thread is allowed to live.*/
       
   133 TBool CFatHelperThreadBase::AllowedToLive() const 
       
   134     {
       
   135     return iAllowedToLive;
       
   136     }
       
   137 
       
   138 /**
       
   139     Set a flag that indicates if the thread shall be alive or shall finish ASAP
       
   140     @param  aAllow controls the thread life and death
       
   141 */
       
   142 void CFatHelperThreadBase::AllowToLive(TBool aAllow) 
       
   143     {
       
   144     iAllowedToLive = aAllow;
       
   145     }
       
   146 
       
   147 //---------------------------------------------------------------------------------------------------------------------------------------
       
   148 
       
   149 /** @return object type */
       
   150 CFatHelperThreadBase::TFatHelperThreadType CFat32FreeSpaceScanner::Type() const 
       
   151     {
       
   152     return EFreeSpaceScanner;
       
   153     }
       
   154 
       
   155 
       
   156 //---------------------------------------------------------------------------------------------------------------------------------------
       
   157 
       
   158 /** @return object type */
       
   159 CFatHelperThreadBase::TFatHelperThreadType CFat32BitCachePopulator::Type() const 
       
   160     {
       
   161     return EBitCachePopulator;
       
   162     }
       
   163 
       
   164 
       
   165 #endif //FAT_TABLE_32_INL
       
   166 
       
   167 
       
   168 
       
   169 
       
   170 
       
   171 
       
   172 
       
   173 
       
   174 
       
   175 
       
   176 
       
   177 
       
   178 
       
   179 
       
   180 
       
   181 
       
   182 
       
   183 
       
   184 
       
   185 
       
   186 
       
   187 
       
   188