home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!agate!dog.ee.lbl.gov!ucbvax!UV3.EGLIN.AF.MIL!RICHARDE
- From: RICHARDE@UV3.EGLIN.AF.MIL ("Eric F. Richards")
- Newsgroups: comp.os.vms
- Subject: RE: ACP-QIO to read QUOTA.SYS
- Message-ID: <9212192143.AA11827@ucbvax.Berkeley.EDU>
- Date: 19 Dec 92 21:12:00 GMT
- Sender: daemon@ucbvax.BERKELEY.EDU
- Distribution: world
- Organization: The Internet
- Lines: 175
-
-
- Dave (no return address) writes:
-
- > I'm looking for a short example using the QIO-ACP interface to diskquota.
- > I can't seem to get my code to work, and the documentation isn't clear
- > enough for me. (I haven't used the QIO-ACP interface before, and I'm
- > trying to do it from Fortran). The unclear parts are:
- >
- > o Is the CHAN arg to $QIO a channel to the device or to QUOTA.SYS?
-
- This is a channel to the device.
-
- > o Can/should the P1 parameter be Fortran structure type /JIBDEF1/,
- > /JIBDEF/, or those UNIONed togather? (i.e. can it be a short JIB,
- > and if so how short?)
-
- I assume you mean FIB here -- I defined it as FIB$K_LENGTH. It's not
- all that big. I'd guess that from the FM, you wouldn't need to have
- more than enough space to hold FIB$L_CNTRLVAL since this is the
- last field that I see being used.
-
- > o Do you need the P2 arg if the JIB$L_CNTRLVAL is set to match all
- > group & member UIC's, and if so, what do you put in the the
- > DQF$L_UIC field of the quota data block?
-
- Nothing. It'll be filled on each successive call. Be sure to clear
- FIB$L_WCC to restart your search.
-
- > o What value do you put in the 2nd word of the descriptor to the
- > JIB & quota block? (e.q. what are "x" and "y" in DSC$K_DTYPE_x
- > DCS$K_CLASS_y. I'm currently trying to use zero for both...)
-
- Zero works for me.
-
- > Please, a sample if you have one handy. Fortran preferred, C or Macro-32
- > are also fine.
-
- Without a return address, I'm posting this. My apologies to the rest of
- the world; type "N" to skip.
-
- ------------------------------------------------------------------------------
-
- 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 #<fib$m_all_mem!fib$m_all_grp>,-; 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
-
- ------------------------------------------------------------------------------
-
-
- > Thanks,
- >
- > ++ Dave
-
- Eric F. Richards
- Senior Software Engineer
- Tybrin Corp
- richarde@eglin.af.mil
- 904/882-9795
- "Opinions here are my own."
-
-
-