;
ALLQUOTA.MAR ACP-QIO to read QUOTA.SYS
;From: RICHARDE@UV3.EGLIN.AF.MIL ("Eric F. Richards")
;Date: 19 Dec 92 21:12:00 GMT
;Example of a wild-card get all quotas routine: I used this in conjunction
;with a Pascal program (available upon request) to get all quotas and sort the
;information. This is necessary since the info returned by $QIO is not
;sorted, just like the QUOTA.SYS file itself.
.title ALLQUOTA - A wild card SHOW QUOTA
.ident /V1.02A/
;
; This routine returns information about all users' quota.
;
; Calling format:
;
; status = ALLQUOTA(diskn, uic, used, perm, overd)
;
; Inputs:
; diskn - ascii descriptor of the disk name
;
; Outputs:
; status - return status code
; UIC - User Identification Code
; used - amount used
; perm - perm quota
; overd - overdraft
;
; Eric F. Richards
; 10-Aug-85
; Gould OSD VAX-11/780, VAX/VMS V4.1
;
.sbttl Definitions
;;; .default displacement, word
.enable suppression
.disable traceback, debug
.library /sys$library:lib/
$dqfdef ; disk quota file offsets
$iodef ; I/O function codes
$ssdef ; system service messages
$fibdef ; file info block offsets
nargs = 5 ; number of arguments
disk = 4 ; device name
uic = 8 ; uic
usage = 12 ; usage
permq = 16 ; permquota
ovrdr = 20 ; overdraft
.sbttl Main Code
.psect $code, pic, shr, word, exe, nowrt
.entry allquota, ^m<>
tstw chan ; channel assigned?
bneq 20$ ; don't reassign if so
cmpw (ap), #nargs ; correct # of args?
bgeq 10$ ; yes: continue
movl #ss$_insfarg, r0 ; no: insuff call args
ret ; get outta here
10$: movw #fib$c_exa_quota, - ; else, retrieve quota
fib$w_cntrlfunc+fib ; Examine quota entry
movl #,-; Set grp, mem wild cards
fib+fib$l_cntrlval ; for control value
clrl fib$l_wcc+fib ; reset wild card scan field
$assign_s devnam=@disk(ap), - ; assign a channel to
chan=chan ; the current disk
blbc r0, 30$ ; error check
;
; Dave -- note that P2, P4 really shouldn't be done this way if
; you're building a sharable image -- pardon sloppy code on my
; part. add inst MOVAL QUODSC, R0; change P2, P4 to Px=R0.
; (Poor programming technique on my part.)
;
20$: $qiow_s chan=chan, - ; ask the acp (xqp) for
func=#io$_acpcontrol, - ; information
iosb=iosb, - ; return I/O status block
p1=fibdsc, - ; give it: File info block,
p2=#quodsc, - ; Quota File Transfer block
p4=#quodsc ; receive same
blbc r0, 30$ ; error check
movzwl iosb, r0 ; check I/O SB for error
blbc r0, 30$ ; return status in r0
movl dqf+dqf$l_uic, @uic(ap) ; return UIC
movl dqf+dqf$l_usage, @usage(ap) ; return usage
movl dqf+dqf$l_permquota, @permq(ap) ; return quota
movl dqf+dqf$l_overdraft, @ovrdr(ap) ; return overdraft
ret ; go home now
30$: tstw chan ; was a channel assgned?
beql 40$ ; no: skip it
pushl r0 ; save error status
$dassgn_s chan=chan ; done, dassgn channel
clrw chan ; destroy chan buf
popl r0 ; restore error status
40$: ret ; go home
.sbttl Local Data
.psect $local, noexe, long, pic, noshr
fibdsc: .long fib$k_length ; descriptor for FIB
.address fib ; pointer to the FIB buffer
quodsc: .long dqf$k_length ; desc for the QFTB
.address dqf ; ptr to its buffer
iosb: .blkl 2 ; QIO I/O status block
chan: .blkw 1 ; channel number
.align long
dqf: .blkb dqf$k_length ; space for quota block,
.align long
fib: .blkb fib$k_length ; FIB buffer
.end ; all done