From owner-freebsd-scsi Thu Nov 25 11:52:36 1999 Delivered-To: freebsd-scsi@freebsd.org Received: from narnia.plutotech.com (narnia.plutotech.com [206.168.67.130]) by hub.freebsd.org (Postfix) with ESMTP id 1D71214DB8 for ; Thu, 25 Nov 1999 11:52:33 -0800 (PST) (envelope-from gibbs@narnia.plutotech.com) Received: (from gibbs@localhost) by narnia.plutotech.com (8.9.3/8.7.3) id MAA99902; Thu, 25 Nov 1999 12:42:21 -0700 (MST) Date: Thu, 25 Nov 1999 12:42:21 -0700 (MST) From: "Justin T. Gibbs" Message-Id: <199911251942.MAA99902@narnia.plutotech.com> To: Nick Hibma Cc: scsi@FreeBSD.org Subject: Re: found device. X-Newsgroups: pluto.freebsd.scsi In-Reply-To: User-Agent: tin/pre-1.4-980818 ("Laura") (UNIX) (FreeBSD/4.0-CURRENT (i386)) Sender: owner-freebsd-scsi@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org In article you wrote: > For your information: The following code fails as well: > > union ccb *ccb = NULL; > struct ccb_getdev *cgd = (struct ccb_getdev *)ccb; > > ccb = malloc(sizeof(union ccb), M_USBDEV, M_WAITOK); > memset(ccb, 0, sizeof(union ccb)); > cgd->ccb_h.func_code = XPT_GDEV_TYPE; When was cgd initialized to anything other than NULL? There is also no need to cast the ccb, just use &ccb->cgd; > if (xpt_create_path(&sc->path, NULL, cam_sim_path(umass_sim), > device_get_unit(sc->sc_dev), CAM_LUN_WILDCARD) > != CAM_REQ_CMP) > return(ENOMEM); > > xpt_async(AC_FOUND_DEVICE, sc->path, cgd); > free(ccb, M_USBDEV); > > This code bombs passasync() (the code fragment below just silently > fails). And no wonder. The cgd is not fully initialized. It needs to have inquiry information that I'm sure several async handlers require. AC_FOUND_DEVICE should only be issued by the XPT. I suppose I should add some mechanism to catch rogue code that attempts to send one. Take the path of your SIM and issue an XPT_SCAN_BUS request. -- Justin To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-scsi" in the body of the message