;/* acf4:comp.os.vms / davidc@montagar.lonestar.org (David L. Cathey, SYSOP) / 8:13 am Sep 24, 1990 */ ; ; Here is a program that will provide a count of total headers in ;the INDEXF.SYS and the number of free headers that are left for SYS$DISK:. ;Note that it will only provide information on SYS$DISK, I didn't take the ;time to make a nifty user interface... Also, it does not flush the cache, ;and that can effect the number of free headers somewhat. ; ;- 8< cut here - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - .title HEADERCNT ;++ ; ; HEADCNT -- Count the number of free headers in the INDEXF.SYS ; ; Author: David L. Cathey ; Date: 23-SEP-1990 ; Copyright: 1990, Montagar Software Concepts ; ; Note: This software is intended as an example only. No warranties ; as to its usability are implied. It's free and you get what you pay ; for! This software may be freely distributed as long as it is ; accompanied by the copyright notice. ;-- .library /SYS$LIBRARY:LIB/ $HM2DEF ; Home Block (ODS-2) Definitions ; ; Some home grown macros... ; .MACRO _STKDEF SYM,ALLOC,SIZ .IIF NB,ALLOC, ALLOC SIZ .IIF NB,SYM, SYM = - . .ENDM _STKDEF .MACRO _STKEND STACK_K_LENGTH = - . .CROSS .RESTORE addl2 #STACK_K_LENGTH,sp .ENDM _STKEND .MACRO _STKINI .SAVE LOCAL_BLOCK .NOCROSS .PSECT _ABS_,ABS .ENDM _STKINI .macro _ILDEF $DEFINI IL $DEF IL_BUFLEN .blkw 1 $DEF IL_CODE .blkw 1 $DEF IL_ADDR .blkl 1 $DEF IL_RETLEN .blkl 1 $EQU IL_LENGTH . $DEFEND IL .macro _ILDEF .endm _ILDEF .endm _ILDEF _ILDEF .macro ITMLST_ITEM code,buflen,bufadr,retlen=0 movw code,IL_CODE+(r0) movw buflen,IL_BUFLEN+(r0) moval bufadr,IL_ADDR+(r0) .if IDN <0> .iff moval retlen,IL_RETLEN+(r0) .endc ITEM_NUMBER = ITEM_NUMBER + 1 .endm ITMLST_ITEM .macro ITMLST_START itmlst,count _ILDEF pushr #^M movc5 #0,(sp),#0,#,itmlst popr #^M movab itmlst,r0 ITEM_NUMBER = 0 .endm ITMLST_START i_fab: $FAB dnm=<[000000]INDEXF.SYS>,fac=,fop=, - shr= i_rab: $RAB fab=i_fab sys$disk: .ascid /SYS$DISK:/ ;++ ; Entry point ;-- .enable local_block .entry Main,0 _STKINI _STKDEF FP_ITMLST .blkb <3*IL_LENGTH> ; 3 element item list _STKDEF FP_DEVNAM .blkb 16 ; full device name _STKDEF FP_DEVNAMLEN .blkl 1 ; full device name length _STKEND ITMLST_START FP_ITMLST(fp),count=3 ITMLST_ITEM code=#DVI$_FULLDEVNAM, - buflen=#16, - bufadr=FP_DEVNAM(fp), - retlen=FP_DEVNAMLEN(fp) ; Get SYS$DISK device name $GETDVIW_S devnam=sys$disk, - itmlst=FP_ITMLST(fp) blbc r0,999$ $FAB_STORE fab=i_fab, - fna=FP_DEVNAM(fp), - ; Fill in FAB fns=FP_DEVNAMLEN(fp) $OPEN fab=i_fab blbc r0,999$ ; Access INDEXF.SYS $CONNECT rab=i_rab blbc r0,999$ calls #0,Process_INDEXF ; Process the INDEXF.SYS 999$: ret .page ;++ ; Process the INDEXF... ;-- .enable local_block .entry Process_INDEXF,^M _STKINI _STKDEF FP_DESC .blkq 1 ; Output descriptor _STKDEF FP_BUFFER .blkb 132 ; Output Buffer _STKDEF FP_HOMEBLK .blkb 512 ; HOME Block Buffer _STKEND $RAB_STORE rab=i_rab, - ubf=FP_HOMEBLK(fp), - usz=#512, - bkt=#2 ; Get HOME block $READ rab=i_rab blbs r0,5$ brw 999$ 5$: movab FP_HOMEBLK(fp),r6 ; Get address of HM in r6 movzwl HM2$W_IBMAPSIZE(r6),r7 mull2 #512,r7 ; Compute stack required for BM subl2 r7,sp ; Free up stack space movab FP_HOMEBLK(fp),r11 subl2 r7,r11 ; Calculate stack buffer address movzwl HM2$W_IBMAPVBN(r6),r10 ; Get index bit map VBN $RAB_STORE rab=i_rab, - ubf=(r11), - usz=r7, - ; Set up RAB for trasfer bkt=r10 $READ rab=i_rab ; Get bit map... blbc r0,999$ clrl r8 ; Clear r8 (bit number) clrl r9 ; # of free headers 10$: ffc r8,#32,(r11),r8 ; Find a free header cmpl r8,i_fab+FAB$L_ALQ ; Out of bounds of INDEXF ALQ? bgtr 20$ ; Yes, done! incl r9 ; Increment # free headers incl r8 ; Skip this bit, now... brb 10$ ; Find another 20$: movzwl HM2$W_IBMAPVBN(r6),r8 ; Get bit map VBN, movzwl HM2$W_IBMAPSIZE(r6),r1 ; and bit map size, subl3 r8,i_fab+FAB$L_ALQ,r11 ; subtract # blocks in INDEXF to subl2 r1,r11 ; first actual header from ALQ movab FP_BUFFER(fp),FP_DESC+4(fp) movl #132,FP_DESC(fp) $FAO_S ctrstr=1000$, - outlen=FP_DESC(fp), - outbuf=FP_DESC(fp), - ; Format output buffer p1=r11, - p2=r9 blbc r0,999$ pushaq FP_DESC(fp) ; Output results... calls #1,g^LIB$PUT_OUTPUT 999$: ret 1000$: .ascid /Number of headers: !SL, Number of free headers: !SL/ .end Main ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;David L. Cathey |INET: davidc@montagar.lonestar.org ;"Can't have everything, where would you |UUCP: ...!letni!montagar!davidc ;put it?"-Steven Wright "Everywhere!"-Me |Fone: (214)-618-2117 ;/* ---------- */ ;