1 Copyright (c) 1999 Massachusetts Institute of Technology
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2 of the License, or (at
6 your option) any later version.
8 This program is distributed in the hope that it will be useful, but
9 WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16 ------------------------------
18 ;Archive device format:
20 ;The first page of an archive device file is its directory.
21 ;The remaining pages are data.
23 ;The directory may not even be looked at unless the archive is "locked".
24 .SEE LOCK,UNLOCK ;Only one ARCDEV can lock a given archive at a time.
25 ;Shuffling the directory should not be done in place, even when it is locked.
26 ;Instead, use DIRGET to make a copy and DIRPUT to store the copy back in.
27 ;When a file is open, the address of its data area is remembered in FILADR.
28 ;The data area of a file never moves, and the file can be open only in one
29 ;direction at a time, so reading or writing the data area requires no interlocking.
31 ;The format of the archive device directory is approximately that of
32 ;an I.T.S. UFD. The differences are:
34 ;In the fixed header, word 0 (UDESCP) contains SIXBIT /ARC1!!/
35 ;Word 1 points to the beginning of the name area, as in UFDs.
36 ;Word 2 points to the end of the data area.
37 ;Word 3 is used to tell when the archive needs to be cleaned
38 ; because it is being touched for the first time since the system came up.
39 ;Word 4 contains what is supposed to be the creation date of the archive.
40 ; Since locking the archive device clobbers the creation date,
41 ; we store it here so we can restore it after clobbering it.
42 ;Word 5 similarly stores the dumped bit.
44 ;There is nothing analogous to the "descriptors" in a disk UFD.
47 UDESCP==0 ;SIXBIT /ARC1!!/
48 UDNAMP==1 ;Address in directory of first filename block.
49 UDDATP==2 ;Address of first free word past data area of last file.
50 UDINIT==3 ;Time of startup of last run of system during which this
51 ;archive was cleaned (ARCCLN). If not same as startup time
52 ;of this run of the system, we must do ARCCLN.
53 UDCRDT==4 ;This word holds what ought to be the creation date
54 ;of the archive device file itself.
55 ;0 => this archive antedates the UDCRDT word, in which
56 ;case it gets set from today's date.
57 UDDMPB==5 ;This is like UDCRDT but stores the dumped bit.
59 UDNMIN==10 ;If UDNAMP is less than this, there is no room for another filename block.
61 ;In each filename block, the UNFN1, UNFN2, UNDATE and UNREF words are
62 ;just as in UFDs. The UNRNDM word is slightly different:
64 LUNBLK==5 ;Number of words in each filename block.
65 UNFN1==0 ;First file name.
66 UNFN2==1 ;Second file name.
67 UNRNDM==2 ;All kinds of random info:
68 ;The RH is the address in the file of the start of the file's data area header.
69 ;The LH contains these bits:
70 UNWRIT==4 ;Open for writing. Not actually maintained in the archive,
71 ;Just reflected to the user when he reads ARC:.FILE. (DIR).
72 UNCDEL==20 ;Delete this file when it is closed.
73 UNIGFL==24 ;Bits to ignore file
74 UNWRDC==301200,, ;Word count of last block mod 2000.
75 ;This information really lives in UHWCNT, and is just reflected
76 ;here when the user reads the image directory.
77 UNDATE==3 ;Date and time file last modified.
78 UNTIM==2200,, ;Compacted time of creation
79 UNYMD==222000,, ;Y,M,D of creation
80 UNMON==270400,, ;Month
83 UNREF==4 ;Reference date same as left half of undate
84 UNREFD==222000,, ;Reference date byte pointer
85 UNAUTH==111100,, ;MFD index of author, all 1=> no directory.
86 UNBYTE==001100,, ;File byte size and length info.
87 ;LET S=BITS PER BYTE, C=COUNT OF UNUSED BYTES IN LAST WD
88 ;400+100xS+C S=1 TO 3 C=0 TO 35.
89 ;200+20xS+C S=4 TO 7 C=0 TO 8
90 ;44+4xS+C S=8 TO 18. C=0 TO 3
91 ;44-S S=19. TO 36. C=0
92 ;NOTE THAT OLD FILES HAVE UNBYTE=0 => S=36.
95 ;The data of a file starts with two words of header information:
96 UHWCNT==0 ;Total length of the file's data, including header, in words.
97 UHREFC==1 ;RH: Number of archives using the file, in either direction.
98 ;LH: -1 if file open for writing.
100 UHBLEN==3 ;Length of this header; offset to 1st actual data word.