os/kernelhwsrv/userlibandfileserver/fileserver/smassstorage/inc/cmassstoragemountcb.h
Update contrib.
1 // Copyright (c) 2004-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Class declaration for CMassStorageMountCB.
23 #ifndef __CMASSSTORAGEMOUNTCB_H__
24 #define __CMASSSTORAGEMOUNTCB_H__
30 Only the MountL, Dismounted and Unlock methods are supported. All other methods
31 leave with KErrNotReady.
32 ControlIO is also supported for debug builds and returns KErrNotSupported for Release builds.
36 class CMassStorageMountCB : public CLocDrvMountCB
39 static CMassStorageMountCB* NewL(const RArray<TInt>& aDriveMapping);
40 void MountL(TBool aForceMount);
43 void VolumeL(TVolumeInfo& aVolume) const;
44 void SetVolumeL(TDes& aName);
45 void MkDirL(const TDesC& aName);
46 void RmDirL(const TDesC& aName);
47 void DeleteL(const TDesC& aName);
48 void RenameL(const TDesC& anOldName,const TDesC& anNewName);
49 void ReplaceL(const TDesC& anOldName,const TDesC& anNewName);
50 void EntryL(const TDesC& aName,TEntry& anEntry) const;
51 void SetEntryL(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask);
52 void FileOpenL(const TDesC& aName,TUint aMode,TFileOpen anOpen,CFileCB* aFile);
53 void DirOpenL(const TDesC& aName,CDirCB* aDir);
54 void RawReadL(TInt64 aPos, TInt aLength, const TAny* aTrg, TInt anOffset, const RMessagePtr2& aMessage) const;
55 void RawWriteL(TInt64 aPos, TInt aLength, const TAny* aTrg, TInt anOffset, const RMessagePtr2& aMessage);
56 void ReadSectionL(const TDesC& aName, TInt aPos, TAny* aTrg, TInt aLength, const RMessagePtr2& aMessage);
57 void GetShortNameL(const TDesC& aLongName,TDes& aShortName);
58 void GetLongNameL(const TDesC& aShorName,TDes& aLongName);
59 TInt ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2);
60 TInt Unlock(TMediaPassword& aPassword, TBool aStore);
63 CMassStorageMountCB(const RArray<TInt>& aDriveMapping);
64 void WritePasswordData();
65 TInt DriveNumberToLun(TInt aDriveNumber);
66 TBool ValidateBootSector();
67 TInt ReadBootSector(TFatBootSector& aBootSector);
68 TInt DetermineFatType(TFatBootSector& aBootSector);
69 TInt CheckDriveNumberL();
74 const RArray<TInt>& iDriveMapping;
77 const TInt KSizeOfFatBootSector = 90;
78 const TInt KVendorIdSize = 8;
79 const TInt KVolumeLabelSize = 11;
80 const TInt KFileSysTypeSize = 8;
81 const TInt KBootSectorSignature = 0xAA55;
82 const TInt KSizeOfFatDirEntry = 32;
85 Boot sector parameter block, enables access to all file system parameters.
86 Data is populated at mount time from the BPB sector
92 inline const TPtrC8 VendorId() const;
93 inline TUint16 BytesPerSector() const;
94 inline TInt SectorsPerCluster() const;
95 inline TInt ReservedSectors() const;
96 inline TInt NumberOfFats() const;
97 inline TInt RootDirEntries() const;
98 inline TInt TotalSectors() const;
99 inline TUint8 MediaDescriptor() const;
100 inline TInt FatSectors() const;
101 inline TInt SectorsPerTrack() const;
102 inline TInt NumberOfHeads() const;
103 inline TInt HiddenSectors() const;
104 inline TInt HugeSectors() const;
105 inline TInt PhysicalDriveNumber() const;
106 inline TInt ExtendedBootSignature() const;
107 inline TUint32 UniqueID() const;
108 inline const TPtrC8 VolumeLabel() const;
109 inline const TPtrC8 FileSysType() const;
110 inline TInt BootSectorSignature() const;
111 inline void SetJumpInstruction();
112 inline void SetVendorID(const TDesC8& aDes);
113 inline void SetBytesPerSector(TInt aBytesPerSector);
114 inline void SetSectorsPerCluster(TInt aSectorsPerCluster);
115 inline void SetReservedSectors(TInt aReservedSectors);
116 inline void SetNumberOfFats(TInt aNumberOfFats);
117 inline void SetRootDirEntries(TInt aRootDirEntries);
118 inline void SetTotalSectors(TInt aTotalSectors);
119 inline void SetMediaDescriptor(TUint8 aMediaDescriptor);
120 inline void SetFatSectors(TInt aFatSectors);
121 inline void SetSectorsPerTrack(TInt aSectorsPerTrack);
122 inline void SetNumberOfHeads(TInt aNumberOfHeads);
123 inline void SetHiddenSectors(TUint32 aHiddenSectors);
124 inline void SetHugeSectors(TUint32 aTotalSectors);
125 inline void SetPhysicalDriveNumber(TInt aPhysicalDriveNumber);
126 inline void SetReservedByte(TUint8 aReservedByte);
127 inline void SetExtendedBootSignature(TInt anExtendedBootSignature);
128 inline void SetUniqueID(TUint32 anUniqueID);
129 inline void SetVolumeLabel(const TDesC8& aDes);
130 inline void SetFileSysType(const TDesC8& aDes);
132 inline void SetFatSectors32(TUint32 aFatSectors32);
133 inline void SetFATFlags(TUint16 aFATFlags);
134 inline void SetVersionNumber(TUint16 aVersionNumber);
135 inline void SetRootClusterNum(TUint32 aRootCusterNum);
136 inline void SetFSInfoSectorNum(TUint16 aFSInfoSectorNum);
137 inline void SetBkBootRecSector(TUint16 aBkBootRecSector);
138 inline TUint32 FatSectors32() const;
139 inline TUint16 FATFlags() const;
140 inline TUint16 VersionNumber() const;
141 inline TUint32 RootClusterNum() const;
142 inline TUint16 FSInfoSectorNum() const;
143 inline TUint16 BkBootRecSector() const;
145 inline TBool Is16BitFat();
146 inline TBool Is32BitFat();
147 inline TInt FirstFatSectorPos();
148 inline TInt RootDirStartSector();
149 inline TInt FirstFreeSector();
152 Jump instruction used for bootable volumes
154 TUint8 iJumpInstruction[3];
156 Vendor ID of the file system that formatted the volume
158 TUint8 iVendorId[KVendorIdSize];
162 TUint16 iBytesPerSector;
164 Sectors per cluster ratio
166 TUint8 iSectorsPerCluster;
168 Number of reserved sectors on the volume
170 TUint16 iReservedSectors;
172 Number of Fats on the volume
174 TUint8 iNumberOfFats;
176 Number of entries allowed in the root directory, specific to Fat12/16, zero for FAT32
178 TUint16 iRootDirEntries;
180 Total sectors on the volume, zero for FAT32
182 TUint16 iTotalSectors;
186 TUint8 iMediaDescriptor;
188 Sectors used for the Fat table, zero for FAT32
194 TUint16 iSectorsPerTrack;
198 TUint16 iNumberOfHeads;
200 Number of hidden sectors in the volume
202 TUint32 iHiddenSectors;
204 Total sectors in the volume, Used if totalSectors > 65535
206 TUint32 iHugeSectors;
209 Start of additional elements @ offset 36 for FAT32
210 Sectors in Fat table for 32 bit volume
212 TUint32 iFatSectors32;
218 Version number of the file system
220 TUint16 iVersionNumber;
222 Cluster number of the root directory
224 TUint32 iRootClusterNum;
226 Sector number containing the FSIInfo structure
228 TUint16 iFSInfoSectorNum;
232 TUint16 iBkBootRecSector;
235 End of Fat32 Only parameters section
237 TUint8 iReserved2[12];
240 Physical drive number, not used in Symbian OS
242 TUint8 iPhysicalDriveNumber;
248 Extended boot signiture
250 TUint8 iExtendedBootSignature;
258 TUint8 iVolumeLabel[KVolumeLabelSize];
262 TUint8 iFileSysType[KFileSysTypeSize];
265 #include "tfatbootsector.inl"
267 #endif //__CMASSSTORAGEMOUNTCB_H__