userlibandfileserver/fileserver/sfile/sf_plugin.h
author Mike Kinghan <mikek@symbian.org>
Tue, 16 Nov 2010 14:39:21 +0000
branchGCC_SURGE
changeset 303 9b85206a602c
parent 200 73ea206103e6
child 189 a5496987b1da
child 247 d8d70de2bd36
permissions -rw-r--r--
We need a way to pass flags to rombuilds in Raptor via extension flm interfaces, so that the CPP pass of the rom input files can be informed what toolchain we are building with and conditionally include or exclude files depending on whether the toolchain could build them.

// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of the License "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
// f32\sfile\sf_plugin.h
// 
//

#if !defined(__SF_PLUGIN_H__)

#define __SF_PLUGIN_H__

#include "message.h"
#include <f32fsys.h>
#include <F32plugin.h>

class CFsSyncMessageScheduler;
class CFsInternalRequest;

class TFsPluginThread
	{
public:
	TFsPluginThread();
public:
	TInt iDriveNumber;
	TBool iIsAvailable;
	RMutex iPluginLock;
	CPluginThread* iThread;
	TUint iId;
	};

/**
 * Plugin Manager
 *
 *	- Initialised in main thread
 *
 *	- Contains array of request chains which represent the
 *	  plugins registered for each request type.
 *	
 *	- Plugins register their interest with each request type,
 *	  specifying the associated thread and pre/post processing options.
 */
class FsPluginManager
	{
public:
	static void InitialiseL();

	static TInt MountPlugin(CFsPluginFactory& aPluginFactory, TInt aDrive, TInt aPos);
	static void DismountPlugin(CFsPluginFactory& aPluginFactory, TInt aPos);

	static TInt InstallPluginFactory(CFsPluginFactory* aFactory,RLibrary aLib);
	static CFsPluginFactory* GetPluginFactory(const TDesC& aName);

	static TInt NextPlugin(CFsPlugin*& aPlugin, CFsMessageRequest* aMsgRequest, TBool aLock, TBool aCheckCurrentOperation=ETrue);
	static TInt PrevPlugin(CFsPlugin*& aPlugin, CFsMessageRequest* aMsgRequest, TBool aLock);
	static TInt InsertInPluginStack(CFsPlugin*& aPlugin,TInt aPos);
	static TInt IsInChain(TInt aUPos, TInt aPos,TInt aDrive, CFsPluginFactory* aPluginFactory);
	static CFsPlugin* FindByUniquePosition(TInt aPos);

	static TInt InitPlugin(CFsPlugin& aPlugin, RLibrary aLibrary);
	static void TransferRequests(CPluginThread* aPluginThread);
	static void CancelPlugin(CFsPlugin* aPlugin,CSessionFs* aSession);
	static TInt ChainCount();
	static TInt Plugin(CFsPlugin*& aPlugin, TInt aPos);

	static void LockChain();
	static void UnlockChain();

	static CFsPluginConn* CreatePluginConnL(TInt aUniquePosition, TUint aClientId);
	static CFsPluginConn* GetPluginConnFromHandle(CSessionFs* aSession, TInt aHandle);

	static TBool IsPluginConnThread(TThreadId tid, CFsPlugin* aPlugin);

	static void DispatchSync(CFsRequest* aRequest);
	static void CompleteSessionRequests(CSessionFs* aSession, TInt aValue, CFsInternalRequest* aRequest);

private:
	static TInt UpdateMountedDrive(CFsPlugin* aPlugin, CFsPluginFactory* aFactory,TInt aDrive);
	static void GetNextCancelPluginOpRequest(CPluginThread* aPluginThread, CFsRequest*& aCancelPluginRequest);
private:
	static CFsObjectCon* iPluginFactories;
	static CFsObjectCon* iPluginConns;

	static RPointerArray<CFsPlugin> iPluginChain;
	static RFastLock iChainLock;

	static CFsSyncMessageScheduler* iScheduler;

	friend class RequestAllocator;
	};

#endif // __SF_PLUGIN_H