

; Bliss-32 10.1-416	Monday 21-AUG-1978 22:53:00	DBB3:[F11A.SRC]DEACCS.B32;17					Page 1

;

;	0001	MODULE DEACCS (

;	0002			LANGUAGE (BLISS32),

;	0003			IDENT = 'A0018A'

;	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 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 22:53:00	DBB3:[F11A.SRC]DEACCS.B32;17					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, 2-May-78  10:23

;	0086	!   X0015 - Add truncate on close function

;	0087	!

;	0088	!   Andrew C. Goldstein, 15-Jun-78  17:25

;	0089	!   A0016 - Add implicit spooling support

;	0090	!

;	0091	!   Andrew C. Goldstein, 19-Jun-78  20:06

;	0092	!   A0017 - Checksum header before truncate operation

;	0093	!

;	0094	!   Andrew C. Goldstein, 28-Jun-78  17:04

;	0095	!   A0018 - Add truncate and allocation interlocks

;	0096	!

;	0097	!**

;	0098	

;	0099	

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

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



; Bliss-32 10.1-416	Monday 21-AUG-1978 22:53:00	DBB3:[F11A.SRC]DEACCS.B32;17					Page 2

;

;	0420	GLOBAL ROUTINE DEACCESS  =

;	0421	

;	0422	!++

;	0423	!

;	0424	! FUNCTIONAL DESCRIPTION:

;	0425	!

;	0426	!	This routine implements the DEACCESS function.

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

;	0428	!

;	0429	! CALLING SEQUENCE:

;	0430	!	DEACCESS ()

;	0431	!

;	0432	! INPUT PARAMETERS:

;	0433	!	NONE

;	0434	!

;	0435	! IMPLICIT INPUTS:

;	0436	!	IO_PACKET: I/O packet in process

;	0437	!	CURRENT_WINDOW: window of file

;	0438	!	PRIMARY_FCB: FCB of file

;	0439	!

;	0440	! OUTPUT PARAMETERS:

;	0441	!	NONE

;	0442	!

;	0443	! IMPLICIT OUTPUTS:

;	0444	!	NONE

;	0445	!

;	0446	! ROUTINE VALUE:

;	0447	!	NONE

;	0448	!

;	0449	! SIDE EFFECTS:

;	0450	!	file deaccessed

;	0451	!	FCB may be deleted

;	0452	!	header may be modified

;	0453	!

;	0454	!--

;	0455	

;	0456	BEGIN

;	0457	

;	0458	LOCAL

;	0459		K,				! local copy of truncate lock count

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

;	0461						! buffer descriptors

;	0462		FIB		: REF BBLOCK,	! FIB

;	0463		FCB		: REF BBLOCK,	! pointer to FCB

;	0464		HEADER		: REF BBLOCK,	! file header

;	0465		IDENT_AREA	: REF BBLOCK;	! header ident area

;	0466	

;	0467	EXTERNAL

;	0468		CLEANUP_FLAGS	: BITVECTOR,	! cleanup action flags

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

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

;	0471		FILE_HEADER	: REF BBLOCK,	! global pointer to current file header

;	0472		CURRENT_WINDOW	: REF BBLOCK,	! window of file

;	0473		PRIMARY_FCB	: REF BBLOCK,	! FCB of file

;	0474		CURRENT_VCB	: REF BBLOCK;	! VCB of volume



; Bliss-32 10.1-416	Monday 21-AUG-1978 22:53:00	DBB3:[F11A.SRC]DEACCS.B32;17					Page 2-1

;

;	0475	

;	0476	EXTERNAL ROUTINE

;	0477		GET_FIB,			! get FIB of request

;	0478		READ_HEADER,			! read file header

;	0479		SEND_SYMBIONT,			! send file to symbiont manager

;	0480		MARK_DIRTY,			! mark buffer for write-back

;	0481		GET_TIME,			! get date and time string

;	0482		WRITE_ATTRIB,			! write attributes routine

;	0483		TRUNCATE,			! truncate file

;	0484		UPDATE_FCB,			! update contents of FCB

;	0485		CHECKSUM;			! compute file header checksum

;	0486	

;	0487	

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

;	0489	! Find the buffer descriptor and FIB.

;	0490	!

;	0491	

;	0492	CLEANUP_FLAGS[CLF_ZCHANNEL] = 1;

;	0493	CLEANUP_FLAGS[CLF_DEACCESS] = 1;

;	0494	CLEANUP_FLAGS[CLF_DELWINDOW] = 1;

;	0495	

;	0496						! pointer to buffer descriptors

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

;	0498	FIB = GET_FIB (.ABD);

;	0499	FCB = .PRIMARY_FCB;

;	0500	

;	0501	! Make sure irrelevant parameters are not present.

;	0502	!

;	0503	

;	0504	IF .FIB[FIB$V_EXTEND]

;	0505	THEN ERR_STATUS (SS$_BADPARAM);

;	0506	

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

;	0508	! and this is the last access, read the header.

;	0509	!

;	0510	

;	0511	IF .CURRENT_WINDOW[WCB$V_WRITE]

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

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

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

;	0515	

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

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

;	0518	!

;	0519	

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

;	0521	THEN

;	0522	    BEGIN

;	0523	

;	0524	    IF .FCB[FCB$V_MARKDEL]

;	0525	    THEN CLEANUP_FLAGS[CLF_DELFILE] = 1;

;	0526	

;	0527	    IF .CLEANUP_FLAGS[CLF_SPOOLFILE]

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

;	0529	    END;



; Bliss-32 10.1-416	Monday 21-AUG-1978 22:53:00	DBB3:[F11A.SRC]DEACCS.B32;17					Page 2-2

;

;	0530	

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

;	0532	!

;	0533	

;	0534	IF .CURRENT_WINDOW[WCB$V_WRITE]

;	0535	THEN

;	0536	    BEGIN

;	0537	    MARK_DIRTY (.HEADER);

;	0538	

;	0539	

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

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

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

;	0543	! lock bit.

;	0544	!

;	0545	

;	0546	    IDENT_AREA = .HEADER + .HEADER[FH1$B_IDOFFSET]*2;

;	0547	    IDENT_AREA[FI1$W_REVISION] = .IDENT_AREA[FI1$W_REVISION] + 1;

;	0548	    GET_TIME (IDENT_AREA[FI1$T_REVDATE]);

;	0549	

;	0550	    IF .CURRENT_WINDOW[WCB$V_DLOCK]

;	0551	    THEN HEADER[FH1$V_LOCKED] = 1;

;	0552	

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

;	0554	    AND .USER_STATUS[0]

;	0555	    THEN

;	0556		BEGIN

;	0557		WRITE_ATTRIB (.HEADER, .ABD);

;	0558		HEADER[FH1$V_LOCKED] = 0;

;	0559		END;

;	0560	

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

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

;	0563	! always exits through error exit.

;	0564	!

;	0565	

;	0566	    IF .FIB[FIB$V_TRUNC]

;	0567	    THEN

;	0568		BEGIN

;	0569		IF .CURRENT_VCB[VCB$V_NOALLOC]

;	0570		THEN ERR_EXIT (SS$_WRITLCK);

;	0571	

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

;	0573		IF .CURRENT_WINDOW[WCB$V_NOTRUNC]

;	0574		THEN K = .K - 1;

;	0575		IF .K NEQ 0

;	0576		THEN ERR_EXIT (SS$_ACCONFLICT);

;	0577	

;	0578		CHECKSUM (.HEADER);

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

;	0580		CLEANUP_FLAGS[CLF_CLEANTRUNC] = 0;

;	0581		CLEANUP_FLAGS[CLF_FIXFCB] = 0;

;	0582		KERNEL_CALL (UPDATE_FCB, .FILE_HEADER);

;	0583		END;

;	0584	



; Bliss-32 10.1-416	Monday 21-AUG-1978 22:53:00	DBB3:[F11A.SRC]DEACCS.B32;17					Page 2-3

;

;	0585	    CHECKSUM (.HEADER);			! checksum the file header

;	0586	    END;

;	0587	

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

;	0589	!

;	0590	

;	0591	RETURN 0;

;	0592	

;	0593	END;					! end of routine DEACCESS





							    .TITLE  DEACCS

							    .IDENT  \A0018A\



							    .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, GET_TIME

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



							    .PSECT  $CODE$,NOWRT,2



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

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

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

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

				       55  DD 0001B 	    PUSHL   ABD							      ; 0498

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

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

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

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

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

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

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

		         01 	  18   A2  B1 00045 2$:     CMPW    24(FCB), #1						      ; 0513

				       0C  12 00049 	    BNEQ    4$							      ;

				       52  DD 0004B 3$:     PUSHL   FCB							      ; 0514

				       7E  D4 0004D 	    CLRL    -(SP)						      ;

		  0000G  CF	       02  FB 0004F 	    CALLS   #2, READ_HEADER					      ;

		         53 	       50  D0 00054 	    MOVL    R0, HEADER						      ;

		         01 	  18   A2  B1 00057 4$:     CMPW    24(FCB), #1						      ; 0520

				       18  12 0005B 	    BNEQ    6$							      ;

	   04 	    1E   A2	       01  E1 0005D 	    BBC     #1, 30(FCB), 5$					      ; 0524

		    02   A6	       20  88 00062 	    BISB2   #32, CLEANUP_FLAGS+2				      ; 0525

	   0B 	         66 	       07  E1 00066 5$:     BBC     #7, CLEANUP_FLAGS, 6$				      ; 0527

				       52  DD 0006A 	    PUSHL   FCB							      ; 0528

				       53  DD 0006C 	    PUSHL   HEADER						      ;

				       55  DD 0006E 	    PUSHL   ABD							      ;

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

		         50 	       67  D0 00075 6$:     MOVL    CURRENT_WINDOW, R0					      ; 0534

	   03 	    0B   A0	       01  E0 00078 	    BBS     #1, 11(R0), 7$					      ;

				     009D  31 0007D 	    BRW     14$							      ;



; Bliss-32 10.1-416	Monday 21-AUG-1978 22:53:00	DBB3:[F11A.SRC]DEACCS.B32;17					Page 2-4

;

				       53  DD 00080 7$:     PUSHL   HEADER						      ; 0537

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

		         50 	       63  9A 00087 	    MOVZBL  (HEADER), R0					      ; 0546

		         50 	     6340  3E 0008A 	    MOVAW   (HEADER)[R0], IDENT_AREA				      ;

				  0A   A0  B6 0008E 	    INCW    10(IDENT_AREA)					      ; 0547

				  0C   A0  9F 00091 	    PUSHAB  12(IDENT_AREA)					      ; 0548

		  0000G  CF	       01  FB 00094 	    CALLS   #1, GET_TIME					      ;

		         50 	       67  D0 00099 	    MOVL    CURRENT_WINDOW, R0					      ; 0550

	   05 	    14   A0	       01  E1 0009C 	    BBC     #1, 20(R0), 8$					      ;

		    0C   A3	  40   8F  88 000A1 	    BISB2   #64, 12(HEADER)					      ; 0551

		         50 	0000G  CF  D0 000A6 8$:     MOVL    IO_PACKET, R0					      ; 0553

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

				       11  1B 000AF 	    BLEQU   9$							      ;

		         0C 	0000G  CF  E9 000B1 	    BLBC    USER_STATUS, 9$					      ; 0554

				       28  BB 000B6 	    PUSHR   #^M<R3,R5>						      ; 0557

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

		    0C   A3	  40   8F  8A 000BD 	    BICB2   #64, 12(HEADER)					      ; 0558

		         50 	  17   A4  E9 000C2 9$:     BLBC    23(FIB), 13$					      ; 0566

		         50 	0000G  CF  D0 000C6 	    MOVL    CURRENT_VCB, R0					      ; 0569

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

				025C   8F  BF 000D0 	    CHMU    #604						      ; 0570

		         51 	  46   A2  3C 000D4 10$:    MOVZWL  70(FCB), K						      ; 0572

		         50 	       67  D0 000D8 	    MOVL    CURRENT_WINDOW, R0					      ; 0573

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

				       51  D7 000E0 	    DECL    K							      ; 0574

				       51  D5 000E2 11$:    TSTL    K							      ; 0575

				       04  13 000E4 	    BEQL    12$							      ;

				0800   8F  BF 000E6 	    CHMU    #2048						      ; 0576

				       53  DD 000EA 12$:    PUSHL   HEADER						      ; 0578

		  0000G  CF	       01  FB 000EC 	    CALLS   #1, CHECKSUM					      ;

				       01  DD 000F1 	    PUSHL   #1							      ; 0579

				       53  DD 000F3 	    PUSHL   HEADER						      ;

				       54  DD 000F5 	    PUSHL   FIB							      ;

		  0000G  CF	       03  FB 000F7 	    CALLS   #3, TRUNCATE					      ;

		         66 00080002   8F  CA 000FC 	    BICL2   #524290, CLEANUP_FLAGS				      ; 0580

				0000G  CF  DD 00103 	    PUSHL   FILE_HEADER						      ; 0582

				       01  DD 00107 	    PUSHL   #1							      ;

				       5E  DD 00109 	    PUSHL   SP							      ;

				0000G  CF  9F 0010B 	    PUSHAB  UPDATE_FCB						      ;

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

				       53  DD 00116 13$:    PUSHL   HEADER						      ; 0585

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

				       50  D4 0011D 14$:    CLRL    R0							      ; 0591

					   04 0011F 	    RET     							      ; 0420



; Routine Size:  288 bytes





;	0594	

;	0595	END

;	0596	ELUDOM











; Bliss-32 10.1-416	Monday 21-AUG-1978 22:53:00	DBB3:[F11A.SRC]DEACCS.B32;17					Page 2-5

;





;				       PSECT SUMMARY

;

;	Name		 Bytes			       Attributes

;

;  $CODE$         	   288  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       242











; Size:		288 code + 0 data bytes

; Run Time:	00:08.5

; Elapsed Time:	00:20.5

; Memory Used:	315 pages

; Compilation Complete

