summaryrefslogtreecommitdiff
path: root/static/v10/man5/worm.5
blob: f5b7872c98f39a472bbacfb23e9836f6b773800f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
.TH WORM 5
.CT 1 dirs
.SH NAME
worm \- format of worm disks
.SH SYNOPSIS
.B #include <worm.h>
.SH DESCRIPTION
A 
.SM WORM
disk is a linked list of `superblocks', roughly one for every
.I "worm write"
on the 
.SM WORM.
The `governing' superblock is at block zero if it exists and
has a valid magic number;
otherwise the governing superblock is the last superblock in
the linked list starting at block 1.
(The link to the next superblock is preallocated
and thus the last superblock in the list will be unwritten.)
Each superblock has some status information and a pointer
to a set of `inodes' describing a set of files.
The status information for the 
.SM WORM
is that of the governing superblock;
the set of files on the 
.SM WORM
is the accumulation of all the superblocks
taken in order.
The structure of a superblock as given in the
include file is:
.LP
.EX
.ta \w'#define 'u +\w'unsigned 'u +\w'mment[128]; 'u
#define	SMAGIC	0x21746967
#define	VLINK	1	/* linked list superblock */
#define	VBTREE	2	/* cbt superblock */
typedef struct superblock
{
	long magic;		/* magic number for superblock */
	unsigned short blocksize; /* physical size of blocks */
	short version;		/* type of superblock */
	long nblocks;		/* number of blocks on device */
	long zero;		/* first logical data block */
	long nfree;		/* number of free blocks */
	long ninodes;		/* number of inodes */
	long ninochars;		/* number of bytes of inode names */
	long binodes;		/* start of inodes */
	long nextffree;		/* next free file block */
	long nextsb;		/* next superblock */
	short fd;		/* fildes for device (in core) */
	char vol_id[128];		/* name the disk can be mounted as */
	char comment[128];		/* comments */
	long myblock;		/* where this superblock is */
	long nF;		/* bytes for .F (VBTREE) */
	long nT;		/* bytes for .T (VBTREE) */
	long ctime;		/* create time for this superblock */
} superblock;
.EE
.PP
superblocks are padded with zeros to
.BR blocksize .
.PP
Following each
.B VLINK
superblock is a set of inodes, a string table, and then the data blocks
for the files described by the inodes.
Following a (there is at most one)
.B VBTREE
superblock
there is a set of inodes, a string table and the 
.B .F
and
.B .T
files for a
.IR cbt (1)
database where the keys are filenames and the data is an inode number.
.LP
.EX
#define	DMAGIC	0x3A746967
typedef struct Inode
{
	long magic;		/* magic number for Dirent */
	long block;		/* starting block of file */
	long nbytes;		/* bytes in file */
	long ctime;		/* creation time */
	union {
		char *n;	/* core - name */
		long o;	/* disk - offset into chars block */
	} name;		/* filename */
	long pad1		/* to 32 bytes */
	short mode		/* as in \fIstat\fP(2) */
	short uid		/* owner */
	short gid		/* owner */
	short pad2		/* to 32 bytes */
} Inode		
.EE
.PP
If the
.B block
field of an inode is negative,
the file has been deleted.
.SH "SEE ALSO"
.IR worm (8)