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

📄 fs.h

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 H
📖 第 1 页 / 共 2 页
字号:
/* @(#)fs.h	4.1	(ULTRIX)	7/2/90 *//************************************************************************ *									* *			Copyright (c) 1984, 1986 by			* *		Digital Equipment Corporation, Maynard, MA		* *			All rights reserved.				* *									* *   This software is furnished under a license and may be used and	* *   copied  only  in accordance with the terms of such license and	* *   with the  inclusion  of  the  above  copyright  notice.   This	* *   software  or  any  other copies thereof may not be provided or	* *   otherwise made available to any other person.  No title to and	* *   ownership of the software is hereby transferred.			* *									* *   This software is  derived  from  software  received  from  the	* *   University    of   California,   Berkeley,   and   from   Bell	* *   Laboratories.  Use, duplication, or disclosure is  subject  to	* *   restrictions  under  license  agreements  with  University  of	* *   California and with AT&T.						* *									* *   The information in this software is subject to change  without	* *   notice  and should not be construed as a commitment by Digital	* *   Equipment Corporation.						* *									* *   Digital assumes no responsibility for the use  or  reliability	* *   of its software on equipment which is not supplied by Digital.	* *									* ************************************************************************//* ------------------------------------------------------------------------ * Modification History: /sys/h/fs.h * * 14 Jun 89 -- prs *	Added clean byte timeout logic. * * 28 Mar 88 -- prs *	Changed value of FS_CLEAN to be product release number. *	This value should change with each new release of ULTRIX, *	to guarantee file systems will be checked across releases. * * 06 Nov 84 -- jrs *	Add new Berkeley macro definitions *	Derived from 4.2BSD, labeled: *		fs.h 6.2	84/09/28 * *	11-Sep-84 Stephen Reilly * 001- Added new structure for the disk partitioning scheme * *	fs.h	6.1	83/07/29 * ----------------------------------------------------------------------- *//* * Each disk drive contains some number of file systems. * A file system consists of a number of cylinder groups. * Each cylinder group has inodes and data. * * A file system is described by its super-block, which in turn * describes the cylinder groups.  The super-block is critical * data and is replicated in each cylinder group to protect against * catastrophic loss.  This is done at mkfs time and the critical * super-block data does not change, so the copies need not be * referenced further unless disaster strikes. * * For file system fs, the offsets of the various blocks of interest * are given in the super block as: *	[fs->fs_sblkno]		Super-block *	[fs->fs_cblkno]		Cylinder group block *	[fs->fs_iblkno]		Inode blocks *	[fs->fs_dblkno]		Data blocks * The beginning of cylinder group cg in fs, is given by * the ``cgbase(fs, cg)'' macro. * * The first boot and super blocks are given in absolute disk addresses. */#define BBSIZE		8192#define SBSIZE		8192#define	BBLOCK		((daddr_t)(0))#define	SBLOCK		((daddr_t)(BBLOCK + BBSIZE / DEV_BSIZE))/* * Addresses stored in inodes are capable of addressing fragments * of `blocks'. File system blocks of at most size MAXBSIZE can  * be optionally broken into 2, 4, or 8 pieces, each of which is * addressible; these pieces may be DEV_BSIZE, or some multiple of * a DEV_BSIZE unit. * * Large files consist of exclusively large data blocks.  To avoid * undue wasted disk space, the last data block of a small file may be * allocated as only as many fragments of a large block as are * necessary.  The file system format retains only a single pointer * to such a fragment, which is a piece of a single large block that * has been divided.  The size of such a fragment is determinable from * information in the inode, using the ``blksize(fs, ip, lbn)'' macro. * * The file system records space availability at the fragment level; * to determine block availability, aligned fragments are examined. * * The root inode is the root of the file system. * Inode 0 can't be used for normal purposes and * historically bad blocks were linked to inode 1, * thus the root inode is 2. (inode 1 is no longer used for * this purpose, however numerous dump tapes make this * assumption, so we are stuck with it) * The lost+found directory is given the next available * inode when it is created by ``mkfs''. */#define	ROOTINO		((ino_t)2)	/* i number of all roots */#define LOSTFOUNDINO	(ROOTINO + 1)/* * Cylinder group related limits. * * For each cylinder we keep track of the availability of blocks at different * rotational positions, so that we can lay out the data to be picked * up with minimum rotational latency.  NRPOS is the number of rotational * positions which we distinguish.  With NRPOS 8 the resolution of our * summary information is 2ms for a typical 3600 rpm drive. */#define	NRPOS		8	/* number distinct rotational positions *//* * MAXIPG bounds the number of inodes per cylinder group, and * is needed only to keep the structure simpler by having the * only a single variable size element (the free bit map). * * N.B.: MAXIPG must be a multiple of INOPB(fs). */#define	MAXIPG		2048	/* max number inodes/cyl group *//* * MINBSIZE is the smallest allowable block size. * In order to insure that it is possible to create files of size * 2^32 with only two levels of indirection, MINBSIZE is set to 4096. * MINBSIZE must be big enough to hold a cylinder group block, * thus changes to (struct cg) must keep its size within MINBSIZE. * MAXCPG is limited only to dimension an array in (struct cg); * it can be made larger as long as that structures size remains * within the bounds dictated by MINBSIZE. * Note that super blocks are always of size MAXBSIZE, * and that MAXBSIZE must be >= MINBSIZE. */#define MINBSIZE	4096#define	MAXCPG		32	/* maximum fs_cpg *//* * The path name on which the file system is mounted is maintained * in fs_fsmnt. MAXMNTLEN defines the amount of space allocated in  * the super block for this name. * The limit on the amount of summary information per file system * is defined by MAXCSBUFS. It is currently parameterized for a * maximum of two million cylinders. */#define MAXMNTLEN 500#define MAXCSBUFS 32/* * Per cylinder group information; summarized in blocks allocated * from first cylinder group data blocks.  These blocks have to be * read in from fs_csaddr (size fs_cssize) in addition to the * super block. * * N.B. sizeof(struct csum) must be a power of two in order for * the ``fs_cs'' macro to work (see below). */struct csum {	long	cs_ndir;	/* number of directories */	long	cs_nbfree;	/* number of free blocks */	long	cs_nifree;	/* number of free inodes */	long	cs_nffree;	/* number of free frags */};#define PT_MAGIC	0x032957	/* Partition magic number */#define PT_VALID	1		/* Indicates if struct is valid */ /* * Structure that is used to determine the partitioning of the disk. * It's location is at the end of the superblock area. * The reason for both the cylinder offset and block offset * is that some of the disk drivers (most notably the uda  * driver) require the block offset rather than the cyl. * offset. */struct pt {	long	pt_magic;	/* magic no. indicating part. info exits */	int	pt_valid;	/* set by driver if pt is current */	struct  pt_info {		int	pi_nblocks;	/* no. of sectors for the partition */		daddr_t	pi_blkoff;	/* block offset for start of part. */	} pt_part[8];};/* * Super block for a file system. */#define	FS_MAGIC	0x011954struct	fs{	struct	fs *fs_link;		/* linked list of file systems */	struct	fs *fs_rlink;		/*     used for incore super blocks */	daddr_t	fs_sblkno;		/* addr of super-block in filesys */	daddr_t	fs_cblkno;		/* offset of cyl-block in filesys */	daddr_t	fs_iblkno;		/* offset of inode-blocks in filesys */	daddr_t	fs_dblkno;		/* offset of first data after cg */	long	fs_cgoffset;		/* cylinder group offset in cylinder */	long	fs_cgmask;		/* used to calc mod fs_ntrak */	time_t 	fs_time;    		/* last time written */	long	fs_size;		/* number of blocks in fs */	long	fs_dsize;		/* number of data blocks in fs */	long	fs_ncg;			/* number of cylinder groups */	long	fs_bsize;		/* size of basic blocks in fs */	long	fs_fsize;		/* size of frag blocks in fs */	long	fs_frag;		/* number of frags in a block in fs *//* these are configuration parameters */	long	fs_minfree;		/* minimum percentage of free blocks */	long	fs_rotdelay;		/* num of ms for optimal next block */	long	fs_rps;			/* disk revolutions per second *//* these fields can be computed from the others */	long	fs_bmask;		/* ``blkoff'' calc of blk offsets */	long	fs_fmask;		/* ``fragoff'' calc of frag offsets */	long	fs_bshift;		/* ``lblkno'' calc of logical blkno */	long	fs_fshift;		/* ``numfrags'' calc number of frags *//* these are configuration parameters */	long	fs_maxcontig;		/* max number of contiguous blks */	long	fs_maxbpg;		/* max number of blks per cyl group *//* these fields can be computed from the others */	long	fs_fragshift;		/* block to frag shift */	long	fs_fsbtodb;		/* fsbtodb and dbtofsb shift constant */	long	fs_sbsize;		/* actual size of super block */	long	fs_csmask;		/* csum block offset */	long	fs_csshift;		/* csum block number */	long	fs_nindir;		/* value of NINDIR */

⌨️ 快捷键说明

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