Trailing-Edge
-
PDP-10 Archives
-
cuspbinsrc_1of2_bb-x128c-sb
-
10,7/backup/usgsub.mac
There are 2 other files named usgsub.mac in the archive. Click here to see a list.
TITLE USGSUB - SUBROUTINE PACKAGE TO INTERFACE BACKUP TO THE ACTDAE
SUBTTL C.D.O'Toole/CDO 22-AUG-85
SEARCH UUOSYM,ACTSYM
;COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1980,1981,1984,1986. ALL RIGHTS RESERVED.
;
;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
;ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE
;INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER
;COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
;OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY
;TRANSFERRED.
;
;THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE
;AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT
;CORPORATION.
;
;DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS
;SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.
;THIS PACKAGE HAS ONLY BEEN TESTED WITH BACKUP AND PERFORMS THE FUNCTIONS
; REQUIRED BY IT TO IMPLEMENT USAGE ACCOUNTING FOR DISK FILES. NO
; OTHER SUPPORT IS IMPLIED.
;AC DEFINITIONS PARALLEL THOSE FOUND IN BACKUP
T1=1 ;TEMP AC
T2==T1+1 ;...
T3==T2+1 ;...
T4==T3+1 ;...
P1==T4+1 ;PERMANENT AC
P2==P1+1 ;...
P3==P2+1 ;...
P4==P3+1 ;...
P==17 ;A STACK
.BCOPY
COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1980,1986. ALL RIGHTS RESERVED.
\;END COPYRIGHT MACRO
.ECOPY
;LOCAL STORAGE
IPCBLK: BLOCK 4 ;BLOCK FOR IPCF SEND
DCHBLK: BLOCK 2 ;BLOCK FOR DSKCHR
USGTAB: BLOCK 1 ;ADDRESS OF THE ACCOUNT STRING DATA BLOCKS
USGDAT: BLOCK UB$ACT ;DATA FOR ACCOUNTING
STRLEN==<UB$END-UB$ACT> ;SIZE OF DATA FOR INDIVIDUAL ACCOUNT STRINGS
CORREQ==<STRLEN*UB$MAC> ;AMOUNT OF CORE REQUIRED FOR ACCOUNT STRINGS
;USGINI -- INITIALIZE THE PACKAGE. CALLED WHEN BACKUP DISCOVERS IT IS
; DOING A "SAVE" OPERATION AND "/USAGE" HAS BEEN SPECIFIED.
;RETURNS CPOPJ IF CANNOT GET ENOUGH CORE TO ALLOCATE ACCOUNTING TABLES.
USGINI::MOVEI T1,CORREQ ;AMOUNT REQUIRED
ADD T1,.JBFF## ;COMPUTE NEW FIRST FREE
CAMG T1,.JBREL## ;SEE IF IT FITS
JRST USGIN1 ;IT DOES, GO CLEAN IT UP A LITTLE
CAIG T1,377777 ;TOO LARGE? (BACKUP RESTRICTION)
CORE T1, ;NO, ALLOCATE THE CORE
POPJ P, ;GIVE FAIL RETURN TO CALLER
USGIN1: MOVE T1,.JBFF## ;WHERE IT IS
MOVEM T1,USGTAB ;SAVE BASE
MOVEI T1,CORREQ ;AMOUNT ACQUIRED AGAIN
ADDM T1,.JBFF## ;UPDATE FIRST FREE
AOS (P) ;GIVE GOOD RETURN
POPJ P, ;RETURN
;USGDIP -- PROTECTION FAILURE ON UFD OR SOME FILE (EITHER USGDIP OR
;USGFIP -- USGFIP). T1 = EXTENDED LOOKUP BLOCK THAT FAILED
USGDIP:: HLRZ T2,.RBEXT(T1) ;GET THE EXTENSION
CAIE T2,'UFD' ;IS THIS THE UFD
JRST USGFIP ;NO, SFD, TREAT SAME AS A FILE PROTECTION FAILURE
MOVSI T2,'Y ' ;GET 'YES'
MOVEM T2,USGDAT+UB$UPF ;FLAG IT FOR DOWN STREAM BILLING
POPJ P, ;AND RETURN
USGFIP:: MOVSI T2,'Y ' ;GET 'YES'
MOVEM T2,USGDAT+UB$FPF ;FLAG A FILE IS PROTECTED FOR DOWN STREAM BILLING
POPJ P, ;AND RETURN
;USGNST -- NEW STRUCTURE TO BE SAVED, T1 = DISK STRUCTURE NAME
USGNST:: MOVEM T1,DCHBLK ;STORE FOR DSKCHR
MOVE T1,[1,,DCHBLK] ;ARG FOR DSKCHR
DSKCHR T1,UU.PHY ;DO IT FOR PHYSICAL STRUCTURE
SETZB T1,DCHBLK ;WHAT!
MOVEM T1,DCHBLK+1 ;SAVE CHARACTERISTICS FOR LATER
POPJ P, ;RETURN
;USGNDI -- BEGIN ACCOUNTING FOR A NEW DIRECTORY. CALLED WHEN BACKUP
; LOOKUPS A UFD OR SFD. T1 = THE EXTENDED LOOKUP BLOCK.
USGNDI:: HLRZ T2,.RBEXT(T1) ;GET THE EXTENSION
CAIE T2,'UFD' ;THIS THE UFD
JRST USGFIL ;NO, SFD, COUNT IT AS A FILE
SETZM USGDAT ;CLEAR DATA AREA
MOVE T2,[USGDAT,,USGDAT+1]
BLT T2,USGDAT+UB$ACT-1
MOVSI T2,(ASCII/N/) ;GET ASCII 'NO' INDICATOR
MOVEM T2,USGDAT+UB$EXP ;SET NOT EXPIRED
MOVSI T2,'N ' ;GET SIXBIT 'NO' INDICATOR
MOVEM T2,USGDAT+UB$UPF ;UFD IS NOT BEEN PROTECTED AGAINST US
MOVEM T2,USGDAT+UB$FPF ;NOR HAS ANY PARTICULAR FILE
MOVEM T2,USGDAT+UB$ABO ;AND THERE HASN'T BEEN AN OVERFLOW OF STRINGS
MOVE T2,.RBNAM(T1) ;THE PPN
MOVEM T2,USGDAT+UB$PPN ;SAVE IT
MOVE T2,.RBQTF(T1) ;FCFS QUOTA
MOVEM T2,USGDAT+UB$QIN ;SAVE IT
MOVE T2,.RBQTO(T1) ;LOGGED OUT QUOTA
MOVEM T2,USGDAT+UB$QOU ;SAVE IT
MOVE T2,.RBLAD(T1) ;LAST ACCOUNTING DATE/TIME
MOVEM T2,USGDAT+UB$LAT ;STORE THAT
LDB T2,[POINT 11,.RBPRV(T1),23] ;CREATION TIME (RB.CRT) = LAST LOGIN
HRRM T2,USGDAT+UB$LLG ;STORE TIME
LDB T2,[POINT 12,.RBPRV(T1),35] ;LOW ORDER DATE (RB.CRD)
HRLM T2,USGDAT+UB$LLG ;STORE DATE
LDB T2,[POINT 3,.RBEXT(T1),20] ;HIGH ORDER EXTENDED DATE (RB.CRX)
DPB T2,[POINT 3,USGDAT+UB$LLG,5] ;COMPLETE DATE
MOVE T2,[%CNDTM] ;GET "NOW"
GETTAB T2, ;GET IT
POPJ P, ;WHAT!
MOVEM T2,.RBLAD(T1) ;NOW IS THE LAST ACCOUNTING DATE/TIME
CAMLE T2,.RBDED(T1) ;CHECK EXPIRATION
SKIPN .RBDED(T1) ;YES, BUT WAIT, DO WE KNOW THE EXPIRATION DATE
SKIPA T2,[ASCII/N/] ;NOT EXPIRED
MOVSI T2,(ASCII/Y/) ;IS EXPIRED
MOVEM T2,USGDAT+UB$EXP ;SET EXPIRED CORRECTLY
POPJ P, ;DON'T COUNT UFD PROPER IN ACCOUNTING
;USGFIL -- ACCOUNT FOR A FILE. CALLED WHEN BACKUP LOOKUPS THE FILE.
; T1 = EXTENDED LOOKUP BLOCK.
USGFIL:: PUSH P,P1 ;SAVE CALLERS
PUSH P,P2 ;...
PUSH P,P3 ;...
MOVE T2,USGDAT+UB$ACN ;NUMBER OF UNIQUE ACCOUNT STRINGS SO FAR
MOVE P1,USGTAB ;GET BASE OF THE TABLES
JUMPE T2,USGFI5 ;FIRST ACCOUNT STRING
USGFI1: MOVEI T3,10 ;NUMBER OF WORDS IN AN ACCOUNT STRING
MOVEI P2,UB$ACT-UB$ACT(P1) ;POINT TO THE STRING
MOVEI P3,.RBACT(T1) ;...
USGFI2: MOVE T4,(P2) ;GET WORD FROM ACCOUNT STRING
CAME T4,(P3) ;MUST HAVE EXACT MATCH FOR ALL WORDS
JRST USGFI4 ;NO MATCH, TRY NEXT TABLE
AOS P2 ;NEXT WORD IN STRING
AOS P3 ;...
SOJG T3,USGFI2 ;MATCH THEM ALL UP
;HERE WE HAVE THE MATCHING ACCOUNT STRING TABLE IN P1
USGFI3: SKIPE P1 ;P1 = 0 IF NO MORE ROOM FOR ACCOUNT STRINGS
AOS UB$NFL-UB$ACT(P1) ;BUMP NUMBER OF FILES
AOS USGDAT+UB$TNF ;BUMP COUNT OF FILES
MOVE T2,.RBALC(T1) ;GET ALLOCATED LENGTH OF FILE
SKIPE P1
ADDM T2,UB$BAL-UB$ACT(P1) ;ADD IN UNDER THIS ACCOUNT STRING
ADDM T2,USGDAT+UB$TAU ;ADD IT IN
MOVE T2,.RBSIZ(T1) ;GET FILE SIZE (WORDS WRITTEN)
ADDI T2,177 ;ROUND UP TO FULL DISK BLOCKS
LSH T2,-7 ;/128
SKIPE P1
ADDM T2,UB$BWR-UB$ACT(P1) ;ADD IN UNDER ACCOUNT STRING
ADDM T2,USGDAT+UB$TWU ;ADD IT IN
POP P,P3 ;RESTORE CALLERS
POP P,P2 ;...
POP P,P1 ;...
POPJ P, ;AND RETURN
;HERE WHEN THE ACCOUNT STRINGS DON'T MATCH, TRY NEXT BLOCK
USGFI4: ADDI P1,STRLEN ;STEP TO NEXT ACCOUNT STRING BLOCK
SOJG T2,USGFI1 ;AND LOOK FOR ANOTHER MATCH
;HERE WHEN THE FILE HAS A UNIQUE ACCOUNT STRING, P1 ALREADY POINTS AT NEW BLOCK
USGFI5: MOVE T2,USGDAT+UB$ACN ;GET NUMBER OF ACCOUNT STRINGS SO FAR
CAIL T2,UB$MAC ;ROOM FOR THE NEW ONE
JRST [MOVSI P1,'Y ' ;FLAG TOO MANY ACCOUNT STRINGS
MOVEM P1,USGDAT+UB$ABO ;REMEMBER FOR DOWN-STREAM BILLING
SETZ P1, ;INDICATE NO TABLE TO UPDATE
JRST USGFI3] ;CONTINUE TO COUNT AGAINST UFD PROPER THOUGH
AOS USGDAT+UB$ACN ;ANOTHER ACCOUNT STRING PRESENT
HRLI T2,.RBACT(T1) ;WHERE IT IS
HRRI T2,UB$ACT-UB$ACT(P1) ;WHERE WE WANT IT
BLT T2,UB$ACT-UB$ACT+7(P1) ;MOVE INTO TABLES
SETZM UB$BAL-UB$ACT(P1) ;START COUNTERS FRESH
SETZM UB$BWR-UB$ACT(P1) ;...
SETZM UB$NFL-UB$ACT(P1) ;...
JRST USGFI3 ;AND ADD IT IN
;USGEND -- MAKE A USAGE ENTRY FOR THE UFD JUST SAVED
USGEND:: MOVSI T1,'Y ' ;GET ERROR INDICATOR
CAME T1,USGDAT+UB$UPF ;CHECK IF THE UFD WAS PROTECTED
CAMN T1,USGDAT+UB$FPF ;OR SOME FILES WERE PROTECTED
JRST USGEN0 ;YES, MUST MAKE THE ENTRY
SKIPN USGDAT+UB$ACN ;NOW SEE IF UFD WAS EMPTY
POPJ P, ;DON'T BOTHER MAKING THE ENTRY
USGEN0: PUSH P,P1 ;SAVE CALLERS
MOVE P1,[%SIACT] ;GET THE PID OF THE ACTDAE
GETTAB P1, ;ASK THE MONITOR
SETZ P1, ;WHAT!
JUMPE P1,USGERT ;RETURN IF NOBODY TO TELL THIS TOO
MOVEM P1,IPCBLK+.IPCFR ;STORE RECEIVER
HRRZ P1,.JBREL## ;GET HIGHEST ADDRESS IN LOW SEG
LSH P1,-^D9 ;TO PAGE NUMBER
AOS P1 ;P1 IS NOW THE PAGE WE WILL USE FOR IPCF
USGEN1: MOVE T1,[.PAGCD,,T2] ;POINT TO ARGUMENTS FOR CREATE
MOVEI T2,1 ;1 ARGUMENT
MOVE T3,P1 ;THE PAGE NUMBER
PAGE. T1, ;CREATE THE PAGE
JRST [CAIE T1,PAGNS% ;OUT OF VIRTUAL CORE?
JRST USGERT ;NO, GIVE UP
MOVEI T1,1 ;WAIT 1 SECOND
SLEEP T1, ;IN CASE SOME SHOWS UP
JRST USGEN1] ;AND TRY IT AGAIN
HRLI P1,1000 ;SIZE OF IPCF PAGE
MOVEM P1,IPCBLK+.IPCFP ;STORE POINTERS
LSH P1,^D9 ;CONVERT TO AN ADDRESS
MOVSI T1,USGDAT ;COLLECTED DATA
HRRI T1,(P1) ;WHERE TO MOVE IT
BLT T1,UB$ACT-1(P1) ;MOVE IT
HRL T1,USGTAB ;WHERE ACCOUNT STRING STUFF IS STORED
HRRI T1,UB$ACT(P1) ;WHERE IT GOES
BLT T1,UB$ACT+CORREQ-1(P1) ;MOVE IT
MOVEI T1,UGDUE$ ;TYPE = DISK USAGE ENTRY
MOVEM T1,UX$TYP(P1) ;STOPE IT
SETZM UB$TNO(P1) ;GET RID OF OLD STUFF FIRST
SETZM UB$NOD(P1) ;...
PJOB T1, ;GET OUR JOB NUMBER
MOVEM T1,UB$JOB(P1) ;STORE IT
MOVSI T4,(ASCIZ/D/) ;ASSUME DETACHED
TRMNO. T1, ;GET TERMINAL DESIGNATOR
JRST USGEN3 ;DETACHED
DPB T1,[POINT 9,UB$TNO(P1),35] ;STORE IN CASE NO NETWORKS
GETLCH T1 ;GET LINE CHARACTERISTICS
MOVSI T4,(ASCIZ/T/) ;ASSUME REGULAR TTY
TLNE T1,(GL.CTY) ;THE SYSTEM CTY
MOVSI T4,(ASCIZ/C/) ;YES
TLNE T1,(GL.ITY) ;INVISIBLE (PSEUDO) TTY
MOVSI T4,(ASCIZ/P/) ;YES
HRRZS T1 ;GET RID OF GETLCH BITS
GTNTN. T1, ;CONVERT TO NODE AND LINE
JRST USGEN3 ;NO NETWORKS
HRRZM T1,UB$TNO(P1) ;STORE REAL LINE NUMBER
HLRZ T3,T1 ;ISOLATE NODE NUMBER
MOVEI T2,2 ;NUMBER OF ARGUMENTS
MOVE T1,[.NDRNN,,T2] ;RETURN NODE NAME FOR NUMBER
NODE. T1, ;ASK TODD
SKIPA ;FAILED?
MOVEM T1,UB$NOD(P1) ;STORE SIXBIT NODE NAME
USGEN3: MOVEM T4,UB$TRD(P1) ;STORE TERMINAL DESIGNATOR
MOVE T1,[SIXBIT/BACKUP/] ;THIS PROGRAMS NAME
MOVEM T1,UB$PNM(P1) ;STORE THAT
MOVE T1,.JBVER## ;THE VERSION NUMBER
MOVEM T1,UB$PVR(P1) ;AND STORE THAT
MOVE T1,DCHBLK ;THE DISK STRUCTURE
MOVEM T1,UB$FSN(P1) ;STORE THAT
LDB T1,[POINT 1,DCHBLK+1,6] ;GET "PRIVATE" BIT
AOS T1 ;MAKE 1=PUB, 2=PRIVATE
MOVEM T1,UB$FST(P1) ;STORE
LDB T1,[POINT 6,DCHBLK+1,26] ;GET CONTROLLER TYPE
MOVEM T1,UB$CNT(P1) ;STORE
LDB T1,[POINT 3,DCHBLK+1,32] ;GET DEVICE (UNIT) TYPE
MOVEM T1,UB$DVT(P1) ;STORE
MOVEI T1,IP.CFV ;A PAGE MODE SEND
MOVEM T1,IPCBLK+.IPCFL ;STORE FLAG WORD
SETZM IPCBLK+.IPCFS ;DON'T SUPPLY A SENDERS PID
USGEN2: MOVE T1,[4,,IPCBLK] ;POINT TO THE BLOCK
IPCFS. T1, ;SEND OFF THE ACCOUNTING MESSAGE
SKIPA ;CHECK FAILURE
JRST USGERT ;RETURN
CAIE T1,IPCRS% ;MY QUOTA EXCEEDED
CAIN T1,IPCRR% ;OR ACTDAE'S QUOTA
USGRTY: JRST [MOVEI T1,1 ;YES, GIVE ACTDAE A CHANCE TO CATCH UP
SLEEP T1, ;SO WAIT A SECOND
JRST USGEN2] ;AND TRY IT AGAIN
CAIN T1,IPCRY% ;SYSTEM OUT OF FREE SPACE
JRST @USGRTY ;YES, WAIT AND RETRY
LSH P1,-^D9 ;THE PAGE NUMBER AGAIN
MOVE T1,[.PAGCD,,T2] ;POINT TO ARGUMENTS FOR DESTROY
MOVEI T2,1 ;1 ARGUMENT
MOVE T3,P1 ;THE PAGE NUMBER
TLO T3,(1B0) ;MUST DESTROY THE PAGE
PAGE. T1, ;DESTROY THE PAGE
JFCL ;OH WELL!
USGERT: POP P,P1 ;...
POPJ P, ;AND RETURN
XLIST ;FORCE OUT LITERALS
LIT
LIST
END