

; Bliss-32 10.1-416	Monday 21-AUG-1978 22:56:54	DBB3:[F11A.SRC]EXTHDR.B32;7					Page 1

;

;	0001	MODULE EXTHDR (

;	0002			LANGUAGE (BLISS32),

;	0003			IDENT = 'A0003'

;	0004			) =

;	0005	BEGIN

;	0006	

;	0007	!

;	0008	! Copyright (c) 1977

;	0009	! Digital Equipment Corporation, Maynard, Massachusetts 01754

;	0010	!

;	0011	! This software is furnished  under a license for use only on a single

;	0012	! computer  system and  may be  copied only with  the inclusion of the

;	0013	! above copyright notice.  This software, or any other copies thereof,

;	0014	! may not be provided or  otherwise made available to any other person

;	0015	! except for use on such system and to one who agrees to these license

;	0016	! terms.  Title to and  ownership of the  software  shall at all times

;	0017	! remain in DEC.

;	0018	!

;	0019	! The information in this software is subject to change without notice

;	0020	! and should  not be construed  as a commitment  by Digital  Equipment

;	0021	! Corporation.

;	0022	!

;	0023	! DEC assumes  no  responsibility  for  the use or  reliability of its

;	0024	! software on equipment which is not supplied by DEC.

;	0025	

;	0026	!++

;	0027	!

;	0028	! FACILITY:  F11ACP Structure Level 1

;	0029	!

;	0030	! ABSTRACT:

;	0031	!

;	0032	!	This routine creates an extension file header for the given file

;	0033	!	header.

;	0034	!

;	0035	! ENVIRONMENT:

;	0036	!

;	0037	!	STARLET operating system, including privileged system services

;	0038	!	and internal exec routines.

;	0039	!

;	0040	!--

;	0041	!

;	0042	!

;	0043	! AUTHOR:  Andrew C. Goldstein,	 CREATION DATE:  27-Jul-1977  10:15

;	0044	!

;	0045	! REVISION HISTORY:

;	0046	!

;	0047	!   Andrew C. Goldstein, 12-Dec-1977  13:41

;	0048	!   X0002 - file ID interface changes

;	0049	!

;	0050	!   Andrew C. Goldstein, 12-Dec-1977  15:21

;	0051	!   X0003 - Move header setup to CREATE_HEADER

;	0052	!

;	0053	!**

;	0054	

;	0055	



; Bliss-32 10.1-416	Monday 21-AUG-1978 22:56:54	DBB3:[F11A.SRC]EXTHDR.B32;7					Page 1-1

;

;	0056	LIBRARY 'SYS$LIBRARY:LIB.L32';

;	0057	REQUIRE 'SRC$:FCPDEF.B32';



; Bliss-32 10.1-416	Monday 21-AUG-1978 22:56:54	DBB3:[F11A.SRC]EXTHDR.B32;7					Page 2

;

;	0376	GLOBAL ROUTINE EXTEND_HEADER (OLD_HEADER, FCB) =

;	0377	

;	0378	!++

;	0379	!

;	0380	! FUNCTIONAL DESCRIPTION:

;	0381	!

;	0382	!	This routine creates an extension file header for the given file

;	0383	!	header.

;	0384	!

;	0385	!

;	0386	! CALLING SEQUENCE:

;	0387	!	EXTEND_HEADER (ARG1, ARG2)

;	0388	!

;	0389	! INPUT PARAMETERS:

;	0390	!	ARG1: address of present last file header

;	0391	!	ARG2: address of present last FCB or 0

;	0392	!

;	0393	! IMPLICIT INPUTS:

;	0394	!	CURRENT_WINDOW: address of file window or 0

;	0395	!	PRIMARY_FCB: primary FCB of file

;	0396	!	CURRENT_VCB: address of VCB of volume

;	0397	!

;	0398	! OUTPUT PARAMETERS:

;	0399	!	NONE

;	0400	!

;	0401	! IMPLICIT OUTPUTS:

;	0402	!	NONE

;	0403	!

;	0404	! ROUTINE VALUE:

;	0405	!	address of new file header

;	0406	!

;	0407	! SIDE EFFECTS:

;	0408	!	file header created, window turned, FCB created

;	0409	!

;	0410	!--

;	0411	

;	0412	BEGIN

;	0413	

;	0414	MAP

;	0415		OLD_HEADER	: REF BBLOCK,	! file header arg

;	0416		FCB		: REF BBLOCK;	! FCB arg

;	0417	

;	0418	LOCAL

;	0419		OLD_FID		: BBLOCK [FID$C_LENGTH], ! file ID of old header

;	0420		EXT_FID		: BBLOCK [FID$C_LENGTH], ! file ID of new header

;	0421		VBN,				! index file VBN of new header

;	0422		LBN,				! LBN of new header

;	0423		MAP_AREA	: REF BBLOCK,	! file header map area

;	0424		NEW_HEADER	: REF BBLOCK;	! address of new file header

;	0425	

;	0426	EXTERNAL

;	0427		CLEANUP_FLAGS	: BITVECTOR,	! cleanup action flags

;	0428		USER_STATUS	: VECTOR,	! I/O status block for user

;	0429		PRIMARY_FCB	: REF BBLOCK,	! primary FCB of file

;	0430		CURRENT_WINDOW	: REF BBLOCK,	! window of file



; Bliss-32 10.1-416	Monday 21-AUG-1978 22:56:54	DBB3:[F11A.SRC]EXTHDR.B32;7					Page 2-1

;

;	0431		CURRENT_VCB	: REF BBLOCK,	! VCB of volume

;	0432		HEADER_LBN,			! LBN of current file header

;	0433		NEW_FID;			! file number of new extension header

;	0434	

;	0435	EXTERNAL ROUTINE

;	0436		INIT_FCB,			! initialize FCB

;	0437		TURN_WINDOW,			! update window

;	0438		CHECKSUM,			! checksum file header

;	0439		MARK_DIRTY,			! mark header for writeback

;	0440		CREATE_HEADER,			! create a new file ID and header

;	0441		INVALIDATE,			! discard a block buffer

;	0442		RESET_LBN,			! reassign buffer LBN

;	0443		WRITE_HEADER,			! write file header

;	0444		READ_HEADER,			! read file header

;	0445		MAKE_EXTFCB;			! create an extension FCB

;	0446	

;	0447	

;	0448	! Save the file ID of the current last header. If the file is accessed, fix

;	0449	! up the FCB if it is not the primary and turn the window to include blocks

;	0450	! from the header if possible. Then prepare the old header for write-back.

;	0451	!

;	0452	

;	0453	OLD_FID[FID$W_NUM] = .OLD_HEADER[FH1$W_FID_NUM];

;	0454	OLD_FID[FID$W_SEQ] = .OLD_HEADER[FH1$W_FID_SEQ];

;	0455	OLD_FID[FID$W_RVN] = 0;

;	0456	

;	0457	IF .FCB NEQ 0 AND .FCB NEQ .PRIMARY_FCB

;	0458	THEN KERNEL_CALL (INIT_FCB, .FCB, .OLD_HEADER);

;	0459	

;	0460	IF .CURRENT_WINDOW NEQ 0

;	0461	THEN KERNEL_CALL (TURN_WINDOW, .CURRENT_WINDOW, .OLD_HEADER, .PRIMARY_FCB[FCB$L_FILESIZE], .FCB[FCB$L_STVBN]);

;	0462	

;	0463	CHECKSUM (.OLD_HEADER);

;	0464	

;	0465	! Now create the new file ID. Map and read the corresponding block in the

;	0466	! index file to extract the file sequence number; then punt the buffer.

;	0467	!

;	0468	

;	0469	NEW_HEADER = CREATE_HEADER ();

;	0470	EXT_FID[FID$W_NUM] = .NEW_HEADER[FH1$W_FID_NUM];

;	0471	EXT_FID[FID$W_SEQ] = .NEW_HEADER[FH1$W_FID_SEQ];

;	0472	LBN = .HEADER_LBN;

;	0473	INVALIDATE (.NEW_HEADER);

;	0474	

;	0475	! Get back the old file header, which may or may not have been written out

;	0476	! due to buffer pool thrashing. Check the segment number for overflow.

;	0477	! Plug in the header extension linkage and write it.

;	0478	!

;	0479	

;	0480	NEW_HEADER = READ_HEADER (OLD_FID, .FCB);

;	0481	MAP_AREA = .NEW_HEADER + .NEW_HEADER[FH1$B_MPOFFSET]*2;

;	0482	IF .MAP_AREA[FM1$B_EX_SEGNUM] GEQU 255

;	0483	THEN ERR_EXIT (SS$_HEADERFULL);

;	0484	MAP_AREA[FM1$W_EX_FILNUM] = .EXT_FID[FID$W_NUM];

;	0485	MAP_AREA[FM1$W_EX_FILSEQ] = .EXT_FID[FID$W_SEQ];



; Bliss-32 10.1-416	Monday 21-AUG-1978 22:56:54	DBB3:[F11A.SRC]EXTHDR.B32;7					Page 2-2

;

;	0486	

;	0487	CHECKSUM (.NEW_HEADER);

;	0488	WRITE_HEADER ();

;	0489	NEW_FID = 0;				! header extension is complete

;	0490	

;	0491	! We now build the new file header over the old one in the same buffer, thus

;	0492	! keeping the attributes.

;	0493	!

;	0494	

;	0495	RESET_LBN (.NEW_HEADER, .LBN);

;	0496	MARK_DIRTY (.NEW_HEADER);

;	0497	HEADER_LBN = .LBN;

;	0498	

;	0499	NEW_HEADER[FH1$W_FID_NUM] = .EXT_FID[FID$W_NUM];

;	0500	NEW_HEADER[FH1$W_FID_SEQ] = .EXT_FID[FID$W_SEQ];

;	0501	

;	0502	MAP_AREA[FM1$B_EX_SEGNUM] = .MAP_AREA[FM1$B_EX_SEGNUM] + 1;

;	0503	MAP_AREA[FM1$W_EX_FILNUM] = 0;

;	0504	MAP_AREA[FM1$W_EX_FILSEQ] = 0;

;	0505	MAP_AREA[FM1$B_INUSE] = 0;

;	0506	

;	0507	CH$FILL (0, .MAP_AREA[FM1$B_AVAIL]*2, .MAP_AREA+FM1$C_POINTERS);

;	0508	

;	0509	! Finally create an extension FCB if the file is accessed.

;	0510	!

;	0511	

;	0512	IF .FCB NEQ 0

;	0513	THEN KERNEL_CALL (MAKE_EXTFCB, .NEW_HEADER, .FCB, 2);

;	0514	

;	0515	RETURN (.NEW_HEADER);

;	0516	

;	0517	END;					! end of routine EXTEND_HEADER





							    .TITLE  EXTHDR

							    .IDENT  \A0003\



							    .EXTRN  CLEANUP_FLAGS, USER_STATUS, PRIMARY_FCB, CURRENT_WINDOW

							    .EXTRN  CURRENT_VCB, HEADER_LBN, NEW_FID, INIT_FCB, TURN_WINDOW

							    .EXTRN  CHECKSUM, MARK_DIRTY, CREATE_HEADER, INVALIDATE

							    .EXTRN  RESET_LBN, WRITE_HEADER, READ_HEADER, MAKE_EXTFCB

							    .EXTRN  SYS$CMKRNL



							    .PSECT  $CODE$,NOWRT,2



					 00FC 00000 	    .ENTRY  EXTEND_HEADER, Save R2,R3,R4,R5,R6,R7		      ; 0376

		         57 00000000G  9F  9E 00002 	    MOVAB   @#SYS$CMKRNL, R7					      ;

		         5E 	       10  C2 00009 	    SUBL2   #16, SP						      ;

		         52 	  04   AC  D0 0000C 	    MOVL    OLD_HEADER, R2					      ; 0453

		    08   AE	  02   A2  D0 00010 	    MOVL    2(R2), OLD_FID					      ;

				  0C   AE  B4 00015 	    CLRW    OLD_FID+4						      ; 0455

		         53 	  08   AC  D0 00018 	    MOVL    FCB, R3						      ; 0457

				       16  13 0001C 	    BEQL    1$							      ;

		  0000G  CF	       53  D1 0001E 	    CMPL    R3, PRIMARY_FCB					      ;

				       0F  13 00023 	    BEQL    1$							      ;



; Bliss-32 10.1-416	Monday 21-AUG-1978 22:56:54	DBB3:[F11A.SRC]EXTHDR.B32;7					Page 2-3

;

				       52  DD 00025 	    PUSHL   R2							      ; 0458

				       53  DD 00027 	    PUSHL   R3							      ;

				       02  DD 00029 	    PUSHL   #2							      ;

				       5E  DD 0002B 	    PUSHL   SP							      ;

				0000G  CF  9F 0002D 	    PUSHAB  INIT_FCB						      ;

		         67 	       05  FB 00031 	    CALLS   #5, SYS$CMKRNL					      ;

		         51 	0000G  CF  D0 00034 1$:     MOVL    CURRENT_WINDOW, R1					      ; 0460

				       18  13 00039 	    BEQL    2$							      ;

				  28   A3  DD 0003B 	    PUSHL   40(R3)						      ; 0461

		         50 	0000G  CF  D0 0003E 	    MOVL    PRIMARY_FCB, R0					      ;

				  34   A0  DD 00043 	    PUSHL   52(R0)						      ;

				       06  BB 00046 	    PUSHR   #^M<R1,R2>						      ;

				       04  DD 00048 	    PUSHL   #4							      ;

				       5E  DD 0004A 	    PUSHL   SP							      ;

				0000G  CF  9F 0004C 	    PUSHAB  TURN_WINDOW						      ;

		         67 	       07  FB 00050 	    CALLS   #7, SYS$CMKRNL					      ;

				       52  DD 00053 2$:     PUSHL   R2							      ; 0463

		  0000G  CF	       01  FB 00055 	    CALLS   #1, CHECKSUM					      ;

		  0000G  CF	       00  FB 0005A 	    CALLS   #0, CREATE_HEADER					      ; 0469

		         56 	       50  D0 0005F 	    MOVL    R0, NEW_HEADER					      ;

		         6E 	  02   A6  D0 00062 	    MOVL    2(NEW_HEADER), EXT_FID				      ; 0470

		         54 	0000G  CF  D0 00066 	    MOVL    HEADER_LBN, LBN					      ; 0472

				       56  DD 0006B 	    PUSHL   NEW_HEADER						      ; 0473

		  0000G  CF	       01  FB 0006D 	    CALLS   #1, INVALIDATE					      ;

				       53  DD 00072 	    PUSHL   R3							      ; 0480

				  0C   AE  9F 00074 	    PUSHAB  OLD_FID						      ;

		  0000G  CF	       02  FB 00077 	    CALLS   #2, READ_HEADER					      ;

		         56 	       50  D0 0007C 	    MOVL    R0, NEW_HEADER					      ;

		         50 	  01   A6  9A 0007F 	    MOVZBL  1(NEW_HEADER), R0					      ; 0481

		         52 	     6640  3E 00083 	    MOVAW   (NEW_HEADER)[R0], MAP_AREA				      ;

		    FF   8F	       62  91 00087 	    CMPB    (MAP_AREA), #255					      ; 0482

				       04  1F 0008B 	    BLSSU   3$							      ;

				08C8   8F  BF 0008D 	    CHMU    #2248						      ; 0483

		    02   A2	       6E  D0 00091 3$:     MOVL    EXT_FID, 2(MAP_AREA)				      ; 0484

				       56  DD 00095 	    PUSHL   NEW_HEADER						      ; 0487

		  0000G  CF	       01  FB 00097 	    CALLS   #1, CHECKSUM					      ;

		  0000G  CF	       00  FB 0009C 	    CALLS   #0, WRITE_HEADER					      ; 0488

				0000G  CF  D4 000A1 	    CLRL    NEW_FID						      ; 0489

				       54  DD 000A5 	    PUSHL   LBN							      ; 0495

				       56  DD 000A7 	    PUSHL   NEW_HEADER						      ;

		  0000G  CF	       02  FB 000A9 	    CALLS   #2, RESET_LBN					      ;

				       56  DD 000AE 	    PUSHL   NEW_HEADER						      ; 0496

		  0000G  CF	       01  FB 000B0 	    CALLS   #1, MARK_DIRTY					      ;

		  0000G  CF	       54  D0 000B5 	    MOVL    LBN, HEADER_LBN					      ; 0497

		    02   A6	       6E  D0 000BA 	    MOVL    EXT_FID, 2(NEW_HEADER)				      ; 0499

				       62  96 000BE 	    INCB    (MAP_AREA)						      ; 0502

				  02   A2  D4 000C0 	    CLRL    2(MAP_AREA)						      ; 0503

				  08   A2  94 000C3 	    CLRB    8(MAP_AREA)						      ; 0505

		         50 	  09   A2  9A 000C6 	    MOVZBL  9(MAP_AREA), R0					      ; 0507

		         50 	       02  C4 000CA 	    MULL2   #2, R0						      ;

	   00 	         6E 	       00  2C 000CD 	    MOVC5   #0, (SP), #0, R0, 10(MAP_AREA)			      ;

		    0A   A2	       50     000D1									      ;

				  08   AC  D5 000D4 	    TSTL    FCB							      ; 0512

				       12  13 000D7 	    BEQL    4$							      ;

				       02  DD 000D9 	    PUSHL   #2							      ; 0513



; Bliss-32 10.1-416	Monday 21-AUG-1978 22:56:54	DBB3:[F11A.SRC]EXTHDR.B32;7					Page 2-4

;

				  08   AC  DD 000DB 	    PUSHL   FCB							      ;

				       56  DD 000DE 	    PUSHL   NEW_HEADER						      ;

				       03  DD 000E0 	    PUSHL   #3							      ;

				       5E  DD 000E2 	    PUSHL   SP							      ;

				0000G  CF  9F 000E4 	    PUSHAB  MAKE_EXTFCB						      ;

		         67 	       06  FB 000E8 	    CALLS   #6, SYS$CMKRNL					      ;

		         50 	       56  D0 000EB 4$:     MOVL    NEW_HEADER, R0					      ; 0515

					   04 000EE 	    RET     							      ; 0376



; Routine Size:  239 bytes





;	0518	

;	0519	END

;	0520	ELUDOM













;				       PSECT SUMMARY

;

;	Name		 Bytes			       Attributes

;

;  $CODE$         	   239  NOWRT,  RD ,  EXE,NOSHR,  LCL,  REL,  CON,NOPIC,ALIGN(2)









;				LIBRARY STATISTICS

;

;					     -------- Symbols --------    Blocks

;	File				     Total    Loaded   Percent      Read

;

;  DBA4:[SYSLIB]LIB.L32;1		      5582        17         0       233











; Size:		239 code + 0 data bytes

; Run Time:	00:07.2

; Elapsed Time:	00:15.0

; Memory Used:	316 pages

; Compilation Complete

