os/kernelhwsrv/userlibandfileserver/fileserver/sfile/sf_ldr.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2006-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\sfile\sf_ldr.h
    15 // 
    16 //
    17 
    18 #ifndef __SF_LDR_H__
    19 #define __SF_LDR_H__
    20 
    21 class TLoaderDeletedList
    22 	{
    23 public:
    24 	TLoaderDeletedList* iNext;
    25 	TInt iDriveNumber;
    26 	TInt64 iStartBlock;
    27 	HBufC* iFileName;
    28 	};
    29 
    30 
    31 NONSHARABLE_CLASS(CReaperCleanupTimer): public CTimer
    32 	{
    33 public:
    34 	CReaperCleanupTimer();
    35 	static TInt New();
    36 	static void Complete();
    37 private:
    38 	~CReaperCleanupTimer();
    39 	void RunL();
    40 	void Start();
    41 	static CReaperCleanupTimer* Timer;
    42 	};
    43 
    44 NONSHARABLE_CLASS(CActiveReaper) : public CActive
    45 	{
    46 public:
    47 	static CActiveReaper* New();
    48 	~CActiveReaper();
    49 	void StartReaper();
    50 	
    51 	void AddDeleted(TLoaderDeletedList* aLink);	
    52 	void InitDelDir();
    53 private:
    54 	CActiveReaper();
    55 
    56 	void Construct();
    57 	virtual void RunL();
    58 	virtual void DoCancel();
    59 	
    60 	TLoaderDeletedList* iLoaderDeletedList;
    61 	};
    62 
    63 NONSHARABLE_CLASS(CSlottedChunkAllocator) : public CBase
    64 	{
    65 public:
    66 	TInt Construct();
    67 	TAny* Alloc(TUint aSize);
    68 	void Free(TAny* aPtr);
    69 
    70 private:
    71 	// slot size must be multiple of page size
    72 	enum { KSlots=2, KSlotSize=16777216 };
    73 	TUint iUsed[KSlots];
    74 	RChunk iChunk;
    75 	TUint8* iBase;
    76 	};
    77 
    78 extern CSlottedChunkAllocator gFileDataAllocator;
    79 
    80 
    81 //#define TRACE_CHECK_FAILURES
    82 //#define TRACE_ON
    83 
    84 
    85 #ifdef TRACE_CHECK_FAILURES
    86 static TInt CheckFail(const char* aFile,TUint aLine)
    87 	{
    88 	RDebug::Printf("\nLoader check failure: %s line %d\n",aFile,aLine);
    89 	return 0;
    90 	}
    91 #define CHECK_FAIL CheckFail(__FILE__,__LINE__)
    92 #define CHECK_FAILURE(_r) (void)(_r==0 || CHECK_FAIL)
    93 #else
    94 #define CHECK_FAIL ((void)0)
    95 #define CHECK_FAILURE(_r) ((void)0)
    96 #endif
    97 
    98 #define RETURN_FAILURE(_r) return (CHECK_FAIL,_r)
    99 #define LEAVE_FAILURE(_r) User::Leave((CHECK_FAIL,_r))
   100 
   101 #ifdef TRACE_ON
   102 #define TRACE(_t) RDebug::Printf _t
   103 #else
   104 #define TRACE(_t) ((void)0)
   105 #endif
   106 #define E32IMAGEHEADER_TRACE TRACE
   107 
   108 
   109 
   110 #endif