.title VDASSIGN .sbttl Creates and/or Assigns Disk File to Virtual Disk Driver .ident /091488/ ; ;+ ;***** ; ; VDASSIGN -- Performs all required operations to associate a ; contiguous "container" file on a physical VMS volume to the ; virtual disk driver, VDDRIVER. Input command syntax is ; similar to the "ASSIGN" DCL command: ; ; VDASSIGN VDan: file_name/SIZE=nnn ; ; where: ; VDan: = Valid device name of VDDRIVER unit to be associated ; with the container file. ; file_name = Name of the container file; if the file does not ; exist, it will be created. ; nnn = Size of "file_name" in blocks to be allocated when the ; file is created. This option is ignored if "file_name" ; already exists. ; ;- ;***** ; ; Paul Sorenson ; AEP/Engineering Computer Support Center ; 1 Riverside Plaza ; Columbus, OH 43215 ; ;***** ; VD$IODEF ; define special VDDRIVER QIO functions .psect $LRWDATA,RD,WRT,NOEXE ; FAB: ; Virtual disk file access block $FAB ALQ=1024,- ; Allocation reset by "/SIZE=nnn" FOP=,- ; no further RMS action allowed XAB=XAB ; XAB: ; Extended file attributes $XABPRO PRO= ; File protection ; ASSIGN_LIST: $ASSIGN devnam=VD_DESC,- chan=VD_CHAN ; GET_FOREIGN_LIST: .long 4 ; # arguments .address IN_DESC ; input buffer descriptor .address P1_DESC ; 1st prompt string descriptor .address IN_SIZE ; place for output length .address PROMPT ; initial "force-prompt" value ; QIO_LIST: $QIO efn=0,- func=IO$_SETMODE!IO$M_VD_STARTUP,- iosb=IOSB ; IN_SIZE: .long 0 IN_DESC: .long IN_BUF_LENGTH .address IN_BUF IN_BUF: .blkb 128 IN_BUF_LENGTH = .-IN_BUF ; IOSB: .BLKL 2 ; PROMPT: .long 0 P1_DESC: ; 1st command line parameter prompt .ascid /Device ? / P2_DESC: ; 2nd command line parameter prompt .ascid /File name ? / ; SWITCH: .ascii &/SIZE=& ; VD_CHAN: ; channel # assigned to VDan: .blkl 1 VD_DESC: ; descriptor of virtual disk device .long 0 .address IN_BUF ; .psect $CODE,RD,WRT,EXE ; .page .sbttl ; ; .entry VD_ASSIGN,^M<> ; ; *** Start by retrieving command line from the CLI prompting for ; required input. ; 1$: CALLG GET_FOREIGN_LIST,G^LIB$GET_FOREIGN CMPL R0,#RMS$_EOF ; end-of-file ?? BNEQ 5$ ; branch if not, continue BRW EXIT ; else, exit 5$: MOVL IN_SIZE,R0 ; recover size of string MOVL IN_DESC+4,R1 ; and start address MOVL #1,PROMPT ; force prompting from here on SKPC #^A/ /,R0,(R1) ; skip leading spaces BEQL 1$ ; prompt again if null MOVL R1,VD_DESC+4 ; set start address of "VDan:" string LOCC #^A/ /,R0,(R1) ; find next space or end-of-string SUBL3 VD_DESC+4,R1,VD_DESC ; set length of string MOVAL P2_DESC,GET_FOREIGN_LIST+8 ; reset arg list for next prompt SUBL3 IN_DESC+4,R1,R2 ; compute # characters used from buffer SUBL R2,IN_DESC ; reset size and start address of MOVL R1,IN_DESC+4 ; input buffer for next prompt BRB 26$ ; branch to continue 20$: CALLG GET_FOREIGN_LIST,G^LIB$GET_FOREIGN CMPL R0,#RMS$_EOF ; end-of-file ?? BNEQ 24$ ; branch if not, continue BRW EXIT ; else, exit 24$: MOVL IN_SIZE,R0 ; recover size of string MOVL IN_DESC+4,R1 ; and start address 26$: SKPC #^A/ /,R0,(R1) ; skip leading spaces BEQL 20$ ; prompt again if null MOVL R1,FAB+FAB$L_FNA ; set start addr of "file_name" string LOCC #^A&/&,R0,(R1) ; locate "/" delimiter or end-of-string SUBL3 FAB+FAB$L_FNA,R1,FAB+FAB$B_FNS ; set length of "file_name" string TSTL R0 ; switch found ?? BEQL 40$ ; branch if not MATCHC #6,SWITCH,R0,(R1) ; is switch "/SIZE=" ?? BNEQ 38$ ; branch if not PUSHAL FAB+FAB$L_ALQ ; setup place for result PUSHL R3 ; setup address and PUSHL R2 ; length of string CALLS #3,G^LIB$CVT_DTB ; convert decimal string to binary BLBS R0,40$ ; branch on success 38$: MOVL #SS$_BADPARAM,R0 ; setup an error code BRB ERROR ; and terminate with error ; ; *** Assign channels to VDDRIVER and container file. Then issue the ; IO$_SETMODE!IO$M_VD_STARTUP QIO to VDDRIVER to associate the ; file with the virtual disk device. ; 40$: $ASSIGN_G ASSIGN_LIST ; assign channel to VDDRIVER BLBC R0,ERROR ; branch on error $CREATE FAB=FAB ; create/open container file BLBC R0,ERROR ; branch on error MOVZWL #SS$_FILNOTCNTG,R0 ; assume error BBC #FAB$V_CTG,FAB+FAB$L_FOP,ERROR ; branch if file is not contiguous MOVZWL VD_CHAN,QIO_LIST+QIO$_CHAN ; define channel to VDDRIVER MOVZWL FAB+FAB$L_STV,QIO_LIST+QIO$_P1 ; save channel to file as QIO parameter $QIOW_G QIO_LIST ; issued "startup" QIO BLBC R0,ERROR ; branch on error MOVZWL IOSB,R0 ; pickup I/O status BLBS R0,EXIT ; branch on success, all done ERROR: PUSHL R0 ; setup error status CALLS #1,G^LIB$SIGNAL ; signal the condition EXIT: $EXIT_S ; .end VD_ASSIGN