Date: Mon, 22 Feb 1999 14:15:40 -0700 (MST) From: "Kenneth D. Merry" <ken@plutotech.com> To: amobbs@allstor-sw.co.uk Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: CAM open errors Message-ID: <199902222115.OAA28164@panzer.plutotech.com> In-Reply-To: <80256720.006889BA.00@mail.plasmon.co.uk> from "amobbs@allstor-sw.co.uk" at "Feb 22, 1999 7: 1:49 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
amobbs@allstor-sw.co.uk wrote... > > Is there a reson (such as meeting spec.) that cam_open_btl et. al. don't > return an error code, but just stick a string in cam_errbuf? The system error codes aren't entirely descriptive, and that's just the way I wrote it. :) > I'm using an application which uses the CAM passthrough drivers, and > basically tries to grab everything on a given bus, and I'd like to be able > to distinguish a genuine failure from simply one caused by the device not > being there. > > I've looked at camcontrol.c, and it doesn't deal with this, it simply > prints the cam_errbuf and exits. Yep, it assumes the user knows which device he's talking about, and doesn't attempt to second guess him by searching around for another device. That could have potentially disastrous results if the user was trying to format da5 and ended up formatting da6 instead... > I could always just hack camlib to do what I want, but if there's a better, > or more standard solution I'd prefer that. It really would be easier if you just used the device matching code to grab everything on a given bus. It will tell you which devices are there, and you can even do things like list all of the 'da' devices on a particular bus. Look at the code for 'camcontrol devlist' in getdevtree() in camcontrol.c. You can pull out whatever devices you're looking for that way, so you don't have to go opening every bus, target and lun. cdrecord uses a similar approach for its '-scanbus' code, and I've got some more sample code that will match against various peripheral driver types. What is it that you're trying to do, anyway? BTW, it might be better to send SCSI-type queries to the freebsd-scsi list. Ken -- Kenneth Merry ken@plutotech.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199902222115.OAA28164>