1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/userlibandfileserver/fileserver/scomp/sc_std.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,193 @@
1.4 +// Copyright (c) 2003-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 +#include "common.h"
1.20 +#include <f32fsys.h>
1.21 +#include <f32ver.h>
1.22 +#include <f32dbg.h>
1.23 +
1.24 +IMPORT_C TUint32 DebugRegister();
1.25 +#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
1.26 +#define __PRINT(t) {if (DebugRegister()&KCOMPFS) RDebug::Print(t);}
1.27 +#define __PRINT1(t,a) {if (DebugRegister()&KCOMPFS) RDebug::Print(t,a);}
1.28 +#define __PRINT2(t,a,b) {if (DebugRegister()&KCOMPFS) RDebug::Print(t,a,b);}
1.29 +#define __PRINT3(t,a,b,c) {if (DebugRegister()&KCOMPFS) RDebug::Print(t,a,b,c);}
1.30 +#define __PRINT4(t,a,b,c,d) {if (DebugRegister()&KCOMPFS) RDebug::Print(t,a,b,c,d);}
1.31 +#else
1.32 +#define __PRINT(t)
1.33 +#define __PRINT1(t,a)
1.34 +#define __PRINT2(t,a,b)
1.35 +#define __PRINT3(t,a,b,c)
1.36 +#define __PRINT4(t,a,b,c,d)
1.37 +#endif
1.38 +
1.39 +
1.40 +enum TCompFault
1.41 + {
1.42 + ECompMountRemount,
1.43 + ECompDirReadPending,
1.44 + ECompFsDefaultPath,
1.45 + ECompDirStoreLongEntryNameL,
1.46 + };
1.47 +
1.48 +class TCompMount
1.49 + {
1.50 +public:
1.51 + inline TCompMount(CFileSystem* aFs, CMountCB* aMount);
1.52 +
1.53 + CFileSystem* iFs;
1.54 + CMountCB* iMount;
1.55 + };
1.56 +
1.57 +
1.58 +// CCompMountCB
1.59 +
1.60 +class CDirCB;
1.61 +class CCompFileSystem;
1.62 +class CCompMountCB : public CMountCB, public CMountCB::MFileAccessor
1.63 + {
1.64 +public:
1.65 + void MountL(TBool aForceMount);
1.66 + TInt ReMount();
1.67 + void Dismounted();
1.68 + void VolumeL(TVolumeInfo& aVolume) const;
1.69 + void SetVolumeL(TDes& aName);
1.70 + void MkDirL(const TDesC& aName);
1.71 + void RmDirL(const TDesC& aName);
1.72 + void DeleteL(const TDesC& aName);
1.73 + void RenameL(const TDesC& anOldName,const TDesC& anNewName);
1.74 + void ReplaceL(const TDesC& anOldName,const TDesC& anNewName);
1.75 + void EntryL(const TDesC& aName,TEntry& anEntry) const;
1.76 + void SetEntryL(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask);
1.77 + void FileOpenL(const TDesC& aName,TUint aMode,TFileOpen anOpen,CFileCB* aFile);
1.78 + void DirOpenL(const TDesC& aName,CDirCB* aDir);
1.79 + void RawReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt anOffset,const RMessagePtr2& aMessage) const;
1.80 + void RawWriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt anOffset,const RMessagePtr2& aMessage);
1.81 + void GetShortNameL(const TDesC& aLongName,TDes& aShortName);
1.82 + void GetLongNameL(const TDesC& aShortName,TDes& aLongName);
1.83 + void IsFileInRom(const TDesC& aFileName,TUint8*& aFileStart);
1.84 + void ReadSectionL(const TDesC& aName,TInt aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage);
1.85 +
1.86 + inline void SetMountNumber(TInt aNum);
1.87 +
1.88 + virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
1.89 + virtual TInt GetFileUniqueId(const TDesC& aName, TInt64& aUniqueId);
1.90 + virtual TInt Spare3(TInt aVal, TAny* aPtr1, TAny* aPtr2);
1.91 + virtual TInt Spare2(TInt aVal, TAny* aPtr1, TAny* aPtr2);
1.92 + virtual TInt Spare1(TInt aVal, TAny* aPtr1, TAny* aPtr2);
1.93 +
1.94 +private:
1.95 + CCompMountCB(CCompFileSystem * aOwner) {iFileSystem=aOwner;}
1.96 + ~CCompMountCB();
1.97 +
1.98 + inline CMountCB* RomMount() const;
1.99 + inline void NullCompFileSystem(void);
1.100 + void NewRomMountL();
1.101 +// TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
1.102 + TInt AddFsToCompositeMount(CFileSystem* aFileSystem);
1.103 +
1.104 + TInt64 iSize;
1.105 + CCompFileSystem * iFileSystem;
1.106 +protected:
1.107 + RArray<TCompMount> iMounts;
1.108 +
1.109 + friend class CCompFileSystem;
1.110 + friend class CCompDirCB;
1.111 + };
1.112 +
1.113 +
1.114 +// CCompDirCB
1.115 +
1.116 +class CCompDirCB : public CDirCB
1.117 + {
1.118 +public:
1.119 + void ReadL(TEntry& anEntry);
1.120 + void StoreLongEntryNameL(const TDesC& aName);
1.121 +
1.122 + TInt InitDir(CDirCB* aTrg, CMountCB* aMount);
1.123 + TInt InitDir(CMountCB* aMount);
1.124 +
1.125 +public:
1.126 + HBufC* iMatch;
1.127 +private:
1.128 + CCompDirCB();
1.129 + ~CCompDirCB();
1.130 +
1.131 + TBool IsDuplicate(TFileName& aFilename);
1.132 +
1.133 + RPointerArray<CDirCB> iDirs;
1.134 + TInt iCurrentDir;
1.135 +
1.136 + friend class CCompFileSystem;
1.137 + friend class CCompMountCB;
1.138 + };
1.139 +
1.140 +
1.141 +// CCompFileCB
1.142 +
1.143 +class CCompFileCB : public CFileCB
1.144 + {
1.145 +public:
1.146 + CCompFileCB();
1.147 + ~CCompFileCB();
1.148 +
1.149 + void RenameL(const TDesC& aNewName);
1.150 + void ReadL(TInt aPos,TInt& aLength,const TAny* aDes);
1.151 + void ReadL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage);
1.152 + void WriteL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage);
1.153 + TInt Address(TInt& aPos) const;
1.154 + void SetSizeL(TInt aSize);
1.155 + void SetEntryL(const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask);
1.156 + void FlushDataL();
1.157 + void FlushAllL();
1.158 +
1.159 + inline void SetTrueFile(CFileCB* aFile);
1.160 + inline CFileCB* TrueFile() const;
1.161 +
1.162 +protected:
1.163 +
1.164 + virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
1.165 +
1.166 +private:
1.167 +
1.168 + CFileCB* iTrueFile;
1.169 + };
1.170 +
1.171 +
1.172 +// CCompFileSystem
1.173 +
1.174 +class CCompFileSystem : public CFileSystem
1.175 + {
1.176 +public:
1.177 + CCompFileSystem();
1.178 + ~CCompFileSystem();
1.179 + static CFileSystem* NewL();
1.180 + TInt Install();
1.181 + CMountCB* NewMountL() const;
1.182 + CFileCB* NewFileL() const;
1.183 + CDirCB* NewDirL() const;
1.184 + CFormatCB* NewFormatL() const;
1.185 + void DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const;
1.186 + TInt DefaultPath(TDes& aPath) const;
1.187 +
1.188 + inline void NullMount(void);
1.189 +private:
1.190 +
1.191 + CCompMountCB* iMount;
1.192 + };
1.193 +
1.194 +
1.195 +#include "sc_std.inl"
1.196 +