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