home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / os / vms / 19588 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  5.6 KB

  1. Path: sparky!uunet!spool.mu.edu!agate!dog.ee.lbl.gov!ucbvax!UV3.EGLIN.AF.MIL!RICHARDE
  2. From: RICHARDE@UV3.EGLIN.AF.MIL ("Eric F. Richards")
  3. Newsgroups: comp.os.vms
  4. Subject: RE: ACP-QIO to read QUOTA.SYS
  5. Message-ID: <9212192143.AA11827@ucbvax.Berkeley.EDU>
  6. Date: 19 Dec 92 21:12:00 GMT
  7. Sender: daemon@ucbvax.BERKELEY.EDU
  8. Distribution: world
  9. Organization: The Internet
  10. Lines: 175
  11.  
  12.  
  13. Dave (no return address) writes:
  14.  
  15. > I'm looking for a short example using the QIO-ACP interface to diskquota.
  16. > I can't seem to get my code to work, and the documentation isn't clear
  17. > enough for me.  (I haven't used the QIO-ACP interface before, and I'm
  18. > trying to do it from Fortran).  The unclear parts are:
  19. >
  20. >  o Is the CHAN arg to $QIO a channel to the device or to QUOTA.SYS?
  21.  
  22. This is a channel to the device.
  23.  
  24. >   o Can/should the P1 parameter be Fortran structure type /JIBDEF1/,
  25. >      /JIBDEF/, or those UNIONed togather? (i.e. can it be a short JIB,
  26. >      and if so how short?)
  27.  
  28. I assume you mean FIB here -- I defined it as FIB$K_LENGTH.  It's not
  29. all that big.  I'd guess that from the FM, you wouldn't need to have
  30. more than enough space to hold FIB$L_CNTRLVAL since this is the
  31. last field that I see being used.
  32.  
  33. >   o Do you need the P2 arg if the JIB$L_CNTRLVAL is set to match all
  34. >     group & member UIC's, and if so, what do you put in the the
  35. >     DQF$L_UIC field of the quota data block?
  36.  
  37. Nothing.  It'll be filled on each successive call.  Be sure to clear
  38. FIB$L_WCC to restart your search.
  39.  
  40. >   o What value do you put in the 2nd word of the descriptor to the
  41. >     JIB & quota block? (e.q. what are "x" and "y" in DSC$K_DTYPE_x
  42. >     DCS$K_CLASS_y.  I'm currently trying to use zero for both...)
  43.  
  44. Zero works for me.
  45.  
  46. > Please, a sample if you have one handy.  Fortran preferred, C or Macro-32
  47. > are also fine.
  48.  
  49. Without a return address, I'm posting this.  My apologies to the rest of
  50. the world; type "N" to skip.
  51.  
  52. ------------------------------------------------------------------------------
  53.  
  54. Example of a wild-card get all quotas routine:  I used this in conjunction
  55. with a Pascal program (available upon request) to get all quotas and sort the
  56. information.  This is necessary since the info returned by $QIO is not
  57. sorted, just like the QUOTA.SYS file itself.
  58.  
  59. ------------------------------------------------------------------------------
  60.  
  61.     .title    ALLQUOTA - A wild card SHOW QUOTA
  62.     .ident    /V1.02A/
  63. ;
  64. ;    This routine returns information about all users' quota.
  65. ;
  66. ;    Calling format:
  67. ;
  68. ;    status = ALLQUOTA(diskn, uic, used, perm, overd)
  69. ;
  70. ;    Inputs:
  71. ;        diskn    - ascii descriptor of the disk name
  72. ;
  73. ;    Outputs:
  74. ;        status    - return status code
  75. ;        UIC    - User Identification Code
  76. ;        used     - amount used
  77. ;        perm    - perm quota
  78. ;        overd    - overdraft
  79. ;
  80. ;    Eric F. Richards
  81. ;    10-Aug-85
  82. ;    Gould OSD VAX-11/780, VAX/VMS V4.1
  83. ;
  84.     .sbttl    Definitions
  85. ;;;    .default displacement, word
  86.     .enable    suppression
  87.     .disable traceback, debug
  88.     .library /sys$library:lib/
  89.     $dqfdef                    ; disk quota file offsets
  90.     $iodef                    ; I/O function codes
  91.     $ssdef                    ; system service messages
  92.     $fibdef                    ; file info block offsets
  93.     nargs    = 5                ; number of arguments
  94.     disk    = 4                ; device name 
  95.     uic    = 8                ; uic
  96.     usage    = 12                ; usage
  97.     permq    = 16                ; permquota
  98.     ovrdr    = 20                ; overdraft
  99.  
  100.     .sbttl    Main Code
  101.     .psect    $code, pic, shr, word, exe, nowrt
  102.  
  103.     .entry    allquota, ^m<>
  104.  
  105.     tstw    chan                ; channel assigned?
  106.     bneq    20$                ; don't reassign if so
  107.  
  108.     cmpw    (ap), #nargs            ; correct # of args?
  109.     bgeq    10$                ; yes: continue
  110.     movl    #ss$_insfarg, r0        ; no: insuff call args
  111.     ret                    ; get outta here
  112.  
  113. 10$:    movw    #fib$c_exa_quota, -        ; else, retrieve quota
  114.         fib$w_cntrlfunc+fib        ; Examine quota entry
  115.     movl    #<fib$m_all_mem!fib$m_all_grp>,-; Set grp, mem wild cards
  116.         fib+fib$l_cntrlval        ; for control value
  117.     clrl    fib$l_wcc+fib            ; reset wild card scan field
  118.  
  119.     $assign_s devnam=@disk(ap), -        ; assign a channel to
  120.           chan=chan            ; the current disk
  121.     blbc    r0, 30$                ; error check
  122.  
  123. ;
  124. ;  Dave -- note that P2, P4 really shouldn't be done this way if
  125. ;  you're building a sharable image -- pardon sloppy code on my
  126. ;  part.  add inst MOVAL QUODSC, R0; change P2, P4 to Px=R0.
  127. ;  (Poor programming technique on my part.)
  128. ;
  129.  
  130. 20$:    $qiow_s    chan=chan, -            ; ask the acp (xqp) for
  131.         func=#io$_acpcontrol, -        ; information
  132.         iosb=iosb, -            ; return I/O status block
  133.         p1=fibdsc, -            ; give it: File info block,
  134.         p2=#quodsc, -            ; Quota File Transfer block
  135.         p4=#quodsc            ; receive same
  136.     blbc    r0, 30$                ; error check
  137.     movzwl    iosb, r0            ; check I/O SB for error
  138.     blbc    r0, 30$                ; return status in r0 
  139.  
  140.     movl    dqf+dqf$l_uic,         @uic(ap)    ; return UIC
  141.     movl    dqf+dqf$l_usage,     @usage(ap)    ; return usage
  142.     movl    dqf+dqf$l_permquota, @permq(ap)    ; return quota
  143.     movl    dqf+dqf$l_overdraft, @ovrdr(ap)    ; return overdraft
  144.     ret                    ; go home now
  145.  
  146. 30$:    tstw    chan                ; was a channel assgned?
  147.     beql    40$                ; no: skip it
  148.     pushl    r0                ; save error status
  149.     $dassgn_s chan=chan            ; done, dassgn channel
  150.     clrw    chan                ; destroy chan buf
  151.     popl    r0                ; restore error status
  152. 40$:    ret                    ; go home
  153.  
  154.     .sbttl    Local Data
  155.     .psect    $local, noexe, long, pic, noshr
  156.  
  157. fibdsc:    .long    fib$k_length            ; descriptor for FIB
  158.     .address fib                ; pointer to the FIB buffer
  159. quodsc:    .long    dqf$k_length            ; desc for the QFTB
  160.     .address dqf                ; ptr to its buffer
  161.  
  162. iosb:    .blkl    2                ; QIO I/O status block
  163. chan:    .blkw    1                ; channel number
  164.  
  165.     .align    long
  166. dqf:    .blkb    dqf$k_length            ; space for quota block,
  167.     .align    long
  168. fib:    .blkb    fib$k_length            ; FIB buffer
  169.  
  170.     .end                    ; all done
  171.  
  172. ------------------------------------------------------------------------------
  173.  
  174.  
  175. > Thanks,
  176. >
  177. > ++ Dave
  178.  
  179. Eric F. Richards
  180. Senior Software Engineer
  181. Tybrin Corp
  182. richarde@eglin.af.mil
  183. 904/882-9795
  184. "Opinions here are my own."
  185.  
  186.  
  187.