

; Bliss-32 10.1-416	Monday 21-AUG-1978 23:12:49	DBB3:[F11B.SRC]DIRACC.B32;6					Page 1

;

;	0001	MODULE DIRACC (

;	0002			LANGUAGE (BLISS32),

;	0003			IDENT = 'B0010'

;	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 "accesses" a directory and readies it for processing.

;	0033	! ENVIRONMENT:

;	0034	!

;	0035	!	STARLET operating system, including privileged system services

;	0036	!	and internal exec routines.

;	0037	!

;	0038	!--

;	0039	!

;	0040	!

;	0041	! AUTHOR:  Andrew C. Goldstein,	 CREATION DATE:  2-Jan-1977  22:53

;	0042	!

;	0043	! REVISION HISTORY:

;	0044	!

;	0045	!   Andrew C. Goldstein, 16-Feb-1977  14:55

;	0046	!   X0002 - Modify for condition handling

;	0047	!

;	0048	!   Andrew C. Goldstein, 3-May-1977  15:08

;	0049	!   X0003 - Add file protection check

;	0050	!

;	0051	!   Andrew C. Goldstein, 22-Jul-1977  17:06

;	0052	!   X0004 - Add check for multi-header directory

;	0053	!

;	0054	!   Andrew C. Goldstein, 4-Nov-1977  14:55

;	0055	!   X0005 - Remove end of file setup (done by INIFCB)



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:12:49	DBB3:[F11B.SRC]DIRACC.B32;6					Page 1-1

;

;	0056	!

;	0057	!   Andrew C. Goldstein, 12-Dec-1977  13:36

;	0058	!   X0006 - file ID interface changes

;	0059	!

;	0060	!   Andrew C. Goldstein, 14-Dec-1977  14:44

;	0061	!   X0007 - Modify for structure level 2

;	0062	!

;	0063	!   Andrew C. Goldstein, 3-Jan-1978  20:01

;	0064	!   B0008 - Create oversized FCB's for directories

;	0065	!

;	0066	!   Andrew C. Goldstein, 5-Jan-1978  20:46

;	0067	!   B0009 - Clear file header address after read

;	0068	!

;	0069	!   Andrew C. Goldstein, 1-Feb-1978  13:40

;	0070	!   B0010 - Save FILE_HEADER across directory header read

;	0071	!

;	0072	!**

;	0073	

;	0074	

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

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

;	0425	

;	0426	

;	0427	FORWARD ROUTINE

;	0428		DIR_ACCESS	: NOVALUE,	! access a directory

;	0429		CREATE_DFCB;			! create directory FCB



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:12:49	DBB3:[F11B.SRC]DIRACC.B32;6					Page 2

;

;	0430	GLOBAL ROUTINE DIR_ACCESS (FIB, WRITE) : NOVALUE =

;	0431	

;	0432	!++

;	0433	!

;	0434	! FUNCTIONAL DESCRIPTION:

;	0435	!

;	0436	!	This routine "accesses" a directory and readies it for processing.

;	0437	!

;	0438	! CALLING SEQUENCE:

;	0439	!	DIR_ACCESS (ARG1, ARG2)

;	0440	!

;	0441	! INPUT PARAMETERS:

;	0442	!	ARG1: address of FIB

;	0443	!	ARG2: 0 if read only

;	0444	!	      1 if read/write

;	0445	!

;	0446	! IMPLICIT INPUTS:

;	0447	!	NONE

;	0448	!

;	0449	! OUTPUT PARAMETERS:

;	0450	!	NONE

;	0451	!

;	0452	! IMPLICIT OUTPUTS:

;	0453	!	DIR_FCB: address of FCB for directory

;	0454	!

;	0455	! ROUTINE VALUE:

;	0456	!	NONE

;	0457	!

;	0458	! SIDE EFFECTS:

;	0459	!	FCB may be created

;	0460	!	directory LRU may be altered

;	0461	!	directory file header may be read

;	0462	!

;	0463	!--

;	0464	

;	0465	BEGIN

;	0466	

;	0467	MAP

;	0468		FIB		: REF BBLOCK;	! FIB argument

;	0469	

;	0470	LOCAL

;	0471		TEMP,				! temp to save header address

;	0472		FCB		: REF BBLOCK,	! FCB address

;	0473		HEADER		: REF BBLOCK;	! directory header address

;	0474	

;	0475	EXTERNAL

;	0476		DIR_FCB		: REF BBLOCK,	! global FCB address

;	0477		FILE_HEADER	: REF BBLOCK;	! global file header address

;	0478	

;	0479	EXTERNAL ROUTINE

;	0480		SEARCH_FCB,			! search FCB list

;	0481		READ_HEADER,			! read file header

;	0482		CHECK_PROTECT,			! check file protection

;	0483		MAKE_DIR_FCB;			! put directory FCB in LRU

;	0484	



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:12:49	DBB3:[F11B.SRC]DIRACC.B32;6					Page 2-1

;

;	0485	

;	0486	! First find the FCB of the directory, if any exists.

;	0487	!

;	0488	

;	0489	FCB = SEARCH_FCB (FIB[FIB$W_DID]);

;	0490	

;	0491	! If there was no FCB, or it is an accessed file, read the header.

;	0492	! If the FCB is in the LRU, check the sequence number since no

;	0493	! one else does. If there was no FCB, create one.

;	0494	!

;	0495	

;	0496	HEADER = 0;				! assume no header

;	0497	IF (IF .FCB EQL 0 THEN 1 ELSE (NOT .FCB[FCB$V_DIR]))

;	0498	THEN

;	0499	    BEGIN

;	0500	    TEMP = .FILE_HEADER;

;	0501	    HEADER = READ_HEADER (FIB[FIB$W_DID], .FCB);

;	0502	    FILE_HEADER = .TEMP;		! restore main header address

;	0503	    END

;	0504	ELSE

;	0505	    IF .FCB[FCB$W_FID_SEQ] NEQ .FIB[FIB$W_DID_SEQ]

;	0506		THEN ERR_EXIT (SS$_FILESEQCHK);

;	0507	

;	0508	IF .FCB EQL 0

;	0509	    THEN FCB = KERNEL_CALL (CREATE_DFCB, .HEADER);

;	0510	DIR_FCB = .FCB;				! store global FCB address

;	0511	

;	0512	! Check directory file protection.

;	0513	!

;	0514	

;	0515	CHECK_PROTECT (.WRITE, .HEADER, .FCB);

;	0516	

;	0517	! If we read a header, check the file attributes to make sure that

;	0518	! this is a real directory file.

;	0519	!

;	0520	

;	0521	IF .HEADER NEQ 0

;	0522	THEN

;	0523	    BEGIN

;	0524	    IF NOT .HEADER[FH2$V_DIRECTORY]

;	0525	    OR NOT .HEADER[FH2$V_CONTIG]

;	0526	    OR .BBLOCK [HEADER[FH2$W_RECATTR], FAT$B_RTYPE] NEQ FAT$C_VARIABLE

;	0527	    OR .BBLOCK [HEADER[FH2$W_RECATTR], FAT$B_RATTRIB] NEQ FAT$M_NOSPAN

;	0528	    OR .HEADER[FH2$W_SEG_NUM] NEQ 0

;	0529	    OR .HEADER[FH2$W_EX_FIDNUM] NEQ 0

;	0530	    OR .HEADER[FH2$W_EX_FIDSEQ] NEQ 0

;	0531	    OR .HEADER[FH2$W_EX_FIDRVN] NEQ 0

;	0532	    THEN ERR_EXIT (SS$_BADIRECTORY);

;	0533	    END;

;	0534	

;	0535	! Arbitrate the access interlocks.

;	0536	!

;	0537	

;	0538	IF .FCB[FCB$V_EXCL]			! check for exclusive access

;	0539	    THEN ERR_EXIT (SS$_ACCONFLICT);



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:12:49	DBB3:[F11B.SRC]DIRACC.B32;6					Page 2-2

;

;	0540	IF .WRITE				! if write access desired

;	0541	AND .FCB[FCB$W_LCNT] NEQ 0		! and file locked against writers

;	0542	    THEN ERR_EXIT (SS$_ACCONFLICT);

;	0543	

;	0544	! Make the final diddles for the FCB to be useful for directory searches.

;	0545	!

;	0546	

;	0547	KERNEL_CALL (MAKE_DIR_FCB, .FCB);

;	0548	

;	0549	RETURN 1;

;	0550	

;	0551	END;					! end of routine DIR_ACCESS





							    .TITLE  DIRACC

							    .IDENT  \B0010\



							    .EXTRN  DIR_FCB, FILE_HEADER, SEARCH_FCB, READ_HEADER

							    .EXTRN  CHECK_PROTECT, MAKE_DIR_FCB, SYS$CMKRNL



							    .PSECT  $CODE$,NOWRT,2



					 007C 00000 	    .ENTRY  DIR_ACCESS, Save R2,R3,R4,R5,R6			      ; 0430

		         56 00000000G  9F  9E 00002 	    MOVAB   @#SYS$CMKRNL, R6					      ;

		         52 	  04   AC  D0 00009 	    MOVL    FIB, R2						      ; 0489

				  0A   A2  9F 0000D 	    PUSHAB  10(R2)						      ;

		  0000G  CF	       01  FB 00010 	    CALLS   #1, SEARCH_FCB					      ;

		         54 	       50  D0 00015 	    MOVL    R0, FCB						      ;

				       53  D4 00018 	    CLRL    HEADER						      ; 0496

				       54  D5 0001A 	    TSTL    FCB							      ; 0497

				       04  13 0001C 	    BEQL    1$							      ;

		         19 	  1E   A4  E8 0001E 	    BLBS    30(FCB), 2$						      ;

		         55 	0000G  CF  D0 00022 1$:     MOVL    FILE_HEADER, TEMP					      ; 0500

				       54  DD 00027 	    PUSHL   FCB							      ; 0501

				  0A   A2  9F 00029 	    PUSHAB  10(R2)						      ;

		  0000G  CF	       02  FB 0002C 	    CALLS   #2, READ_HEADER					      ;

		         53 	       50  D0 00031 	    MOVL    R0, HEADER						      ;

		  0000G  CF	       55  D0 00034 	    MOVL    TEMP, FILE_HEADER					      ; 0502

				       0C  11 00039 	    BRB     3$							      ; 0497

		    0C   A2	  22   A4  B1 0003B 2$:     CMPW    34(FCB), 12(R2)					      ; 0505

				       05  13 00040 	    BEQL    3$							      ;

				08B8   8F  BF 00042 	    CHMU    #2232						      ; 0506

					   04 00046 	    RET     							      ;

				       54  D5 00047 3$:     TSTL    FCB							      ; 0508

				       10  12 00049 	    BNEQ    4$							      ;

				       53  DD 0004B 	    PUSHL   HEADER						      ; 0509

				       01  DD 0004D 	    PUSHL   #1							      ;

				       5E  DD 0004F 	    PUSHL   SP							      ;

				0000V  CF  9F 00051 	    PUSHAB  CREATE_DFCB						      ;

		         66 	       04  FB 00055 	    CALLS   #4, SYS$CMKRNL					      ;

		         54 	       50  D0 00058 	    MOVL    R0, FCB						      ;

		  0000G  CF	       54  D0 0005B 4$:     MOVL    FCB, DIR_FCB					      ; 0510

				       18  BB 00060 	    PUSHR   #^M<R3,R4>						      ; 0515

				  08   AC  DD 00062 	    PUSHL   WRITE						      ;

		  0000G  CF	       03  FB 00065 	    CALLS   #3, CHECK_PROTECT					      ;



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:12:49	DBB3:[F11B.SRC]DIRACC.B32;6					Page 2-3

;

				       53  D5 0006A 	    TSTL    HEADER						      ; 0521

				       2F  13 0006C 	    BEQL    6$							      ;

	   25 	    35   A3	       05  E1 0006E 	    BBC     #5, 53(HEADER), 5$					      ; 0524

	   20 	    34   A3	       07  E1 00073 	    BBC     #7, 52(HEADER), 5$					      ; 0525

		         02 	  14   A3  91 00078 	    CMPB    20(HEADER), #2					      ; 0526

				       1A  12 0007C 	    BNEQ    5$							      ;

		         08 	  15   A3  91 0007E 	    CMPB    21(HEADER), #8					      ; 0527

				       14  12 00082 	    BNEQ    5$							      ;

				  04   A3  B5 00084 	    TSTW    4(HEADER)						      ; 0528

				       0F  12 00087 	    BNEQ    5$							      ;

				  0E   A3  B5 00089 	    TSTW    14(HEADER)						      ; 0529

				       0A  12 0008C 	    BNEQ    5$							      ;

				  10   A3  B5 0008E 	    TSTW    16(HEADER)						      ; 0530

				       05  12 00091 	    BNEQ    5$							      ;

				  12   A3  B5 00093 	    TSTW    18(HEADER)						      ; 0531

				       05  13 00096 	    BEQL    6$							      ;

				0828   8F  BF 00098 5$:     CHMU    #2088						      ; 0532

					   04 0009C 	    RET     							      ;

	   09 	    1E   A4	       03  E0 0009D 6$:     BBS     #3, 30(FCB), 7$					      ; 0538

		         0A 	  08   AC  E9 000A2 	    BLBC    WRITE, 8$						      ; 0540

				  1A   A4  B5 000A6 	    TSTW    26(FCB)						      ; 0541

				       05  13 000A9 	    BEQL    8$							      ;

				0800   8F  BF 000AB 7$:     CHMU    #2048						      ; 0542

					   04 000AF 	    RET     							      ;

				       54  DD 000B0 8$:     PUSHL   FCB							      ; 0547

				       01  DD 000B2 	    PUSHL   #1							      ;

				       5E  DD 000B4 	    PUSHL   SP							      ;

				0000G  CF  9F 000B6 	    PUSHAB  MAKE_DIR_FCB					      ;

		         66 	       04  FB 000BA 	    CALLS   #4, SYS$CMKRNL					      ;

					   04 000BD 	    RET     							      ; 0430



; Routine Size:  190 bytes







; Bliss-32 10.1-416	Monday 21-AUG-1978 23:12:49	DBB3:[F11B.SRC]DIRACC.B32;6					Page 3

;

;	0552	ROUTINE CREATE_DFCB (HEADER) =

;	0553	

;	0554	!++

;	0555	!

;	0556	! FUNCTIONAL DESCRIPTION:

;	0557	!

;	0558	!	This routine creates a directory FCB and initializes it according to

;	0559	!	the given file header.

;	0560	!

;	0561	! CALLING SEQUENCE:

;	0562	!	CREATE_DFCB (ARG1)

;	0563	!

;	0564	! INPUT PARAMETERS:

;	0565	!	ARG1: address of file header

;	0566	!

;	0567	! IMPLICIT INPUTS:

;	0568	!	NONE

;	0569	!

;	0570	! OUTPUT PARAMETERS:

;	0571	!	NONE

;	0572	!

;	0573	! IMPLICIT OUTPUTS:

;	0574	!	NONE

;	0575	!

;	0576	! ROUTINE VALUE:

;	0577	!	ADDRESS OF FCB

;	0578	!

;	0579	! SIDE EFFECTS:

;	0580	!	FCB created and initialized

;	0581	!

;	0582	!--

;	0583	

;	0584	BEGIN

;	0585	

;	0586	MAP

;	0587		HEADER		: REF BBLOCK;	! file header argument

;	0588	

;	0589	LOCAL

;	0590		FCB		: REF BBLOCK;	! address of FCB created

;	0591	

;	0592	EXTERNAL ROUTINE

;	0593		ALLOCATE,			! allocate dynamic memory

;	0594		INIT_FCB2;			! initialize contents of FCB

;	0595	

;	0596	! Allocate an FCB sized and typed block, including the area for

;	0597	! the directory index. Then use the common routine to init it.

;	0598	!

;	0599	

;	0600	FCB = ALLOCATE (FCB$C_LENGTH+FCB$S_DIRIDX, FCB_TYPE);

;	0601	FCB[FCB$L_WLFL] = FCB[FCB$L_WLFL];	! init null window list

;	0602	FCB[FCB$L_WLBL] = FCB[FCB$L_WLFL];

;	0603	FCB[FCB$L_STVBN] = 1;			! init start VBN to 1

;	0604	CH$FILL (-1, FCB$S_DIRIDX, FCB[FCB$B_DIRIDX]);

;	0605	INIT_FCB2 (.FCB, .HEADER);

;	0606	RETURN .FCB;



; Bliss-32 10.1-416	Monday 21-AUG-1978 23:12:49	DBB3:[F11B.SRC]DIRACC.B32;6					Page 3-1

;

;	0607	

;	0608	END;					! end of routine CREATE_FCB







							    .EXTRN  ALLOCATE, INIT_FCB2



					 007C 000BE CREATE_DFCB:

							    .WORD   Save R2,R3,R4,R5,R6					      ; 0552

				       7E  D4 000C0 	    CLRL    -(SP)						      ; 0600

		         7E 	  58   8F  9A 000C2 	    MOVZBL  #88, -(SP)						      ;

		  0000G  CF	       02  FB 000C6 	    CALLS   #2, ALLOCATE					      ;

		         56 	       50  D0 000CB 	    MOVL    R0, FCB						      ;

		    10   A6	  10   A6  9E 000CE 	    MOVAB   16(FCB), 16(FCB)					      ; 0601

		    14   A6	  10   A6  9E 000D3 	    MOVAB   16(FCB), 20(FCB)					      ; 0602

		    28   A6	       01  D0 000D8 	    MOVL    #1, 40(FCB)						      ; 0603

      FF   8F	         6E 	       00  2C 000DC 	    MOVC5   #0, (SP), #-1, #16, 72(FCB)				      ; 0604

		    48   A6	       10     000E1									      ;

				  04   AC  DD 000E4 	    PUSHL   HEADER						      ; 0605

				       56  DD 000E7 	    PUSHL   FCB							      ;

		  0000G  CF	       02  FB 000E9 	    CALLS   #2, INIT_FCB2					      ;

		         50 	       56  D0 000EE 	    MOVL    FCB, R0						      ; 0606

					   04 000F1 	    RET     							      ; 0552



; Routine Size:  52 bytes





;	0609	

;	0610	END

;	0611	ELUDOM













;				       PSECT SUMMARY

;

;	Name		 Bytes			       Attributes

;

;  $CODE$         	   242  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        33         0       241











; Bliss-32 10.1-416	Monday 21-AUG-1978 23:12:49	DBB3:[F11B.SRC]DIRACC.B32;6					Page 3-2

;



; Size:		242 code + 0 data bytes

; Run Time:	00:07.6

; Elapsed Time:	00:14.6

; Memory Used:	294 pages

; Compilation Complete

