Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Nov 1999 12:42:21 -0700 (MST)
From:      "Justin T. Gibbs" <gibbs@narnia.plutotech.com>
To:        Nick Hibma <hibma@skylink.it>
Cc:        scsi@FreeBSD.org
Subject:   Re: found device.
Message-ID:  <199911251942.MAA99902@narnia.plutotech.com>
In-Reply-To: <Pine.BSF.4.20.9911251536010.1647-100000@henny.jrc.it>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <Pine.BSF.4.20.9911251536010.1647-100000@henny.jrc.it> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199911251942.MAA99902>