Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ bar(5) — SunOS 4.0.2

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

bar(1)

BAR(5)  —  FILE FORMATS

NAME

bar − tape archive file format

AVAILABILITY

Sun386i systems only. 

DESCRIPTION

The bar(1) tape archive command dumps several files into one, onto a medium suitable for transportation.  This format is not compatible with the format generated by tar(1). 

A “bar tape” or the barfile can be a diskette, a tape, or a regular file.  It is a series of blocks, each of size TBLOCK.  Each file stored on the tape is preceded by a header block that describes the file, followed by zero or more blocks that give the contents of the file.  At the end of the tape are two blocks filled with binary zeros, as an end-of-file indicator for the archive. 

The blocks are grouped for physical I/O operations.  Each group of n blocks (where n is set by the b function modifier on the bar(1) command line — the default is 20 blocks) is written with a single system call.  On nine-track tapes, the result of this write is a single tape record.  The last group is always written at the full size, with the last valid data followed by the two zero blocks, followed by random data.  On reading, the specified or default group size is used for the first read, but if that read returns less than a full tape block, the reduced block size is used for further reads, unless the B function modifier is used. 

The header block looks like this:

#define TBLOCK512
union hblock {
char dummy[TBLOCK];
struct header {
char mode[8];
char uid[8];
char gid[8];
char size[12];
char mtime[12];
char chksum[8];
char rdev[8];
char linkflag;
char bar_magic[2];
char volume_num[4];
char compressed;
char date[12];
char start_of_name;
} dbuf;
};

Except as noted below, the fields are zero-filled octal numbers in ASCII, each field (of width w) containing w-2 digits, a space, and a null character. 

mode is the file mode, with the top bit masked off, and does not have a space before the null character. 

uid and gid are the user and group ID numbers of the file’s owner. 

size is the size of the file in bytes, and is stored with no space before the null character.  Links and symbolic links, and special files, are dumped with this field specified as zero. 

mtime is the modification time of the file at the time it was dumped.  mtime does not contain a trailing null character. 

chksum is a decimal ASCII value that represents the sum of all the bytes in the header block.  Unused fields of the header are binary zeros and are included in chksum.  When calculating the checksum, the chksum field is treated as if it were all blanks. 

rdev is the device type, for files that are devices.  rdev does not contain a trailing null character. 

linkflag is ASCII 0 if the file is “normal” or a special file, 1 if it is an hard link, 2 if it is a symbolic link, and 3 if it is a special file (device or FIFO ).  The name linked-to, if any, is in a null terminated string, following the null terminated file name stored in start_of_name. 

bar_magic is a special number indicating that this is a bar archive. 

date is the date of the archive in the yymmddhhmm format used by date(1). 

For each file stored on the tape, the address of start_of_name is the beginning of the file name.  start_of_name is a null-terminated string.  Files dumped because they were in a directory that was named in the command line have the directory name as prefix and /filename as suffix.  The first time a given inode number is dumped, it is dumped as a regular file.  The second and subsequent times, it is dumped as a link instead.  Upon retrieval, if a link entry is retrieved, but not the file it was linked to, an error message is printed and the tape must be manually re-scanned to retrieve the linked-to file. 

An additional header block (one that does not pertain to a particular file) is written to the first block of each volume of the archive.  The volume header ID is copied to start_of_name and is a NULL string, unless a volume header is specified with the bar(1) H function modifier.  The size in the volume header is the number of bytes to skip to the start of the header for the first full file (always zero on the first volume). 

The encoding of the header is designed to be portable across machines. 

SEE ALSO

bar(1)
 

Sun Release 4.0  —  Last change: 3 May 1989

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