Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: jack@yvette.ucdavis.edu (John M. Crowell)
Subject: Re: Soln: Attn RT-11 gurus: file protect detection
Date: 13 Feb 92 16:51:35 GMT	[thread overview]
Message-ID: <17730@aggie.ucdavis.edu> (raw)
In-Reply-To: 1992Feb7.131645.1612@vixvax.mgi.com

In article <1992Feb7.131645.1612@vixvax.mgi.com> cepek@vixvax.mgi.com writes:
>
> On RT-11, is there a way to find out if a file is protected (without
> having to muddle through the directory itself)?
> :
>

Well the obvious (to me at least) way to determine whether
a file is protected is to look at its status word with the
.GFSTA programmed request, which returns the status word
in R0.

e.g.

	.GFSTA	#area,#chan,#dblk
	bcs	error
	tst	r0	; bit 15 =1 => protected
	bmi	aprot	; branch if file protected
	.
	.
	.
dblk:	.word		; .RAD50 of device goes here
	.word		; .RAD50 of file name goes
	.word		;      in these two words
	.word		; .RAD50 of extension goes here


Of course you can accomplish the same thing with
.GFINF using an offset of zero to point to the
status word:

	.GFINF	#area,#chan,#dblk,#0
	bcs	error
	tst	r0
	bmi	aprot



If you're using an antiquated version of RT-11 that
doesn't have .GFSTA and .GFINF, you can use the
USR callback on a .LOOKUP (triggered by an odd
address for the dblk entry.

e.g.
	; directory entry offsets

	e.stat	=  0	; offset to status word
	e.date	= 14	; offset to date word

	.lookup	#farea,#chan
	bcs	error
	tst	status	; look at status word
	bmi	aprot	; branch if file protected
	.
	.
	.close	#chan
	.
	.
	.
; Check file status
;  This routine is entered after file is found
;  with R1 pointing to the date word in the
;  directory entry in the USR buffer.

chksta:	mov	<e.stat-e.date>(r1),status
	rts	pc
	.
	.
	.
status:	.word	0	; file status goes here

farea:	.byte	chan,1	; these will be filled in by .LOOKUP
	.word	dblk+1	; odd address triggers callback
	.word	0	; no sequence number
	.word	0	; this word is ignored
	.word	chkstq	; address of callback routine


For more information and more examples of USR callback
routines, see the February, 1990 issue of the DECUS
Newsletter.


  reply	other threads:[~1992-02-13 16:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1992-02-06 15:44 Attn RT-11 gurus: file protect detection? cepek
1992-02-07  1:02 ` cepek
1992-02-07 18:16   ` Soln: Attn RT-11 gurus: file protect detection cepek
1992-02-13 16:51     ` John M. Crowell [this message]
1992-02-07 20:24 ` Attn RT-11 gurus: file protect detection? Jerry Weiss
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox