os/kernelhwsrv/kerneltest/f32test/ext/t_emptyext.cpp
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) 2002-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 // f32test\ext\emptyext.cpp
    15 // extension which simply records/prints out accesses to each function
    16 // 
    17 //
    18 
    19 #include <f32fsys.h>
    20 
    21 
    22 class CEmptyExtProxyDrive : public CBaseExtProxyDrive
    23 	{
    24 public:
    25 	static CEmptyExtProxyDrive* NewL(CProxyDrive* aProxyDrive, CMountCB* aMount);
    26 	~CEmptyExtProxyDrive();
    27 public:
    28 	virtual TInt Initialise();
    29 	virtual TInt Dismounted();
    30 	virtual TInt Enlarge(TInt aLength);
    31 	virtual TInt ReduceSize(TInt aPos, TInt aLength);
    32 	virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset);
    33 	virtual TInt Read(TInt64 aPos,TInt aLength,TDes8& aTrg);
    34 	virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset);
    35 	virtual TInt Write(TInt64 aPos,const TDesC8& aSrc);
    36 	virtual TInt Caps(TDes8& anInfo);
    37 	virtual TInt Format(TFormatInfo& anInfo);
    38 private:
    39 	CEmptyExtProxyDrive(CProxyDrive* aProxyDrive, CMountCB* aMount);
    40 private:
    41 	TInt iInitialise;
    42 	TInt iDismounted;
    43 	TInt iEnlarge;
    44 	TInt iReduceSize;
    45 	TInt iReadThread;
    46 	TInt iRead;
    47 	TInt iWriteThread;
    48 	TInt iWrite;
    49 	TInt iCaps;
    50 	TInt iFormat;
    51 	};
    52 
    53 class CEmptyProxyDriveFactory : public CProxyDriveFactory
    54 	{
    55 public:
    56 	CEmptyProxyDriveFactory();
    57 	virtual TInt Install();			
    58 	virtual CProxyDrive* NewProxyDriveL(CProxyDrive* aProxy,CMountCB* aMount);
    59 	};
    60 
    61 CEmptyExtProxyDrive* CEmptyExtProxyDrive::NewL(CProxyDrive* aProxyDrive, CMountCB* aMount)
    62 //
    63 //
    64 //
    65 	{
    66 	CEmptyExtProxyDrive* temp=new(ELeave) CEmptyExtProxyDrive(aProxyDrive,aMount);
    67 	return(temp);
    68 	}
    69 
    70 
    71 CEmptyExtProxyDrive::CEmptyExtProxyDrive(CProxyDrive* aProxyDrive, CMountCB* aMount):CBaseExtProxyDrive(aProxyDrive,aMount) 
    72 	{
    73 	RDebug::Print(_L("CEmptyExtProxyDrive::CEmptyExtProxyDrive"));
    74 	}
    75 
    76 CEmptyExtProxyDrive::~CEmptyExtProxyDrive()
    77 //
    78 //
    79 //
    80 	{
    81 	// print out the figures obtained
    82 	RDebug::Print(_L("Initialise = %d"),iInitialise);
    83 	RDebug::Print(_L("Dismounted = %d"),iDismounted);
    84 	RDebug::Print(_L("Enlarge = %d"),iEnlarge);
    85 	RDebug::Print(_L("ReduceSize = %d"),iReduceSize);
    86 	RDebug::Print(_L("Read Thread = %d"),iReadThread);
    87 	RDebug::Print(_L("Read = %d"),iRead);
    88 	RDebug::Print(_L("Write Thread = %d"),iWriteThread);
    89 	RDebug::Print(_L("Write = %d"),iWrite);
    90 	RDebug::Print(_L("Format = %d"),iFormat);
    91 	}
    92 
    93 TInt CEmptyExtProxyDrive::Initialise()
    94 //
    95 //
    96 //
    97 	{
    98 	RDebug::Print(_L("CEmptyExtProxyDrive::Initialise()"));
    99 	++iInitialise;
   100 	return(CBaseExtProxyDrive::Initialise());
   101 	}
   102 
   103 TInt CEmptyExtProxyDrive::Dismounted()
   104 //
   105 //
   106 //
   107 	{
   108 	RDebug::Print(_L("CEmptyExtProxyDrive::Dismounted()"));
   109 	++iDismounted;
   110 	return(CBaseExtProxyDrive::Dismounted());
   111 	}
   112 
   113 TInt CEmptyExtProxyDrive::Enlarge(TInt aLength)
   114 //
   115 //
   116 //
   117 	{
   118 	++iEnlarge;
   119 	return(CBaseExtProxyDrive::Enlarge(aLength));
   120 	}
   121 
   122 
   123 TInt CEmptyExtProxyDrive::ReduceSize(TInt aPos, TInt aLength)
   124 //
   125 //
   126 //
   127 	{
   128 	++iReduceSize;
   129 	return(CBaseExtProxyDrive::ReduceSize(aPos,aLength));
   130 	}
   131 
   132 TInt CEmptyExtProxyDrive::Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset)
   133 //
   134 //
   135 //
   136 	{
   137 	++iReadThread;
   138 	return(CBaseExtProxyDrive::Read(aPos,aLength,aTrg,aThreadHandle,anOffset));
   139 	}
   140 
   141 TInt CEmptyExtProxyDrive::Read(TInt64 aPos,TInt aLength,TDes8& aTrg)
   142 //
   143 //
   144 //
   145 	{
   146 	++iRead;
   147 	return(CBaseExtProxyDrive::Read(aPos,aLength,aTrg));
   148 	}
   149 
   150 TInt CEmptyExtProxyDrive::Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset)
   151 //
   152 //
   153 //
   154 	{
   155 	++iWriteThread;
   156 	return(CBaseExtProxyDrive::Write(aPos,aLength,aSrc,aThreadHandle,anOffset));
   157 	}
   158 
   159 TInt CEmptyExtProxyDrive::Write(TInt64 aPos,const TDesC8& aSrc)
   160 //
   161 //
   162 //
   163 	{
   164 	++iWrite;
   165 	return(CBaseExtProxyDrive::Write(aPos,aSrc));
   166 	}
   167 
   168 TInt CEmptyExtProxyDrive::Caps(TDes8& anInfo)
   169 //
   170 //
   171 //
   172 	{
   173 	++iCaps;
   174 	return(CBaseExtProxyDrive::Caps(anInfo));
   175 	}
   176 
   177 TInt CEmptyExtProxyDrive::Format(TFormatInfo& anInfo)
   178 //
   179 //
   180 //
   181 	{
   182 	++iFormat;
   183 	return(CBaseExtProxyDrive::Format(anInfo));
   184 	}
   185 
   186 
   187 CEmptyProxyDriveFactory::CEmptyProxyDriveFactory()
   188 //
   189 //
   190 //
   191 	{
   192 	RDebug::Print(_L("CEmptyProxyDriveFactory::CEmptyProxyDriveFactory"));
   193 	}
   194 
   195 TInt CEmptyProxyDriveFactory::Install()
   196 //
   197 //
   198 //
   199 	{
   200 	_LIT(KEmptyName,"Empty");
   201 	return(SetName(&KEmptyName));
   202 	}
   203 
   204 CProxyDrive* CEmptyProxyDriveFactory::NewProxyDriveL(CProxyDrive* aProxy,CMountCB* aMount)
   205 //
   206 //
   207 //
   208 	{
   209 	return(CEmptyExtProxyDrive::NewL(aProxy,aMount));
   210 	}
   211 
   212 extern "C" {
   213 
   214 EXPORT_C CProxyDriveFactory* CreateFileSystem()
   215 //
   216 // Create a new file system
   217 //
   218 	{
   219 	return(new CEmptyProxyDriveFactory());
   220 	}
   221 }
   222 
   223