fotaapplication/fotaserver/FotaStorage/src/fotaDiskStorage.cpp
branchRCL_3
changeset 25 b183ec05bd8c
parent 24 13d7c31c74e0
child 26 19bba8228ff0
equal deleted inserted replaced
24:13d7c31c74e0 25:b183ec05bd8c
     1 /*
       
     2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   stores update package to filesystem
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <ecom.h>
       
    22 #include <implementationproxy.h>
       
    23 #include <centralrepository.h>
       
    24 #include <sysutil.h> 
       
    25 #include "fotadiskstoragePrivateCRKeys.h"
       
    26 #include "fotaDiskStorage.h"
       
    27 #include "fotadebug.h"
       
    28 
       
    29 // CONSTANTS
       
    30 // System Critical Level (128KB) plus 5KB for fota operations.
       
    31 const TInt KSystemCriticalWorkingspace = 136192;
       
    32 
       
    33 // MACROS
       
    34 #ifdef __EABI__
       
    35 #ifndef IMPLEMENTATION_PROXY_ENTRY
       
    36 typedef TAny*   TProxyNewLPtr;
       
    37 #define IMPLEMENTATION_PROXY_ENTRY(aUid, aFuncPtr) {{aUid},(TProxyNewLPtr)(aFuncPtr)}
       
    38 #endif
       
    39 #endif
       
    40 
       
    41 // ============================ MEMBER FUNCTIONS =============================
       
    42 
       
    43 // ---------------------------------------------------------------------------
       
    44 // CFotaDiskStorage::CFotaDiskStorage()
       
    45 // ---------------------------------------------------------------------------
       
    46 //
       
    47 CFotaDiskStorage::CFotaDiskStorage ()
       
    48     {
       
    49     }
       
    50 
       
    51 // ---------------------------------------------------------------------------
       
    52 // CFotaDiskStorage::NewL()
       
    53 // ---------------------------------------------------------------------------
       
    54 //
       
    55 CFotaDiskStorage* CFotaDiskStorage::NewL()
       
    56     {
       
    57     FLOG(_L("CFotaDiskStorage::NewL()"));
       
    58     CFotaDiskStorage* self = new ( ELeave ) CFotaDiskStorage;
       
    59     FLOG(_L("  CFotaDiskStorage created at %X "), self);
       
    60     CleanupStack::PushL( self );
       
    61     self->ConstructL();
       
    62     CleanupStack::Pop( self );
       
    63     return self;
       
    64     }
       
    65 
       
    66 // ---------------------------------------------------------------------------
       
    67 // CFotaDiskStorage::ConstructL() 
       
    68 // ---------------------------------------------------------------------------
       
    69 //
       
    70 void CFotaDiskStorage::ConstructL() 
       
    71     {
       
    72     FLOG(_L("CFotaDiskStorage::ConstructL() >>"));
       
    73     TInt err;
       
    74     User::LeaveIfError ( iFs.Connect() );
       
    75 
       
    76     // Ensures that fotaserver private dir exists
       
    77     err = iFs.MkDirAll(KDummyFilePath);
       
    78     if ( err!=KErrAlreadyExists && err != KErrNone )
       
    79         {
       
    80         FLOG(_L(" created priv dir err %d"),err);
       
    81         User::Leave ( err ) ;
       
    82         }
       
    83     FLOG(_L("CFotaDiskStorage::ConstructL()  sessionpath to %S")
       
    84                         , &KDummyFilePath,err);
       
    85     User::LeaveIfError ( iFs.SetSessionPath ( KDummyFilePath ) );
       
    86 
       
    87     // newdummy remains should not exist now. safety.
       
    88     err = iFs.Delete ( _L("newdummy") ) ;
       
    89     if ( err!=KErrNone && err!= KErrNotFound ) User::Leave (err);
       
    90 
       
    91     // Get write limit 
       
    92     TInt writelimit( KFileReservationDefaultSize );
       
    93     TInt chunksize ( iChunkSize );
       
    94     CRepository* centrep( NULL);
       
    95     TRAP(err, centrep = CRepository::NewL( KCRUidFotaDiskStorage ) );
       
    96     if ( centrep ) 
       
    97         {
       
    98         err = centrep->Get( KFotaDiskSpaceReservationKey, writelimit );
       
    99         err = centrep->Get( KFotaDiskSpaceReservationChunkKey, chunksize );
       
   100         }
       
   101     iDummySize = writelimit;
       
   102     iChunkSize = chunksize;
       
   103     delete centrep;
       
   104 
       
   105     AdjustDummyStorageL();
       
   106     FLOG(_L("CFotaDiskStorage::ConstructL() <<"));
       
   107     }
       
   108 
       
   109 // ---------------------------------------------------------------------------
       
   110 // CFotaDiskStorage::~CFotaDiskStorage ()
       
   111 // ---------------------------------------------------------------------------
       
   112 //
       
   113 CFotaDiskStorage::~CFotaDiskStorage ()
       
   114     {
       
   115     FLOG(_L("CFotaDiskStorage::~CFotaDiskStorage ()"));
       
   116     iFileWriteStream.Close();
       
   117     iFs.Close();
       
   118     }
       
   119 
       
   120 
       
   121 // ---------------------------------------------------------------------------
       
   122 // CFotaDiskStorage::IsPackageStoreSizeAvailableL
       
   123 // does the pkg fit to reservation or filesystem
       
   124 // ---------------------------------------------------------------------------
       
   125 //
       
   126 CFotaStorage::TFreeSpace CFotaDiskStorage::IsPackageStoreSizeAvailableL(TInt& aSize)
       
   127     {
       
   128     CFotaStorage::TFreeSpace isavailable;
       
   129     TInt            swupdSize(0);
       
   130     TInt            dummySize(0);
       
   131     SpaceAllocatedBySWUPDFilesL( swupdSize, dummySize);
       
   132 
       
   133     if ( aSize <= dummySize ) 
       
   134         {        
       
   135         // fits to reservation
       
   136         isavailable = CFotaStorage::EFitsToReservation;
       
   137         }
       
   138     else
       
   139         {
       
   140         // doesnt fit to reservation, does it fit to filesystem?
       
   141         TInt sizeNeededFromFS = aSize - dummySize ;
       
   142         if ( sizeNeededFromFS < 0 ) sizeNeededFromFS = 0;
       
   143         TBool critical = SysUtil::FFSSpaceBelowCriticalLevelL( &iFs, sizeNeededFromFS );
       
   144         if ( critical )
       
   145         	{
       
   146 					// how much space would be needed
       
   147 					TVolumeInfo vi;
       
   148         	iFs.Volume(vi,EDriveC);
       
   149         	
       
   150 					TInt neededspace = sizeNeededFromFS - vi.iFree + KSystemCriticalWorkingspace;
       
   151 					FLOG(_L("neededspace = %d vi.iFree = %d "), neededspace , vi.iFree);		
       
   152 					FLOG(_L(" neededspace = sizeNeededFromFS - vi.iFree + KSystemCriticalWorkingspace;") );
       
   153         	//= aSize - vi.iFree;
       
   154         	aSize = neededspace;
       
   155         	isavailable = CFotaStorage::EDoesntFitToFileSystem;
       
   156         	}
       
   157         else
       
   158         	{
       
   159 					isavailable = CFotaStorage::EFitsToFileSystem;
       
   160         	}
       
   161         }
       
   162         TInt fitstodummy = isavailable==CFotaStorage::EFitsToReservation?1:0 ;
       
   163         TInt fitstoFS = isavailable==CFotaStorage::EFitsToFileSystem?1:0 ;
       
   164         TInt DoesntFitToFS = 	isavailable==CFotaStorage::EDoesntFitToFileSystem?1:0 ; 
       
   165         	
       
   166     FLOG(_L("CFotaDiskStorage::IsPackageStoreSizeAvailableL %d<%d (sz vs dummy) => fitstodummy:%d fitstoFS:%d DoesntFitToFS:%d")
       
   167         ,aSize,dummySize,fitstodummy,fitstoFS,DoesntFitToFS );
       
   168 
       
   169     return isavailable;
       
   170     }
       
   171 
       
   172 
       
   173 // ---------------------------------------------------------------------------
       
   174 // CFotaDiskStorage::AdjustDummyStorageL()
       
   175 // Ensure that total of iDummySize bytes are reserved by .swupd files and 
       
   176 // dummy file.
       
   177 // ---------------------------------------------------------------------------
       
   178 //
       
   179 TInt CFotaDiskStorage::AdjustDummyStorageL  ( )
       
   180     {
       
   181     FLOG(_L("CFotaDiskStorage::AdjustDummyStorageL >>"));
       
   182     // Count size reserved by .swupd files
       
   183     // CDir*       list;
       
   184     TInt        err;
       
   185     TInt        swupdSize(0);
       
   186     TInt        dummySize(0);
       
   187     RFile       dummy;
       
   188 
       
   189     TRAP(err,SpaceAllocatedBySWUPDFilesL( swupdSize, dummySize));
       
   190 
       
   191     // Calculate space for dummy file
       
   192     TInt targetsize = iDummySize - swupdSize;
       
   193     if ( targetsize<0 ) 
       
   194         {
       
   195         targetsize=0;
       
   196         }
       
   197 
       
   198     // Reduce dummy file size 
       
   199     if ( dummySize != targetsize || dummySize ==0 ) 
       
   200         {
       
   201         FLOG(_L("   dummy new size %d (old %d)"), targetsize,dummySize);
       
   202 
       
   203         err = dummy.Open(iFs, KDummyFileName, EFileWrite|EFileShareExclusive);
       
   204 
       
   205         if (err == KErrNotFound ) 
       
   206             {
       
   207             User::LeaveIfError(dummy.Replace(iFs, KDummyFileName
       
   208                                 , EFileWrite|EFileShareExclusive)); 
       
   209             }
       
   210         else
       
   211             if ( err!=KErrNone) User::LeaveIfError (err);
       
   212 
       
   213         CleanupClosePushL(dummy);
       
   214         TInt err= dummy.SetSize (targetsize);
       
   215         if (err!=KErrNone)
       
   216         	{
       
   217         	FLOG(_L("Error while creating reserved space:  %d "),err );
       
   218         	}
       
   219         CleanupStack::PopAndDestroy(1); // dummy
       
   220         }
       
   221     FLOG(_L("CFotaDiskStorage::AdjustDummyStorageL, reserved file size = %d <<"),targetsize);
       
   222     return 0;
       
   223     }
       
   224 
       
   225 // ---------------------------------------------------------------------------
       
   226 // CFotaDiskStorage::OpenUpdatePackageStore
       
   227 // Open upd pkg store for writing (writes to dummy file).
       
   228 // ---------------------------------------------------------------------------
       
   229 TInt CFotaDiskStorage::OpenUpdatePackageStoreL(const TInt aPkgId,TInt aNewDummySize
       
   230                                                 , RWriteStream*& aPkgStore)
       
   231 	{
       
   232     FLOG(_L("CFotaDiskStorage::OpenUpdatePackageStore"));
       
   233     TInt        err (KErrNone);
       
   234 
       
   235     // Remove reserved memory
       
   236     RFile tmp;
       
   237     err = tmp.Open(iFs, KDummyFileName, EFileWrite|EFileShareExclusive);
       
   238     CleanupClosePushL(tmp);
       
   239     if ( !err )
       
   240     	{
       
   241         FLOG(_L("Removing the reserved memory as download has started"), iDummySize);
       
   242         tmp.SetSize( KErrNone );
       
   243         }
       
   244     CleanupStack::PopAndDestroy( &tmp ); 
       
   245 	// flexible mem handling: increase dummy size to receive over sized package
       
   246     if (iDummySize < aNewDummySize)
       
   247     	iDummySize = aNewDummySize;
       
   248     FLOG(_L("Newer dummy size = %d"),iDummySize);
       
   249 
       
   250     TBuf<KMaxFileName>    swupd;
       
   251 
       
   252     swupd.AppendNum(aPkgId);
       
   253     swupd.Append(_L(".swupd"));
       
   254     err = iFileWriteStream.Open(iFs, swupd, EFileWrite) ;
       
   255     if (err == KErrNotFound ) 
       
   256         {
       
   257         User::LeaveIfError(iFileWriteStream.Replace(iFs, swupd
       
   258                                                             , EFileWrite));
       
   259         }
       
   260     else
       
   261         if ( err!=KErrNone) User::LeaveIfError (err);
       
   262 
       
   263     //Positioning the seek if the file is already present (in case of resume)
       
   264 	TEntry entry;
       
   265 	TInt size (KErrNone);
       
   266 	err = iFs.Entry(swupd,entry);
       
   267 	if (!err)
       
   268 		size = entry.iSize; 
       
   269 	if (size)
       
   270 		{
       
   271 	    MStreamBuf* x = iFileWriteStream.Sink();
       
   272 	    TStreamPos pos(0);
       
   273 	    TRAPD(err2, pos = x->TellL(MStreamBuf::EWrite));
       
   274 	    
       
   275 	    pos+=size;
       
   276 	    TRAP(err2, x->SeekL(MStreamBuf::EWrite,pos ));
       
   277 		}
       
   278     aPkgStore = &iFileWriteStream;
       
   279     return err;
       
   280     }
       
   281 
       
   282 // ---------------------------------------------------------------------------
       
   283 // CFotaDiskStorage::GetDownloadedUpdatePackageSizeL
       
   284 // Gets the downloaded update package size in bytes
       
   285 // ---------------------------------------------------------------------------
       
   286 
       
   287 void CFotaDiskStorage::GetDownloadedUpdatePackageSizeL(const TInt aPkgId, TInt& aSize)
       
   288 	{
       
   289 	FLOG(_L("CFotaDiskStorage::GetDownloadedUpdatePackageSizeL >>"));
       
   290 	aSize = 0;
       
   291 
       
   292     TBuf<KMaxFileName>    swupd;
       
   293 
       
   294     swupd.AppendNum(aPkgId);
       
   295     swupd.Append(_L(".swupd"));
       
   296 
       
   297 	TInt err(KErrNone);
       
   298 	TEntry entry;
       
   299 	err = iFs.Entry(swupd,entry);
       
   300 	if (!err)
       
   301 	aSize = entry.iSize; 
       
   302 	FLOG(_L("CFotaDiskStorage::GetDownloadedUpdatePackageSizeL,err = %d, aSize = %d <<"),err, aSize);
       
   303 	}
       
   304 
       
   305 
       
   306 // ---------------------------------------------------------------------------
       
   307 // CFotaDiskStorage::UpdatePackageDownloadComplete
       
   308 // closes the stream and frees resources
       
   309 // ---------------------------------------------------------------------------
       
   310 void CFotaDiskStorage::UpdatePackageDownloadCompleteL(const TInt aPkgId)
       
   311     {
       
   312     FLOG(_L("CFotaDiskStorage::UpdatePackageDownloadComplete(const TInt aPkgId)"));
       
   313     RFile       fswupd;
       
   314     TBuf<KMaxFileName>    fn;
       
   315     TInt        err;
       
   316     iFileWriteStream.Close();
       
   317     if(iBytesWritten<1) 
       
   318         {
       
   319         FLOG(_L("  no bytes received!"));
       
   320 //        User::Leave(KErrNotFound);
       
   321         return;
       
   322         }
       
   323     TBuf<KMaxFileName>    swupd;
       
   324 
       
   325     swupd.AppendNum(aPkgId);
       
   326     swupd.Append(_L(".swupd"));
       
   327 
       
   328     // open swupd file for reading
       
   329     err = fswupd.Open(iFs, swupd, EFileWrite|EFileShareExclusive);
       
   330     FLOG(_L("  open err %d"),err);
       
   331     if (err == KErrNotFound ) 
       
   332         {
       
   333         FLOG(_L("swupd not found, creaeting"));
       
   334         User::LeaveIfError(fswupd.Replace(iFs, swupd
       
   335                                         ,EFileWrite|EFileShareExclusive)); 
       
   336         }
       
   337     else
       
   338         if ( err!=KErrNone) User::LeaveIfError (err);
       
   339     CleanupClosePushL(fswupd);
       
   340 
       
   341     RFile       ND;
       
   342     User::LeaveIfError ( ND.Replace ( iFs, KDummyFileName, EFileWrite ) );
       
   343     CleanupClosePushL  ( ND);
       
   344     CleanupStack::PopAndDestroy(2); // dummies
       
   345     AdjustDummyStorageL();
       
   346     }
       
   347 
       
   348 // ---------------------------------------------------------------------------
       
   349 // CFotaDiskStorage::GetUpdatePackageLocation
       
   350 // Gets update package location, that is , path.
       
   351 // ---------------------------------------------------------------------------
       
   352 void CFotaDiskStorage::GetUpdatePackageLocationL(const TInt aPkgId
       
   353                                                         , TDes8& aPath )
       
   354 {
       
   355     TBuf8<20> fn;
       
   356     fn.AppendNum(aPkgId);
       
   357     fn.Append(_L8(".swupd"));
       
   358     TInt pathlength = ((TDesC16)KDummyFilePath).Length();
       
   359     HBufC8* path = HBufC8::NewLC( pathlength );
       
   360     path->Des().Copy( KDummyFilePath );
       
   361 
       
   362     aPath.Append( path->Des() );
       
   363     aPath.Append(fn);
       
   364     CleanupStack::PopAndDestroy( path );
       
   365 }
       
   366 
       
   367 // ---------------------------------------------------------------------------
       
   368 // CFotaDiskStorage::GetUpdatePackageIds
       
   369 // getupdate package ids
       
   370 // ---------------------------------------------------------------------------
       
   371 void CFotaDiskStorage::GetUpdatePackageIdsL(TDes16& aPackageIdList)
       
   372     {
       
   373     FLOG(_L("CFotaDiskStorage::GetUpdatePackageIds"));
       
   374     // Read all .swupd files and parse pkg ids from filenames
       
   375     TInt err;
       
   376     CDir*   list;
       
   377     err=iFs.GetDir (_L("*.swupd"), KEntryAttNormal ,ESortByName, list  );
       
   378     for(int i=0; i<list->Count() ;++i )
       
   379         {
       
   380         TEntry t = (*list)[i];
       
   381         TParse  p;
       
   382         TInt16  pkgid;
       
   383         p.Set(t.iName,NULL,NULL);
       
   384         TLex    lex(p.Name());
       
   385         err = lex.Val(pkgid);
       
   386         FLOG(_L("   %S"),&t.iName);
       
   387         if(err==KErrNone)
       
   388             {
       
   389             TPtrC  filename(p.Name());
       
   390             FLOG(_L("  pkig found: %d"), pkgid);
       
   391             TDateTime d = t.iModified.DateTime();
       
   392             aPackageIdList.Append (pkgid);   
       
   393             }
       
   394         }
       
   395     delete list;
       
   396     }
       
   397 
       
   398 // ---------------------------------------------------------------------------
       
   399 // CFotaDiskStorage::DeleteUpdatePackageL 
       
   400 // ---------------------------------------------------------------------------
       
   401 void  CFotaDiskStorage::DeleteUpdatePackageL (const TInt aPkgId)
       
   402     {
       
   403     FLOG(_L("CFotaDiskStorage::DeleteUpdatePackageL %d >>"),aPkgId);
       
   404     RFile       dummy;
       
   405     TInt err=    dummy.Open(iFs, KDummyFileName , EFileWrite|EFileShareExclusive);
       
   406     FLOG(_L("Error opening the reserved file...%d"),err);
       
   407     CleanupClosePushL ( dummy );
       
   408     TRAP(err, DoDeleteUpdatePackageL ( dummy, aPkgId, 0 ));
       
   409     CleanupStack::PopAndDestroy(1);
       
   410     AdjustDummyStorageL();
       
   411 
       
   412     FLOG(_L("CFotaDiskStorage::DeleteUpdatePackageL %d, err = %d <<"),aPkgId, err);
       
   413     }
       
   414 
       
   415 // ---------------------------------------------------------------------------
       
   416 // CFotaDiskStorage::DoDeleteUpdatePackageL 
       
   417 // Delete swupd by chunking data to dummy (param) file. Will grow dummy 
       
   418 // independently, but takes already allocated bytes into account.
       
   419 // ---------------------------------------------------------------------------
       
   420 void  CFotaDiskStorage::DoDeleteUpdatePackageL ( RFile& dummy, TInt aPkgId
       
   421                                                     , TInt aAlreadyAllocated)
       
   422     {
       
   423     // Open swupd file 
       
   424     TInt      err;
       
   425     TBuf8<KMaxFileName> swupdpath;
       
   426     TBuf<KMaxFileName>  swupdpath16;
       
   427     GetUpdatePackageLocationL ( aPkgId, swupdpath) ;
       
   428     swupdpath16.Copy ( swupdpath );
       
   429     RFile       swupd;
       
   430     err = swupd.Open( iFs, swupdpath16, EFileWrite );
       
   431     if ( err == KErrNotFound )      return; // no need to delete
       
   432     if ( err != KErrNone )          User::Leave ( err );
       
   433     CleanupClosePushL ( swupd );
       
   434 
       
   435     // Reduce dummy size
       
   436     TInt dummytargetsize = iDummySize - aAlreadyAllocated;
       
   437     for ( TInt p=0; p<10000 ; ++p )
       
   438         {
       
   439         TInt        dsize;
       
   440         TInt        swupdsize(0);
       
   441         User::LeaveIfError( dummy.Size( dsize ) );
       
   442         User::LeaveIfError( swupd.Size( swupdsize) );
       
   443         TInt        chunk =  swupdsize > iChunkSize ? iChunkSize : swupdsize;
       
   444 
       
   445         // Ensure that dummy dosnt get oversized
       
   446         if ( dsize <= dummytargetsize  && dsize + chunk >= dummytargetsize ) 
       
   447                     chunk = dummytargetsize - dsize;
       
   448 
       
   449         // Safety
       
   450         if ( dsize >= dummytargetsize ) break;
       
   451 
       
   452         FLOG(_L("  deleting swupd:  dummy %d\t  swupd %d\t chunk%d"),dsize
       
   453                                                 ,swupdsize,chunk);
       
   454         if (chunk>0)
       
   455             {
       
   456             User::LeaveIfError( dummy.SetSize( dsize + chunk ) );
       
   457             User::LeaveIfError( swupd.SetSize( swupdsize - chunk ) );
       
   458             }
       
   459         else 
       
   460             break;
       
   461         }
       
   462     CleanupStack::PopAndDestroy(1); // swupd 
       
   463 
       
   464     // Delete swupd  (dummy file is big enough now)
       
   465     err = iFs.Delete ( swupdpath16 ) ;
       
   466     FLOG(_L("CFotaDiskStorage::DoDeleteUpdatePackageL deleted ,err %d"),err);
       
   467     if ( err != KErrNone && err != KErrNotFound ) 
       
   468         {
       
   469         User::Leave ( err );
       
   470         }
       
   471     }
       
   472 
       
   473 // ---------------------------------------------------------------------------
       
   474 // CFotaDiskStorage::SpaceAllocatedBySWUPDFilesL
       
   475 // Counts space allocated by swupd files
       
   476 // ---------------------------------------------------------------------------
       
   477 void CFotaDiskStorage::SpaceAllocatedBySWUPDFilesL( TInt& aSwupdSize, TInt& aDummySize )
       
   478     {
       
   479     CDir*       list;
       
   480     TInt        err;
       
   481     // TInt        (0);
       
   482     aSwupdSize = 0;
       
   483     aDummySize = 0;
       
   484     err = iFs.GetDir (_L("*.swupd"), KEntryAttNormal ,ESortByName, list );
       
   485     User::LeaveIfError(err);
       
   486     CleanupStack::PushL ( list );
       
   487     
       
   488     // get sizes of swupd files
       
   489     for(int i=0; i<list->Count() ;++i )
       
   490         {
       
   491         TEntry t = (*list)[i];
       
   492         TParse  p;
       
   493         TInt16  pkgid;
       
   494         
       
   495         p.Set(t.iName,NULL,NULL);
       
   496         TLex    lex(p.Name());
       
   497         err = lex.Val(pkgid);
       
   498         if(err==KErrNone)
       
   499             {
       
   500             TPtrC  filename(p.Name());
       
   501             aSwupdSize += t.iSize;
       
   502             }
       
   503         }
       
   504     CleanupStack::PopAndDestroy( list );
       
   505 
       
   506     // get size of dummyfile
       
   507     err = iFs.GetDir (KDummyFileName, KEntryAttNormal ,ESortByName, list );
       
   508     User::LeaveIfError(err);
       
   509     CleanupStack::PushL ( list );
       
   510     if ( list->Count() >0 )
       
   511         {
       
   512         TEntry t = (*list)[0];
       
   513         aDummySize = t.iSize;
       
   514         }
       
   515     CleanupStack::PopAndDestroy( list );
       
   516     FLOG(_L("CFotaDiskStorage::SpaceAllocatedBySWUPDFilesL dummy:%d swupd:%d")
       
   517                         ,aDummySize,aSwupdSize);
       
   518     }        
       
   519 
       
   520 // ---------------------------------------------------------------------------
       
   521 // Global implementation uid array
       
   522 // Define the Implementation UIDs for JP2K decoder.
       
   523 // (other items were commented in a header).
       
   524 // ---------------------------------------------------------------------------
       
   525 //
       
   526 const TImplementationProxy ImplementationTable[] =
       
   527 {
       
   528     // implementation_uid
       
   529     IMPLEMENTATION_PROXY_ENTRY( 0x10207385 , CFotaDiskStorage::NewL )
       
   530 };
       
   531 
       
   532 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   533 
       
   534 // ---------------------------------------------------------------------------
       
   535 // ImplementationGroupProxy Implements proxy interface for ECom
       
   536 // Exported proxy for instantiation method resolution.
       
   537 // ---------------------------------------------------------------------------
       
   538 //
       
   539 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(  //lint !e714 Used by ECom
       
   540     TInt& aTableCount ) // Number of tables 
       
   541     {
       
   542     aTableCount = sizeof( ImplementationTable ) / sizeof( 
       
   543                                                         TImplementationProxy );
       
   544     return ImplementationTable;
       
   545     }