From: SMTP%"critz@star.enet.dec.com" 20-SEP-1993 08:40:29.07 To: EVERHART CC: Subj: Re: How to find UCB address from device name? X-Newsgroups: comp.os.vms From: critz@star.enet.dec.com (Richard Critz) Subject: Re: How to find UCB address from device name? Message-Id: <1993Sep16.165001.29067@nntpd.lkg.dec.com> Lines: 71 Sender: usenet@nntpd.lkg.dec.com (USENET News System) Reply-To: critz@star.enet.dec.com (Richard Critz) Organization: Digital Equipment Corporation, Nashua, NH Date: Thu, 16 Sep 1993 16:50:01 GMT To: Info-VAX@kl.sri.com X-Gateway-Source-Info: USENET While the preferred mechanism for getting the UCB address given the device name is to: 1) $ASSIGN a channel to the device 2) call IOC$VERIFYCHAN to locate the CCB for the channel (DO *NOT* try to do it yourself. You'll fail on OpenVMS AXP V1.5 and later since I changed the algorithm for mapping channel number to CCB. Just use the routine) 3) Fetch the UCB from the appropriate field in the CCB (CCB$L_UCB) You can also use IOC$SEARCHDEV (this routine is pageable but has a simpler interface) or IOC$SEARCHINT. IOC$SEARCHDEV is called as follows: ;+ ; ; IOC$SEARCH - general I/O database search ; IOC$SEARCHDEV - search for specific physical device ; IOC$SEARCHALL - generic search for any device ; ; This routine searches the I/O database for the specified device, using ; the specified search rules. Depending on the search, a lock may or may ; not be taken out on the device when it is found. ; ; INPUTS: ; ; R1 = address of descriptor of device / logical name string ; R2 = flags ; R3 = address to store lock value block ; I/O database mutex held, IPL 2 ; ; OUTPUTS: ; ; R0 = SS$_NORMAL - device found ; = SS$_ACCVIO - name string is not readable ; = SS$_NONLOCAL - nonlocal device ; = SS$_IVLOGNAM - invalid logical name (e.g., too long) ; = SS$_TOOMANYLNAM - max. logical name recursion exceeded ; = SS$_IVDEVNAM - invalid device name string ; = SS$_NOSUCHDEV - device not found ; = SS$_NODEVAVL - device exists but not available according to rules ; = SS$_DEVALLOC - device allocated to other user ; = SS$_NOPRIV - failed device protection ; = SS$_TEMPLATEDEV - can't allocate template device ; = SS$_DEVMOUNT - device already mounted ; = SS$_DEVOFFLINE - device marked offline ; R1 = UCB ; R2 = DDB ; R3 = system block ; R4 - R11 preserved ; ; Note: If failure, R1 - R3 point to the last structures looked at. ; ; R2 and R3 are input only to IOC$SEARCH. ; ; IOC$SEARCHDEV: R2 = IOC$M_PHY ! IOC$M_ANY ; R3 = 0 ; IOC$SEARCHALL: R2 = IOC$M_ANY ! IOC$M_LOCAL ; R3 = 0 ; ;- -- ----------------------------------------------------------------------------- Richard Critz critz@star.enet.dec.com -- I speak only for myself; I make no commitments for Digital. -- -----------------------------------------------------------------------------