|
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\srom\sr_std.h |
|
15 // |
|
16 // |
|
17 |
|
18 #if defined(_UNICODE) |
|
19 #if !defined(UNICODE) |
|
20 #define UNICODE |
|
21 #endif |
|
22 #endif |
|
23 |
|
24 #include "common.h" |
|
25 #include <f32fsys.h> |
|
26 #include <f32ver.h> |
|
27 #include <e32rom.h> |
|
28 |
|
29 #if defined(__EPOC32__) |
|
30 // #define __PRINT_DEBUG_INFO_SR_STD__ 1 |
|
31 #endif |
|
32 |
|
33 #if defined(__PRINT_DEBUG_INFO_SR_STD__) && !defined(__LOCK_SR_STD__) |
|
34 #define __LOCK_SR_STD__ |
|
35 #define __PRINT(t) RDebug::t; |
|
36 #else |
|
37 #define __PRINT(t) |
|
38 #endif |
|
39 |
|
40 // |
|
41 enum TFault |
|
42 { |
|
43 ERomReMountNotSupported, |
|
44 ERomGetFileInfo, |
|
45 ERomFileTooBig, |
|
46 ERomCreateFileMapping, |
|
47 ERomCreateMappedView, |
|
48 ERomInvalidArgument, |
|
49 ERomFsCorrupt |
|
50 }; |
|
51 // |
|
52 NONSHARABLE_CLASS(CRom) : public CFileSystem |
|
53 { |
|
54 public: |
|
55 CRom(); |
|
56 ~CRom(); |
|
57 TInt Install(); |
|
58 CMountCB* NewMountL() const; |
|
59 CFileCB* NewFileL() const; |
|
60 CDirCB* NewDirL() const; |
|
61 CFormatCB* NewFormatL() const; |
|
62 void DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const; |
|
63 const TRomHeader& RomHeader() const {return(*iRomHeaderAddress);} |
|
64 TLinAddr RootDirectory() const {return UserSvr::RomRootDirectoryAddress();} |
|
65 private: |
|
66 static const TRomHeader* iRomHeaderAddress; |
|
67 }; |
|
68 // |
|
69 NONSHARABLE_CLASS(CRomMountCB) : public CMountCB, public CMountCB::MFileAccessor |
|
70 { |
|
71 public: |
|
72 CRomMountCB(const CRom* aRom); |
|
73 void MountL(TBool aForceMount); |
|
74 TInt ReMount(); |
|
75 void Dismounted(); |
|
76 static TInt Compare(const TDesC& aLeft, const TDesC& aRight); |
|
77 void VolumeL(TVolumeInfo& aVolume) const; |
|
78 void SetVolumeL(TDes& aName); |
|
79 void MkDirL(const TDesC& aName); |
|
80 void RmDirL(const TDesC& aName); |
|
81 void DeleteL(const TDesC& aName); |
|
82 void RenameL(const TDesC& anOldName,const TDesC& anNewName); |
|
83 void ReplaceL(const TDesC& anOldName,const TDesC& anNewName); |
|
84 void EntryL(const TDesC& aName,TEntry& anEntry) const; |
|
85 void SetEntryL(const TDesC& aName,const TTime& aTime,TUint aMask,TUint aVal); |
|
86 void FileOpenL(const TDesC& aName,TUint aMode,TFileOpen anOpen,CFileCB* aFile); |
|
87 void DirOpenL(const TDesC& aName,CDirCB* aDir); |
|
88 void FindLeafDirL(const TDesC& aName,TLinAddr& aDir) const; |
|
89 void FindL(const TDesC& aName,TUint anAtt,TLinAddr aDir,TLinAddr& anEntry,TInt anError) const; |
|
90 void FindBinaryL(const TDesC& aName,TUint aAtt,TBool aAttKnown,TLinAddr aDir,TLinAddr& aEntry,TInt aError) const; |
|
91 void FindEntryL(const TDesC& aName,TUint anAtt,TBool aAttKnown,TLinAddr& aDir,TLinAddr& anEntry) const; |
|
92 const TRomHeader& RomHeader() const {return (iRom->RomHeader());} |
|
93 TLinAddr RomRootDirectory() const {return iRom->RootDirectory(); } |
|
94 void RawReadL(TInt64 aPos,TInt aLength,const TAny* aDes,TInt anOffset,const RMessagePtr2& aMessage) const; |
|
95 void RawWriteL(TInt64 aPos,TInt aLength,const TAny* aDes,TInt anOffset,const RMessagePtr2& aMessage); |
|
96 void ReadUidL(TLinAddr anAddr,TEntry& anEntry) const; |
|
97 void GetShortNameL(const TDesC& aLongName,TDes& aShortName); |
|
98 void GetLongNameL(const TDesC& aShortName,TDes& aLongName); |
|
99 void IsFileInRom(const TDesC& aFileName,TUint8*& aFileStart); |
|
100 void ReadSectionL(const TDesC& aName,TInt aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage); |
|
101 virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); |
|
102 virtual TInt GetFileUniqueId(const TDesC& aName, TInt64& aUniqueId); |
|
103 virtual TInt Spare3(TInt aVal, TAny* aPtr1, TAny* aPtr2); |
|
104 virtual TInt Spare2(TInt aVal, TAny* aPtr1, TAny* aPtr2); |
|
105 virtual TInt Spare1(TInt aVal, TAny* aPtr1, TAny* aPtr2); |
|
106 |
|
107 private: |
|
108 const CRom* iRom; |
|
109 }; |
|
110 // |
|
111 NONSHARABLE_CLASS(CRomFileCB) : public CFileCB |
|
112 { |
|
113 public: |
|
114 CRomFileCB(const CRom* aRom); |
|
115 void RenameL(const TDesC& aNewName); |
|
116 void ReadL(TInt aPos,TInt& aLength,const TAny* aTrg,const RMessagePtr2& aMessage); |
|
117 void WriteL(TInt aPos,TInt& aLength,const TAny* aSrc,const RMessagePtr2& aMessage); |
|
118 void SetSizeL(TInt aSize); |
|
119 void SetEntryL(const TTime& aTime,TUint aMask,TUint aVal); |
|
120 void FlushDataL(); |
|
121 void FlushAllL(); |
|
122 TInt Address(TInt& aPos) const; |
|
123 const TRomHeader& RomHeader() const {return(iRom->RomHeader());} |
|
124 TLinAddr RomRootDirectory() const {return iRom->RootDirectory(); } |
|
125 void SetBase(const TUint8* aBase) {iBase=aBase;} |
|
126 private: |
|
127 const CRom* iRom; |
|
128 const TUint8* iBase; |
|
129 }; |
|
130 // |
|
131 NONSHARABLE_CLASS(CRomDirCB) : public CDirCB |
|
132 { |
|
133 public: |
|
134 CRomDirCB(const CRom* aRom); |
|
135 ~CRomDirCB(); |
|
136 void ReadL(TEntry& anEntry); |
|
137 const TRomHeader& RomHeader() const {return(iRom->RomHeader());} |
|
138 TLinAddr RomRootDirectory() const {return iRom->RootDirectory(); } |
|
139 void SetDir(TLinAddr aDir,TLinAddr anEntry,const TDesC& aMatch); |
|
140 private: |
|
141 TBool MatchUid(); |
|
142 private: |
|
143 const CRom* iRom; |
|
144 TEntry iEntry; |
|
145 TLinAddr iDir; |
|
146 TLinAddr iNext; |
|
147 HBufC* iMatch; |
|
148 }; |
|
149 // |
|
150 GLREF_C TInt InstallFileSystem(CFileSystem* aSys,RLibrary aLib); |
|
151 |