home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / vmsnet / internal / 1555 < prev    next >
Encoding:
Text File  |  1992-11-08  |  8.3 KB  |  209 lines

  1. Path: sparky!uunet!decwrl!netsys!agate!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!usc!news.service.uci.edu!unogate!mvb.saic.com!macro32
  2. From: "Brian J. Schenkenberger, VAXman"
  3. Newsgroups: vmsnet.internals
  4. Subject: Re: Need help clearing FH2$V_ALM_AIP
  5. Message-ID: <01GQU7WXB88G96VWMI@MONMOUTH-etdl1.Army.MIL>
  6. Date: Fri, 6 Nov 1992 17:17 EDT
  7. Organization: Macro32<==>Vmsnet.Internals Gateway
  8. X-Gateway-Source-Info: Mailing List
  9. Lines: 198
  10.  
  11. >I was experimenting with the various ALM bits that could be set in
  12. >the UCHAR longword in a file header and managed to set FH2$V_ALM_AIP
  13. >(Archive In Progress).
  14. >
  15. >This bit seems to be unclearable.  I'll send an "Atta-boy" to
  16. >the first person to figure out how to at least let me erase
  17. >the file without having to reinit the disk it's on.
  18. >[...]
  19. >Jonathan Welch  VAX Systems Manager  Umass/Amherst  JHWELCH@ecs.umass.edu
  20.  
  21. Well... much to my chagrin, I was conscripted into performing my civic
  22. duty this week. Yes, Jury duty... complete with its $5.00 a day recompense.
  23. I never got on a case and had a lot of free time to compose a macro program
  24. for the above request on my papyrus laptop computer... (I hate working with
  25. its 'pointing device')
  26.  
  27. I was released from Jury duty today, so I typed it in, fixed a few minor bug-
  28. gers, and here it is...
  29.  
  30. This is a stripped down quick and dirty.  Other bits of error checking could
  31. applied.
  32.  
  33.         .title  CLEAR_ALM_AIP   (**example compliments of BJS**)
  34.  
  35.         .library        "sys$library:lib.mlb"
  36.         .link           "sys$system:sys.stb"
  37.  
  38.         $ccbdef         ; channel control block definitions
  39.         $fchdef         ; file characteristics definitions
  40.         $fh2def         ; ODS2 file header definitions
  41.         $fibdef         ; file info. block definitions
  42.         $wcbdef         ; window control block definitions
  43. ;----------------------------------------------------------------------------
  44.         .macro  check_status,status_block,?lbl1,?lbl2
  45.         blbs    r0,lbl1
  46.         ret
  47. lbl1:
  48.         .if nb  status_block
  49.         movzwl  status_block,r0
  50.         blbs    r0,lbl2
  51.         ret
  52. lbl2:
  53.         .endc
  54.         .endm   check_status
  55. ;------------------------------------------------------------------------------
  56.         .psect  $$$data,wrt,noexe,page
  57.  
  58. get_channel:    $assign devnam=sys_disk,chan=xqp_function+qio$_chan
  59. xqp_function:   $qio    func=io$_access!io$m_access,iosb=iosb,p1=fib_descr
  60.  
  61. fib_descr:      .long           fib$k_length
  62.                 .address        .+4
  63.  
  64. fib:            .blkb           fib$k_length
  65.                 .=fib+fib$w_fid_num             ;INDEXF.SYS
  66.                 .word   1                       ;FID=(1,1,0) - Always!!!
  67.                 .=fib+fib$w_fid_seq
  68.                 .word   1
  69.                 .=fib+fib$b_fid_rvn
  70.                 .byte   0
  71.                 .=fib+fib$b_fid_nmx
  72.                 .byte   0
  73.                 .=fib+fib$w_did_num             ;DID=(4,4,0) - Always!!!
  74.                 .word   4
  75.                 .=fib+fib$w_did_seq
  76.                 .word   4
  77.                 .=fib+fib$b_did_rvn
  78.                 .byte   0
  79.                 .=fib+fib$b_did_nmx
  80.                 .byte   0
  81.                 .=fib+fib$w_cntrlfunc
  82.                 .word           fib$c_remap
  83.                 .=fib+fib$w_nmctl
  84.                 .word           fib$m_findfid
  85.                 .=fib+fib$k_length
  86.  
  87. iosb:   .quad   0
  88. sys_disk:       .ascid  /YOURDISK/      ;<<<*** BYOD! you supply the drive
  89.  
  90. arglst:
  91. arglst.argcnt:  .long   3
  92. arglst.channel: .long   0
  93. arglst.vbn:     .long   3112    ;<<<*** VBN of your file's file header in
  94. arglst.lbn:     .long   0       ;       INDEXF.SYS...
  95.  
  96. ;----------------------------------------------------------------------------
  97.         .align  page
  98. block:  .blkb   512
  99. ;------------------------------------------------------------------------------
  100.         .psect  $$$code,nowrt,exe,long
  101.         .entry  fixfilehdr,0
  102.  
  103.         $assign_g       get_channel     ; assign a channel to the disk
  104.         check_status                    ; should we continue?
  105.  
  106.         $qiow_g xqp_function            ; access the disk's INDEXF.SYS
  107.         check_status    iosb            ; should we continue?
  108.  
  109.         movl    #io$_acpcontrol,-       ; setup function to remap the
  110.                 xqp_function+qio$_func  ; -- entire file
  111.  
  112.         $qiow_g xqp_function            ; map the entire file, lots o' WCBs
  113.         check_status    iosb            ; should we continue?
  114.  
  115.         movw    xqp_function+qio$_chan,-  ; put channel number in arg. list
  116.                 arglst.channel
  117.  
  118.         $cmexec_s  routin=vbn_to_lbn,-  ; executive routine to convert
  119.                         arglst=arglst   ; -- VBNs to LBNs
  120.  
  121.         movl    #io$_deaccess,-         ; setup function to deaccess
  122.                 xqp_function+qio$_func  ; -- the INDEXF.SYS file
  123.  
  124.         $qiow_g xqp_function            ; let the INDEXF.SYS file go...
  125.         check_status    iosb            ; should we continue?
  126.  
  127.         $qiow_s chan=xqp_function+qio$_chan,-   ; read in the file header
  128.                 func=#io$_readlblk,-            ; -- so we may modify it
  129.                 iosb=iosb,-                     ; -- to our liking...
  130.                 p1=block,-
  131.                 p2=#512,-
  132.                 p3=arglst.lbn
  133.  
  134.         check_status    iosb            ; should we continue?
  135.  
  136.         bbcc    #fch$v_alm_aip,-        ; clear that damn ALM_AIP bit
  137.                 block+fh2$l_filechar,.+1
  138.  
  139.         clrq    r0                      ; init counter & checksum accumulator
  140.  
  141. 10$:    addw2   block[r0],r1            ; calculate the new checksum value
  142.         aoblss  #255,r0,10$             ; -- for our hand written file header
  143.         movw    r1,block[r0]
  144.  
  145.         ; logical write is done here since the vitrual write is blocked
  146.         ; due to that nasty ALM_AIP bit...
  147.  
  148.         $qiow_s chan=xqp_function+qio$_chan,-   ; put our hand written file
  149.                 func=#io$_writelblk,-           ; -- header back in the disk.
  150.                 iosb=iosb,-
  151.                 p1=block,-
  152.                 p2=#512,-
  153.                 p3=arglst.lbn
  154.  
  155.         check_status    iosb            ; should we continue?
  156.  
  157.         movc5   #0,#0,#0,#fib$k_length,fib      ; start with a fresh fib block
  158.  
  159.         movw    #fib$c_flush_cache,-    ; need to flush file system caches
  160.                 fib+fib$w_cntrlfunc
  161.         movl    #fib$c_bfrd_cache,-     ; specifically, buffer desc. cache
  162.                 fib+fib$l_cntrlval
  163.  
  164.         movl    #io$_acpcontrol,-       ; setup function to remap the
  165.                 xqp_function+qio$_func  ; -- entire file
  166.  
  167.         $qiow_g xqp_function            ; access the disk's INDEXF.SYS
  168.  
  169.         check_status    iosb            ; should we continue?
  170.                                         ; (really not necessary, we're going
  171.         $exit_s r0                      ; to exit anyway)
  172. ;----------------------------------------------------------------------------
  173. argcnt  = 0
  174. channel = 4
  175. vbn     = 8     ; the vbn comes in but it doesn't go back!!
  176. lbn     = 12
  177.  
  178. stlbn   = 2
  179. stlbnsz = 4
  180.         .entry  vbn_to_lbn,0
  181.         movl    @#ctl$gl_ccbbase,r0     ; get base address oc CCB region
  182.         subl2   channel(ap),r0          ; get CCB of channel (rev. indexed)
  183.  
  184.         movl    ccb$l_wind(r0),r0       ; get 1st window mapping the file
  185. 10$:    movl    wcb$l_link(r0),r1       ; are there others???
  186.         beql    20$                     ; NO?? then branch to 20$
  187.         cmpl    vbn(ap),wcb$l_stvbn(r1) ; does our VBN map in this window?
  188.         blssu   20$                     ; NO?? then branch to 20$
  189.         movl    r1,r0                   ; use the next window
  190.         brb     10$                     ; ... and check it out again
  191.  
  192. 20$:    movzwl  wcb$w_nmap(r0),r1       ; how many map pointers in window
  193.         subl2   wcb$l_stvbn(r0),vbn(ap) ; offset by the window's start VBN
  194.         movab   wcb$w_p1_count(r0),r0   ; get the address of mapping pointers
  195. 30$:    cmpw    vbn(ap),(r0)            ; is our VBN in this map pointer?
  196.         blssu   40$                     ; YES?? then branch to 40$
  197.         subw2   (r0)+,vbn(ap)           ; offset our VBN by the mapping count
  198.         movab   stlbnsz(r0),r0          ; get address of next mapping pointer
  199.         sobgtr  r1,30$                  ; ... try, try again...
  200.         movl    #ss$_illblknum,r0
  201.         ret
  202.  
  203. 40$:    addl3   vbn(ap),stlbn(r0),lbn(ap)  ; VBN offset + Starting LBN = LBN
  204.         movl    #ss$_normal,r0          ; ok
  205.         ret
  206.  
  207.         .end    fixfilehdr
  208.  
  209.