1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/userlibandfileserver/fileserver/sfat/inc/fat_table.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,140 @@
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 +// f32\sfat\inc\fat_table.h
1.18 +// FAT12/16 File Allocation Table classes definitions
1.19 +//
1.20 +//
1.21 +
1.22 +/**
1.23 + @file
1.24 + @internalTechnology
1.25 +*/
1.26 +
1.27 +//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1.28 +//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1.29 +//!!
1.30 +//!! WARNING!! DO NOT edit this file !! '\sfat' component is obsolete and is not being used. '\sfat32'replaces it
1.31 +//!!
1.32 +//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1.33 +//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1.34 +
1.35 +
1.36 +
1.37 +#ifndef FAT_TABLE_H
1.38 +#define FAT_TABLE_H
1.39 +
1.40 +
1.41 +//---------------------------------------------------------------------------------------------------------------------------------------
1.42 +
1.43 +/**
1.44 + Fat table used for all media except RAM, manages the Fat table for all cluster requests.
1.45 +*/
1.46 +class CAtaFatTable : public CFatTable
1.47 + {
1.48 +public:
1.49 + static CAtaFatTable* NewL(CFatMountCB& aOwner);
1.50 +
1.51 + //-- overrides from the base class
1.52 + void FlushL();
1.53 + void Dismount(TBool aDiscardDirtyData);
1.54 + void ReMountL();
1.55 + void InvalidateCacheL(TInt64 aPos, TUint32 aLength);
1.56 + void InvalidateCacheL();
1.57 +
1.58 + TUint32 ReadL(TUint32 aFatIndex) const;
1.59 + void WriteL(TUint32 aFatIndex, TUint32 aValue);
1.60 +
1.61 + TInt64 DataPositionInBytes(TUint32 aCluster) const;
1.62 +
1.63 +private:
1.64 + CAtaFatTable(CFatMountCB& aOwner);
1.65 + void InitializeL();
1.66 + void CreateCacheL();
1.67 +
1.68 +private:
1.69 + CFatCacheBase* iCache; ///< FAT cache, fixed or LRU depending on the FAT type
1.70 + };
1.71 +
1.72 +//---------------------------------------------------------------------------------------------------------------------------------------
1.73 +
1.74 +/**
1.75 + Fat table used for RAM media, manages the Fat table for all cluster requests.
1.76 + RAM media only supports Fat12/16.
1.77 +*/
1.78 +class CRamFatTable : public CFatTable
1.79 + {
1.80 +public:
1.81 + static CRamFatTable* NewL(CFatMountCB& aOwner);
1.82 +
1.83 + void ReMountL();
1.84 + TUint32 ReadL(TUint32 aFatIndex) const;
1.85 + void WriteL(TUint32 aFatIndex, TUint32 aValue);
1.86 + TInt64 DataPositionInBytes(TUint32 aCluster) const;
1.87 + void FreeClusterListL(TUint32 aCluster);
1.88 + TUint32 AllocateSingleClusterL(TUint32 aNearestCluster);
1.89 + void ExtendClusterListL(TUint32 aNumber,TInt& aCluster);
1.90 +
1.91 +private:
1.92 + CRamFatTable(CFatMountCB& aOwner);
1.93 +
1.94 + void InitializeL();
1.95 +
1.96 + inline TUint8 *RamDiskBase() const;
1.97 + inline TInt AllocateClusterNumber();
1.98 + inline void WriteFatTable(TInt aFatIndex,TInt aValue);
1.99 + inline void WriteFatTable(TInt aFatIndex,TInt aFatValue,TInt anIndirectionTableValue);
1.100 + inline void ReadIndirectionTable(TUint32& aCluster) const;
1.101 + inline void WriteIndirectionTable(TInt aFatIndex,TInt aValue);
1.102 + inline TUint8* MemCopy(TAny* aTrg,const TAny* aSrc,TInt aLength);
1.103 + inline TUint8* MemCopyFillZ(TAny* aTrg, TAny* aSrc, TInt aLength);
1.104 + inline void ZeroFillCluster(TInt aCluster);
1.105 +
1.106 + void UpdateIndirectionTable(TUint32 aStartCluster,TUint32 anEndCluster,TInt aNum);
1.107 +
1.108 +protected:
1.109 +
1.110 + TInt iFatTablePos; ///< Current position in the fat table
1.111 + TInt iIndirectionTablePos; ///< Current position in indirection table, second fat used for this
1.112 + TUint8* iRamDiskBase; ///< Pointer to the Ram disk base
1.113 + };
1.114 +
1.115 +
1.116 +
1.117 +//---------------------------------------------------------------------------------------------------------------------------------
1.118 +
1.119 +
1.120 +#endif //FAT_TABLE_H
1.121 +
1.122 +
1.123 +
1.124 +
1.125 +
1.126 +
1.127 +
1.128 +
1.129 +
1.130 +
1.131 +
1.132 +
1.133 +
1.134 +
1.135 +
1.136 +
1.137 +
1.138 +
1.139 +
1.140 +
1.141 +
1.142 +
1.143 +