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