1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/userlibandfileserver/fileserver/automounter/automounter.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,222 @@
1.4 +// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +
1.18 +/*
1.19 + @file
1.20 + @internalTechnology
1.21 +
1.22 + "fs_auto_mounter" filesystem classes definition
1.23 +*/
1.24 +
1.25 +
1.26 +#ifndef AUTOMOUNTER_FILESYSTEM_H
1.27 +#define AUTOMOUNTER_FILESYSTEM_H
1.28 +
1.29 +#include "filesystem_utils.h"
1.30 +#include <f32fsys.h>
1.31 +#include <f32dbg.h>
1.32 +
1.33 +
1.34 +IMPORT_C TUint32 DebugRegister();
1.35 +
1.36 +//-- define this for having logs disregarding DebugRegister() settings
1.37 +//#define FORCE_LOGS
1.38 +
1.39 +
1.40 +#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
1.41 +//----------------- DEBUG mode -----------------
1.42 +
1.43 +#ifndef FORCE_LOGS
1.44 + #define __PRINT(t) {if (DebugRegister()&KFSYS) RDebug::Print(t);}
1.45 + #define __PRINT1(t,a) {if (DebugRegister()&KFSYS) RDebug::Print(t,a);}
1.46 + #define __PRINT2(t,a,b) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b);}
1.47 + #define __PRINT3(t,a,b,c) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b,c);}
1.48 + #define __PRINT4(t,a,b,c,d) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b,c,d);}
1.49 +#else
1.50 + #define __PRINT(t) {RDebug::Print(t);}
1.51 + #define __PRINT1(t,a) {RDebug::Print(t,a);}
1.52 + #define __PRINT2(t,a,b) {RDebug::Print(t,a,b);}
1.53 + #define __PRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);}
1.54 + #define __PRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);}
1.55 +#endif
1.56 +
1.57 +#define DBG_STATEMENT(text) text
1.58 +
1.59 +#else
1.60 +//----------------- RELEASE mode -----------------
1.61 +#define __PRINT(t)
1.62 +#define __PRINT1(t,a)
1.63 +#define __PRINT2(t,a,b)
1.64 +#define __PRINT3(t,a,b,c)
1.65 +#define __PRINT4(t,a,b,c,d)
1.66 +#define __PRINT8BIT1(t,a)
1.67 +#define __PRINT1TEMP(t,a)
1.68 +
1.69 +#define DBG_STATEMENT(text)
1.70 +
1.71 +#endif //#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
1.72 +
1.73 +
1.74 +//#######################################################################################################################################
1.75 +//# constants definitions here
1.76 +//#######################################################################################################################################
1.77 +
1.78 +
1.79 +
1.80 +//-----------------------------------------------------------------------------
1.81 +
1.82 +/**
1.83 +Internal fault codes for Automounter.fsy
1.84 +*/
1.85 +enum TFault
1.86 + {
1.87 + ENotImplemented,
1.88 + EWrongDriveAttributes,
1.89 + EPluginInitialise,
1.90 + EFileSysNotAdded,
1.91 + EWrongConfiguration,
1.92 + EIncompatibleFileSystems,
1.93 +
1.94 + EMustNotBeCalled
1.95 +
1.96 + };
1.97 +
1.98 +//-----------------------------------------------------------------------------
1.99 +
1.100 +void Fault(TFault aFault);
1.101 +
1.102 +
1.103 +//-----------------------------------------------------------------------------
1.104 +/**
1.105 + This class is a container for child file system names that are supported by automounter.
1.106 + Child FS names are stored in Upper Case to enable simple FSName hash calculations.
1.107 + The names must be unique.
1.108 +*/
1.109 +class XStringArray
1.110 + {
1.111 + public:
1.112 + XStringArray();
1.113 + ~XStringArray();
1.114 +
1.115 + void Reset();
1.116 + const TDesC& operator[](TUint aIndex) const;
1.117 + TInt Append(const TDesC& aString);
1.118 + TUint Count() const {return iStrings.Count();}
1.119 + TUint32 GetStringHash(TUint aIndex) const;
1.120 +
1.121 +
1.122 + private:
1.123 + XStringArray(const XStringArray&);
1.124 + XStringArray& operator=(const XStringArray&);
1.125 +
1.126 + /** panic codes */
1.127 + enum TPanicCode
1.128 + {
1.129 + EIndexOutOfRange, ///< index out of range
1.130 + ENotImplemented, ///< functionality isn't implemented
1.131 + };
1.132 +
1.133 + void Panic(TPanicCode aPanicCode) const;
1.134 +
1.135 + private:
1.136 + RPointerArray<HBufC> iStrings;
1.137 +
1.138 + };
1.139 +
1.140 +
1.141 +//-----------------------------------------------------------------------------
1.142 +
1.143 +/**
1.144 + File system class definition
1.145 +*/
1.146 +class CAutoMounterFileSystem : public CFileSystem, CFileSystem::MFileSystemExtInterface
1.147 + {
1.148 +public:
1.149 + static CAutoMounterFileSystem* New();
1.150 + ~CAutoMounterFileSystem();
1.151 +public:
1.152 +
1.153 + //-- pure virtual interface implementation, overrides from CFileSystem
1.154 + TInt Install();
1.155 + CMountCB* NewMountL() const;
1.156 + CFileCB* NewFileL() const;
1.157 + CDirCB* NewDirL() const;
1.158 + CFormatCB* NewFormatL() const;
1.159 +
1.160 + //-- non-pure virtual interface, overrides from CFileSystem
1.161 +#ifdef _DEBUG
1.162 + TInt Remove();
1.163 + TBool QueryVersionSupported(const TVersion& aVer) const;
1.164 +#endif
1.165 +
1.166 + TBool IsExtensionSupported() const;
1.167 + TInt DefaultPath(TDes& aPath) const;
1.168 + TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
1.169 +
1.170 +
1.171 +
1.172 +
1.173 +protected:
1.174 + CAutoMounterFileSystem();
1.175 +
1.176 + TInt TryMountFilesystem(TDrive* apDrive, CMountCB** apMount, CFileSystem** apFS);
1.177 +
1.178 +
1.179 + //-------------------------------
1.180 + virtual CMountCB* NewMountExL(TDrive* apDrive, CFileSystem** apFileSystem, TBool aForceMount, TUint32 aFsNameHash);
1.181 + virtual TInt GetSupportedFileSystemName(TInt aFsNumber, TDes& aFsName) const;
1.182 +
1.183 +
1.184 +private:
1.185 +
1.186 + /** possible states of this object */
1.187 + enum TState
1.188 + {
1.189 + EInvalid = 0, ///< initial, invalid
1.190 + ENotInitialised,
1.191 + EInitialised,
1.192 + };
1.193 +
1.194 + inline TState State() const {return iState;}
1.195 + inline void SetState(TState aState) {iState = aState;}
1.196 +
1.197 +
1.198 + /** "default child" file system name index in the child names container. "default child" is used in some weir cases, when
1.199 + it doesn't matter which particular child FS to use, e.g. getting access to the media driver for media unlocking. */
1.200 + enum {KDefaultFSNo = 0};
1.201 +
1.202 +
1.203 + CFileSystem* GetChildFileSystem(TUint aIndex) const;
1.204 + CFileSystem* GetChildFileSysteByNameHash(TUint32 aFsNameHash) const;
1.205 +
1.206 + void InitialiseFileSystem();
1.207 + TInt DoProcessProxyDriveSupport();
1.208 +
1.209 +private:
1.210 +
1.211 + TState iState; ///< this object current state
1.212 + XStringArray iFSNames; ///< child file system names container.
1.213 +
1.214 + };
1.215 +
1.216 +
1.217 +//-----------------------------------------------------------------------------
1.218 +
1.219 +#endif //AUTOMOUNTER_FILESYSTEM_H
1.220 +
1.221 +
1.222 +
1.223 +
1.224 +
1.225 +