

; Bliss-32 10.1-416	Monday 21-AUG-1978 23:15:17	DBB3:[F11B.SRC]EXTHDR.B32;6					Page 1

;

;	0001	MODULE EXTHDR (

;	0002			LANGUAGE (BLISS32),

;	0003			IDENT = 'B0005'

;	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 2

;	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	!   Andrew C. Goldstein, 14-Dec-1977  14:55

;	0054	!   X0004 - Modify for structure level 2

;	0055	!



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:15:17	DBB3:[F11B.SRC]EXTHDR.B32;6					Page 1-1

;

;	0056	!   Andrew C. Goldstein, 23-Jan-1978  22:42

;	0057	!   B0005 - Truncate Ident area of extension header

;	0058	!

;	0059	!**

;	0060	

;	0061	

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

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



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:15:17	DBB3:[F11B.SRC]EXTHDR.B32;6					Page 2

;

;	0412	GLOBAL ROUTINE EXTEND_HEADER (OLD_HEADER, FCB) =

;	0413	

;	0414	!++

;	0415	!

;	0416	! FUNCTIONAL DESCRIPTION:

;	0417	!

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

;	0419	!	header.

;	0420	!

;	0421	!

;	0422	! CALLING SEQUENCE:

;	0423	!	EXTEND_HEADER (ARG1, ARG2)

;	0424	!

;	0425	! INPUT PARAMETERS:

;	0426	!	ARG1: address of present last file header

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

;	0428	!

;	0429	! IMPLICIT INPUTS:

;	0430	!	CURRENT_WINDOW: address of file window or 0

;	0431	!	PRIMARY_FCB: primary FCB of file

;	0432	!	CURRENT_VCB: address of VCB of volume

;	0433	!

;	0434	! OUTPUT PARAMETERS:

;	0435	!	NONE

;	0436	!

;	0437	! IMPLICIT OUTPUTS:

;	0438	!	NONE

;	0439	!

;	0440	! ROUTINE VALUE:

;	0441	!	address of new file header

;	0442	!

;	0443	! SIDE EFFECTS:

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

;	0445	!

;	0446	!--

;	0447	

;	0448	BEGIN

;	0449	

;	0450	MAP

;	0451		OLD_HEADER	: REF BBLOCK,	! file header arg

;	0452		FCB		: REF BBLOCK;	! FCB arg

;	0453	

;	0454	LOCAL

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

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

;	0457		VBN,				! index file VBN of new header

;	0458		LBN,				! LBN of new header

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

;	0460	

;	0461	EXTERNAL

;	0462		CLEANUP_FLAGS	: BITVECTOR,	! cleanup action flags

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

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

;	0465		CURRENT_WINDOW	: REF BBLOCK,	! window of file

;	0466		CURRENT_VCB	: REF BBLOCK,	! VCB of volume



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:15:17	DBB3:[F11B.SRC]EXTHDR.B32;6					Page 2-1

;

;	0467		HEADER_LBN,			! LBN of current file header

;	0468		NEW_FID;			! file number of new extension header

;	0469	

;	0470	EXTERNAL ROUTINE

;	0471		INIT_FCB2,			! initialize FCB

;	0472		TURN_WINDOW,			! update window

;	0473		CHECKSUM,			! checksum file header

;	0474		MARK_DIRTY,			! mark header for writeback

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

;	0476		INVALIDATE,			! discard a block buffer

;	0477		RESET_LBN,			! reassign buffer LBN

;	0478		WRITE_HEADER,			! write file header

;	0479		READ_HEADER,			! read file header

;	0480		MAKE_EXTFCB;			! create an extension FCB

;	0481	

;	0482	

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

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

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

;	0486	!

;	0487	

;	0488	CH$MOVE (FID$C_LENGTH, OLD_HEADER[FH2$W_FID], OLD_FID);

;	0489	

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

;	0491	THEN KERNEL_CALL (INIT_FCB2, .FCB, .OLD_HEADER);

;	0492	

;	0493	IF .CURRENT_WINDOW NEQ 0

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

;	0495	

;	0496	CHECKSUM (.OLD_HEADER);

;	0497	

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

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

;	0500	!

;	0501	

;	0502	NEW_HEADER = CREATE_HEADER ();

;	0503	CH$MOVE (FID$C_LENGTH, NEW_HEADER[FH2$W_FID], EXT_FID);

;	0504	LBN = .HEADER_LBN;

;	0505	INVALIDATE (.NEW_HEADER);

;	0506	

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

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

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

;	0510	!

;	0511	

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

;	0513	IF .NEW_HEADER[FH2$W_SEG_NUM] GEQU 65535

;	0514	THEN ERR_EXIT (SS$_HEADERFULL);

;	0515	CH$MOVE (FID$C_LENGTH, EXT_FID, NEW_HEADER[FH2$W_EXT_FID]);

;	0516	

;	0517	CHECKSUM (.NEW_HEADER);

;	0518	WRITE_HEADER ();

;	0519	NEW_FID = 0;				! header extension is complete

;	0520	

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



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:15:17	DBB3:[F11B.SRC]EXTHDR.B32;6					Page 2-2

;

;	0522	! keeping the attributes. Note that we truncate the Ident area to only the

;	0523	! file name, to gain map pointer space.

;	0524	!

;	0525	

;	0526	RESET_LBN (.NEW_HEADER, .LBN);

;	0527	MARK_DIRTY (.NEW_HEADER);

;	0528	HEADER_LBN = .LBN;

;	0529	

;	0530	CH$MOVE (FID$C_LENGTH, EXT_FID, NEW_HEADER[FH2$W_FID]);

;	0531	

;	0532	NEW_HEADER[FH2$W_SEG_NUM] = .NEW_HEADER[FH2$W_SEG_NUM] + 1;

;	0533	CH$FILL (0, FID$C_LENGTH, NEW_HEADER[FH2$W_EXT_FID]);

;	0534	NEW_HEADER[FH2$B_MAP_INUSE] = 0;

;	0535	NEW_HEADER[FH2$B_MPOFFSET] = .NEW_HEADER[FH2$B_IDOFFSET] +

;	0536				     ($BYTEOFFSET (FI2$W_REVISION)) / 2;

;	0537	NEW_HEADER[FH2$B_ACOFFSET] = ($BYTEOFFSET (FH2$W_CHECKSUM)) / 2;

;	0538	NEW_HEADER[FH2$B_RSOFFSET] = ($BYTEOFFSET (FH2$W_CHECKSUM)) / 2;

;	0539	

;	0540	CH$FILL (0, 512 - .NEW_HEADER[FH2$B_MPOFFSET]*2, .NEW_HEADER + .NEW_HEADER[FH2$B_MPOFFSET]*2);

;	0541	

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

;	0543	!

;	0544	

;	0545	IF .FCB NEQ 0

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

;	0547	

;	0548	RETURN (.NEW_HEADER);

;	0549	

;	0550	END;					! end of routine EXTEND_HEADER





							    .TITLE  EXTHDR

							    .IDENT  \B0005\



							    .EXTRN  CLEANUP_FLAGS, USER_STATUS, PRIMARY_FCB, CURRENT_WINDOW

							    .EXTRN  CURRENT_VCB, HEADER_LBN, NEW_FID, INIT_FCB2, 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



					 03FC 00000 	    .ENTRY  EXTEND_HEADER, Save R2,R3,R4,R5,R6,R7,R8,R9		      ; 0412

		         59 00000000G  9F  9E 00002 	    MOVAB   @#SYS$CMKRNL, R9					      ;

		         5E 	       10  C2 00009 	    SUBL2   #16, SP						      ;

		         56 	  04   AC  D0 0000C 	    MOVL    OLD_HEADER, R6					      ; 0488

      08   AE	    08   A6	       06  28 00010 	    MOVC3   #6, 8(R6), OLD_FID					      ;

		         57 	  08   AC  D0 00016 	    MOVL    FCB, R7						      ; 0490

				       16  13 0001A 	    BEQL    1$							      ;

		  0000G  CF	       57  D1 0001C 	    CMPL    R7, PRIMARY_FCB					      ;

				       0F  13 00021 	    BEQL    1$							      ;

				       56  DD 00023 	    PUSHL   R6							      ; 0491

				       57  DD 00025 	    PUSHL   R7							      ;

				       02  DD 00027 	    PUSHL   #2							      ;

				       5E  DD 00029 	    PUSHL   SP							      ;



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:15:17	DBB3:[F11B.SRC]EXTHDR.B32;6					Page 2-3

;

				0000G  CF  9F 0002B 	    PUSHAB  INIT_FCB2						      ;

		         69 	       05  FB 0002F 	    CALLS   #5, SYS$CMKRNL					      ;

		         51 	0000G  CF  D0 00032 1$:     MOVL    CURRENT_WINDOW, R1					      ; 0493

				       1A  13 00037 	    BEQL    2$							      ;

				  28   A7  DD 00039 	    PUSHL   40(R7)						      ; 0494

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

				  34   A0  DD 00041 	    PUSHL   52(R0)						      ;

				0042   8F  BB 00044 	    PUSHR   #^M<R1,R6>						      ;

				       04  DD 00048 	    PUSHL   #4							      ;

				       5E  DD 0004A 	    PUSHL   SP							      ;

				0000G  CF  9F 0004C 	    PUSHAB  TURN_WINDOW						      ;

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

				       56  DD 00053 2$:     PUSHL   R6							      ; 0496

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

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

		         56 	       50  D0 0005F 	    MOVL    R0, NEW_HEADER					      ;

	   6E 	    08   A6	       06  28 00062 	    MOVC3   #6, 8(NEW_HEADER), EXT_FID				      ; 0503

		         58 	0000G  CF  D0 00067 	    MOVL    HEADER_LBN, LBN					      ; 0504

				       56  DD 0006C 	    PUSHL   NEW_HEADER						      ; 0505

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

				       57  DD 00073 	    PUSHL   R7							      ; 0512

				  0C   AE  9F 00075 	    PUSHAB  OLD_FID						      ;

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

		         56 	       50  D0 0007D 	    MOVL    R0, NEW_HEADER					      ;

		  FFFF   8F	  04   A6  B1 00080 	    CMPW    4(NEW_HEADER), #65535				      ; 0513

				       06  1F 00086 	    BLSSU   3$							      ;

				08C8   8F  BF 00088 	    CHMU    #2248						      ; 0514

				       79  11 0008C 	    BRB     5$							      ;

      0E   A6	         6E 	       06  28 0008E 3$:     MOVC3   #6, EXT_FID, 14(NEW_HEADER)				      ; 0515

				       56  DD 00093 	    PUSHL   NEW_HEADER						      ; 0517

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

		  0000G  CF	       00  FB 0009A 	    CALLS   #0, WRITE_HEADER					      ; 0518

				0000G  CF  D4 0009F 	    CLRL    NEW_FID						      ; 0519

				0140   8F  BB 000A3 	    PUSHR   #^M<R6,R8>						      ; 0526

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

				       56  DD 000AC 	    PUSHL   NEW_HEADER						      ; 0527

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

		  0000G  CF	       58  D0 000B3 	    MOVL    LBN, HEADER_LBN					      ; 0528

      08   A6	         6E 	       06  28 000B8 	    MOVC3   #6, EXT_FID, 8(NEW_HEADER)				      ; 0530

				  04   A6  B6 000BD 	    INCW    4(NEW_HEADER)					      ; 0532

	   00 	         6E 	       00  2C 000C0 	    MOVC5   #0, (SP), #0, #6, 14(NEW_HEADER)			      ; 0533

		    0E   A6	       06     000C4									      ;

				  3A   A6  94 000C7 	    CLRB    58(NEW_HEADER)					      ; 0534

      01   A6	         66 	       0A  81 000CA 	    ADDB3   #10, (NEW_HEADER), 1(NEW_HEADER)			      ; 0535

		    02   A6	       01  AE 000CF 	    MNEGW   #1, 2(NEW_HEADER)					      ; 0537

		         50 	  01   A6  9A 000D3 	    MOVZBL  1(NEW_HEADER), R0					      ; 0540

		         51 	       50  CE 000D7 	    MNEGL   R0, R1						      ;

		         51 	       02  C4 000DA 	    MULL2   #2, R1						      ;

		         51 	0200   C1  9E 000DD 	    MOVAB   512(R1), R1						      ;

		         57 	     6640  3E 000E2 	    MOVAW   (NEW_HEADER)[R0], R7				      ;

	   00 	         6E 	       00  2C 000E6 	    MOVC5   #0, (SP), #0, R1, (R7)				      ;

		         67 	       51     000EA									      ;

				  08   AC  D5 000EC 	    TSTL    FCB							      ; 0545

				       12  13 000EF 	    BEQL    4$							      ;

				       02  DD 000F1 	    PUSHL   #2							      ; 0546



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:15:17	DBB3:[F11B.SRC]EXTHDR.B32;6					Page 2-4

;

				  08   AC  DD 000F3 	    PUSHL   FCB							      ;

				       56  DD 000F6 	    PUSHL   NEW_HEADER						      ;

				       03  DD 000F8 	    PUSHL   #3							      ;

				       5E  DD 000FA 	    PUSHL   SP							      ;

				0000G  CF  9F 000FC 	    PUSHAB  MAKE_EXTFCB						      ;

		         69 	       06  FB 00100 	    CALLS   #6, SYS$CMKRNL					      ;

		         50 	       56  D0 00103 4$:     MOVL    NEW_HEADER, R0					      ; 0548

					   04 00106 	    RET     							      ;

				       50  D4 00107 5$:     CLRL    R0							      ; 0412

					   04 00109 	    RET     							      ;



; Routine Size:  266 bytes





;	0551	

;	0552	END

;	0553	ELUDOM













;				       PSECT SUMMARY

;

;	Name		 Bytes			       Attributes

;

;  $CODE$         	   266  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        22         0       236











; Size:		266 code + 0 data bytes

; Run Time:	00:07.4

; Elapsed Time:	00:16.2

; Memory Used:	316 pages

; Compilation Complete

