aboutsummaryrefslogtreecommitdiff
path: root/lib/libcam
Commit message (Collapse)AuthorAgeFilesLines
* MAN[1-9] -> MAN.Ruslan Ermilov2001-03-271-1/+1
| | | | Notes: svn path=/head/; revision=74870
* Rewrite of the CAM error recovery code.Kenneth D. Merry2001-03-271-34/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some of the major changes include: - The SCSI error handling portion of cam_periph_error() has been broken out into a number of subfunctions to better modularize the code that handles the hierarchy of SCSI errors. As a result, the code is now much easier to read. - String handling and error printing has been significantly revamped. We now use sbufs to do string formatting instead of using printfs (for the kernel) and snprintf/strncat (for userland) as before. There is a new catchall error printing routine, cam_error_print() and its string-based counterpart, cam_error_string() that allow the kernel and userland applications to pass in a CCB and have errors printed out properly, whether or not they're SCSI errors. Among other things, this helped eliminate a fair amount of duplicate code in camcontrol. We now print out more information than before, including the CAM status and SCSI status and the error recovery action taken to remedy the problem. - sbufs are now available in userland, via libsbuf. This change was necessary since most of the error printing code is shared between libcam and the kernel. - A new transfer settings interface is included in this checkin. This code is #ifdef'ed out, and is primarily intended to aid discussion with HBA driver authors on the final form the interface should take. There is example code in the ahc(4) driver that implements the HBA driver side of the new interface. The new transfer settings code won't be enabled until we're ready to switch all HBA drivers over to the new interface. src/Makefile.inc1, lib/Makefile: Add libsbuf. It must be built before libcam, since libcam uses sbuf routines. libcam/Makefile: libcam now depends on libsbuf. libsbuf/Makefile: Add a makefile for libsbuf. This pulls in the sbuf sources from sys/kern. bsd.libnames.mk: Add LIBSBUF. camcontrol/Makefile: Add -lsbuf. Since camcontrol is statically linked, we can't depend on the dynamic linker to pull in libsbuf. camcontrol.c: Use cam_error_print() instead of checking for CAM_SCSI_STATUS_ERROR on every failed CCB. sbuf.9: Change the prototypes for sbuf_cat() and sbuf_cpy() so that the source string is now a const char *. This is more in line wth the standard system string functions, and helps eliminate warnings when dealing with a const source buffer. Fix a typo. cam.c: Add description strings for the various CAM error status values, as well as routines to look up those strings. Add new cam_error_string() and cam_error_print() routines for userland and the kernel. cam.h: Add a new CAM flag, CAM_RETRY_SELTO. Add enumerated types for the various options available with cam_error_print() and cam_error_string(). cam_ccb.h: Add new transfer negotiation structures/types. Change inq_len in the ccb_getdev structure to be "reserved". This field has never been filled in, and will be removed when we next bump the CAM version. cam_debug.h: Fix typo. cam_periph.c: Modularize cam_periph_error(). The SCSI error handling part of cam_periph_error() is now in camperiphscsistatuserror() and camperiphscsisenseerror(). In cam_periph_lock(), increase the reference count on the periph while we wait for our lock attempt to succeed so that the periph won't go away while we're sleeping. cam_xpt.c: Add new transfer negotiation code. (ifdefed out) Add a new function, xpt_path_string(). This is a string/sbuf analog to xpt_print_path(). scsi_all.c: Revamp string handing and error printing code. We now use sbufs for much of the string formatting code. More of that code is shared between userland the kernel. scsi_all.h: Get rid of SS_TURSTART, it wasn't terribly useful in the first place. Add a new error action, SS_REQSENSE. (Send a request sense and then retry the command.) This is useful when the controller hasn't performed autosense for some reason. Change the default actions around a bit. scsi_cd.c, scsi_da.c, scsi_pt.c, scsi_ses.c: SF_RETRY_SELTO -> CAM_RETRY_SELTO. Selection timeouts shouldn't be covered by a sense flag. scsi_pass.[ch]: SF_RETRY_SELTO -> CAM_RETRY_SELTO. Get rid of the last vestiges of a read/write interface. libkern/bsearch.c, sys/libkern.h, conf/files: Add bsearch.c, which is needed for some of the new table lookup routines. aic7xxx_freebsd.c: Define AHC_NEW_TRAN_SETTINGS if CAM_NEW_TRAN_CODE is defined. sbuf.h, subr_sbuf.c: Add the appropriate #ifdefs so sbufs can compile and run in userland. Change sbuf_printf() to use vsnprintf() instead of kvprintf(), which is only available in the kernel. Change the source string for sbuf_cpy() and sbuf_cat() to be a const char *. Add __BEGIN_DECLS and __END_DECLS around function prototypes since they're now exported to userland. kdump/mkioctls: Include stdio.h before cam.h since cam.h now includes a function with a FILE * argument. Submitted by: gibbs (mostly) Reviewed by: jdp, marcel (libsbuf makefile changes) Reviewed by: des (sbuf changes) Reviewed by: ken Notes: svn path=/head/; revision=74840
* Remove the `r' devices.David E. O'Brien2001-02-271-5/+2
| | | | Notes: svn path=/head/; revision=73186
* mdoc(7) police: removed history info from the .Os FreeBSD call.Ruslan Ermilov2000-12-142-2/+2
| | | | Notes: svn path=/head/; revision=70015
* Use Fx macro wherever possible.Ruslan Ermilov2000-11-141-3/+6
| | | | Notes: svn path=/head/; revision=68716
* Fixed typo: .FR -> .FaRuslan Ermilov2000-11-061-1/+1
| | | | Notes: svn path=/head/; revision=68393
* This is an overhaul of the mode page handling in camcontrol as well asKelly Yancey2000-08-082-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | related patches. These include: * Mode page editting can be scripted. This involves two things: first, if stdin is not a tty, changes are read from stdin rather than invoking $EDITOR. Second, and more importantly, not all modepage entries must be included in the change set. This means that camcontrol can now gracefully handle more intrusive editting from the $EDITOR, including removal or rearrangement of lines. It also means that you can do stuff like: # echo "WCE: 1" | camcontrol modepage da3 -m 8 -e # newfs /dev/da3 # echo "WCE: 0" | camcontrol modepage da3 -m 8 -e * Range-checking on user-supplied input values. modeedit.c now uses the field width specifiers to determine the maximum allowable value for a field. If the user enters a value larger than the maximum, it clips the value to the max and warns the user. This also involved patching cam_cmdparse.c to be more consistent with regards to the "count" parameter to arg_put (previously is was the length of strings and 1 for all integral types). The cam_cdbparse(3) man page was also updated to reflect the revised semantics. * In the process, I removed the 64 entry limit on mode pages (not that we were even close to hitting that limit). This was a nice side-effect of the other changes. * Technically, the new mode editting functionality allows editting of character array entries in mode pages (type 'c' or 'z'), however since buff_encode doesn't grok them it is currently useless. * Camcontrol gained two new options related to mode pages: -l and -b. The former lists all available mode pages for a given device. The latter forces mode page display in binary format (the default when no mode page definition was found in scsi_modes). * Added support for mode page names to scsi_modes. Allows names to be displayed alongside mode numbers in the mode page listing. Updated scsi_modes to use the new functionality. This also adds the semicolon into the scsi_modes syntax as an optional mode page definition terminator. This is needed to name pages without providing a page format definition. * Updated scsi_all.h to include a structure describing mode page headers. * Added $FreeBSD$ line to scsi_modes. Inspired by: dwhite Reviewed by: ken Notes: svn path=/head/; revision=64382
* Fix groff confusion for PS output.Alexander Langer2000-06-201-3/+1
| | | | | | | | PR: 14532 Submitted by: Peter Jeremy <peter.jeremy@alcatel.com.au> Notes: svn path=/head/; revision=61859
* Implement a new camcontrol function, 'camcontrol format'.Kenneth D. Merry2000-05-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | libcam/Makefile: Add scsi_da.c to libcam for the new scsi_format_unit() function. camcontrol.8: Update the man page for the new format functionality, and take out the examples section describing how to do it with 'camcontrol cmd'. camcontrol.c: New format functionality. Note that unlike the rest of the camcontrol subcommands, this one is interactive by default. Because of the potential destructiveness of the format command, I thought it necessary to get confirmation from the user before spamming a disk. You can disable the interactive behavior, and the status meter with command line arguments. scsi_da.c: Add the new scsi_format_unit() cdb building function and use #ifdef _KERNEL to make this file compile in both the kernel and userland. The format unit function is currently only defined in the non-kernel case, because nothing in the kernel is using it. If that changes, it should be un-ifdefed and compiled in both cases. scsi_da.h: New function declaration, CDB structure and format data structures. Thanks to Nick Hibma for providing some valuable input on these changes. Notes: svn path=/head/; revision=60767
* Introduce .Lb macro to libcam manpages.Alexey Zelkin2000-04-222-0/+4
| | | | Notes: svn path=/head/; revision=59503
* Specify the system directory for which we put in our include pathMatt Jacob2000-01-211-1/+2
| | | | | | | | as a separate line so we can override it on the command line if we need to. Notes: svn path=/head/; revision=56377
* get pd_type from inquiry data itselfMatt Jacob2000-01-161-1/+1
| | | | Notes: svn path=/head/; revision=56122
* Replace beforeinstall target with new variables used by .mk system.Rodney W. Grimes2000-01-141-4/+3
| | | | | | | Reviewed by: marcel, and make world Notes: svn path=/head/; revision=55955
* Fix a file descriptor leak in cam_open_btl(). The xpt device was opened,Kenneth D. Merry1999-09-121-1/+5
| | | | | | | | | but never closed. Submitted by: amobbs@allstor-sw.co.uk Notes: svn path=/head/; revision=51213
* $Id$ -> $FreeBSD$Peter Wemm1999-08-285-5/+5
| | | | Notes: svn path=/head/; revision=50476
* Take out a reference to ccb(4). I never got around to writing it.Kenneth D. Merry1999-08-171-3/+2
| | | | | | | Reported by: "Alexey M. Zelkin" <phantom@cris.net> Notes: svn path=/head/; revision=49984
* Various man page cleanup:Mike Pritchard1999-08-151-3/+3
| | | | | | | | | | | | | - Sort xrefs - FreeBSD.ORG -> FreeBSD.org - Be consistent with section names as outlines in mdoc(7) - Other misc mdoc cleanup. PR: doc/13144 Submitted by: Alexy M. Zelkin <phantom@cris.net> Notes: svn path=/head/; revision=49828
* Add a MAINTAINER line to modules that I maintain.Kenneth D. Merry1999-06-181-0/+1
| | | | | | | Suggested by: brian, markm Notes: svn path=/head/; revision=47993
* cam_get_device() was returning 0 on failure, and 1 on success, whileMike Pritchard1999-06-151-10/+10
| | | | | | | | | | | camcontrol(8) and the documentation in camlib.c and cam(3) all expect -1 on failure and 0 on success. Updated camlib.c to return the values specified by the documentation. PR: 12023 Notes: svn path=/head/; revision=47933
* Fixed missing header in synopsis (<camlib.h> includes half the universeBruce Evans1999-03-052-2/+4
| | | | | | | but not <stdio.h>). Notes: svn path=/head/; revision=44489
* Use snprintf to make sure we don't overflow a buffer.Kenneth D. Merry1998-11-151-4/+5
| | | | Notes: svn path=/head/; revision=41190
* Fix an error message. (it was using an uninitialized variable)Kenneth D. Merry1998-11-151-2/+2
| | | | | | | Reported by: dan@math.berkeley.edu (Dan Strick) Notes: svn path=/head/; revision=41189
* Add man pages for many of the functions in the CAM library. This coversKenneth D. Merry1998-10-143-33/+983
| | | | | | | | | | | | | | most of the open/close routines, and the buffer/cdb parsing routines derived from the old scsi(3) library. The cam_cdbparse(3) man page borrows from the old scsi(3) man page, so the copyright and history section reflect that. The many scsi_* functions and other functions that are pulled in from the kernel aren't documented yet, but will be eventually. Notes: svn path=/head/; revision=40337
* Add a "dummy light" (actually two dummy lights) to catch people who don'tKenneth D. Merry1998-10-121-4/+27
| | | | | | | | | | | | have the passthrough device configured in their kernel. This will hopefully reduce the number of people complaining that they can't get {camcontrol, xmcd, tosha, cdrecord, etc.} to work. Reviewed by: gibbs Notes: svn path=/head/; revision=40271
* Remove scsi_da.c from the list of things compiled into the CAM library.Kenneth D. Merry1998-09-181-1/+1
| | | | | | | | | | | | | | | | | The functions that were being compiled into the library have been moved to scsi_all.c. One warning: Any programs using scsi_start_stop() or scsi_read_write() that included scsi_da.h but not scsi_all.h will need to be changed to include scsi_all.h. This doesn't affect camcontrol, and I don't think it affects any ports, but you never know. PR: kern/7969 Reviewed by: gibbs Notes: svn path=/head/; revision=39465
* Fix some Alpha portability problems, and add some belt-and-suspendersKenneth D. Merry1998-09-161-9/+44
| | | | | | | | | | checking in some functions. Submitted by: dfr Modified by: ken Notes: svn path=/head/; revision=39381
* I hate late night commits. These should be nuked from the atticy byJustin T. Gibbs1998-09-154-0/+0
| | | | | | | the CVS meister. Notes: svn path=/head/; revision=39210
* CAM userland utility library, a replacement for libscsi.Justin T. Gibbs1998-09-158-0/+1774
Submitted by: "Kenneth D. Merry" <ken@FreeBSD.org> Notes: svn path=/head/; revision=39209