Consolidate license copies
[its.git] / system / fsdefs.43
1 ;;; Copyright (c) 1999 Massachusetts Institute of Technology
2 ;;;
3 ;;; This program is free software; you can redistribute it and/or
4 ;;; modify it under the terms of the GNU General Public License as
5 ;;; published by the Free Software Foundation; either version 3 of the
6 ;;; License, or (at your option) any later version.
7 ;;;
8 ;;; This program is distributed in the hope that it will be useful,
9 ;;; but 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.
12 ;;;
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
17 .AUXIL
18
19 IFNDEF DEFSYM,[ ;ALLOW USER TO USE SYMBOLS IN OTHER WAYS IF HE WISHES.
20                 ;BUT NORMALLY, DEFSYM FOO==BAR DOES FOO==BAR WITH ERROR CHECK.
21 DEFINE DEFSYM X/
22 IRPS Z,,[X]
23 IFNDEF Z,X
24 .ELSE [
25    $$TEM1==Z
26    X
27    IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/`
28 ]
29 .ISTOP
30 TERMIN TERMIN
31
32 IFLE .MLLIT,.ERR .MLLIT MUST BE 1; SETTING IT TO 1.
33 .MLLIT==1
34 $$TEMP==1
35 ]
36 .ELSE $$TEMP==0
37 \f
38 ;FILE SYSTEM PARAMETERS - APPLIES TO ALL ITS MACHINES
39
40 ;9/5/79 - tut format changed!
41 ;8/19/90 - DM "funny" bit flushed
42
43 ;MFD INFO
44
45 IFDEF NBLKS,[                   ;MFDBLK KNOWN ONLY IF .INSRT APPROPRIATE PHYSICAL PARAMS FILE
46 DEFSYM  MFDBLK==NBLKS/2-1       ;LOC ON DISK
47 DEFSYM  MFDCYL==MFDBLK/NBLKSC
48 DEFSYM  MFDSRF==<MFDBLK-MFDCYL*NBLKSC>*SECBLK/NSECS
49 DEFSYM  MFDSEC==<MFDBLK-MFDCYL*NBLKSC>*SECBLK-MFDSRF*NSECS
50 ]
51                 ;RANDOM INFO IN MFD
52 DEFSYM  MDNUM==0        ;ASCENDING DIR NUM
53 DEFSYM  MDNAMP==1       ;PNTR TO ORG OF USER NAME BLOCK AREA
54 DEFSYM  MDYEAR==2       ;CURRENT YEAR
55 DEFSYM  MPDOFF==3       ;DE-CORIOLIS CLOCK OFFSET
56 DEFSYM  MPDWDK==4       ;PREFERRED WRITING DISK (PHYSICAL DRIVE #)
57 DEFSYM  MDCHK==5        ;THIS WORD MUST BE M.F.D. (FOR CHECKING)
58 DEFSYM  MDNUDS==6       ;NUMBER USER DIRECTORIES (FOR CHECKING ONLY)
59 DEFSYM  LMIBLK==7       ;TOTAL STG USED BY HACKS LIKE THIS
60                 ;USER NAME BLKS FROM C(MDNAMP) TO END
61 DEFSYM  LMNBLK==2       ;# WDS/BLK
62 DEFSYM  MNUNAM==0       ;6BIT USER NAME
63  ;SECOND WORD OF A USER-NAME BLOCK IS ZERO.
64  ;DECUUO CONTAINS A KLUDGE WHICH DEPENDS ON THIS,
65  ;PLEASE NOTIFY BUG-DECUUO BEFORE CHANGING IT.
66
67 ;TUT INFO
68
69 IFDEF NBLKS,[
70 DEFSYM  TUTBLK==MFDBLK-NTUTBL   ;LOC ON DISK
71 DEFSYM  TUTCYL==TUTBLK/NBLKSC
72 DEFSYM  TUTSRF==<TUTBLK-TUTCYL*NBLKSC>*SECBLK/NSECS
73 DEFSYM  TUTSEC==<TUTBLK-TUTCYL*NBLKSC>*SECBLK-TUTSRF*NSECS
74 ]
75 DEFSYM  TUTBYT==3               ;SIZE OF BYTES (USED TO BE 4)
76 DEFSYM  TUTBP==<440000+TUTBYT_6>,,
77 DEFSYM  TUTEPW==36./TUTBYT      ;NUMBER OF ENTRIES PER WORD
78 DEFSYM  TUTMAX==1_TUTBYT
79 DEFSYM  TUTLK==TUTMAX-1         ;HIGHEST CODE MEANS LOCKED OUT
80 DEFSYM  TUTMNY==TUTLK-1         ;TUT MANY OR MORE REFS
81
82 ;RANDOM INFO IN TUT (AT THE FRONT)
83 DEFSYM  QPKNUM==0               ;PACK #
84 DEFSYM  QPAKID==1               ;PACK ID
85 DEFSYM  QTUTP==2                ;FREE SPACE POINTER TO TRACK AREA.  ADVANCE BY CYLINDERS
86 DEFSYM  QSWAPA==3               ;SWAPPING AREA.  FIRST TRACK OF NON-SWAPPING AREA
87                                 ;NEW FILES WILL NOT BE WRITTEN LOWER THAN THIS.
88 DEFSYM  QFRSTB==4               ;FIRST BLOCK TUT'ED
89 DEFSYM  QLASTB==5               ;LAST BLOCK TUT'ED
90 DEFSYM  QTRSRV==6               ;-1 IF ONLY ALLOCATED DIRS CAN HAVE FILES ON THIS PACK
91                                 ;IF NOT 0 AND NOT -1, SIXBIT NAME OF "SECONDARY" PACK
92                                 ;STG FOR RANDOM INFO ^
93 DEFSYM  LTIBLK==20              ;BYTES MAPPING THE DISK START HERE
94 \f
95 ;UFD INFO
96 ;IF A IS RELATIVE LOCATION OF MFD ENTRY, USER DIR IS LOCATED IN
97 ;TRACK NUMBERED <A-2000+2*MDNUDS>/2  (SEE QFL2)
98
99 DEFSYM  UFDBYT==6               ;SIZE OF BYTES (Do not change!)
100 DEFSYM  UFDBPW==36./UFDBYT      ;NUMBER OF BYTES PER WORD
101
102                 ;RANDOM INFO IN UFD
103 DEFSYM  UDESCP==0       ;FS PNTR TO DESC AREA
104 DEFSYM  UDNAMP==1       ;PNTR TO ORG OF NAME AREA
105 DEFSYM  UDNAME==2       ;USER NAME (FOR CHECKING)
106 DEFSYM  UDBLKS==3       ;LEFT HALF HAS AMOUNT OF SPACE ALLOCATED (NOT USED
107                         ; CURRENTLY BY SYSTEM), RIGHT HALF HAS NUMBER OF BLOCKS USED.
108 DEFSYM  UDALLO==4       ;IF NONZERO, LEFT HALF HAS DISK NUMBER, RIGHT
109                         ; HALF HAS AMOUNT OF SPACE ALLOCATED
110 DEFSYM  UDDESC==11.     ;FIRST LOC AVAIL FOR DESC
111
112 ; 8/19/90 Due to the larger size of RP07s it was necessary to officially
113 ; flush the DM "funny" bit.  This change only changes the comments in this
114 ; file, but any program that interprets UFD descriptors needs to be fixed
115 ; to not mask that bit out (as most of them currently do).  Fortunately all
116 ; the known ITS filesystems have zeros in all their "funny" bits, so the
117 ; change is upward compatible.
118
119 ; UFD descriptor format described:
120 ;
121 ; Each 6-bit byte is taken in turn and used to compute a sequence of block
122 ; numbers.  If N is the current descriptor byte, and B is the current block
123 ; number (initially undefined), then N is interpreted as follows: 
124 ;
125 ;  0  Marks the end of the file description.
126
127 ;  1 to UDTKMX  (1 to 14)               "Take" N blocks.
128 ;       Blocks B through B + N - 1 are the next N blocks of the file.
129 ;       Set B := B + N .
130
131 ;  UDTKMX+1 to UDWPH-1  (15 to 36)      "Skip" B - UDTKMX blocks.
132 ;       Set N := N + B - UDTKMX .
133 ;       (ITS has been broken for years such that it never uses this
134 ;       UFD descriptor code!)
135
136 ;  UDWPH  (37)                          Write Place Holder
137 ;       A noop.  Used to reserve space in directories for files that are
138 ;       being written.  Just skip over it and read the next byte.
139
140 ;  40 - 77                              Load address and take 1.
141 ;       Read the next NXLBYT descriptor bytes (NXLBYT=2), N2 and N3.
142 ;       Set B := LSH(AND(N, 37), 12.) + LSH(N2, 6) + N3 .
143 ;       Block B is the next block in the file.
144 ;       Set B := B + 1 .
145 ;
146 ; A zero length file is described as two bytes: UDWPH then 0.  UDWPH does
147 ; not otherwise normally appear in UFD descriptions for closed files.
148 ; Note that a legal description must use codes 40 - 77 before it can use
149 ; any code other than UDWPH.
150
151 ; Links are described as a sequence of SIXBIT characters terminated with a
152 ; 0 byte.  The directory, first and second name are stored in order.
153 ; The first two components are terminated with a ";" if they are less than
154 ; 6 characters long.  ";" (73), ":" (72) and " " (0) are quoted by
155 ; preceding them with a ":".  Some examples:
156 ;
157 ; Link target names:            Bytes stored in directory:
158 ;
159 ; 123456 123456 123456          "123456123456123456 "
160 ; ALAN   FOO    BAR             "ALAN;FOO;BAR "
161 ; .MAIL. NAMES  >               ".MAIL.NAMES;> "
162 ; .MAIL.  LISTS   MSGS          ".MAIL.: LISTS: : MSGS "
163 ; MOON   LUNAR  :EJ             "MOON;LUNAR;::EJ "
164 ;
165 ; There are a lot of illegal or wasteful possibilities for link descriptors
166 ; ("A;B ", "A;B;C;D ", ":A;:B;:C ", etc.), which is suprising since
167 ; somebody was clearly trying to compress them into as few bytes as
168 ; possible.
169
170 ; Here is the pre 8/19/90 comment describing UFD descriptors:
171
172 ;       ;UFD DESCRIPTORS
173 ;       ;0 => FREE  1-UDTKMX => TAKE NEXT N
174 ;       ;UDTKMX+1 THRU UDWPH-1 => SKIP N-UDTKMX AND TAKE ONE
175 ;       ;UDWPH => WRITE-PLACE-HOLDER
176 ;       ;40 BIT SET => LOAD ADDRESS.  LOWER 5 BITS PLUS NEXT NXLBYT (2)
177 ;       ;  CHARS (17 BITS IN ALL)
178 ;       ;40 BIT & 20 BIT => "FUNNY" BLOCK IF DMDSK.  WHAT IS THIS, ANYWAY?
179 ;       ;END BY 0
180
181 ;       ;IF LINK DESCR
182 ;       ;6 CHAR OR UNTIL ; = SYS NAME.  MUST HAVE NO CHAR = 0 IN THIS OR
183 ;       ; NEXT 2 NAMES 
184 ;       ;NEXT CHAR QUOTED BY : (FOR NAMES WITH : OR ;)
185 ;       ;NEXT CHAR N1
186 ;       ;NEXT CHAR N2
187 ;       ;END BY 0
188
189 DEFSYM  UDTKMX==12.             ;HIGHEST "TAKE N" CODE
190 DEFSYM  UDWPH==31.              ;PLACE HOLDER ON WRITE (OR NULL FILE)
191 DEFSYM  UDSKMX==UDWPH-UDTKMX-1  ;# BLOCKS THAT CAN BE SKIPPED
192 DEFSYM  NXLBYT==2               ;# ADDITIONAL BYTES FOR LOAD ADDR
193                                 ;IN SYSTEM THIS IS DEFINED AT FRONT OF FILE
194
195         ;NAME AREA DATA
196
197 DEFSYM  LUNBLK==5       ;WDS/NAME BLK
198 DEFSYM  UNFN1==0        ;FIRST FN
199 DEFSYM  UNFN2==1        ;SECOND FN
200 DEFSYM  UNRNDM==2       ;ALL KINDS OF RANDOM INFO
201 DEFSYM          UNDSCP==1500,,          ;PNTR TO DESC
202 DEFSYM          UNPKN==150500,,         ;PACK #
203 DEFSYM          UNLINK==1               ;LINK BIT
204 DEFSYM          UNLNKB==220100,,
205 DEFSYM          UNREAP==2               ;IF 1, DONT REAP FILE
206 DEFSYM          UNWRIT==4               ;OPEN FOR WRITING
207 DEFSYM          UNMARK==10              ;GC MARK BIT
208 DEFSYM          UNCDEL==20              ;DEL WHEN CLOSED
209 DEFSYM          DELBTS==20              ;DELETED -- IGNORE
210 DEFSYM          UNIGFL==24              ;BITS TO IGNORE FILE
211 DEFSYM          UNWRDC==301200,,        ;WORD COUNT OF LAST BLOCK MOD 2000
212 DEFSYM          UNDUMP==400000          ;HAS BEEN DUMPED
213 DEFSYM  UNDATE==3       ;DATE ETC.
214 DEFSYM          UNTIM==2200,,           ;COMPACTED TIME OF CREATION
215 DEFSYM          UNYMD==222000,,         ;Y,M,D OF CREATION
216 DEFSYM          UNMON==270400,,         ;MONTH
217 DEFSYM          UNDAY==220500,,         ;DAY
218 DEFSYM          UNYRB==330700,,         ;YEAR
219 DEFSYM  UNREF==4        ;REFERENCE DATE SAME AS LEFT HALF OF UNDATE
220 DEFSYM          UNREFD==222000,,        ;REFERENCE DATE BYTE POINTER
221 DEFSYM          UNAUTH==111100,,        ;MFD INDEX OF AUTHOR, ALL 1=> NO DIRECTORY
222 DEFSYM          UNBYTE==001100,,        ;FILE BYTE SIZE AND LENGTH INFO.
223                         ;LET S=BITS PER BYTE, C=COUNT OF UNUSED BYTES IN LAST WD
224                         ;400+100xS+C    S=1 TO 3        C=0 TO 35.
225                         ;200+20xS+C     S=4 TO 7        C=0 TO 8
226                         ;44+4xS+C       S=8 TO 18.      C=0 TO 3
227                         ;44-S           S=19. TO 36.    C=0
228                         ;NOTE THAT OLD FILES HAVE UNBYTE=0 => S=36.
229 \f
230 IF1 IFDEF NUDSL, IFG NUDSL*LMNBLK+LMIBLK-2000,.ERR MFD LOSES
231
232 IFN $$TEMP,EXPUNG DEFSYM