os/kernelhwsrv/kerneltest/f32test/plugins/version_2/src/combinational2_plugin.cpp
Update contrib.
1 // Copyright (c) 2007-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include "Combinational2_plugin.h"
17 #include "plugincommon.h"
18 #include <f32pluginutils.h>
22 Leaving New function for the plugin
25 CCombinational2Plugin* CCombinational2Plugin::NewL()
27 CCombinational2Plugin* self = new(ELeave) CCombinational2Plugin;
28 CleanupStack::PushL(self);
36 Constructor for the plugin
39 CCombinational2Plugin::CCombinational2Plugin() : iInterceptsEnabled(EFalse),
45 void CCombinational2Plugin::ConstructL()
50 The destructor for the plugin
53 CCombinational2Plugin::~CCombinational2Plugin()
58 Initialise the plugin.
61 void CCombinational2Plugin::InitialiseL()
63 _LOG(_L("CCombinational2Plugin InitialiseL"));
68 Enable the plugin's intercepts.
71 void CCombinational2Plugin::EnableInterceptsL()
73 if (iInterceptsEnabled) return;
75 User::LeaveIfError(RegisterIntercept(EFsFileRead, EPrePostIntercept));
76 User::LeaveIfError(RegisterIntercept(EFsFileWrite, EPrePostIntercept));
77 User::LeaveIfError(RegisterIntercept(EFsDirOpen, EPrePostIntercept));
78 User::LeaveIfError(RegisterIntercept(EFsFileLock, EPrePostIntercept));
79 User::LeaveIfError(RegisterIntercept(EFsFileUnLock, EPrePostIntercept));
80 User::LeaveIfError(RegisterIntercept(EFsFileSeek, EPrePostIntercept));
81 User::LeaveIfError(RegisterIntercept(EFsFileSize, EPrePostIntercept));
82 User::LeaveIfError(RegisterIntercept(EFsFileSetSize, EPrePostIntercept));
83 User::LeaveIfError(RegisterIntercept(EFsDirReadOne, EPrePostIntercept));
84 User::LeaveIfError(RegisterIntercept(EFsDirReadPacked, EPrePostIntercept));
85 User::LeaveIfError(RegisterIntercept(EFsFileOpen, EPrePostIntercept));
86 User::LeaveIfError(RegisterIntercept(EFsFileCreate, EPrePostIntercept));
87 User::LeaveIfError(RegisterIntercept(EFsFileReplace, EPrePostIntercept));
88 User::LeaveIfError(RegisterIntercept(EFsFileRename, EPrePostIntercept));
89 User::LeaveIfError(RegisterIntercept(EFsReadFileSection,EPrePostIntercept));
90 User::LeaveIfError(RegisterIntercept(EFsFileSubClose, EPrePostIntercept));
91 User::LeaveIfError(RegisterIntercept(EFsEntry, EPrePostIntercept));
92 User::LeaveIfError(RegisterIntercept(EFsSetEntry, EPrePostIntercept));
94 _LOG(_L("Combinational2 Plugin: Enabled intercepts."));
96 iInterceptsEnabled = ETrue;
100 Disable the plugin's intercepts.
103 void CCombinational2Plugin::DisableInterceptsL()
105 if (!iInterceptsEnabled) return;
107 User::LeaveIfError(UnregisterIntercept(EFsFileRead, EPrePostIntercept));
108 User::LeaveIfError(UnregisterIntercept(EFsFileRename, EPrePostIntercept));
109 User::LeaveIfError(UnregisterIntercept(EFsFileWrite, EPrePostIntercept));
110 User::LeaveIfError(UnregisterIntercept(EFsDirOpen, EPrePostIntercept));
111 User::LeaveIfError(UnregisterIntercept(EFsFileLock, EPrePostIntercept));
112 User::LeaveIfError(UnregisterIntercept(EFsFileUnLock, EPrePostIntercept));
113 User::LeaveIfError(UnregisterIntercept(EFsFileSeek, EPrePostIntercept));
114 User::LeaveIfError(UnregisterIntercept(EFsFileSize, EPrePostIntercept));
115 User::LeaveIfError(UnregisterIntercept(EFsFileSetSize, EPrePostIntercept));
116 User::LeaveIfError(UnregisterIntercept(EFsFileCreate, EPrePostIntercept));
117 User::LeaveIfError(UnregisterIntercept(EFsFileOpen, EPrePostIntercept));
118 User::LeaveIfError(UnregisterIntercept(EFsFileReplace, EPrePostIntercept));
119 User::LeaveIfError(UnregisterIntercept(EFsFileSubClose, EPrePostIntercept));
120 User::LeaveIfError(UnregisterIntercept(EFsReadFileSection, EPrePostIntercept));
121 User::LeaveIfError(UnregisterIntercept(EFsDirReadOne, EPrePostIntercept));
122 User::LeaveIfError(UnregisterIntercept(EFsDirReadPacked, EPrePostIntercept));
123 User::LeaveIfError(UnregisterIntercept(EFsEntry, EPrePostIntercept));
124 User::LeaveIfError(UnregisterIntercept(EFsSetEntry, EPrePostIntercept));
126 _LOG(_L("Combinational2 Plugin: Disabled intercepts."));
128 iInterceptsEnabled = EFalse;
132 Test second stage: - This is part of a test which is opening a different file in CombinationalPlugin1.
133 We need to get the entry here and make sure its for the right file.
135 TInt CCombinational2Plugin::DoEntry(TFsPluginRequest& aRequest)
139 if(aRequest.IsPostOperation()) //post
147 RFsPlugin fs(aRequest);
150 name = aRequest.Src().FullName(); //STF: Is this valid for entry?
154 iLineNumber = __LINE__;
158 err = fs.Entry(name, entry);
160 iLineNumber = __LINE__;
164 TPckgC<TEntry> e(entry);
165 err = aRequest.Write(TFsPluginRequest::EEntry,e);
167 iLineNumber = __LINE__;
173 return KErrCompletion;
182 TInt CCombinational2Plugin::DoRequestL(TFsPluginRequest& aRequest)
186 TInt function = aRequest.Function();
191 err = DoEntry(aRequest);
201 CFsPluginConn* CCombinational2Plugin::NewPluginConnL()
203 return new(ELeave) CCombinational2PluginConn();
207 //Synchronous RPlugin::DoControl
208 TInt CCombinational2Plugin::FsPluginDoControlL(CFsPluginConnRequest& aRequest)
212 TInt function = aRequest.Function();
214 TPckg<TInt> errCodeDes(iLastError);
215 TPckg<TInt> lineNumberDes(iLineNumber);
219 case KPluginGetError:
221 TRAP(err,aRequest.WriteParam1L(errCodeDes));
222 TRAP(err,aRequest.WriteParam2L(lineNumberDes));
233 TInt CCombinational2PluginConn::DoControl(CFsPluginConnRequest& aRequest)
235 return ((CCombinational2Plugin*)Plugin())->FsPluginDoControlL(aRequest);
238 void CCombinational2PluginConn::DoRequest(CFsPluginConnRequest& aRequest)
243 void CCombinational2PluginConn::DoCancel(TInt /*aReqMask*/)
249 class CCombinational2PluginFactory : public CFsPluginFactory
252 CCombinational2PluginFactory();
253 virtual TInt Install();
254 virtual CFsPlugin* NewPluginL();
255 virtual CFsPlugin* NewPluginConnL();
256 virtual TInt UniquePosition();
260 Constructor for the plugin factory
263 CCombinational2PluginFactory::CCombinational2PluginFactory()
268 Install function for the plugin factory
271 TInt CCombinational2PluginFactory::Install()
273 SetSupportedDrives(KPluginSupportAllDrives);
274 return(SetName(&KCombinational2PluginName));
280 TInt CCombinational2PluginFactory::UniquePosition()
282 return(KCombinational2Pos);
286 Plugin factory function
289 CFsPlugin* CCombinational2PluginFactory::NewPluginL()
292 return CCombinational2Plugin::NewL();
296 Plugin factory function
299 CFsPlugin* CCombinational2PluginFactory::NewPluginConnL()
302 return CCombinational2Plugin::NewL();
311 EXPORT_C CFsPluginFactory* CreateFileSystem()
313 return(new CCombinational2PluginFactory());