.TITLE SELECTPATH .IDENT /V1.0-4/ ;++ ; OVERVIEW: ; ; VMS has added preferred path selection QIO to V5.4 of VMS. This MACRO ; program provides a DCL foreign command line interface to this QIO ; ; To use it, assign a symbol to point to the image that starts with a $ ; (foreign command interface) i.e. "SELECTPATH :== $SELECTPATH". ; ; Issue the command "SELECTPATH hsc$device" where "hsc" is name of the HSC ; that is the prefered path, e.g. $10$DUA10: has a primary path HSC015 and ; secondary path HSC014. To select HSC014, use : ; $SELECTPATH HSC014$DUA10: ; This will set the prefered path on the local node so that the next ; mount will use that path (if /CLUSTER is used, all nodes in the ; cluster will use that path). Note that no change is made to the SHOW DEVICE ; output. If the disk is mounted (not foreign) then the IO$M_FORCEPATH ; modifier will be used to force the drive into mount verification and move ; it to the new HSC. ; ; PROGRAM NOTES: ; ; The following DCL command procedure will compile, link, and assign an ; appropriate symbol. ; ; $ if f$search("selectpath.mar") .nes. "" then - ; macro/list/cross'P1' selectpath ; $ if f$search("selectpath.obj") .nes. "" then - ; link/map/cross'P1' SELECTPATH ; $ purge/log ; $ selectpath :== $'f$logical("sys$disk")''f$directory()'selectpath ; $ exit ; $ ; ; RESTRICTIONS: ; ; Only devices mounted through the DU driver will respond to this QIO. ; Specifically, Phase I shadowed (DUS) devices can not be "failed-over" ; using this QIO. The member drives, however, can have the prefered ; path selected before they are mounted into a shadow-set. For Phase ; II shadowing, the member drives can be moved between HSCs without ; disolving the shadow-set. ;-- ;+ ; Macro library calls ;- .LIBRARY /SYS$LIBRARY:LIB/ $SSDEF $DVIDEF $ASSIGNDEF $QIODEF $IODEF $EXITDEF .PSECT RWDATA,WRT,NOEXE,QUAD DEV_DESC: .WORD 32 ; Fixed length string descriptor .BYTE DSC$K_DTYPE_T .BYTE DSC$K_CLASS_S .ADDRESS DEV_NAME DEV_NAME: .BLKB 32 ; Device to change the path on DEV_LEN: .LONG 0 ; Returned actual length CHNL: .WORD 0 ; Channel ;+ ; GETDVI storage ;- .ALIGN LONG DEV_LST: ; Item list .WORD 4 .WORD DVI$_MOUNTCNT .LONG DVI_MOUNTCNT .LONG DVI_RET_LEN .WORD 16 .WORD DVI$_DEVNAM .LONG DVI_DEVNAM .LONG DVI_DEV_LEN .WORD 4 .WORD DVI$_UNIT .LONG DVI_UNIT .LONG DVI_RET_LEN .WORD 4 .WORD DVI$_HOST_AVAIL .LONG DVI_HOST_AVAIL .LONG DVI_RET_LEN .WORD 16 .WORD DVI$_HOST_NAME .LONG DVI_HOST_NAME .LONG DVI_HOST_LEN .WORD 4 .WORD DVI$_ALT_HOST_AVAIL .LONG DVI_ALT_HOST_AVAIL .LONG DVI_RET_LEN .WORD 16 .WORD DVI$_ALT_HOST_NAME .LONG DVI_ALT_HOST_NAME .LONG DVI_ALT_HOST_LEN .LONG 0 DVI_RET_LEN: ; Storage for returned values .LONG 0 DVI_MOUNTCNT: .LONG 0 DVI_DEVNAM: .BLKB 16 DVI_DEV_LEN: .LONG 0 DVI_UNIT: .LONG 0 DVI_HOST_AVAIL: .LONG 0 DVI_HOST_LEN: .LONG 0 DVI_HOST_NAME: .BLKB 16 DVI_ALT_HOST_AVAIL: .LONG 0 DVI_ALT_HOST_LEN: .LONG 0 DVI_ALT_HOST_COUNT: ; Count for ASCIC string .BLKB 1 DVI_ALT_HOST_NAME: .BLKB 16 .PSECT CODE,NOWRT,EXE,LONG .ENTRY SELECTPATH,^M<> PUSHAL DEV_LEN ; Address to return length PUSHL #0 ; No prompt string PUSHAL DEV_DESC ; Address of string descriptor CALLS #3,G^LIB$GET_FOREIGN ; Get device name from command line BLBS R0,1$ ; Success BRW 10$ 1$: MOVW DEV_LEN,DEV_DESC ; Store returned length in descriptor $ASSIGN_S - DEVNAM=DEV_DESC,- CHAN=CHNL BLBS R0,3$ BRW 10$ ; Branch if error occured 3$: $GETDVIW_S - ; Get device characteristics DEVNAM=DEV_DESC,- ; Device Descriptor ITMLST=DEV_LST ; List of item codes to return BLBC R0,10$ ; Branch if error occured TSTL DVI_HOST_AVAIL ; Is the primary host available? BEQL 4$ ; No CMPC3 DVI_HOST_LEN,DVI_HOST_NAME,DEV_NAME ; Is this the host wanted BEQL 12$ ; Yes, we are done. 4$: TSTL DVI_ALT_HOST_AVAIL ; Is the secondary host available? BEQL 11$ ; No CMPC3 DVI_ALT_HOST_LEN,DVI_ALT_HOST_NAME,DEV_NAME ; Want this one? BNEQ 11$ ; No MOVB DVI_ALT_HOST_LEN,- DVI_ALT_HOST_COUNT ; Store count for ASCIC string $QIOW_S - ; Issue QIO to set prefered path CHAN=CHNL,- FUNC=#IO$_SETPRFPATH,- P1=DVI_ALT_HOST_COUNT ; ASCIC Node name TSTL DVI_MOUNTCNT BNEQ 13$ ; Device is mounted 10$: $EXIT_S R0 11$: MOVL #SS$_NODEVAVL,R0 BRB 10$ 12$: MOVL #SS$_NORMAL,R0 BRB 10$ ;+ ; Need to switch Primary and Secondary Hosts ;- 13$: $QIOW_S - CHAN=CHNL,- FUNC=# BRB 10$ .END SELECTPATH