fs(4-ufs) fs(4-ufs)
NAME
fs (ufs) - Format eines Datenträgers im ufs-Dateisystem
SYNTAX
#include <sys/param.h>
#include <sys/types.h>
#include <sys/fs/ufsfs.h>
BESCHREIBUNG
Auf jedem Plattenlaufwerk sind eine Reihe von Dateisystemen enthalten.
Ein Dateisystem besteht aus mehreren Gruppen von Zylindern. In jeder
Zylinder-Gruppe sind I-Nodes und Daten enthalten.
Ein Dateisystem gliedert sich in seinen sogenannten Superblock sowie
die Informationen in den Zylindergruppe-Blöcken. Da die Daten im
Superblock unentbehrlich sind, wird eine Kopie des Superblocks als
Schutz gegen einen totalen Datenverlust vor jeden Zylindergruppen-
Block gesetzt. Dies geschieht während der Ausführung von mkfs. Da sich
an den Daten im Superblock dann nichts mehr ändert, muß danach nicht
mehr auf die Kopien verwiesen werden.
/*
* Super block for a file system.
*/
#define FSMAGIC 0x011954
#define FSACTIVE 0x5e72d81a /* fsstate: mounted */
#define FSOKAY 0x7c269d38 /* fsstate: clean */
#define FSBAD 0xcb096f43 /* fsstate: bad root */
struct fs
{
struct fs *fslink; /* linked list of file systems */
struct fs *fsrlink; /* used for incore super blocks */
daddrt fssblkno; /* addr of super-block in filesys */
daddrt fscblkno; /* offset of cyl-block in filesys */
daddrt fsiblkno; /* offset of inode-blocks in filesys */
daddrt fsdblkno; /* offset of first data after cg */
long fscgoffset; /* cylinder group offset in cylinder */
long fscgmask; /* used to calc mod fsntrak */
timet fstime; /* last time written */
long fssize; /* number of blocks in fs */
long fsdsize; /* number of data blocks in fs */
long fsncg; /* number of cylinder groups */
long fsbsize; /* size of basic blocks in fs */
long fsfsize; /* size of frag blocks in fs */
long fsfrag; /* number of frags in a block in fs */
/* these are configuration parameters */
long fsminfree; /* minimum percentage of free blocks */
long fsrotdelay; /* num of ms for optimal next block */
long fsrps; /* disk revolutions per second */
Seite 1 Reliant UNIX 5.44 Gedruckt 11/98
fs(4-ufs) fs(4-ufs)
/* these fields can be computed from the others */
long fsbmask; /* "blkoff" calc of blk offsets */
long fsfmask; /* "fragoff" calc of frag offsets */
long fsbshift; /* "lblkno" calc of logical blkno */
long fsfshift; /* "numfrags" calc number of frags */
/* these are configuration parameters */
long fsmaxcontig; /* max number of contiguous blks */
long fsmaxbpg; /* max number of blks per cyl group */
/* these fields can be computed from the others */
long fsfragshift; /* block to frag shift */
long fsfsbtodb; /* fsbtodb and dbtofsb shift constant */
long fssbsize; /* actual size of super block */
long fscsmask; /* csum block offset */
long fscsshift; /* csum block number */
long fsnindir; /* value of NINDIR */
long fsinopb; /* value of INOPB */
long fsnspf; /* value of NSPF */
long fsoptim; /* optimization preference, see below */
long fsstate; /* file system state */
long fssparecon[2]; /* reserved for future constants */
/* a unique id for this filesystem (currently unused and unmaintained) */
long fsid[2]; /* file system id */
/* sizes determined by number of cylinder groups and their sizes */
daddrt fscsaddr; /* blk addr of cyl grp summary area */
long fscssize; /* size of cyl grp summary area */
long fscgsize; /* cylinder group size */
/* these fields should be derived from the hardware */
long fsntrak; /* tracks per cylinder */
long fsnsect; /* sectors per track */
long fsspc; /* sectors per cylinder */
/* this comes from the disk driver partitioning */
long fsncyl; /* cylinders in file system */
/* these fields can be computed from the others */
long fscpg; /* cylinders per group */
long fsipg; /* inodes per group */
long fsfpg; /* blocks per group * fsfrag */
/* this data must be re-computed after crashes */
struct csum fscstotal; /* cylinder summary information */
/* these fields are cleared at mount time */
char fsfmod; /* super block modified flag */
char fsclean; /* file system is clean flag */
char fsronly; /* mounted read-only flag */
char fsflags; /* currently unused flag */
char fsfsmnt[MAXMNTLEN]; /* name mounted on */
/* these fields retain the current block allocation info */
long fscgrotor; /* last cg searched */
struct csum *fscsp[MAXCSBUFS]; /* list of fscs info buffers */
long fscpc; /* cyl per cycle in postbl */
short fspostbl[MAXCPG][NRPOS];/* head of blocks for each rotation */
long fsmagic; /* magic number */
uchar fsrotbl[1]; /* list of blocks for each rotation */
};
Seite 2 Reliant UNIX 5.44 Gedruckt 11/98
fs(4-ufs) fs(4-ufs)
/*
* Cylinder group block for a file system.
*/
#define CGMAGIC 0x090255
struct cg
{
struct cg *cglink; /* linked list of cyl groups */
struct cg *cgrlink; /* used for incore cyl groups */
timet cgtime; /* time last written */
long cgcgx; /* we are the cgx'th cylinder group */
short cgncyl; /* number of cyl's this cg */
short cgniblk; /* number of inode blocks this cg */
long cgndblk; /* number of data blocks this cg */
struct csum cgcs; /* cylinder summary information */
long cgrotor; /* position of last used block */
long cgfrotor; /* position of last used frag */
long cgirotor; /* position of last used inode */
long cgfrsum[MAXFRAG]; /* counts of available frags */
long cgbtot[MAXCPG]; /* block totals per cylinder */
short cgb[MAXCPG][NRPOS]; /* positions of free blocks */
char cgiused[MAXIPG/NBBY];/* used inode map */
long cgmagic; /* magic number */
uchar cgfree[1]; /* free block map */
};
SIEHE AUCH
inode(4-ufs).
Seite 3 Reliant UNIX 5.44 Gedruckt 11/98