

; Bliss-32 10.1-416	Monday 21-AUG-1978 23:19:38	DBB3:[F11B.SRC]RDHEDR.B32;10					Page 1

;

;	0001	MODULE RDHEDR (

;	0002			LANGUAGE (BLISS32),

;	0003			IDENT = 'B0007A'

;	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 reads the desired file header, checks it for

;	0033	!	validity and correctness, and returns its address.

;	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:  13-Dec-1976  22:00

;	0044	!

;	0045	! REVISION HISTORY:

;	0046	!

;	0047	!   Andrew C. Goldstein, 16-Feb-1977  15:12

;	0048	!   X0002 - Modify for condition handling

;	0049	!

;	0050	!   Andrew C. Goldstein, 21-Mar-1977  19:20

;	0051	!   X0003 - Store header address in common

;	0052	!

;	0053	!   Andrew C. Goldstein, 13-Apr-1977  16:28

;	0054	!   X0004 - Check for zero file number

;	0055	!



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:19:38	DBB3:[F11B.SRC]RDHEDR.B32;10					Page 1-1

;

;	0056	!   Andrew C. Goldstein, 12-Dec-1977  14:14

;	0057	!   X0005 - file ID interface changes

;	0058	!

;	0059	!   Andrew C. Goldstein, 14-Dec-1977  15:46

;	0060	!   X0006 - Modify for structure level 2

;	0061	!

;	0062	!   Andrew C. Goldstein, 14-Jun-78  23:00

;	0063	!   B0007 - Add implicit spooling support

;	0064	!

;	0065	!**

;	0066	

;	0067	

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

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



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:19:38	DBB3:[F11B.SRC]RDHEDR.B32;10					Page 2

;

;	0418	GLOBAL ROUTINE READ_HEADER (FILE_ID, FCB) =

;	0419	

;	0420	!++

;	0421	!

;	0422	! FUNCTIONAL DESCRIPTION:

;	0423	!

;	0424	!	This routine reads the desired file header, checks it for

;	0425	!	validity and correctness, and returns its address.

;	0426	!

;	0427	! CALLING SEQUENCE:

;	0428	!	READ_HEADER (ARG1, ARG2)

;	0429	!

;	0430	! INPUT PARAMETERS:

;	0431	!	ARG1: address of file ID or 0

;	0432	!	ARG2: FCB address or 0 if none

;	0433	!

;	0434	! IMPLICIT INPUTS:

;	0435	!	CURRENT_VCB contains address of VCB in process

;	0436	!

;	0437	! OUTPUT PARAMETERS:

;	0438	!	NONE

;	0439	!

;	0440	! IMPLICIT OUTPUTS:

;	0441	!	HEADER_LBN contains LBN of header read

;	0442	!	FILE_HEADER contains address of header buffer

;	0443	!

;	0444	! ROUTINE VALUE:

;	0445	!	address of file header

;	0446	!

;	0447	! SIDE EFFECTS:

;	0448	!	index file window may be turned

;	0449	!

;	0450	!--

;	0451	

;	0452	BEGIN

;	0453	

;	0454	MAP

;	0455		FILE_ID		: REF BBLOCK,	! file ID arg

;	0456		FCB		: REF BBLOCK;	! FCB arg

;	0457	

;	0458	LOCAL

;	0459		VBN,				! VBN of header

;	0460		LBN,				! LBN of header

;	0461		HEADER		: REF BBLOCK,		! address of header block

;	0462		FID		: REF BBLOCK,	! local file ID pointer

;	0463		IDX_FCB		: REF BBLOCK;	! address of index file FCB

;	0464	

;	0465	EXTERNAL

;	0466		CLEANUP_FLAGS	: BITVECTOR,	! cleanup_action flags

;	0467		HEADER_LBN,			! longword to get LBN of header

;	0468		FILE_HEADER	: REF BBLOCK,	! longword to get buffer address

;	0469		CURRENT_VCB	: REF BBLOCK;	! address of VCB in process

;	0470	

;	0471	EXTERNAL ROUTINE

;	0472		MAP_VBN,			! map virtual to logical



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:19:38	DBB3:[F11B.SRC]RDHEDR.B32;10					Page 2-1

;

;	0473		READ_BLOCK,			! read a disk block

;	0474		CHECK_HEADER2;			! check header for correctness

;	0475	

;	0476	! Get the LBN of the file header. If an FCB is supplied, it contains

;	0477	! the LBN. If not, derive it from the file number.

;	0478	!

;	0479	

;	0480	LBN =

;	0481	    BEGIN

;	0482	    IF .FCB NEQ 0

;	0483	    THEN .FCB[FCB$L_HDLBN]

;	0484	    ELSE

;	0485		BEGIN

;	0486		VBN = .FILE_ID[FID$W_NUM];

;	0487		IF .CURRENT_VCB[VCB$V_EXTFID]

;	0488		THEN VBN<16,8> = .FILE_ID[FID$B_NMX];

;	0489		IF .VBN EQL 0 THEN ERR_EXIT (SS$_NOSUCHFILE);

;	0490		VBN = .VBN + .CURRENT_VCB[VCB$B_IBMAPSIZE] + .CURRENT_VCB[VCB$W_CLUSTER]*4;

;	0491		IDX_FCB = .CURRENT_VCB[VCB$L_FCBFL];

;	0492		MAP_VBN (.VBN, .IDX_FCB[FCB$L_WLFL])

;	0493		END

;	0494	    END;

;	0495	

;	0496	IF .LBN EQL -1 THEN ERR_EXIT (SS$_NOSUCHFILE);

;	0497	

;	0498	! Now read the header and check it for correctness. If a file ID

;	0499	! was supplied, use the file number and file sequence number from

;	0500	! it; else use the arguments. If the file operation is being done on a

;	0501	! spooled device, the file must be marked as spooled.

;	0502	!

;	0503	

;	0504	HEADER = READ_BLOCK (.LBN, 1, HEADER_TYPE);

;	0505	IF .CLEANUP_FLAGS[CLF_SPOOLFILE]

;	0506	AND NOT .HEADER[FH2$V_SPOOL]

;	0507	AND (.HEADER[FH2$W_FID_NUM] GTRU .CURRENT_VCB[VCB$B_RESFILES]

;	0508	    OR (.CURRENT_VCB[VCB$V_EXTFID]

;	0509		AND .HEADER[FH2$B_FID_NMX] NEQ 0)

;	0510	    )

;	0511	THEN ERR_EXIT (SS$_NOSUCHFILE);

;	0512	

;	0513	IF .FILE_ID NEQ 0

;	0514	THEN

;	0515	    FID = .FILE_ID

;	0516	ELSE

;	0517	    FID = FCB[FCB$W_FID];

;	0518	

;	0519	IF NOT CHECK_HEADER2 (.HEADER, .FID) THEN ERR_EXIT ();

;	0520	

;	0521	HEADER_LBN = .LBN;			! return LBN of header

;	0522	FILE_HEADER = .HEADER;			! and address

;	0523	RETURN .HEADER;				! and the header itself

;	0524	END;					! end of routine READ_HEADER





							    .TITLE  RDHEDR



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:19:38	DBB3:[F11B.SRC]RDHEDR.B32;10					Page 2-2

;

							    .IDENT  \B0007A\



							    .EXTRN  CLEANUP_FLAGS, HEADER_LBN, FILE_HEADER, CURRENT_VCB

							    .EXTRN  MAP_VBN, READ_BLOCK, CHECK_HEADER2



							    .PSECT  $CODE$,NOWRT,2



					 001C 00000 	    .ENTRY  READ_HEADER, Save R2,R3,R4				      ; 0418

		         54 	0000G  CF  9E 00002 	    MOVAB   CURRENT_VCB, R4					      ;

		         50 	  08   AC  D0 00007 	    MOVL    FCB, R0						      ; 0482

				       06  13 0000B 	    BEQL    1$							      ;

		         53 	  30   A0  D0 0000D 	    MOVL    48(R0), LBN						      ; 0481

				       3C  11 00011 	    BRB     3$							      ;

		         51 	  04   AC  D0 00013 1$:     MOVL    FILE_ID, R1						      ; 0486

		         52 	       61  3C 00017 	    MOVZWL  (R1), VBN						      ;

		         50 	       64  D0 0001A 	    MOVL    CURRENT_VCB, R0					      ; 0487

	   06 	    0B   A0	       05  E1 0001D 	    BBC     #5, 11(R0), 2$					      ;

	   08 	         10 	  05   A1  F0 00022 	    INSV    5(R1), #16, #8, VBN					      ; 0488

				       52     00027									      ;

				       52  D5 00028 2$:     TSTL    VBN							      ; 0489

				       5B  13 0002A 	    BEQL    4$							      ;

		         51 	       64  D0 0002C 	    MOVL    CURRENT_VCB, R1					      ; 0490

		         50 	  38   A1  9A 0002F 	    MOVZBL  56(R1), R0						      ;

	   53 	         52 	       50  C1 00033 	    ADDL3   R0, VBN, R3						      ;

		         50 	  3C   A1  3C 00037 	    MOVZWL  60(R1), R0						      ;

		         52 	     6340  DE 0003B 	    MOVAL   (R3)[R0], VBN					      ;

		         50 	       61  D0 0003F 	    MOVL    (R1), IDX_FCB					      ; 0491

				  10   A0  DD 00042 	    PUSHL   16(IDX_FCB)						      ; 0492

				       52  DD 00045 	    PUSHL   VBN							      ;

		  0000G  CF	       02  FB 00047 	    CALLS   #2, MAP_VBN						      ;

		         53 	       50  D0 0004C 	    MOVL    R0, LBN						      ;

	      FFFFFFFF   8F	       53  D1 0004F 3$:     CMPL    LBN, #-1						      ; 0496

				       2F  13 00056 	    BEQL    4$							      ;

		         7E 	       01  7D 00058 	    MOVQ    #1, -(SP)						      ; 0504

				       53  DD 0005B 	    PUSHL   LBN							      ;

		  0000G  CF	       03  FB 0005D 	    CALLS   #3, READ_BLOCK					      ;

		         52 	       50  D0 00062 	    MOVL    R0, HEADER						      ;

	   22 	  0000G  CF	       07  E1 00065 	    BBC     #7, CLEANUP_FLAGS, 5$				      ; 0505

	   1D 	    35   A2	       04  E0 0006B 	    BBS     #4, 53(HEADER), 5$					      ; 0506

		         50 	       64  D0 00070 	    MOVL    CURRENT_VCB, R0					      ; 0507

		         51 	  4F   A0  9A 00073 	    MOVZBL  79(R0), R1						      ;

		    08   A2	       51  B1 00077 	    CMPW    R1, 8(HEADER)					      ;

				       0A  1F 0007B 	    BLSSU   4$							      ;

	   0B 	    0B   A0	       05  E1 0007D 	    BBC     #5, 11(R0), 5$					      ; 0508

				  0D   A2  95 00082 	    TSTB    13(HEADER)						      ; 0509

				       06  13 00085 	    BEQL    5$							      ;

				0910   8F  BF 00087 4$:     CHMU    #2320						      ; 0511

				       2E  11 0008B 	    BRB     9$							      ;

				  04   AC  D5 0008D 5$:     TSTL    FILE_ID						      ; 0513

				       06  13 00090 	    BEQL    6$							      ;

		         50 	  04   AC  D0 00092 	    MOVL    FILE_ID, FID					      ; 0515

				       05  11 00096 	    BRB     7$							      ; 0513

	   50 	    08   AC	       20  C1 00098 6$:     ADDL3   #32, FCB, FID					      ; 0517

				       50  DD 0009D 7$:     PUSHL   FID							      ; 0519

				       52  DD 0009F 	    PUSHL   HEADER						      ;



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:19:38	DBB3:[F11B.SRC]RDHEDR.B32;10					Page 2-3

;

		  0000G  CF	       02  FB 000A1 	    CALLS   #2, CHECK_HEADER2					      ;

		         04 	       50  E8 000A6 	    BLBS    R0, 8$						      ;

				       00  BF 000A9 	    CHMU    #0							      ;

				       0E  11 000AB 	    BRB     9$							      ;

		  0000G  CF	       53  D0 000AD 8$:     MOVL    LBN, HEADER_LBN					      ; 0521

		  0000G  CF	       52  D0 000B2 	    MOVL    HEADER, FILE_HEADER					      ; 0522

		         50 	       52  D0 000B7 	    MOVL    HEADER, R0						      ; 0523

					   04 000BA 	    RET     							      ;

				       50  D4 000BB 9$:     CLRL    R0							      ; 0418

					   04 000BD 	    RET     							      ;



; Routine Size:  190 bytes





;	0525	

;	0526	END

;	0527	ELUDOM













;				       PSECT SUMMARY

;

;	Name		 Bytes			       Attributes

;

;  $CODE$         	   190  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        21         0       237











; Size:		190 code + 0 data bytes

; Run Time:	00:06.6

; Elapsed Time:	00:13.5

; Memory Used:	286 pages

; Compilation Complete

