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

📄 hpfs.h

📁 ARM 嵌入式 系统 设计与实例开发 实验教材 二源码
💻 H
📖 第 1 页 / 共 2 页
字号:
/* *  linux/fs/hpfs/hpfs.h * *  HPFS structures by Chris Smith, 1993 * *  a little bit modified by Mikulas Patocka, 1998-1999 *//* The paper     Duncan, Roy     Design goals and implementation of the new High Performance File System     Microsoft Systems Journal  Sept 1989  v4 n5 p1(13)   describes what HPFS looked like when it was new, and it is the source   of most of the information given here.  The rest is conjecture.   For definitive information on the Duncan paper, see it, not this file.   For definitive information on HPFS, ask somebody else -- this is guesswork.   There are certain to be many mistakes. *//* Notation */typedef unsigned secno;			/* sector number, partition relative */typedef secno dnode_secno;		/* sector number of a dnode */typedef secno fnode_secno;		/* sector number of an fnode */typedef secno anode_secno;		/* sector number of an anode *//* sector 0 *//* The boot block is very like a FAT boot block, except that the   29h signature byte is 28h instead, and the ID string is "HPFS". */#define BB_MAGIC 0xaa55struct hpfs_boot_block{  unsigned char jmp[3];  unsigned char oem_id[8];  unsigned char bytes_per_sector[2];	/* 512 */  unsigned char sectors_per_cluster;  unsigned char n_reserved_sectors[2];  unsigned char n_fats;  unsigned char n_rootdir_entries[2];  unsigned char n_sectors_s[2];  unsigned char media_byte;  unsigned short sectors_per_fat;  unsigned short sectors_per_track;  unsigned short heads_per_cyl;  unsigned int n_hidden_sectors;  unsigned int n_sectors_l;		/* size of partition */  unsigned char drive_number;  unsigned char mbz;  unsigned char sig_28h;		/* 28h */  unsigned char vol_serno[4];  unsigned char vol_label[11];  unsigned char sig_hpfs[8];		/* "HPFS    " */  unsigned char pad[448];  unsigned short magic;			/* aa55 */};/* sector 16 *//* The super block has the pointer to the root directory. */#define SB_MAGIC 0xf995e849struct hpfs_super_block{  unsigned magic;			/* f995 e849 */  unsigned magic1;			/* fa53 e9c5, more magic? */  /*unsigned huh202;*/			/* ?? 202 = N. of B. in 1.00390625 S.*/  char version;				/* version of a filesystem  usually 2 */  char funcversion;			/* functional version - oldest version  					   of filesystem that can understand					   this disk */  unsigned short int zero;		/* 0 */  fnode_secno root;			/* fnode of root directory */  secno n_sectors;			/* size of filesystem */  unsigned n_badblocks;			/* number of bad blocks */  secno bitmaps;			/* pointers to free space bit maps */  unsigned zero1;			/* 0 */  secno badblocks;			/* bad block list */  unsigned zero3;			/* 0 */  time_t last_chkdsk;			/* date last checked, 0 if never */  /*unsigned zero4;*/			/* 0 */  time_t last_optimize;			/* date last optimized, 0 if never */  secno n_dir_band;			/* number of sectors in dir band */  secno dir_band_start;			/* first sector in dir band */  secno dir_band_end;			/* last sector in dir band */  secno dir_band_bitmap;		/* free space map, 1 dnode per bit */  char volume_name[32];			/* not used */  secno user_id_table;			/* 8 preallocated sectors - user id */  unsigned zero6[103];			/* 0 */};/* sector 17 *//* The spare block has pointers to spare sectors.  */#define SP_MAGIC 0xf9911849struct hpfs_spare_block{  unsigned magic;			/* f991 1849 */  unsigned magic1;			/* fa52 29c5, more magic? */  unsigned dirty: 1;			/* 0 clean, 1 "improperly stopped" */  /*unsigned flag1234: 4;*/		/* unknown flags */  unsigned sparedir_used: 1;		/* spare dirblks used */  unsigned hotfixes_used: 1;		/* hotfixes used */  unsigned bad_sector: 1;		/* bad sector, corrupted disk (???) */  unsigned bad_bitmap: 1;		/* bad bitmap */  unsigned fast: 1;			/* partition was fast formatted */  unsigned old_wrote: 1;		/* old version wrote to partion */  unsigned old_wrote_1: 1;		/* old version wrote to partion (?) */  unsigned install_dasd_limits: 1;	/* HPFS386 flags */  unsigned resynch_dasd_limits: 1;  unsigned dasd_limits_operational: 1;  unsigned multimedia_active: 1;  unsigned dce_acls_active: 1;  unsigned dasd_limits_dirty: 1;  unsigned flag67: 2;  unsigned char mm_contlgulty;  unsigned char unused;  secno hotfix_map;			/* info about remapped bad sectors */  unsigned n_spares_used;		/* number of hotfixes */  unsigned n_spares;			/* number of spares in hotfix map */  unsigned n_dnode_spares_free;		/* spare dnodes unused */  unsigned n_dnode_spares;		/* length of spare_dnodes[] list,					   follows in this block*/  secno code_page_dir;			/* code page directory block */  unsigned n_code_pages;		/* number of code pages */  /*unsigned large_numbers[2];*/	/* ?? */  unsigned super_crc;			/* on HPFS386 and LAN Server this is  					   checksum of superblock, on normal					   OS/2 unused */  unsigned spare_crc;			/* on HPFS386 checksum of spareblock */  unsigned zero1[15];			/* unused */  dnode_secno spare_dnodes[100];	/* emergency free dnode list */  unsigned zero2[1];			/* room for more? */};/* The bad block list is 4 sectors long.  The first word must be zero,   the remaining words give n_badblocks bad block numbers.   I bet you can see it coming... */#define BAD_MAGIC 0       /* The hotfix map is 4 sectors long.  It looks like       secno from[n_spares];       secno to[n_spares];   The to[] list is initialized to point to n_spares preallocated empty   sectors.  The from[] list contains the sector numbers of bad blocks   which have been remapped to corresponding sectors in the to[] list.   n_spares_used gives the length of the from[] list. *//* Sectors 18 and 19 are preallocated and unused.   Maybe they're spares for 16 and 17, but simple substitution fails. *//* The code page info pointed to by the spare block consists of an index   block and blocks containing uppercasing tables.  I don't know what   these are for (CHKDSK, maybe?) -- OS/2 does not seem to use them   itself.  Linux doesn't use them either. *//* block pointed to by spareblock->code_page_dir */#define CP_DIR_MAGIC 0x494521f7struct code_page_directory{  unsigned magic;			/* 4945 21f7 */  unsigned n_code_pages;		/* number of pointers following */  unsigned zero1[2];  struct {    unsigned short ix;			/* index */    unsigned short code_page_number;	/* code page number */    unsigned bounds;			/* matches corresponding word					   in data block */    secno code_page_data;		/* sector number of a code_page_data					   containing c.p. array */    unsigned short index;		/* index in c.p. array in that sector*/    unsigned short unknown;		/* some unknown value; usually 0;    					   2 in Japanese version */  } array[31];				/* unknown length */};/* blocks pointed to by code_page_directory */#define CP_DATA_MAGIC 0x894521f7struct code_page_data{  unsigned magic;			/* 8945 21f7 */  unsigned n_used;			/* # elements used in c_p_data[] */  unsigned bounds[3];			/* looks a bit like					     (beg1,end1), (beg2,end2)					   one byte each */  unsigned short offs[3];		/* offsets from start of sector					   to start of c_p_data[ix] */  struct {    unsigned short ix;			/* index */    unsigned short code_page_number;	/* code page number */    unsigned short unknown;		/* the same as in cp directory */    unsigned char map[128];		/* upcase table for chars 80..ff */    unsigned short zero2;  } code_page[3];  unsigned char incognita[78];};/* Free space bitmaps are 4 sectors long, which is 16384 bits.   16384 sectors is 8 meg, and each 8 meg band has a 4-sector bitmap.   Bit order in the maps is little-endian.  0 means taken, 1 means free.   Bit map sectors are marked allocated in the bit maps, and so are sectors    off the end of the partition.   Band 0 is sectors 0-3fff, its map is in sectors 18-1b.   Band 1 is 4000-7fff, its map is in 7ffc-7fff.   Band 2 is 8000-ffff, its map is in 8000-8003.   The remaining bands have maps in their first (even) or last (odd) 4 sectors     -- if the last, partial, band is odd its map is in its last 4 sectors.   The bitmap locations are given in a table pointed to by the super block.   No doubt they aren't constrained to be at 18, 7ffc, 8000, ...; that is   just where they usually are.   The "directory band" is a bunch of sectors preallocated for dnodes.   It has a 4-sector free space bitmap of its own.  Each bit in the map   corresponds to one 4-sector dnode, bit 0 of the map corresponding to   the first 4 sectors of the directory band.  The entire band is marked   allocated in the main bitmap.   The super block gives the locations   of the directory band and its bitmap.  ("band" doesn't mean it is   8 meg long; it isn't.)  *//* dnode: directory.  4 sectors long */

⌨️ 快捷键说明

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