reactos操作系统实现(134)

 文件控制块主要用来表示一个ReactOS打开文件的对象。下面就来仔细地分析文件控制块的结构,如下:

#001  typedef struct _VFATFCB

#002  {

 

ROS的文件头部,主要包括文件流的描述和系统使用的变量。

#003    /* FCB header required by ROS/NT */

#004    FSRTL_COMMON_FCB_HEADER RFCB;

 

指向每个文件的数据段指针。

#005    SECTION_OBJECT_POINTERS SectionObjectPointers;

#006    ERESOURCE MainResource;

#007    ERESOURCE PagingIoResource;

#008    /* end FCB header required by ROS/NT */

#009 

 

这个目录或文件的目录入口指针。

#010    /* directory entry for this file or directory */

#011    DIR_ENTRY entry;

#012 

 

指向属性的入口。

#013    /* Pointer to attributes in entry */

#014    PUCHAR Attributes;

#015 

 

保存长文件名称。

#016    /* long file name, points into PathNameBuffer */

#017    UNICODE_STRING LongNameU;

#018 

 

保存短文件名称。

#019    /* short file name */

#020    UNICODE_STRING ShortNameU;

#021 

 

保存目录的名称。

#022    /* directory name, points into PathNameBuffer */

#023    UNICODE_STRING DirNameU;

#024 

 

保存路径和文件名称,最大260个字节。

#025    /* path + long file name 260 max*/

#026    UNICODE_STRING PathNameU;

#027 

 

保存路径名称。

#028    /* buffer for PathNameU */

#029    PWCHAR PathNameBuffer;

#030 

 

保存短名称。

#031    /* buffer for ShortNameU */

#032    WCHAR ShortNameBuffer[13];

#033 

 

文件控制块的引用计数。

#034    /* */

#035    LONG RefCount;

#036 

 

保存这个分卷有多少个文件控制块。

#037    /* List of FCB's for this volume */

#038    LIST_ENTRY FcbListEntry;

#039 

 

指向父文件控制块的指针。

#040    /* pointer to the parent fcb */

#041    struct _VFATFCB* parentFcb;

#042 

 

控制块的标志保存。

#043    /* Flags for the fcb */

#044    ULONG Flags;

#045 

 

关联这个文件控制块与文件对象。

#046    /* pointer to the file object which has initialized the fcb */

#047    PFILE_OBJECT FileObject;

#048 

 

短文件名称的目录索引。

#049    /* Directory index for the short name entry */

#050    ULONG dirIndex;

#051 

 

长文件名称的目录索引。

#052    /* Directory index where the long name starts */

#053    ULONG startIndex;

#054 

 

共享访问文件对象标志。

#055    /* Share access for the file object */

#056    SHARE_ACCESS FCBShareAccess;

#057 

 

打开文件次数计数。

#058    /* Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLEANUP */

#059    ULONG OpenHandleCount;

#060 

 

路径名称和长文件名称在HASH表里的位置。

#061    /* Entry into the hash table for the path + long name */

#062    HASHENTRY Hash;

#063 

 

路径名称和短文件名称在HASH表里的位置。

#064    /* Entry into the hash table for the path + short name */

#065    HASHENTRY ShortHash;

#066 

 

文件锁住范围。

#067    /* List of byte-range locks for this file */

#068    FILE_LOCK FileLock;

#069 

 

保存最后读写的簇和位置。

#070    /*

#071     * Optimalization: caching of last read/write cluster+offset pair. Can't

#072     * be in VFATCCB because it must be reset everytime the allocated clusters

#073     * change.

#074     */

#075    FAST_MUTEX LastMutex;

#076    ULONG LastCluster;

#077    ULONG LastOffset;

#078  } VFATFCB, *PVFATFCB;

posted @ 2009-11-16 22:59  ajuanabc  阅读(105)  评论(0编辑  收藏  举报