WORM(5) WORM(5) NAME worm - format of worm disks SYNOPSIS #include <worm.h> DESCRIPTION A WORM disk is a linked list of `superblocks', roughly one for every worm write on the 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 WORM is that of the governing superblock; the set of files on the WORM is the accumulation of all the superblocks taken in order. The structure of a superblock as given in the include file is: #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; superblocks are padded with zeros to blocksize. Following each VLINK superblock is a set of inodes, a string table, and then the data blocks for the files described by WORM(5) WORM(5) the inodes. Following a (there is at most one) VBTREE superblock there is a set of inodes, a string table and the .F and .T files for a cbt(1) database where the keys are filenames and the data is an inode number. #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 stat(2) */ short uid /* owner */ short gid /* owner */ short pad2 /* to 32 bytes */ } Inode If the block field of an inode is negative, the file has been deleted. SEE ALSO worm(8)