|
1 // Copyright (c) 1995-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 // f32\sfile\sf_plugin.h |
|
15 // |
|
16 // |
|
17 |
|
18 #if !defined(__SF_PLUGIN_H__) |
|
19 |
|
20 #define __SF_PLUGIN_H__ |
|
21 |
|
22 #include "message.h" |
|
23 #include <f32fsys.h> |
|
24 #include <F32plugin.h> |
|
25 |
|
26 class CFsSyncMessageScheduler; |
|
27 class CFsInternalRequest; |
|
28 |
|
29 class TFsPluginThread |
|
30 { |
|
31 public: |
|
32 TFsPluginThread(); |
|
33 public: |
|
34 TInt iDriveNumber; |
|
35 TBool iIsAvailable; |
|
36 RMutex iPluginLock; |
|
37 CPluginThread* iThread; |
|
38 TUint iId; |
|
39 }; |
|
40 |
|
41 /** |
|
42 * Plugin Manager |
|
43 * |
|
44 * - Initialised in main thread |
|
45 * |
|
46 * - Contains array of request chains which represent the |
|
47 * plugins registered for each request type. |
|
48 * |
|
49 * - Plugins register their interest with each request type, |
|
50 * specifying the associated thread and pre/post processing options. |
|
51 */ |
|
52 class FsPluginManager |
|
53 { |
|
54 public: |
|
55 static void InitialiseL(); |
|
56 |
|
57 static TInt MountPlugin(CFsPluginFactory& aPluginFactory, TInt aDrive, TInt aPos); |
|
58 static void DismountPlugin(CFsPluginFactory& aPluginFactory, TInt aPos); |
|
59 |
|
60 static TInt InstallPluginFactory(CFsPluginFactory* aFactory,RLibrary aLib); |
|
61 static CFsPluginFactory* GetPluginFactory(const TDesC& aName); |
|
62 |
|
63 static TInt NextPlugin(CFsPlugin*& aPlugin, CFsMessageRequest* aMsgRequest, TBool aLock, TBool aCheckCurrentOperation=ETrue); |
|
64 static TInt PrevPlugin(CFsPlugin*& aPlugin, CFsMessageRequest* aMsgRequest, TBool aLock); |
|
65 static TInt InsertInPluginStack(CFsPlugin*& aPlugin,TInt aPos); |
|
66 static TInt IsInChain(TInt aUPos, TInt aPos,TInt aDrive, CFsPluginFactory* aPluginFactory); |
|
67 static CFsPlugin* FindByUniquePosition(TInt aPos); |
|
68 |
|
69 static TInt InitPlugin(CFsPlugin& aPlugin); |
|
70 static void TransferRequests(CPluginThread* aPluginThread); |
|
71 static void CancelPlugin(CFsPlugin* aPlugin,CSessionFs* aSession); |
|
72 static TInt ChainCount(); |
|
73 static TInt Plugin(CFsPlugin*& aPlugin, TInt aPos); |
|
74 |
|
75 static void LockChain(); |
|
76 static void UnlockChain(); |
|
77 |
|
78 static CFsPluginConn* CreatePluginConnL(TInt aUniquePosition, TUint aClientId); |
|
79 static CFsPluginConn* GetPluginConnFromHandle(CSessionFs* aSession, TInt aHandle); |
|
80 |
|
81 static TBool IsPluginConnThread(TThreadId tid, CFsPlugin* aPlugin); |
|
82 |
|
83 static void DispatchSync(CFsRequest* aRequest); |
|
84 static void CompleteSessionRequests(CSessionFs* aSession, TInt aValue, CFsInternalRequest* aRequest); |
|
85 |
|
86 private: |
|
87 static TInt UpdateMountedDrive(CFsPlugin* aPlugin, CFsPluginFactory* aFactory,TInt aDrive); |
|
88 static void GetNextCancelPluginOpRequest(CPluginThread* aPluginThread, CFsRequest*& aCancelPluginRequest); |
|
89 private: |
|
90 static CFsObjectCon* iPluginFactories; |
|
91 static CFsObjectCon* iPluginConns; |
|
92 |
|
93 static RPointerArray<CFsPlugin> iPluginChain; |
|
94 static RFastLock iChainLock; |
|
95 |
|
96 static CFsSyncMessageScheduler* iScheduler; |
|
97 |
|
98 friend class RequestAllocator; |
|
99 }; |
|
100 |
|
101 #endif // __SF_PLUGIN_H |
|
102 |