

; Bliss-32 10.1-416	Monday 21-AUG-1978 23:11:26	DBB3:[F11B.SRC]DEACCS.B32;19					Page 1

;

;	0001	MODULE DEACCS (

;	0002			LANGUAGE (BLISS32),

;	0003			IDENT = 'B0021A'

;	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 implements the DEACCESS function.

;	0033	!

;	0034	! ENVIRONMENT:

;	0035	!

;	0036	!	STARLET operating system, including privileged system services

;	0037	!	and internal exec routines.

;	0038	!

;	0039	!--

;	0040	!

;	0041	!

;	0042	! AUTHOR:  Andrew C. Goldstein,	 CREATION DATE:  6-Jan-1977  23:29

;	0043	!

;	0044	! REVISION HISTORY:

;	0045	!

;	0046	!   Andrew C. Goldstein, 16-Feb-1977  14:53

;	0047	!   X0002 - Modify for condition handling

;	0048	!

;	0049	!   Andrew C. Goldstein, 23-Mar-1977  15:03

;	0050	!   X0003 - Check for illegal parameters

;	0051	!

;	0052	!   Andrew C. Goldstein, 29-Mar-1977  17:19

;	0053	!   X0004 - Checksum file header after modification

;	0054	!

;	0055	!   Andrew C. Goldstein, 1-Apr-1977  17:00



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:11:26	DBB3:[F11B.SRC]DEACCS.B32;19					Page 1-1

;

;	0056	!   X0005 - Move GET_FIB out of kernel mode

;	0057	!

;	0058	!   Andrew C. Goldstein, 4-Apr-1977  16:45

;	0059	!   X0006 - Add file deletion code

;	0060	!

;	0061	!   Andrew C. Goldstein, 12-Apr-1977  15:22

;	0062	!   X0007 - Modify for buffer manager

;	0063	!

;	0064	!   Andrew C. Goldstein, 2-May-1977  16:35

;	0065	!   X0008 - Insert revision date and time

;	0066	!

;	0067	!   Andrew C. Goldstein, 23-Jun-1977  11:21

;	0068	!   X0009 - Set CLF_DELWINDOW bit

;	0069	!

;	0070	!   Andrew C. Goldstein, 12-Jul-1977  14:19

;	0071	!   X0010 - Move WRITE_ATTRIB out of kernel mode

;	0072	!

;	0073	!   Andrew C. Goldstein, 13-Jul-1977  15:38

;	0074	!   X0011 - Rework file header checksumming

;	0075	!

;	0076	!   Andrew C. Goldstein, 3-Aug-1977  16:51

;	0077	!   X0012 - Checksum file header at end if written

;	0078	!

;	0079	!   Andrew C. Goldstein, 17-Nov-1977  9:16

;	0080	!   X0013 - Skip write attributes if there are parameter errors

;	0081	!

;	0082	!   Andrew C. Goldstein, 12-Dec-1977  13:24

;	0083	!   X0014 - file ID interface changes

;	0084	!

;	0085	!   Andrew C. Goldstein, 14-Dec-1977  14:31

;	0086	!   X0015 - Modify for structure level 2

;	0087	!

;	0088	!   Andrew C. Goldstein, 23-Jan-1978  18:35

;	0089	!   B0016 - Condition revision date update on Ident area length

;	0090	!

;	0091	!   Andrew C. Goldstein, 2-May-78  10:26

;	0092	!   B0017 - Add truncate on close function

;	0093	!

;	0094	!   Andrew C. Goldstein, 22-May-78  21:43

;	0095	!   B0018 - Add dynamic bad block flagging

;	0096	!

;	0097	!   Andrew C. Goldstein, 15-Jun-78  17:24

;	0098	!   B0019 - Add implicit spooling support

;	0099	!

;	0100	!   Andrew C. Goldstein, 19-Jun-78  20:09

;	0101	!   B0020 - Checksum file header before truncate

;	0102	!

;	0103	!   Andrew C. Goldstein, 28-Jun-78  17:02

;	0104	!   B0021 - Add truncate and allocation interlocks

;	0105	!

;	0106	!**

;	0107	

;	0108	

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

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



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:11:26	DBB3:[F11B.SRC]DEACCS.B32;19					Page 1-2

;



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:11:26	DBB3:[F11B.SRC]DEACCS.B32;19					Page 2

;

;	0459	GLOBAL ROUTINE DEACCESS  =

;	0460	

;	0461	!++

;	0462	!

;	0463	! FUNCTIONAL DESCRIPTION:

;	0464	!

;	0465	!	This routine implements the DEACCESS function.

;	0466	!	If an attribute list is present, attributes are written.

;	0467	!

;	0468	! CALLING SEQUENCE:

;	0469	!	DEACCESS ()

;	0470	!

;	0471	! INPUT PARAMETERS:

;	0472	!	NONE

;	0473	!

;	0474	! IMPLICIT INPUTS:

;	0475	!	IO_PACKET: I/O packet in process

;	0476	!	CURRENT_WINDOW: window of file

;	0477	!	PRIMARY_FCB: FCB of file

;	0478	!

;	0479	! OUTPUT PARAMETERS:

;	0480	!	NONE

;	0481	!

;	0482	! IMPLICIT OUTPUTS:

;	0483	!	NONE

;	0484	!

;	0485	! ROUTINE VALUE:

;	0486	!	NONE

;	0487	!

;	0488	! SIDE EFFECTS:

;	0489	!	file deaccessed

;	0490	!	FCB may be deleted

;	0491	!	header may be modified

;	0492	!

;	0493	!--

;	0494	

;	0495	BEGIN

;	0496	

;	0497	LOCAL

;	0498		K,				! local copy of truncate lock count

;	0499		ABD		: REF BBLOCKVECTOR [,ABD$C_LENGTH],

;	0500						! buffer descriptors

;	0501		FIB		: REF BBLOCK,	! FIB

;	0502		FCB		: REF BBLOCK,	! pointer to FCB

;	0503		HEADER		: REF BBLOCK,	! file header

;	0504		IDENT_AREA	: REF BBLOCK;	! header ident area

;	0505	

;	0506	EXTERNAL

;	0507		CLEANUP_FLAGS	: BITVECTOR,	! cleanup action flags

;	0508		USER_STATUS	: VECTOR,	! I/O status going back to user

;	0509		IO_PACKET	: REF BBLOCK,	! I/O packet in process

;	0510		FILE_HEADER	: REF BBLOCK,	! global copy of current file header

;	0511		CURRENT_WINDOW	: REF BBLOCK,	! window of file

;	0512		PRIMARY_FCB	: REF BBLOCK,	! FCB of file

;	0513		CURRENT_VCB	: REF BBLOCK;	! VCB of volume



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:11:26	DBB3:[F11B.SRC]DEACCS.B32;19					Page 2-1

;

;	0514	

;	0515	EXTERNAL ROUTINE

;	0516		GET_FIB,			! get FIB of request

;	0517		READ_HEADER,			! read file header

;	0518		SEND_SYMBIONT,			! send file to symbiont manager

;	0519		MARK_DIRTY,			! mark buffer for write-back

;	0520		WRITE_ATTRIB,			! write attributes routine

;	0521		TRUNCATE,			! truncate file

;	0522		UPDATE_FCB,			! update contents of FCB

;	0523		CHECKSUM;			! compute file header checksum

;	0524	

;	0525	

;	0526	! Set the cleanup flags to cause the deaccess to occurr.

;	0527	! Find the buffer descriptor and FIB.

;	0528	!

;	0529	

;	0530	CLEANUP_FLAGS[CLF_ZCHANNEL] = 1;

;	0531	CLEANUP_FLAGS[CLF_DEACCESS] = 1;

;	0532	CLEANUP_FLAGS[CLF_DELWINDOW] = 1;

;	0533	

;	0534						! pointer to buffer descriptors

;	0535	ABD = .BBLOCK [.IO_PACKET[IRP$L_SVAPTE], AIB$L_DESCRIPT];

;	0536	FIB = GET_FIB (.ABD);

;	0537	FCB = .PRIMARY_FCB;

;	0538	

;	0539	! Make sure irrelevant parameters are not present.

;	0540	!

;	0541	

;	0542	IF .FIB[FIB$V_EXTEND]

;	0543	THEN ERR_STATUS (SS$_BADPARAM);

;	0544	

;	0545	! If the file is accessed for write, or if the file is marked for delete

;	0546	! or is marked bad and this is the last access, read the header.

;	0547	!

;	0548	

;	0549	IF .CURRENT_WINDOW[WCB$V_WRITE]

;	0550	OR ((.FCB[FCB$V_MARKDEL] OR .FCB[FCB$V_BADBLK] OR .CLEANUP_FLAGS[CLF_SPOOLFILE])

;	0551	    AND .FCB[FCB$W_ACNT] EQL 1)

;	0552	THEN HEADER = READ_HEADER (0, .FCB);

;	0553	

;	0554	! If this the last deaccess from a file marked for delete, delete the file.

;	0555	! If the file is a spool file, send it to the job controller.

;	0556	!

;	0557	

;	0558	IF .FCB[FCB$W_ACNT] EQL 1

;	0559	THEN

;	0560	    BEGIN

;	0561	    IF .FCB[FCB$V_MARKDEL]

;	0562	    THEN CLEANUP_FLAGS[CLF_DELFILE] = 1;

;	0563	

;	0564	    IF .CLEANUP_FLAGS[CLF_SPOOLFILE]

;	0565	    THEN SEND_SYMBIONT (.ABD, .HEADER, .FCB);

;	0566	

;	0567	! If the FCB is marked bad, now set the bad block bit in the file header.

;	0568	!



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:11:26	DBB3:[F11B.SRC]DEACCS.B32;19					Page 2-2

;

;	0569	

;	0570	    IF .FCB[FCB$V_BADBLK]

;	0571	    THEN

;	0572		BEGIN

;	0573		HEADER[FH2$V_BADBLOCK] = 1;

;	0574		MARK_DIRTY (.HEADER);

;	0575		END;

;	0576	    END;

;	0577	

;	0578	! Do deaccess processing for a write accessed file.

;	0579	!

;	0580	

;	0581	IF .CURRENT_WINDOW[WCB$V_WRITE]

;	0582	THEN

;	0583	    BEGIN

;	0584	    MARK_DIRTY (.HEADER);

;	0585	

;	0586	

;	0587	! Increment the revision count of the file. If a deaccess lock was

;	0588	! requested on the file, set the lock bit. Then process the write

;	0589	! attributes, if any. If attributes were written, then clear the

;	0590	! lock bit.

;	0591	!

;	0592	

;	0593	    IF .HEADER[FH2$B_MPOFFSET] - .HEADER[FH2$B_IDOFFSET] GEQU

;	0594		($BYTEOFFSET (FI2$Q_REVDATE) + FI2$S_REVDATE) / 2

;	0595	    THEN

;	0596		BEGIN

;	0597		IDENT_AREA = .HEADER + .HEADER[FH2$B_IDOFFSET]*2;

;	0598		IDENT_AREA[FI2$W_REVISION] = .IDENT_AREA[FI2$W_REVISION] + 1;

;	0599		$GETTIM (TIMADR = IDENT_AREA[FI2$Q_REVDATE]);

;	0600		END;

;	0601	

;	0602	    IF .CURRENT_WINDOW[WCB$V_DLOCK]

;	0603	    THEN HEADER[FH2$V_LOCKED] = 1;

;	0604	

;	0605	    IF .IO_PACKET[IRP$W_BCNT] GTR ABD$C_ATTRIB

;	0606	    AND .USER_STATUS[0]

;	0607	    THEN

;	0608		BEGIN

;	0609		WRITE_ATTRIB (.HEADER, .ABD);

;	0610		HEADER[FH2$V_LOCKED] = 0;

;	0611		END;

;	0612	

;	0613	! If a truncate is requested, do it (if the file was write accessed). Note

;	0614	! that we must manually clear the truncate cleanup flag, since deaccess

;	0615	! always exits through error exit.

;	0616	!

;	0617	

;	0618	    IF .FIB[FIB$V_TRUNC]

;	0619	    THEN

;	0620		BEGIN

;	0621		IF .CURRENT_VCB[VCB$V_NOALLOC]

;	0622		THEN ERR_EXIT (SS$_WRITLCK);

;	0623	



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:11:26	DBB3:[F11B.SRC]DEACCS.B32;19					Page 2-3

;

;	0624		K = .FCB[FCB$W_TCNT];

;	0625		IF .CURRENT_WINDOW[WCB$V_NOTRUNC]

;	0626		THEN K = .K - 1;

;	0627		IF .K NEQ 0

;	0628		THEN ERR_EXIT (SS$_ACCONFLICT);

;	0629	

;	0630		CHECKSUM (.HEADER);

;	0631		TRUNCATE (.FIB, .HEADER, DEALLOC_BLOCKS);

;	0632		CLEANUP_FLAGS[CLF_CLEANTRUNC] = 0;

;	0633		CLEANUP_FLAGS[CLF_FIXFCB] = 0;

;	0634		KERNEL_CALL (UPDATE_FCB, .FILE_HEADER);

;	0635		END;

;	0636	    END;

;	0637	

;	0638	! Return failure to let the error cleanup do the actual deaccessing.

;	0639	!

;	0640	

;	0641	RETURN 0;

;	0642	

;	0643	END;					! end of routine DEACCESS





							    .TITLE  DEACCS

							    .IDENT  \B0021A\



							    .EXTRN  CLEANUP_FLAGS, USER_STATUS, IO_PACKET, FILE_HEADER

							    .EXTRN  CURRENT_WINDOW, PRIMARY_FCB, CURRENT_VCB, GET_FIB

							    .EXTRN  READ_HEADER, SEND_SYMBIONT, MARK_DIRTY, WRITE_ATTRIB

							    .EXTRN  TRUNCATE, UPDATE_FCB, CHECKSUM, SYS$GETTIM, SYS$CMKRNL



							    .PSECT  $CODE$,NOWRT,2



					 00FC 00000 	    .ENTRY  DEACCESS, Save R2,R3,R4,R5,R6,R7			      ; 0459

		         57 	0000G  CF  9E 00002 	    MOVAB   CURRENT_WINDOW, R7					      ;

		         56 	0000G  CF  9E 00007 	    MOVAB   CLEANUP_FLAGS, R6					      ;

		    02   A6	0403   8F  A8 0000C 	    BISW2   #1027, CLEANUP_FLAGS+2				      ; 0532

		         50 	0000G  CF  D0 00012 	    MOVL    IO_PACKET, R0					      ; 0535

		         55 	  2C   B0  D0 00017 	    MOVL    @44(R0), ABD					      ;

				       55  DD 0001B 	    PUSHL   ABD							      ; 0536

		  0000G  CF	       01  FB 0001D 	    CALLS   #1, GET_FIB						      ;

		         54 	       50  D0 00022 	    MOVL    R0, FIB						      ;

		         52 	0000G  CF  D0 00025 	    MOVL    PRIMARY_FCB, FCB					      ; 0537

	   05 	    16   A4	       07  E1 0002A 	    BBC     #7, 22(FIB), 1$					      ; 0542

		  0000G  CF	       14  B0 0002F 	    MOVW    #20, USER_STATUS					      ; 0543

		         50 	       67  D0 00034 1$:     MOVL    CURRENT_WINDOW, R0					      ; 0549

	   14 	    0B   A0	       01  E0 00037 	    BBS     #1, 11(R0), 3$					      ;

	   09 	    1E   A2	       01  E0 0003C 	    BBS     #1, 30(FCB), 2$					      ; 0550

	   04 	    1E   A2	       02  E0 00041 	    BBS     #2, 30(FCB), 2$					      ;

	   12 	         66 	       07  E1 00046 	    BBC     #7, CLEANUP_FLAGS, 4$				      ;

		         01 	  18   A2  B1 0004A 2$:     CMPW    24(FCB), #1						      ; 0551

				       0C  12 0004E 	    BNEQ    4$							      ;

				       52  DD 00050 3$:     PUSHL   FCB							      ; 0552

				       7E  D4 00052 	    CLRL    -(SP)						      ;

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

		         53 	       50  D0 00059 	    MOVL    R0, HEADER						      ;



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:11:26	DBB3:[F11B.SRC]DEACCS.B32;19					Page 2-4

;

		         01 	  18   A2  B1 0005C 4$:     CMPW    24(FCB), #1						      ; 0558

				       29  12 00060 	    BNEQ    7$							      ;

	   04 	    1E   A2	       01  E1 00062 	    BBC     #1, 30(FCB), 5$					      ; 0561

		    02   A6	       20  88 00067 	    BISB2   #32, CLEANUP_FLAGS+2				      ; 0562

	   0B 	         66 	       07  E1 0006B 5$:     BBC     #7, CLEANUP_FLAGS, 6$				      ; 0564

				       52  DD 0006F 	    PUSHL   FCB							      ; 0565

				       53  DD 00071 	    PUSHL   HEADER						      ;

				       55  DD 00073 	    PUSHL   ABD							      ;

		  0000G  CF	       03  FB 00075 	    CALLS   #3, SEND_SYMBIONT					      ;

	   0C 	    1E   A2	       02  E1 0007A 6$:     BBC     #2, 30(FCB), 7$					      ; 0570

		    35   A3	  40   8F  88 0007F 	    BISB2   #64, 53(HEADER)					      ; 0573

				       53  DD 00084 	    PUSHL   HEADER						      ; 0574

		  0000G  CF	       01  FB 00086 	    CALLS   #1, MARK_DIRTY					      ;

		         50 	       67  D0 0008B 7$:     MOVL    CURRENT_WINDOW, R0					      ; 0581

	   7A 	    0B   A0	       01  E1 0008E 	    BBC     #1, 11(R0), 13$					      ;

				       53  DD 00093 	    PUSHL   HEADER						      ; 0584

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

		         50 	       63  9A 0009A 	    MOVZBL  (HEADER), R0					      ; 0593

		         51 	  01   A3  9A 0009D 	    MOVZBL  1(HEADER), R1					      ;

		         51 	       50  C2 000A1 	    SUBL2   R0, R1						      ;

		         13 	       51  D1 000A4 	    CMPL    R1, #19						      ;

				       11  1F 000A7 	    BLSSU   8$							      ;

		         50 	     6340  3E 000A9 	    MOVAW   (HEADER)[R0], IDENT_AREA				      ; 0597

				  14   A0  B6 000AD 	    INCW    20(IDENT_AREA)					      ; 0598

				  1E   A0  9F 000B0 	    PUSHAB  30(IDENT_AREA)					      ; 0599

	      00000000G  9F	       01  FB 000B3 	    CALLS   #1, @#SYS$GETTIM					      ;

		         50 	       67  D0 000BA 8$:     MOVL    CURRENT_WINDOW, R0					      ; 0602

	   05 	    14   A0	       01  E1 000BD 	    BBC     #1, 20(R0), 9$					      ;

		    34   A3	  40   8F  88 000C2 	    BISB2   #64, 52(HEADER)					      ; 0603

		         50 	0000G  CF  D0 000C7 9$:     MOVL    IO_PACKET, R0					      ; 0605

		         05 	  32   A0  B1 000CC 	    CMPW    50(R0), #5						      ;

				       11  1B 000D0 	    BLEQU   10$							      ;

		         0C 	0000G  CF  E9 000D2 	    BLBC    USER_STATUS, 10$					      ; 0606

				       28  BB 000D7 	    PUSHR   #^M<R3,R5>						      ; 0609

		  0000G  CF	       02  FB 000D9 	    CALLS   #2, WRITE_ATTRIB					      ;

		    34   A3	  40   8F  8A 000DE 	    BICB2   #64, 52(HEADER)					      ; 0610

		         54 	  17   A4  E9 000E3 10$:    BLBC    23(FIB), 15$					      ; 0618

		         50 	0000G  CF  D0 000E7 	    MOVL    CURRENT_VCB, R0					      ; 0621

	   06 	    0B   A0	       04  E1 000EC 	    BBC     #4, 11(R0), 11$					      ;

				025C   8F  BF 000F1 	    CHMU    #604						      ; 0622

				       44  11 000F5 	    BRB     15$							      ;

		         51 	  46   A2  3C 000F7 11$:    MOVZWL  70(FCB), K						      ; 0624

		         50 	       67  D0 000FB 	    MOVL    CURRENT_WINDOW, R0					      ; 0625

	   02 	    15   A0	       03  E1 000FE 	    BBC     #3, 21(R0), 12$					      ;

				       51  D7 00103 	    DECL    K							      ; 0626

				       51  D5 00105 12$:    TSTL    K							      ; 0627

				       06  13 00107 	    BEQL    14$							      ;

				0800   8F  BF 00109 	    CHMU    #2048						      ; 0628

				       2C  11 0010D 13$:    BRB     15$							      ;

				       53  DD 0010F 14$:    PUSHL   HEADER						      ; 0630

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

				       01  DD 00116 	    PUSHL   #1							      ; 0631

				       53  DD 00118 	    PUSHL   HEADER						      ;

				       54  DD 0011A 	    PUSHL   FIB							      ;

		  0000G  CF	       03  FB 0011C 	    CALLS   #3, TRUNCATE					      ;



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:11:26	DBB3:[F11B.SRC]DEACCS.B32;19					Page 2-5

;

		         66 00080002   8F  CA 00121 	    BICL2   #524290, CLEANUP_FLAGS				      ; 0632

				0000G  CF  DD 00128 	    PUSHL   FILE_HEADER						      ; 0634

				       01  DD 0012C 	    PUSHL   #1							      ;

				       5E  DD 0012E 	    PUSHL   SP							      ;

				0000G  CF  9F 00130 	    PUSHAB  UPDATE_FCB						      ;

	      00000000G  9F	       04  FB 00134 	    CALLS   #4, @#SYS$CMKRNL					      ;

				       50  D4 0013B 15$:    CLRL    R0							      ; 0459

					   04 0013D 	    RET     							      ;



; Routine Size:  318 bytes





;	0644	

;	0645	END

;	0646	ELUDOM













;				       PSECT SUMMARY

;

;	Name		 Bytes			       Attributes

;

;  $CODE$         	   318  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        34         0       246











; Size:		318 code + 0 data bytes

; Run Time:	00:09.3

; Elapsed Time:	00:21.7

; Memory Used:	327 pages

; Compilation Complete

