os/kernelhwsrv/kerneltest/f32test/testfsys/t_tfsys3.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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 // f32test\testfsys\t_tfsys3.cpp
    15 // 
    16 //
    17 
    18 #include "t_tfsys3.h"
    19 
    20 
    21 const TInt KMajorVersionNumber=1;
    22 const TInt KMinorVersionNumber=0;
    23 
    24 CTestFileSystem::CTestFileSystem()
    25 //
    26 // Constructor
    27 //
    28 	{
    29 	__DECLARE_NAME(_S("CTestFileSystem3"));
    30 	}
    31 
    32 CTestFileSystem::~CTestFileSystem()
    33 //
    34 // Destructor
    35 //
    36 	{}
    37 
    38 TInt CTestFileSystem::Install()
    39 //
    40 // Install the file system
    41 //
    42 	{
    43 	iVersion=TVersion(KMajorVersionNumber,KMinorVersionNumber,KF32BuildVersionNumber);
    44 	TPtrC name=_L("Test3");
    45 	return(SetName(&name));
    46 	}
    47 
    48 CMountCB* CTestFileSystem::NewMountL() const
    49 //
    50 // Create a new mount control block
    51 //
    52 	{
    53 	return (new(ELeave) CTestMountCB);
    54 	}
    55 
    56 CFileCB* CTestFileSystem::NewFileL() const
    57 //
    58 // Create a new file
    59 //
    60 	{
    61 	return (new(ELeave) CTestFileCB);
    62 	}
    63 
    64 CDirCB* CTestFileSystem::NewDirL() const
    65 //
    66 // create a new directory lister
    67 //
    68 	{
    69 	return (new(ELeave) CTestDirCB);
    70 	}
    71 
    72 CFormatCB* CTestFileSystem::NewFormatL() const
    73 //
    74 // Create a new media formatter
    75 //
    76 	{
    77 	return (new(ELeave) CTestFormatCB);
    78 	}
    79 
    80 TInt CTestFileSystem::DefaultPath(TDes& aPath) const
    81 //
    82 // Return the intial default path
    83 //
    84 	{
    85 	aPath=_L("C:\\");
    86 	return (KErrNone);
    87 	}
    88 
    89 
    90 /**
    91 Reports whether the specified interface is supported - if it is,
    92 the supplied interface object is modified to it
    93 
    94 @param aInterfaceId     The interface of interest
    95 @param aInterface       The interface object
    96 @return                 KErrNone if the interface is supported, otherwise KErrNotFound 
    97 
    98 @see CFileSystem::GetInterface()
    99 */
   100 TInt CTestFileSystem::GetInterface(TInt aInterfaceId, TAny*& aInterface,TAny* aInput)
   101     {
   102     switch(aInterfaceId)
   103         {
   104         case CFileSystem::EProxyDriveSupport: // The FAT Filesystem supports proxy drives
   105 			return KErrNone;
   106 
   107         default:
   108             return(CFileSystem::GetInterface(aInterfaceId, aInterface, aInput));
   109         }
   110     }
   111 
   112 CFileSystem* CTestFileSystem::NewL()
   113 //
   114 //
   115 //
   116 	{
   117 	CFileSystem* testFSys = new(ELeave) CTestFileSystem;
   118 	return testFSys;
   119 	}
   120 
   121 
   122 CTestMountCB::CTestMountCB(){};
   123 CTestMountCB::~CTestMountCB(){};
   124 CTestDirCB::CTestDirCB(){};
   125 CTestDirCB::~CTestDirCB(){};
   126 CTestFileCB::CTestFileCB(){};
   127 CTestFileCB::~CTestFileCB(){};
   128 CTestFormatCB::CTestFormatCB(){};
   129 CTestFormatCB::~CTestFormatCB(){};
   130 
   131 
   132 extern "C" {
   133 
   134 EXPORT_C CFileSystem* CreateFileSystem()
   135 //
   136 // Create a new file system
   137 //
   138 	{
   139 	return(CTestFileSystem::NewL());
   140 	}
   141 }
   142 
   143 TInt CTestMountCB::ClusterSize() const
   144 	{
   145 	return KTestClusterSize;
   146 	}
   147 
   148 TInt CTestMountCB::SubType(TDes& aName) const
   149 	{
   150 	if(aName.MaxLength() < 12)
   151 		return KErrArgument;
   152 
   153 	aName = _L("Test3SubType");
   154 	return KErrNone;
   155 	}
   156 
   157 TInt CTestMountCB::GetInterface(TInt aInterfaceId, TAny*& aInterface,TAny* aInput)
   158 	{
   159 	switch(aInterfaceId)
   160 		{
   161 		case (CMountCB::EGetFileSystemSubType):
   162 			{
   163 			aInterface = (MFileSystemSubType*) (this);
   164 			return KErrNone;
   165 			}
   166 		case (CMountCB::EGetClusterSize):
   167 			{
   168 			aInterface = (MFileSystemClusterSize*) (this);
   169 			return KErrNone;
   170 			}
   171 		default:
   172 			{
   173 			return(CMountCB::GetInterface(aInterfaceId, aInterface, aInput));
   174 			}
   175 		}
   176 	}