usbmgmt/usbmgr/host/functiondrivers/ms/msmm/referencepolicyplugin/src/referencepolicyplugin.cpp
branchRCL_3
changeset 15 f92a4f87e424
parent 0 c9bc50fca66e
child 16 012cc2ee6408
equal deleted inserted replaced
14:d3e8e7d462dd 15:f92a4f87e424
     1 /*
     1 /*
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    25 #include <e32std.h>
    25 #include <e32std.h>
    26 #include <usb/usblogger.h>
    26 #include <usb/usblogger.h>
    27 #include <usb/hostms/msmm_policy_def.h>
    27 #include <usb/hostms/msmm_policy_def.h>
    28 #include "refppnotificationman.h"
    28 #include "refppnotificationman.h"
    29 #include "srvpanic.h"
    29 #include "srvpanic.h"
       
    30 #include "OstTraceDefinitions.h"
       
    31 #ifdef OST_TRACE_COMPILER_IN_USE
       
    32 #include "referencepolicypluginTraces.h"
       
    33 #endif
       
    34 
    30  
    35  
    31 #ifdef __FLOG_ACTIVE
       
    32 _LIT8(KLogComponent, "UsbHostMsmmRefPP");
       
    33 #endif
       
    34 
    36 
    35 //  Global Variables
    37 //  Global Variables
    36 const TUid KHostMsRepositoryUid = {0x10285c46};
    38 const TUid KHostMsRepositoryUid = {0x10285c46};
    37 const TUint32 KPermittedRangeUid = 0x00010000;
    39 const TUint32 KPermittedRangeUid = 0x00010000;
    38 const TUint32 KForbiddenListUid = 0x00010001;
    40 const TUint32 KForbiddenListUid = 0x00010001;
    45 const TUint KHistoryGranularity = 0x8;
    47 const TUint KHistoryGranularity = 0x8;
    46 const TUint KPermittedDrvRangeBufLen = 0x3;
    48 const TUint KPermittedDrvRangeBufLen = 0x3;
    47 
    49 
    48 CReferencePolicyPlugin::~CReferencePolicyPlugin()
    50 CReferencePolicyPlugin::~CReferencePolicyPlugin()
    49     {
    51     {
    50     LOG_FUNC
    52     OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_CREFERENCEPOLICYPLUGIN_DES_ENTRY );
       
    53     
    51     Cancel();
    54     Cancel();
    52     ClearHistory(); // Remove all buffered history record.
    55     ClearHistory(); // Remove all buffered history record.
    53     delete iRepository;
    56     delete iRepository;
    54     delete iNotificationMan;
    57     delete iNotificationMan;
    55     iFs.Close();
    58     iFs.Close();
       
    59     OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_CREFERENCEPOLICYPLUGIN_DES_EXIT );
    56     }
    60     }
    57 
    61 
    58 CReferencePolicyPlugin* CReferencePolicyPlugin::NewL()
    62 CReferencePolicyPlugin* CReferencePolicyPlugin::NewL()
    59     {
    63     {
    60     LOG_STATIC_FUNC_ENTRY
    64     OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_NEWL_ENTRY );
       
    65     
    61     CReferencePolicyPlugin* self = new (ELeave) CReferencePolicyPlugin;
    66     CReferencePolicyPlugin* self = new (ELeave) CReferencePolicyPlugin;
    62     CleanupStack::PushL(self);
    67     CleanupStack::PushL(self);
    63     self->ConstructL();
    68     self->ConstructL();
    64     CleanupStack::Pop(self);
    69     CleanupStack::Pop(self);
    65     
    70     
       
    71     OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_NEWL_EXIT );
    66     return self;
    72     return self;
    67     }
    73     }
    68 
    74 
    69 void CReferencePolicyPlugin::RetrieveDriveLetterL(TText& aDriveName,
    75 void CReferencePolicyPlugin::RetrieveDriveLetterL(TText& aDriveName,
    70         const TPolicyRequestData& aData, TRequestStatus& aStatus)
    76         const TPolicyRequestData& aData, TRequestStatus& aStatus)
    71     {
    77     {
    72     LOG_FUNC
    78     OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_RETRIEVEDRIVELETTERL_TTEXT_TPOLICYREQUESTDATA_TREQUESTSTATUS_ENTRY );
       
    79     
    73     Cancel();
    80     Cancel();
    74     aStatus = KRequestPending;
    81     aStatus = KRequestPending;
    75     iClientStatus = &aStatus;    
    82     iClientStatus = &aStatus;    
    76 
    83 
    77     RetrieveDriveLetterL(aDriveName, aData);
    84     RetrieveDriveLetterL(aDriveName, aData);
    78     // In a licensee owned policy plugin, it shall complete client 
    85     // In a licensee owned policy plugin, it shall complete client 
    79     // request in RunL() in general 
    86     // request in RunL() in general 
    80     Complete(KErrNone);
    87     Complete(KErrNone);
       
    88     OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_RETRIEVEDRIVELETTERL_TTEXT_TPOLICYREQUESTDATA_TREQUESTSTATUS_EXIT );
    81     }
    89     }
    82 
    90 
    83 void CReferencePolicyPlugin::CancelRetrieveDriveLetter()
    91 void CReferencePolicyPlugin::CancelRetrieveDriveLetter()
    84     {
    92     {
    85     LOG_FUNC
    93     OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_CANCELRETRIEVEDRIVELETTER_ENTRY );
       
    94     
    86     Cancel();
    95     Cancel();
       
    96     OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_CANCELRETRIEVEDRIVELETTER_EXIT );
    87     }
    97     }
    88 
    98 
    89 void CReferencePolicyPlugin::SaveLatestMountInfoL(
    99 void CReferencePolicyPlugin::SaveLatestMountInfoL(
    90         const TPolicyMountRecord& aData, TRequestStatus& aStatus)
   100         const TPolicyMountRecord& aData, TRequestStatus& aStatus)
    91     {
   101     {
    92     LOG_FUNC    
   102     OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_SAVELATESTMOUNTINFOL_TPOLICYMOUNTRECORD_TREQUESTSTATUS_ENTRY );
       
   103     
    93     Cancel();
   104     Cancel();
    94     aStatus = KRequestPending;
   105     aStatus = KRequestPending;
    95     iClientStatus = &aStatus;
   106     iClientStatus = &aStatus;
    96 
   107 
    97     SaveLatestMountInfoL(aData);
   108     SaveLatestMountInfoL(aData);
    98     // In a licensee owned policy plugin, it shall complete client 
   109     // In a licensee owned policy plugin, it shall complete client 
    99     // request in RunL() in general 
   110     // request in RunL() in general 
   100     Complete(KErrNone);
   111     Complete(KErrNone);
       
   112     OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_SAVELATESTMOUNTINFOL_TPOLICYMOUNTRECORD_TREQUESTSTATUS_EXIT );
   101     }
   113     }
   102 
   114 
   103 void CReferencePolicyPlugin::CancelSaveLatestMountInfo()
   115 void CReferencePolicyPlugin::CancelSaveLatestMountInfo()
   104     {
   116     {
   105     LOG_FUNC
   117     OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_CANCELSAVELATESTMOUNTINFO_ENTRY );
       
   118     
   106     Cancel();
   119     Cancel();
       
   120     OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_CANCELSAVELATESTMOUNTINFO_EXIT );
   107     }
   121     }
   108 
   122 
   109 void CReferencePolicyPlugin::SendErrorNotificationL(
   123 void CReferencePolicyPlugin::SendErrorNotificationL(
   110         const THostMsErrData& aErrData)
   124         const THostMsErrData& aErrData)
   111     {
   125     {
   112     LOG_FUNC
   126     OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_SENDERRORNOTIFICATIONL_ENTRY );
       
   127     
   113     iNotificationMan->SendErrorNotificationL(aErrData);
   128     iNotificationMan->SendErrorNotificationL(aErrData);
       
   129     OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_SENDERRORNOTIFICATIONL_EXIT );
   114     }
   130     }
   115 
   131 
   116 void CReferencePolicyPlugin::GetSuspensionPolicy(TSuspensionPolicy& aPolicy)
   132 void CReferencePolicyPlugin::GetSuspensionPolicy(TSuspensionPolicy& aPolicy)
   117     {
   133     {
   118     LOG_FUNC
   134     OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_GETSUSPENSIONPOLICY_ENTRY );
       
   135     
   119     aPolicy = iSuspensionPolicy;
   136     aPolicy = iSuspensionPolicy;
       
   137     OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_GETSUSPENSIONPOLICY_EXIT );
   120     }
   138     }
   121 
   139 
   122 void CReferencePolicyPlugin::DoCancel()
   140 void CReferencePolicyPlugin::DoCancel()
   123     {
   141     {
   124     LOG_FUNC
   142     OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_DOCANCEL_ENTRY );
       
   143     
   125     // No more work need to do in current implementation of reference
   144     // No more work need to do in current implementation of reference
   126     // policy plugin. 
   145     // policy plugin. 
   127     // In a licensee owned policy plugin, it shall complete client 
   146     // In a licensee owned policy plugin, it shall complete client 
   128     // request here with KErrCancel.
   147     // request here with KErrCancel.
       
   148     OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_DOCANCEL_EXIT );
   129     }
   149     }
   130 
   150 
   131 void CReferencePolicyPlugin::RunL()
   151 void CReferencePolicyPlugin::RunL()
   132     {
   152     {
   133     LOG_FUNC
   153     OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_RUNL_ENTRY );
       
   154     
   134     // No more work need to do in current implementation of reference
   155     // No more work need to do in current implementation of reference
   135     // policy plugin. 
   156     // policy plugin. 
   136     // In a licensee owned policy plugin, it shall complete client 
   157     // In a licensee owned policy plugin, it shall complete client 
   137     // request here with a proper error code.
   158     // request here with a proper error code.
       
   159     OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_RUNL_EXIT );
   138     }
   160     }
   139 
   161 
   140 CReferencePolicyPlugin::CReferencePolicyPlugin() :
   162 CReferencePolicyPlugin::CReferencePolicyPlugin() :
   141 CMsmmPolicyPluginBase(),
   163 CMsmmPolicyPluginBase(),
   142 iHistory(KHistoryGranularity)
   164 iHistory(KHistoryGranularity)
   143     {
   165     {
   144     LOG_FUNC
   166     OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_CREFERENCEPOLICYPLUGIN_CONS_ENTRY );
       
   167     
   145     CActiveScheduler::Add(this);
   168     CActiveScheduler::Add(this);
       
   169     OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_CREFERENCEPOLICYPLUGIN_CONS_EXIT );
   146     }
   170     }
   147 
   171 
   148 void CReferencePolicyPlugin::ConstructL()
   172 void CReferencePolicyPlugin::ConstructL()
   149     {
   173     {
   150     LOG_FUNC
   174     OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_CONSTRUCTL_ENTRY );
       
   175     
   151     iRepository = CRepository::NewL(KHostMsRepositoryUid);
   176     iRepository = CRepository::NewL(KHostMsRepositoryUid);
   152     User::LeaveIfError(iFs.Connect());
   177     User::LeaveIfError(iFs.Connect());
   153     iNotificationMan = CMsmmPolicyNotificationManager::NewL();
   178     iNotificationMan = CMsmmPolicyNotificationManager::NewL();
   154     RetrieveHistoryL();
   179     RetrieveHistoryL();
   155     AvailableDriveListL();
   180     AvailableDriveListL();
   158             KOTGCapableSuspendTimeUid, value));
   183             KOTGCapableSuspendTimeUid, value));
   159     iSuspensionPolicy.iOtgSuspendTime = value;
   184     iSuspensionPolicy.iOtgSuspendTime = value;
   160     User::LeaveIfError(iRepository->Get(
   185     User::LeaveIfError(iRepository->Get(
   161             KMediaPollingTimeUid, value));
   186             KMediaPollingTimeUid, value));
   162     iSuspensionPolicy.iStatusPollingInterval = value;
   187     iSuspensionPolicy.iStatusPollingInterval = value;
       
   188     OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_CONSTRUCTL_EXIT );
   163     }
   189     }
   164 
   190 
   165 void CReferencePolicyPlugin::RetrieveDriveLetterL(TText& aDriveName,
   191 void CReferencePolicyPlugin::RetrieveDriveLetterL(TText& aDriveName,
   166         const TPolicyRequestData& aData)
   192         const TPolicyRequestData& aData)
   167     {
   193     {
   168     LOG_FUNC
   194     OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_RETRIEVEDRIVELETTERL_TTEXT_TPOLICYREQUESTDATA_ENTRY );
   169 
   195     
   170     TDriveList availableNames;
   196     TDriveList availableNames;
   171     FilterFsForbiddenDriveListL(availableNames);
   197     FilterFsForbiddenDriveListL(availableNames);
   172 
   198 
   173     if (!availableNames.Length())
   199     if (!availableNames.Length())
   174         {
   200         {
   199             // And it is available now. RefPP allocate it to the 
   225             // And it is available now. RefPP allocate it to the 
   200             // LU currently mounted.
   226             // LU currently mounted.
   201             aDriveName = history.iDriveName;
   227             aDriveName = history.iDriveName;
   202             }
   228             }
   203         }
   229         }
       
   230     OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_RETRIEVEDRIVELETTERL_TTEXT_TPOLICYREQUESTDATA_EXIT );
   204     }
   231     }
   205 
   232 
   206 void CReferencePolicyPlugin::SaveLatestMountInfoL(
   233 void CReferencePolicyPlugin::SaveLatestMountInfoL(
   207         const TPolicyMountRecord& aData)
   234         const TPolicyMountRecord& aData)
   208     {
   235     {
   209     LOG_FUNC
   236   OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_SAVELATESTMOUNTINFOL_TPOLICYMOUNTRECORD_ENTRY );
   210 
   237   
   211     if (iMaxHistoryRecCount == 0) // This policy disable history
   238     if (iMaxHistoryRecCount == 0) // This policy disable history
   212         {
   239         {
       
   240         OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_SAVELATESTMOUNTINFOL_TPOLICYMOUNTRECORD_EXIT );
   213         return;
   241         return;
   214         }
   242         }
   215     
   243     
   216     TPolicyMountRecord* historyRecord = 
   244     TPolicyMountRecord* historyRecord = 
   217             new (ELeave) TPolicyMountRecord(aData);
   245             new (ELeave) TPolicyMountRecord(aData);
   241     for (TInt index = 0; index < iHistory.Count(); index++)
   269     for (TInt index = 0; index < iHistory.Count(); index++)
   242         {
   270         {
   243         TPckg<TPolicyMountRecord> historyPckg(*iHistory[index]);
   271         TPckg<TPolicyMountRecord> historyPckg(*iHistory[index]);
   244         User::LeaveIfError(iRepository->Set(historyRecordUid++, historyPckg));
   272         User::LeaveIfError(iRepository->Set(historyRecordUid++, historyPckg));
   245         }
   273         }
       
   274     OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_SAVELATESTMOUNTINFOL_TPOLICYMOUNTRECORD_EXIT_DUP1 );
   246     }
   275     }
   247 
   276 
   248 void CReferencePolicyPlugin::Complete(TInt aError)
   277 void CReferencePolicyPlugin::Complete(TInt aError)
   249     {
   278     {
   250     LOG_FUNC
   279     OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_COMPLETE_ENTRY );
       
   280     
   251     User::RequestComplete(iClientStatus, aError);
   281     User::RequestComplete(iClientStatus, aError);
       
   282     OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_COMPLETE_EXIT );
   252     }
   283     }
   253 
   284 
   254 void CReferencePolicyPlugin::PrepareAvailableDriveList()
   285 void CReferencePolicyPlugin::PrepareAvailableDriveList()
   255     {
   286     {
   256     LOG_FUNC
   287     OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_PREPAREAVAILABLEDRIVELIST_ENTRY );
       
   288     
   257     iAvailableDrvList.SetLength(KMaxDrives);
   289     iAvailableDrvList.SetLength(KMaxDrives);
   258     iAvailableDrvList.Fill(0, KMaxDrives);
   290     iAvailableDrvList.Fill(0, KMaxDrives);
       
   291     OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_PREPAREAVAILABLEDRIVELIST_EXIT );
   259     }
   292     }
   260 
   293 
   261 void CReferencePolicyPlugin::AvailableDriveListL()
   294 void CReferencePolicyPlugin::AvailableDriveListL()
   262     {
   295     {
   263     LOG_FUNC
   296     OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_AVAILABLEDRIVELISTL_ENTRY );
       
   297     
   264     TBuf8<KPermittedDrvRangeBufLen> permittedRange;
   298     TBuf8<KPermittedDrvRangeBufLen> permittedRange;
   265     TDriveList forbiddenList;
   299     TDriveList forbiddenList;
   266 
   300 
   267     PrepareAvailableDriveList();
   301     PrepareAvailableDriveList();
   268 
   302 
   278                 // Permitted
   312                 // Permitted
   279                 iAvailableDrvList[index - 'A'] = 0x01;
   313                 iAvailableDrvList[index - 'A'] = 0x01;
   280                 }
   314                 }
   281             }
   315             }
   282         }
   316         }
       
   317     OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_AVAILABLEDRIVELISTL_EXIT );
   283     }
   318     }
   284 
   319 
   285 void CReferencePolicyPlugin::FilterFsForbiddenDriveListL(
   320 void CReferencePolicyPlugin::FilterFsForbiddenDriveListL(
   286         TDriveList& aAvailableNames)
   321         TDriveList& aAvailableNames)
   287     {
   322     {
   288     LOG_FUNC
   323     OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_FILTERFSFORBIDDENDRIVELISTL_ENTRY );
       
   324     
   289     TDriveList names;
   325     TDriveList names;
   290     names.SetLength(KMaxDrives);
   326     names.SetLength(KMaxDrives);
   291 
   327 
   292     TDriveList drives;
   328     TDriveList drives;
   293     User::LeaveIfError(iFs.DriveList(drives));
   329     User::LeaveIfError(iFs.DriveList(drives));
   300             names[count++] = index+'A';
   336             names[count++] = index+'A';
   301             }
   337             }
   302         }
   338         }
   303     names.SetLength(count);
   339     names.SetLength(count);
   304     aAvailableNames = names;
   340     aAvailableNames = names;
       
   341     OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_FILTERFSFORBIDDENDRIVELISTL_EXIT );
   305     }
   342     }
   306 
   343 
   307 void CReferencePolicyPlugin::FindFirstNotUsedDriveLetter(
   344 void CReferencePolicyPlugin::FindFirstNotUsedDriveLetter(
   308         const TDriveList& aAvailableNames,
   345         const TDriveList& aAvailableNames,
   309         TText& aDriveName)
   346         TText& aDriveName)
   310     {
   347     {
   311     LOG_FUNC
   348     OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_FINDFIRSTNOTUSEDDRIVELETTER_ENTRY );
       
   349     
   312     TDriveList usedLetter;
   350     TDriveList usedLetter;
   313     TUint index = 0;
   351     TUint index = 0;
   314     for (index = 0; index < iHistory.Count(); index++)
   352     for (index = 0; index < iHistory.Count(); index++)
   315         {
   353         {
   316         const TPolicyMountRecord& record = *iHistory[index];
   354         const TPolicyMountRecord& record = *iHistory[index];
   319     for (index = 0; index < aAvailableNames.Length(); index++)
   357     for (index = 0; index < aAvailableNames.Length(); index++)
   320         {
   358         {
   321         if (usedLetter.Locate(aAvailableNames[index]) == KErrNotFound)
   359         if (usedLetter.Locate(aAvailableNames[index]) == KErrNotFound)
   322             {
   360             {
   323             aDriveName = aAvailableNames[index];
   361             aDriveName = aAvailableNames[index];
       
   362             OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_FINDFIRSTNOTUSEDDRIVELETTER_EXIT );
   324             return; // A unused drive letter found out
   363             return; // A unused drive letter found out
   325             }
   364             }
   326         }
   365         }
       
   366     OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_FINDFIRSTNOTUSEDDRIVELETTER_EXIT_DUP1 );
   327     }
   367     }
   328 
   368 
   329 // Retrieve history from CR
   369 // Retrieve history from CR
   330 void CReferencePolicyPlugin::RetrieveHistoryL()
   370 void CReferencePolicyPlugin::RetrieveHistoryL()
   331     {
   371     {
   332     LOG_FUNC
   372     OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_RETRIEVEHISTORYL_ENTRY );
       
   373     
   333     // Read history record number from CR
   374     // Read history record number from CR
   334     TInt historyCount(0);
   375     TInt historyCount(0);
   335     User::LeaveIfError(
   376     User::LeaveIfError(
   336             iRepository->Get(KMaxHistoryCountUid, iMaxHistoryRecCount));
   377             iRepository->Get(KMaxHistoryCountUid, iMaxHistoryRecCount));
   337     User::LeaveIfError(iRepository->Get(KHistoryCountUid, historyCount));
   378     User::LeaveIfError(iRepository->Get(KHistoryCountUid, historyCount));
   350             CleanupStack::PushL(record);
   391             CleanupStack::PushL(record);
   351             iHistory.AppendL(record);
   392             iHistory.AppendL(record);
   352             CleanupStack::Pop(record);
   393             CleanupStack::Pop(record);
   353             }
   394             }
   354         }
   395         }
       
   396     OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_RETRIEVEHISTORYL_EXIT );
   355     }
   397     }
   356 
   398 
   357 // Remove all buffered history
   399 // Remove all buffered history
   358 void CReferencePolicyPlugin::ClearHistory()
   400 void CReferencePolicyPlugin::ClearHistory()
   359     {
   401     {
   360     LOG_FUNC
   402     OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_CLEARHISTORY_ENTRY );
       
   403     
   361     iHistory.ResetAndDestroy();
   404     iHistory.ResetAndDestroy();
   362     iHistory.Close();
   405     iHistory.Close();
       
   406     OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_CLEARHISTORY_EXIT );
   363     }
   407     }
   364 
   408 
   365 // Search in history for a logic unit	
   409 // Search in history for a logic unit	
   366 TInt CReferencePolicyPlugin::SearchHistoryByLogicUnit(
   410 TInt CReferencePolicyPlugin::SearchHistoryByLogicUnit(
   367         const TPolicyRequestData& aLogicUnit) const
   411         const TPolicyRequestData& aLogicUnit) const
   368     {
   412     {
   369     LOG_FUNC
   413     OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_SEARCHHISTORYBYLOGICUNIT_ENTRY );
       
   414     
   370     TInt ret(KErrNotFound);
   415     TInt ret(KErrNotFound);
   371     TUint count = iHistory.Count();
   416     TUint count = iHistory.Count();
   372     for (TUint index = 0; index < count; index ++)
   417     for (TUint index = 0; index < count; index ++)
   373         {
   418         {
   374         const TPolicyMountRecord& record = *iHistory[index];
   419         const TPolicyMountRecord& record = *iHistory[index];
   381                 (logicalUnit.iInterfaceNumber == aLogicUnit.iInterfaceNumber) &&
   426                 (logicalUnit.iInterfaceNumber == aLogicUnit.iInterfaceNumber) &&
   382                 (logicalUnit.iSerialNumber == aLogicUnit.iSerialNumber) &&
   427                 (logicalUnit.iSerialNumber == aLogicUnit.iSerialNumber) &&
   383                 (logicalUnit.iOtgInformation == aLogicUnit.iOtgInformation))
   428                 (logicalUnit.iOtgInformation == aLogicUnit.iOtgInformation))
   384             {
   429             {
   385             // Matched
   430             // Matched
       
   431             OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_SEARCHHISTORYBYLOGICUNIT_EXIT );
   386             return index;
   432             return index;
   387             }
   433             }
   388         }
   434         }
   389     // Can't find any matched records
   435     // Can't find any matched records
       
   436     OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_SEARCHHISTORYBYLOGICUNIT_EXIT_DUP1 );
   390     return ret;
   437     return ret;
   391     }
   438     }
   392 
   439 
   393 // End of file
   440 // End of file