Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fd(5) — Pixar HSI 1.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

libfd(3H)

mx(4)

fdmount(5)

fdck(8)

fdmkfs(8)

FD(5)  —  Pixar Programmer’s Manual

NAME

fd− format of fast-disk filesystem (Version 2)

SYNOPSIS

#include <fd.h>
#include <fdfilsys.h>

DESCRIPTION

This manual page describes the organization of the disk data within one Fast-Disk filesystem.  Multiple Fast-Disk filesystems may be connected to one host computer.  Each filesystem resides in its own Fast-Disk partition (see mx(4)), and is self-contained.

The Fast-Disk filesystem is a rudimentary structure permitting the allocation and maintenance of a set of files within a tree-structured directory hierarchy.  Each file and directory within the filesystem is made up of a contiguous set of disk blocks.  Directory structure and free-block information are maintained by a set of Pixar-supplied routines and utilities (see libfd(3H)).

The filesystem begins in block zero (0).  All blocks are of size FD_BLOCKSIZE bytes (as defined in the header file fd.h).  The filesystem is composed of three principal elements:  the superblock, the free list, and the heap.

Block 0 of the filesystem, whose location is given symbolically as FD_SBLOCK, contains the superblock, which in turn provides information about the positions of the other elements of the filesystem.  The layout of the superblock is:

#define FD_SBMAGIC 0xDA102759   /∗ magic number in s_magic ∗/
struct fdsuperblock {
long     s_magic;   /∗ magic number, identifies superblock ∗/
long     s_version; /∗ version of filesystem, presently 2 ∗/
fdaddr_t s_fsize;   /∗ total size of filesystem (blocks) ∗/
fdaddr_t s_flist0;  /∗ first block of free list ∗/
fdaddr_t s_nflist;  /∗ size of free list (blocks) ∗/
fdaddr_t s_heap0;   /∗ first block of heap ∗/
fdaddr_t s_nheap;   /∗ size of heap (blocks) ∗/
fdaddr_t s_rootbn;  /∗ block # of root directory (in heap) ∗/
fdoff_t  s_rootlen; /∗ length of root directory (bytes) ∗/
/∗ pad out with 0x00 bytes to make one complete disk block ∗/
};

The heap occupies most of the filesystem and contains all directory and file data blocks.  A directory appears as one or more contiguous blocks in the heap.  Each disk block of a directory contains an array of directory entries, representing files and subdirectories within the directory. The format of a directory entry is:

struct FdDirent {
char     fd_name[FD_NAMELEN]; /∗ file name ∗/
fdaddr_t fd_offset;   /∗ block number where file begins ∗/
fdoff_t  fd_length;   /∗ in bytes  ∗/
long     fd_modtime;  /∗ time stamp ∗/
int      fd_uid;      /∗ creator’s user-ID ∗/
long     fd_mode;
#define FDS_IFMT        0xF0   /∗ file-type field ∗/
#define     FDS_IFREG   0x10   /∗ regular file ∗/
#define     FDS_IFDIR   0x20   /∗ subdirectory ∗/
};

Each directory block is filled with as many complete entries as possible; however, a directory entry never spans two blocks of a directory, so each directory block will have several unused bytes at the end.  If fd_name[0] is zero (NUL), then the entry is vacant; otherwise it is in use. If the file’s name is shorter than FD_NAMELEN bytes, fd_name is padded with zero (NUL) bytes on the right.  The space requirement of a file or directory in blocks is given by the FD_NBL macro:

#define FD_NBL(bytes) (((unsigned long)(bytes)+FD_BLOCKSIZE−1)/FD_BLOCKSIZE)

The top-level directory is called the root directory, and its position and size are given by the superblock fields s_rootbn and s_rootlen, respectively.  Every directory is a positive, integral multiple of FD_BLOCKSIZE bytes long.  Regular data files, however, can be between 0 and 2∗∗32-2 bytes long. 

A table of information about free blocks in the filesystem heap is maintained in a set of contiguous disk blocks called the free list, whose origin and length are given by the superblock fields s_flist0 and s_nflist, respectively.  The structure of the free list is as follows:

struct FdFreelist {
struct ff_h {
long     ff_magic;     /∗ magic number ∗/
#define FF_MAGIC   0xF2EEFEE
fdaddr_t ff_size;      /∗ [no longer used] ∗/
} ff_h;
struct ff_e {
fdaddr_t ff_offset;    /∗ in blocks ∗/
fdaddr_t ff_length;    /∗ in blocks ∗/
} ff_e[variable];
};

The free list is sorted in ff_offset order, and is terminated by an entry with a zero ff_offset field.  When the free list saturates, libfd can no longer account for all unallocated space and will begin to sacrifice some of it.  This poses no danger to existing files, but it does impair complete utilization of available space within the disk partition.  This condition can be relieved through use of the −c option of fdck(8).

SEE ALSO

libfd(3H), mx(4), fdmount(5), fdck(8), fdmkfs(8)

Release β  —  Last change: 6/8/89

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026