os/kernelhwsrv/userlibandfileserver/fileserver/sfat/fat_dir_entry.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// f32\sfat\inc\fat_dir_entry.h
sl@0
    15
// FAT directory entry related stuff definitions.
sl@0
    16
// 
sl@0
    17
//
sl@0
    18
sl@0
    19
/**
sl@0
    20
 @file
sl@0
    21
 @internalTechnology
sl@0
    22
*/
sl@0
    23
sl@0
    24
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
sl@0
    25
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
sl@0
    26
//!!
sl@0
    27
//!! WARNING!! DO NOT edit this file !! '\sfat' component is obsolete and is not being used. '\sfat32'replaces it
sl@0
    28
//!!
sl@0
    29
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
sl@0
    30
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
sl@0
    31
sl@0
    32
sl@0
    33
#if !defined(FAT_DIR_ENTRY_H)
sl@0
    34
#define FAT_DIR_ENTRY_H
sl@0
    35
sl@0
    36
sl@0
    37
//-------------------------------------------------------------------------------------------------------------------
sl@0
    38
sl@0
    39
sl@0
    40
const TInt      KFatDirNameSize         = 11;   ///< Dos directory/File name length
sl@0
    41
const TInt      KVFatEntryAttribute     = 0x0F;  ///< VFat entry attribute setting
sl@0
    42
const TUint8    KDotEntryByte           = 0x2e;  ///< Dot value for self and parent pointer directory entries
sl@0
    43
const TUint8    KBlankSpace             = 0x20;  ///< Blank space in a directory entry
sl@0
    44
const TInt      KSizeOfFatDirEntryLog2  = 5;     ///< Log2 of size in bytes of a Fat directry entry 
sl@0
    45
const TUint     KSizeOfFatDirEntry      = 1 << KSizeOfFatDirEntryLog2;    ///< Size in bytes of a Fat directry entry 
sl@0
    46
sl@0
    47
const TUint16 KReservedIdOldEntry = 1;  ///< Rugged FAT "OldEntry" id
sl@0
    48
const TUint16 KReservedIdNewEntry = 0;  ///< Rugged FAT "ReservedIdNewEntry" id
sl@0
    49
sl@0
    50
sl@0
    51
typedef TBuf8<KFatDirNameSize> TShortName;  ///< Buffer type fot short names in dos entries
sl@0
    52
sl@0
    53
//-------------------------------------------------------------------------------------------------------------------
sl@0
    54
sl@0
    55
/**
sl@0
    56
    Fat DOS directory entry structure
sl@0
    57
*/
sl@0
    58
struct SFatDirEntry
sl@0
    59
    {
sl@0
    60
    TUint8  iName[KFatDirNameSize]; ///< :0  File/Directory name
sl@0
    61
    TUint8  iAttributes;            ///< :11 File/Directory attributes
sl@0
    62
    TUint8  iReserved1[2];          ///< :12 2 reserved bytes(in our implementation), some versions of Windows may use them
sl@0
    63
    TUint16 iTimeC;                 ///< :14 Creation time
sl@0
    64
    TUint16 iDateC;                 ///< :16 Creation date
sl@0
    65
    TUint16 iReserved2;             ///< :18 2 reserved bytes(in our implementation), FAT specs say that this is "last access date". Rugged FAT uses them as a special entry ID
sl@0
    66
    TUint16 iStartClusterHi;        ///< :20 High 16 bits of the File/Directory cluster number (Fat32 only)
sl@0
    67
    TUint16 iTime;                  ///< :22 last write access time 
sl@0
    68
    TUint16 iDate;                  ///< :24 last write access date 
sl@0
    69
    TUint16 iStartClusterLo;        ///< :26 Low 16 bits of the File/Directory cluster number 
sl@0
    70
    TUint32 iSize;                  ///< :28 File/Directory size in bytes
sl@0
    71
    };
sl@0
    72
sl@0
    73
sl@0
    74
//-------------------------------------------------------------------------------------------------------------------
sl@0
    75
sl@0
    76
/**
sl@0
    77
Provides access to the Fat directory entry parameters
sl@0
    78
*/
sl@0
    79
class TFatDirEntry
sl@0
    80
    {
sl@0
    81
public:
sl@0
    82
    inline TFatDirEntry();
sl@0
    83
    inline void InitZ();
sl@0
    84
sl@0
    85
    inline const TPtrC8 Name() const;
sl@0
    86
    inline TInt Attributes() const;
sl@0
    87
    inline TTime Time(TTimeIntervalSeconds aOffset) const;
sl@0
    88
    inline TInt StartCluster() const;
sl@0
    89
    inline TUint32 Size() const;
sl@0
    90
    inline TBool IsErased() const;
sl@0
    91
    inline TBool IsCurrentDirectory() const;
sl@0
    92
    inline TBool IsParentDirectory() const;
sl@0
    93
    inline TBool IsEndOfDirectory() const;
sl@0
    94
    inline TBool IsGarbage() const;
sl@0
    95
    inline void SetName(const TDesC8& aDes);
sl@0
    96
    inline void SetAttributes(TInt anAtt);
sl@0
    97
    inline void SetTime(TTime aTime, TTimeIntervalSeconds aOffset);
sl@0
    98
    inline void SetCreateTime(TTime aTime, TTimeIntervalSeconds aOffset);
sl@0
    99
    inline void SetStartCluster(TInt aStartCluster);
sl@0
   100
    inline void SetSize(TUint32 aFilesize);
sl@0
   101
    inline void SetErased();
sl@0
   102
    inline void SetCurrentDirectory();
sl@0
   103
    inline void SetParentDirectory();
sl@0
   104
    inline void SetEndOfDirectory();
sl@0
   105
    inline TUint RuggedFatEntryId() const;
sl@0
   106
    inline void  SetRuggedFatEntryId(TUint16 aId);
sl@0
   107
sl@0
   108
public:
sl@0
   109
    void InitializeAsVFat(TUint8 aCheckSum);
sl@0
   110
    void SetVFatEntry(const TDesC& aName,TInt aRemainderLen);
sl@0
   111
    void ReadVFatEntry(TDes16& aVBuf) const;
sl@0
   112
    inline TBool IsLongNameStart() const;
sl@0
   113
    inline TBool IsVFatEntry() const;
sl@0
   114
    inline TInt NumFollowing() const;
sl@0
   115
    inline TUint8 CheckSum() const;
sl@0
   116
sl@0
   117
sl@0
   118
public:
sl@0
   119
    TUint8 iData[KSizeOfFatDirEntry]; ///< The directory entry data
sl@0
   120
    };
sl@0
   121
sl@0
   122
sl@0
   123
sl@0
   124
#endif //FAT_DIR_ENTRY_H
sl@0
   125
sl@0
   126
sl@0
   127
sl@0
   128
sl@0
   129
sl@0
   130
sl@0
   131
sl@0
   132
sl@0
   133
sl@0
   134
sl@0
   135
sl@0
   136
sl@0
   137
sl@0
   138