;<FOONEX>STORAG.MAC;25 18-Mar-81 21:17:36, Edit by MMCM
;DSK:<PEFMON>STORAG.MAC;1 12-Jun-80 20:18:30, Edit by FRENCH
;ADDED SNSOFN
;DSK:<134-TENEX>STORAG.MAC;15 18-May-80 19:38:17, Edit by PETERS
; Added crocks that seem to be needed so new IMPDV and NETWRK will assemble
;<134-TENEX>STORAG.MAC;14    28-Mar-80 20:37:30    EDIT BY PETERS
; Moved BUGTAB declaration to PARAMS
;<134-TENEX>STORAG.MAC;13     7-Dec-79 16:55:27    EDIT BY PETERS
; Removed GDSKAL from pie-slice data declarations and added CTUSED
; and CTUNPT from prime and non-prime connect time seconds per group
;<134-TENEX>STORAG.MAC;12    18-Nov-79 14:23:43    EDIT BY PETERS
;changed net buffer assignment to be conditional on rntbfs
;<134-TENEX>STORAG.MAC;11    11-Oct-79 16:16:28    EDIT BY PETERS
;made net buffer assignment condtional on not being already declared
;<134-TENEX>STORAG.MAC;10    20-Sep-78 19:53:47    EDIT BY PETERS
;<134-TENEX>STORAG.MAC;9    20-Sep-78 17:41:16    EDIT BY PETERS
;<134-TENEX>STORAG.MAC;8    20-Sep-78 15:07:24    EDIT BY PETERS
;<134-TENEX>STORAG.MAC;7    11-Feb-77 06:41:11    EDIT BY LYNCH
;<134-TENEX>STORAG.MAC;6    10-Feb-77 11:08:21    EDIT BY LYNCH
;<134-TENEX>STORAG.MAC;5    10-Feb-77 10:56:46    EDIT BY LYNCH
; FIXED UP NETWORK BUFFERS
;<134-TENEX>STORAG.MAC;4     7-Nov-76 02:08:32    TVEDIT'd by Geoff
; Added storage from NETWRK.MAC
;<134-TENEX>STORAG.MAC;3     4-MAY-76 15:15:04    EDIT BY UNTULIS
;ADDED CPUNPT SLOT IN GROUP DATA FOR NON-PRIME TIME CPU USED
;<134-TENEX>STORAG.MAC;2    18-FEB-76 16:28:31    EDIT BY UNTULIS
;CHANGED SSTSIZ TO 36000
;<135-TENEX>STORAG.MAC;5    13-NOV-75 11:16:21    EDIT BY CALVIN
; Added GDSKAL (Group DiSK ALlocation)
;<134-TENEX>STORAG.MAC;4    28-APR-75 13:54:03    EDIT BY CLEMENTS
;<134-TENEX>STORAG.MAC;3    28-APR-75 11:24:40    EDIT BY CLEMENTS
;<134-TENEX>STORAG.MAC;2    24-APR-75 12:26:38    EDIT BY CLEMENTS
;<134-TENEX>STORAG.MAC;1    23-APR-75 13:52:42    EDIT BY CLEMENTS
;NEW FILE STORAG.MAC WHICH WILL CONTAIN ALL LS, GS, ETC AREAS OF
; THE SYSTEM, TO REDUCE THE NUMBER OF CONFIGURATION-DEPENDENT FILES.

	SEARCH PROLOG
	TITLE STORAGE

;THIS MODULE CONTAINS LS, GS, NGS, NGSP, ETC MACROS, PARTICULARLY
;THOSE WHICH ARE CONFIGURATION-DEPENDENT IN SIZE OR
;IN EXISTENCE.


IFN PIESLC,<

;STORAGE FOR PIE-SLICE GROUP DATA FILE
NGSP GRPFIL,NGRPPG			;PLACE TO MAP THE FILE

TOTSHR=:GRPFIL				;TOTAL NUMBER OF SHARES

;EACH PIE-SLICE GROUP ENTRY CONTAINS THE FOLLOWING FIELDS
BEGDAT=:GRPFIL+1			;START DATE OF GROUP
CPUSED=:GRPFIL+2			;CPU TIME USED BY GROUP
SSHARE=:GRPFIL+3			;NUMBER OF SHARES OWNED BY GROUP
GRPNM=:GRPFIL+4				;GROUP NAME (SIXBIT)
CTUSED=:GRPFIL+5			;PRIME TIME CONNECT SECONDS
CPUNPT=:GRPFIL+6			;NON PRIME TIME CPU TIME
CTUNPT=:GRPFIL+7			;NON PRIME CONNECT SECONDS
;NOTE THAT THERE ARE 1 UNUSED WORDS PER GROUP ENTRY
;SRI HAS ADDED THE CPUNPT DATA WORD

;OTHER SWAPPABLE STORAGE FOR PIE-SLICE SCHEDULER
NGS NJBGRP,NGRPS		;NUMBER OF JOBS PER GROUP
NGS KFACT,1			;MULTIPLICATIVE FACTOR FOR WINDFALL
NGS PIEFLG,1			;NON-ZERO MEANS PIE SLICE DATA FILE
				;SUCCESSFULLY MAPPED
NGS GRPLOK,1			;PIE-SLICE DATA LOCK

>;END PIE-SLICE SCHEDULER CONDITIONAL

SSTSIZ==:36000		;MAX SIZE OF SWP SYM TAB
DDTSYM=:MDDT+1		;PTR TO DDT SYMTAB PTR

NGSP SWPST,SSTSIZ/1000		;SWP SYM TAB

; STUFF FOR NON-JOB0 AUTOJOB STARTUP FROM FILE

GS AUTONX,1		; STATE OF NON-JOB0 STARTUP
			; + CHARACTER POINTER TO STARTUP FILE
			; -1 DONE

LS SWPSTP,1			;POINTER TO SWAPPABLE SYMTAB
LS GOTDDT,1			;REMEMBERS IF WE HAVE MAPPED DDT

LS HSYST2,1			; LINEAR TAD OF SHUTDOWN
LS HSYST3,1			; LINEARTAD FOR NEXT MSG TYPEOUT
LS HSYST5,1			; REASON CODE FOR SHUTDOWN (A LA 1822)

NGS JOBNM2,NJOBS		;THE REAL JOB NAME, EVEN IF .OTHER

; LOGGING TTY VARIABLES

LS(LOGLCK,1)		; INTERLOCK TO PREVENT INTERMIXING MSGS
LS(LLGLCK,1)		; PC OF LAST LOCKER
LS(FLGLCK,1)		; FORKX OF LAST LOCKER

;STORAGE FOR CRJOB
;
NGS JOBONT,NJOBS	;JOB NUMBER WHICH OWNS ANOTHER JOB (IE CREATED 
			; IT), OR -1 IF NOT OWNED.
NGS CRJONJ,1		;DURING THE JSYS, JOB NUMBER CREATING NEW JOB
NGS CRJAC1,1		;AC1 FROM CREATOR TO CREATEE FOR EXEC0
NGS CRJOJC,1		;CAPABILITIES WORD OF CREATOR AT TIME OF JSYS
NGS CRJUSR,10		;NAME STRING WHICH NEW JOB WILL BE LOGGED IN AS.
NGS CRJPSW,10		;PASSWORD FOR LOGIN OF NEW JOB
NGS CRJACT,11		;ACCOUNT FOR LOGIN. AND STRING SPACE FOR IT
NGS CRJFIL,40		;FILE NAME STRING TO RUN IN NEW JOB.
NGS CRJEVO,1		;OFFSET IN ENT VEC FOR FILE TO RUN
NGS CRJFAC,20		;AC'S TO PUT INTO FORK BEING RUN
NGS CRJTTY,1		;TTY NUMBER FOR NEW JOB, OR -1 IF TO BE DETACHED
NGS CRJEXF,1		;EXEC FLAG WORD REQUESTED
NGS CRJPJF,1		;PRIMARY JFN'S FOR NEW JOB

; Resident storage for file system

LS(DIOFN,NDSKS)		; Ofn for directory index file
LS(FDOFN,NFDIB*NDSKS)	; Table of ofns for fd
LS(FDLOFN,NDSKS)	; Long file ofn for fd
LS(SNSOFN,NDSKS)	; DISK ERROR SENSITIVE RANGE OFNS (START,,END)


; Storage for NETWRK.MAC, configuration dependent.
IFDEF IMPCHN,<

LS(LSKT,NSKT)		; Local socket number
LS(FSKT,NSKT)		; Foreign socket number
LS(NETAWD,NSKT)		; B0-8 -- foreign host number (777 for none)
			; B9-17 -- link number (0 for none)
			; B18-23 -- time-out countdown
			; B24-26 -- unused
			; B27-35 -- index to link table
LS(NETHST,NSKT)		; Foreign host number (-1 if none)
LS(NETBAL,NSKT)		; Bits of allocation
LS(NETDAL,NSKT)		; Desired level of bit allocation
LS(NETBUF,NSKT)		; B0-17 -- bytes per buffer
			; B18-35 -- buffer location -1 (0 for none)
LS(NETSTS,NSKT)		; B0-3 -- fsm state
			; B4-11 -- flag bits
			; B12-17 -- bit stream byte size
			; B18-35 -- MESSAGE COUNT STATISTICS
LS(NETFRK,NSKT)		; B0-b5 -- interrupt channel for ins
			; B6-B11 -- UNUSED
			; B12-B17 -- FSM STATE CHANGE INTERRUPT CHANNEL
			; B18-b35 -- forkx of fork to interrupt
LS(NETBTC,NSKT)		; BIT COUNT STATISTICS
LS(NCPLCK)		; Lock to prevent DOFSM confusion
LS(NCPLLK)		; FORKX OF LAST NCPLCK LOCKER
LS(NCPLCN)		; COUNT OF NCPLCK LOCKS
LS(NCPLFC)		; COUNT OF NCPLCK FAILURES
LS(ASNTBC)		; ASNTBF TRAFFIC COUNTER
LS(NETCNC)		; Count of total conections opened
LS(FUNNYC)		; Count of funny inputs to fsm

IFNDEF RNTBFS,<
NGSP NTBUFS,NNTBFS/1000	; NETWORK BUFFERS
>

LS(NETFRE,7)		; Net buffer free list header
LS ASNTHR,1		; Buffer space low threshold

; Storage associated with TCP.
; Cells needed whether or not TCP is loaded.

LS TCPNFI,1		; Number of free input buffers
LS TCPFRI,1		; List of free input buffers
LS TCPNFB,1		; List of empty output buffers
LS TCPFLG,1		; AOS to wakeup TCP fork
LS TCPON,1		; Non-0 if TCP is enabled
LS TCPIBI,1		; TCP (Internet Gateway) input queue input pointer
LS TCPIBO,1		; TCP (Internet Gateway) input queue output pointer
LS TCPOBI,1		; TCP (Internet Gateway) output queue input pointer
LS TCPOBO,1		; TCP (Internet Gateway) output queue output pointer

> ; END OF CONDITION ON IMPCHN

;STORAGE FOR CHAOSNET
IFDEF CHAOS,<

;PACKET SIZES (GLOBALS SO EVERYONE CAN GET AT THEM)
LS CHPMXC			;MAXIMUM NUMBER OF DATA BYTES LEGAL IN A PACKET
LS CHPMXT			;MAXIMUM NUMBER OF DATA BYTES ALLOWED IN FE PACKET
LS CHPMXW			;MAXIMUM NUMBER OF WORDS THEREIN

LS CHAON,1			;NON-ZERO CHAOS NET IS ENABLED
LS CHASDS,1			;DEVICE STATUS
LS MYCHAD,1			;MY ADDRESS ON THE NETWORK
LS NPKSIN,1			;NUMBER OF PACKETS IN FROM INTERFACE
LS NPKSOU,1			;NUMBER OF PACKETS OUTPUT TO INTERFACE
LS MXTWIN,1			;MAXIMUM WINDOW SIZES FOR XMISSION AND
LS MXRWIN,1			; RECEPTION
LS NMWIND,1			;NOMINAL WINDOW SIZE
LS CHAFLG,1			;CURRENT REQUESTS FOR CHAOS BACKGROUND FORK
NR CHAPFG,1			;LAST STATE OF CHAFLG AT START OF BACKGROUND CYCLE
LS CHABFT,1			;TODCLK SET BY BACKGROUND FORK ON EACH CYCLE
LS CHABFW,1			;WHERE THE BACKGROUND FORK IS NOW (FOR DEBUGGING)
NR CHAONL,1			;VALUE OF CHAON LAST TIME CHAOS FORK LOOKED
NR CHAONC,1			;-1: NET JUST WENT DOWN, 1: JUST CAME UP
LS CHAFHN,1			;CHAOS NET FORK HANDLE
LS CHATIM,1			;TIME (TODCLK) OF NEXT BASIC CHAOS FORK CYCLE
NR CHATM1,1			;TIME OF NEXT TIMEOUT PASS
NR CHATMA,1			;PARALLEL FLAGS FOR THE ABOVE 2 CLOCKS
NR CHAT1A,1			; COMING DUE
NR CHATM2,1			;TIME OF NEXT RFC MATCHING PASS
LS CHNGTM,1			;TIME FOR NEXT NEGOTIATION TIMEOUT CHECKS
LS CTMSTM,1			;TIME FOR NVT SENDALL CHECKS
LS CVTPTR,1			;AOBJN PTR FOR CHAOS NVTS
LS CHCNLK,1			;CONNECTION TABLE LOCK
LS CHANPD,1			;NUMBER OF PACKETS DISCARDED
LS CHANPO,1			;NUMBER OF PACKETS ACTUALLY SENT OVER TO -11
LS CHANOL,1			;NUMBER OF TIMES WE WANTED TO GO OVER -11 LIMIT
LS CHNPO1,1			;NUMBER OF PACKETS OUTSTANDING IN -11 STILL
LS CHNPOW,1			;WATCHDOG FOR CHNPO1
LS CHNPWT,1			; AND TIMER FOR CHNPOW
LS CHALRW,1			;LOCAL-ROUTING NEXT-CYCLE TIME
LS CHNPF,1			;NUMBER OF PACKETS FORWARDED
LS CHNPKI,1			;NUMBER OF PACKETS INPUT FROM -11
LS CHNSNS,1			;NUMBER OF SNS PACKETS SENT
LS CHNSTS,1			;NUMBER OF STS PACKETS SENT
LS CHNRTR,1			;NUMBER OF RETRANSMISSIONS
LS CHNPOL,1			;NUMBER OF PACKETS ROUTED LOCALLY
LS CHNNRS,1			;NUMBER OF TIMES NO PKT STORAGE AT PI LEVEL
LS CHQLCL,1			;LOCALLY-ROUTED PACKETS-IN-TRANSIT Q
				; (PACKETS LINKED THROUGH XMIT ACTIVE IN PKTLNK)
LS CHQRFC,1			;INCOMING RFC QUEUE
LS CHQRFP,1			;PACKET RFC FORK IS LOOKING AT
LS CHRFLK,1			;LOCK FOR RFC TABLE
NR RFCTAB,CHRFMX		;RFC LISTENING TABLE
LS CHRFHC,1			;GLOBAL RFC-HANDLER CONNECTION
LS CHACON,MAXCON		;RESIDENT CONNECTION TABLE
LS MYHNAM,^D50/5		;MY OFFICIAL HOST NAME (FROM HOSTS2)
LS MYHTIM,1			;LIMIT FOR WAIT ON MYCHAD TO APPEAR FROM -11
LS CHPIOF,1			;USED FOR PI LOCKING
LS CHPIDF,1			;USED TO HANDLE NESTED PI LOCKING
LS CHATTW,NTTCVT+1		;NVTS-WITH-DATA-WAITING QUEUE
LS CHAPRO,1			;206 CHAOSNET PROTECTION FLAG
NR CHOSTP,1			;HAVE A HOST TABLE IN CHOSTB WHEN NON-ZERO
NR CHANET,1			;CHAOS NET NUMBER FROM HOST2
NR CHANAO,1			;OFFSET OF CHAOSNET ADDRESS TABLE IN CHOSTB
NRP CHOSTB,<CHST2P*PGSIZ>	;HOSTS2.BIN IMAGE FOR HOSTNAME LOOKUPS
IFN 0,<
LS CHARPQ,1			;OUTGOING ARPANET QUEUE
>
>;IFDEF CHAOS

; Variables in psb associated with files

PS(CAPMSK)
PS(CAPENB)
PS(PRIMRY)		; Primary io indirection pointers
PS(LSTERR)		; Last error number
PS(ERRSAV,10)		; Block of error parameters

; Variables in jsb associated with files

DEFINE JFS(SYM)<ASSIGN SYM,JFNPC,1>
ASSIGN JFN0,JFNPC,0
JFS(FILBYT)		; Byte pointers to current window
JFS(FILBYN)		; Byte number of current byte
JFS(FILLEN)		; Total length of file in bytes
JFS(FILCNT)		; Bytes remaining in current buffer
JFS(FILLCK)		; File lock word
JFS(FILWND)		; Lh ==> current page number
			; Rh ==> location of current window
JFS(FILSTS)		; Lh ==> file status bits
			; Rh ==> device dependent dispatch address
JFS(FILDEV)		; Device dependent  information
JFS(FILOFN)		; Lh ==> ofn for this file
			; Rh ==> ofn of long file pt table
JFS(FILLFW)		; Lh ==> current page table number
			; Rh ==> location of page table table
JFS(FILDDN)		; Lh ==> pointer to device string block
			; Rh ==> directory number
JFS(FILNEN)		; Lh ==> pointer to file name string block
			; Rh ==> pointer to extension string block
JFS(FILVER)		; Lh ==> fork number of originator of this jfn
			; Rh ==> version number
JFS(FILDNW)		; Lh ==) ptr to directory wild card string block
			; Rh ==) ptr to name wild card string block
JFS(FILEXW)		; Lh ==) ptr to extension wild card string block
			; Rh ==) ptr to retype buffer
			; *** Word 16 UNUSED ***

; The following variables overlay the space in the above definitions
; This is possible since they are used only during gtjfn

ASSIGN	FILTMP,FILBYT,0	; Lh ==>0 ptr to temp string block for default
			; Rh ==>0 point to temp string block
ASSIGN	FILPRT,FILBYN,0	; Pointer to protection string or protection #
ASSIGN	FILACT,FILLEN,0	; Pointer to account string or account number
ASSIGN	FILOPT,FILWND,0	; Byte pointer to store string in gtjfn

IFDEF CHAOS,<
ASSIGN FILBFO,FILDNW,0	;OUTPUT BUFFER
ASSIGN FILBFI,FILEXW,0	;INPUT BUFFER
JFS(FILBCT)		;BYTE COUNTS OUTPUT,,INPUT
JFS(FILCOD)		;OUTPUT BUFFER PACKET ADDRESS
>

JS(JFNLCK)		; Lock to prevent tampering with jfn's
JS(MAXJFN)
JS(JOBUNT)		; CONNECTED DSK UNIT
JS(JBCLCK)		; LOCK FOR ASGPAG
JS(JBCOR,4)		; Page allocation bit table
JS(JSBFRE,7)		; Job area free storage header
JS(JSFREE,IJSFRE)	; Free storage area in job block

	END ; OF STORAG.MAC

