⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hpfs.h

📁 ARM 嵌入式 系统 设计与实例开发 实验教材 二源码
💻 H
📖 第 1 页 / 共 2 页
字号:
/* A directory is a tree of dnodes.  The fnode for a directory   contains one pointer, to the root dnode of the tree.  The fnode   never moves, the dnodes do the B-tree thing, splitting and merging   as files are added and removed.  */#define DNODE_MAGIC   0x77e40aaestruct dnode {  unsigned magic;			/* 77e4 0aae */  unsigned first_free;			/* offset from start of dnode to					   first free dir entry */  unsigned root_dnode:1;		/* Is it root dnode? */  unsigned increment_me:31;		/* some kind of activity counter?					   Neither HPFS.IFS nor CHKDSK cares					   if you change this word */  secno up;				/* (root dnode) directory's fnode					   (nonroot) parent dnode */  dnode_secno self;			/* pointer to this dnode */  unsigned char dirent[2028];		/* one or more dirents */};struct hpfs_dirent {  unsigned short length;		/* offset to next dirent */  unsigned first: 1;			/* set on phony ^A^A (".") entry */  unsigned has_acl: 1;  unsigned down: 1;			/* down pointer present (after name) */  unsigned last: 1;			/* set on phony \377 entry */  unsigned has_ea: 1;			/* entry has EA */  unsigned has_xtd_perm: 1;		/* has extended perm list (???) */  unsigned has_explicit_acl: 1;  unsigned has_needea: 1;		/* ?? some EA has NEEDEA set					   I have no idea why this is					   interesting in a dir entry */  unsigned read_only: 1;		/* dos attrib */  unsigned hidden: 1;			/* dos attrib */  unsigned system: 1;			/* dos attrib */  unsigned flag11: 1;			/* would be volume label dos attrib */  unsigned directory: 1;		/* dos attrib */  unsigned archive: 1;			/* dos attrib */  unsigned not_8x3: 1;			/* name is not 8.3 */  unsigned flag15: 1;  fnode_secno fnode;			/* fnode giving allocation info */  time_t write_date;			/* mtime */  unsigned file_size;			/* file length, bytes */  time_t read_date;			/* atime */  time_t creation_date;			/* ctime */  unsigned ea_size;			/* total EA length, bytes */  unsigned char no_of_acls : 3;		/* number of ACL's */  unsigned char reserver : 5;  unsigned char ix;			/* code page index (of filename), see					   struct code_page_data */  unsigned char namelen, name[1];	/* file name */  /* dnode_secno down;	  btree down pointer, if present,     			  follows name on next word boundary, or maybe it			  precedes next dirent, which is on a word boundary. */};/* B+ tree: allocation info in fnodes and anodes *//* dnodes point to fnodes which are responsible for listing the sectors   assigned to the file.  This is done with trees of (length,address)   pairs.  (Actually triples, of (length, file-address, disk-address)   which can represent holes.  Find out if HPFS does that.)   At any rate, fnodes contain a small tree; if subtrees are needed   they occupy essentially a full block in anodes.  A leaf-level tree node   has 3-word entries giving sector runs, a non-leaf node has 2-word   entries giving subtree pointers.  A flag in the header says which. */struct bplus_leaf_node{  unsigned file_secno;			/* first file sector in extent */  unsigned length;			/* length, sectors */  secno disk_secno;			/* first corresponding disk sector */};struct bplus_internal_node{  unsigned file_secno;			/* subtree maps sectors < this  */  anode_secno down;			/* pointer to subtree */};struct bplus_header{  unsigned hbff: 1;	/* high bit of first free entry offset */  unsigned flag1: 1;  unsigned flag2: 1;  unsigned flag3: 1;  unsigned flag4: 1;  unsigned fnode_parent: 1;		/* ? we're pointed to by an fnode,					   the data btree or some ea or the					   main ea bootage pointer ea_secno */					/* also can get set in fnodes, which					   may be a chkdsk glitch or may mean					   this bit is irrelevant in fnodes,					   or this interpretation is all wet */  unsigned binary_search: 1;		/* suggest binary search (unused) */  unsigned internal: 1;			/* 1 -> (internal) tree of anodes					   0 -> (leaf) list of extents */  unsigned char fill[3];  unsigned char n_free_nodes;		/* free nodes in following array */  unsigned char n_used_nodes;		/* used nodes in following array */  unsigned short first_free;		/* offset from start of header to					   first free node in array */  union {    struct bplus_internal_node internal[0]; /* (internal) 2-word entries giving					       subtree pointers */    struct bplus_leaf_node external[0];	    /* (external) 3-word entries giving					       sector runs */  } u;};/* fnode: root of allocation b+ tree, and EA's *//* Every file and every directory has one fnode, pointed to by the directory   entry and pointing to the file's sectors or directory's root dnode.  EA's   are also stored here, and there are said to be ACL's somewhere here too. */#define FNODE_MAGIC 0xf7e40aaestruct fnode{  unsigned magic;			/* f7e4 0aae */  unsigned zero1[2];			/* read history */  unsigned char len, name[15];		/* true length, truncated name */  fnode_secno up;			/* pointer to file's directory fnode */  /*unsigned zero2[3];*/  secno acl_size_l;  secno acl_secno;  unsigned short acl_size_s;  char acl_anode;  char zero2;				/* history bit count */  unsigned ea_size_l;			/* length of disk-resident ea's */  secno ea_secno;			/* first sector of disk-resident ea's*/  unsigned short ea_size_s;		/* length of fnode-resident ea's */  unsigned flag0: 1;  unsigned ea_anode: 1;			/* 1 -> ea_secno is an anode */  unsigned flag2: 1;  unsigned flag3: 1;  unsigned flag4: 1;  unsigned flag5: 1;  unsigned flag6: 1;  unsigned flag7: 1;  unsigned dirflag: 1;			/* 1 -> directory.  first & only extent					   points to dnode. */  unsigned flag9: 1;  unsigned flag10: 1;  unsigned flag11: 1;  unsigned flag12: 1;  unsigned flag13: 1;  unsigned flag14: 1;  unsigned flag15: 1;  struct bplus_header btree;		/* b+ tree, 8 extents or 12 subtrees */  union {    struct bplus_leaf_node external[8];    struct bplus_internal_node internal[12];  } u;  unsigned file_size;			/* file length, bytes */  unsigned n_needea;			/* number of EA's with NEEDEA set */  char user_id[16];			/* unused */  unsigned ea_offs;			/* offset from start of fnode					   to first fnode-resident ea */  char dasd_limit_treshhold;  char dasd_limit_delta;  unsigned dasd_limit;  unsigned dasd_usage;  /*unsigned zero5[2];*/  unsigned char ea[316];		/* zero or more EA's, packed together					   with no alignment padding.					   (Do not use this name, get here					   via fnode + ea_offs. I think.) */};/* anode: 99.44% pure allocation tree */#define ANODE_MAGIC 0x37e40aaestruct anode{  unsigned magic;			/* 37e4 0aae */  anode_secno self;			/* pointer to this anode */  secno up;				/* parent anode or fnode */  struct bplus_header btree;		/* b+tree, 40 extents or 60 subtrees */  union {    struct bplus_leaf_node external[40];    struct bplus_internal_node internal[60];  } u;  unsigned fill[3];			/* unused */};/* extended attributes.   A file's EA info is stored as a list of (name,value) pairs.  It is   usually in the fnode, but (if it's large) it is moved to a single   sector run outside the fnode, or to multiple runs with an anode tree   that points to them.   The value of a single EA is stored along with the name, or (if large)   it is moved to a single sector run, or multiple runs pointed to by an   anode tree, pointed to by the value field of the (name,value) pair.   Flags in the EA tell whether the value is immediate, in a single sector   run, or in multiple runs.  Flags in the fnode tell whether the EA list   is immediate, in a single run, or in multiple runs. */struct extended_attribute{  unsigned indirect: 1;			/* 1 -> value gives sector number					   where real value starts */  unsigned anode: 1;			/* 1 -> sector is an anode					   that points to fragmented value */  unsigned flag2: 1;  unsigned flag3: 1;  unsigned flag4: 1;  unsigned flag5: 1;  unsigned flag6: 1;  unsigned needea: 1;			/* required ea */  unsigned char namelen;		/* length of name, bytes */  unsigned short valuelen;		/* length of value, bytes */  unsigned char name[0];  /*    unsigned char name[namelen];	ascii attrib name    unsigned char nul;			terminating '\0', not counted    unsigned char value[valuelen];	value, arbitrary      if this.indirect, valuelen is 8 and the value is        unsigned length;		real length of value, bytes        secno secno;			sector address where it starts      if this.anode, the above sector number is the root of an anode tree        which points to the value.  */};/*   Local Variables:   comment-column: 40   End:*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -