summaryrefslogtreecommitdiffstats
path: root/sbin/camcontrol
Commit message (Collapse)AuthorAgeFilesLines
* Take care of WARNS=3 warnings by using unsigned/signed variablejohan2002-08-201-6/+7
| | | | | | as needed. Approved by: ken, sheldonh (mentor)
* Remove unused variable. camcontrol is now WARNS=2 clean on i386.johan2002-08-181-1/+0
| | | | Approved by: ken, sheldonh (mentor)
* The .Nm utilitycharnier2002-07-061-6/+17
|
* Fix syntax errors (labels with no statement).wollman2002-05-301-4/+4
|
* Fix a bzero length calculation. sizeof(struct ccb_getdev) should have beenken2002-04-011-1/+1
| | | | | | sizeof(struct ccb_getdevstats). MFC after: 3 days
* Remove 'register' keyword.obrien2002-03-202-2/+2
| | | | | | It does not help modern compilers, and some may take some hit from it. (I also found several functions that listed *every* of its 10 local vars with "register" -- just how many free registers do people think machines have?)
* Correct an out of date device node name. We do not have /dev/rsd0.ctlmaxim2002-02-112-2/+2
| | | | | | | | | nowadays. Spotted by: Sergey Osokin <osa@freebsd.org.ru> Reviewed by: ken, ru Approved by: ken, ru MFC after: 1 week
* Style.ru2002-01-241-11/+8
| | | | Approved by: ken
* By popular demand, also include the "devlist" subcommand into the setjoerg2002-01-181-1/+7
| | | | | | of commands available in the boot floppy environment. MFC after: 1 week
* Well, RELEASE_BUILD_FIXIT has now been renamed into RELEASE_CRUNCH.joerg2002-01-181-2/+2
| | | | | At least, the old version is still good for the MFC though (where everything is still going the old way). ;-)
* Add 'camcontrol rescan all' and 'camcontrol reset all' functionality token2002-01-182-46/+185
| | | | | | | | | | | | | | | camcontrol. This enables rescanning all busses or resetting all busses in a system. The current implementation is not the ideal way to do it -- the ideal way to do it would be for the transport layer to handle wildcarded busses on bus rescan and reset operations. The current implementation enumerates all the busses and sends a rescan or reset CCB individually. Handling this behavior in the transport layer will happen later. Reviewed by: imp Tested by: joerg MFC after: 1 week
* Provide an option to make camcontrol `minimalistic': if the (env/make)joerg2002-01-172-1/+37
| | | | | | | | | variable RELEASE_BUILD_FIXIT is defined, a camcontrol binary will be built that only knows the "rescan" and "reset" subcommands. The resulting code is small enough to still fit onto the boot floppy. Reviewed by: ken MFC after: 1 week
* Fix breakage in 'camcontrol defects' introduced in rev 1.34 (the new errorken2001-12-051-2/+2
| | | | | | | | | | recovery code) back in March, 2001. In effect, this brain-o would cause 'camcontrol defects' to always return an error. Pointed out by: joerg Tested by: mdodd
* Default to WARNS=2.obrien2001-12-041-0/+1
| | | | | | Binary builds that cannot handle this must explicitly set WARNS=0. Reviewed by: mike
* mdoc(7) police: replace `\*(Ba' with a simple `|', it's handled specially.ru2001-08-161-1/+1
|
* mdoc(7) police: s/BSD/.Bx/ where appropriate.ru2001-08-141-1/+3
|
* mdoc(7) police:ru2001-08-071-1/+1
| | | | | | | Avoid using parenthesis enclosure macros (.Pq and .Po/.Pc) with plain text. Not only this slows down the mdoc(7) processing significantly, but it also has an undesired (in this case) effect of disabling hyphenation within the entire enclosed block.
* Use STD{ERR,IN,OUT}_FILENO instead of their numeric values. Thesheldonh2001-07-261-1/+1
| | | | | | | definitions are more readable, and it's possible that they're more portable to pathalogical platforms. Submitted by: David Hill <david@phobia.ms>
* Remove whitespace at EOL.dd2001-07-151-6/+6
|
* Rewrite of the CAM error recovery code.ken2001-03-272-113/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* - Backout botched attempt to introduce MANSECT feature.ru2001-03-261-0/+1
| | | | - MAN[1-9] -> MAN.
* Set the default manual section for sbin/ to 8.ru2001-03-201-1/+0
|
* Prepare for mdoc(7)NG.ru2000-12-181-20/+14
|
* Properly check malloc(3) return valuesjedgar2000-12-012-0/+24
| | | | Approved by: ken
* Fix format string warningskris2000-11-271-3/+3
|
* mdoc(7) police: use the new features of the Nm macro.ru2000-11-201-44/+44
|
* Adjust 'camcontrol negotiate -v' so it prints out the initiator ID from theken2000-09-171-0/+2
| | | | Path Inquiry CCB.
* optreset is declared in unistd.h, so we don't need to declare it here again.imp2000-08-161-2/+0
| | | | Reviews by: ken
* Fix an order-of-operations bug and properly shift page_control values forkbyanc2000-08-101-6/+8
| | | | comparison with SMS_PAGE_CTRL_* macros.
* Include new modepage list (-l) option in the verbose usage.kbyanc2000-08-091-0/+1
|
* Fix a typo in the last commit so that this compiles.jhb2000-08-091-1/+1
|
* Fix some whitespace errors.kbyanc2000-08-081-12/+12
| | | | Pointed out by: ps
* Replace -l with .Fl lkbyanc2000-08-081-1/+3
| | | | Pointed out by: sheldonh
* This is an overhaul of the mode page handling in camcontrol as well askbyanc2000-08-086-739/+823
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Print the correct speed when speed is less than 1MB/s.n_hibma2000-07-011-1/+1
| | | | | | Fixed in cam_xpt.c, r1.81 Submitted by: Gerd Knops <gerti@bitart.com>
* When printing out the transfer rate display for 'camcontrol inquiry',ken2000-06-281-1/+2
| | | | | | | | | | | | | use the current setting for tagged queueing when deciding whether or not to print "Tagged Queueing Enabled" instead of using the device's actual capabilities. This is more consistent with the rest of the transfer rate display, which relies on current settings, and is more consistent with the way we display things on boot. Reported by: Gustavo Vieira Goncalves Coelho Rios <kernel@tdnet.com.br> Reviewed by: mjacob
* Eliminate the default device name (da) and unit number (0) in camcontrol.ken2000-06-042-17/+15
| | | | | | | | This may break some scripts, but with the number of ways users can damage a system with this tool, it's important to make sure they specify which device they want to talk to. Suggested by: joerg
* Use the Ic (Internal command) mdoc macro to denote camcontrol subcommands.ken2000-06-031-44/+51
| | | | Submitted by: sheldonh
* Send 'camcontrol help' usage output to stdout instead of stderr, so itken2000-06-031-2/+2
| | | | | | | | | can be viewed more easily with a pager. Regular (i.e. short) usage output is still sent to stderr. PR: bin/12358 Submitted by: Christian Weisgerber <naddy@mips.rhein-neckar.de>
* Implement a new camcontrol function, 'camcontrol format'.ken2000-05-212-31/+393
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Correct the usage of the ".Bd -literal -offset xxx" macro to usempp2000-05-051-8/+8
| | | | | | | a proper offset. This silences warnings when the man page is formated with groff. PR: bin/14534
* Typo ("frequencey").mph2000-03-151-1/+1
|
* Remove single-space hard sentence breaks. These degrade the qualitysheldonh2000-03-011-1/+2
| | | | | of the typeset output, tend to make diffs harder to read and provide bad examples for new-comers to mdoc.
* Fix 'camcontrol inquiry'. The inquiry data structure changes (increased token2000-02-201-2/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 256 bytes) caused it to break on many devices. The SCSI spec says that for commands with 8-bit length fields, a value of 0 means 256 bytes. As it turns out, many devices don't deal with that properly. Some interpret the 0 as 0, and return no data. Others return more than 256 bytes of data, and cause an overrun. The fix is to tell the device we've only allocated SHORT_INQUIRY_LENGTH (36 bytes) of inquiry data, instead of sizeof(struct scsi_inquiry_data). camcontrol.c: Change inq_len in the call to scsi_inquiry() to SHORT_INQUIRY_LENGTH, and add a long comment explaining the reason for the change. scsi_all.h: Add a comment above the definitinon of SHORT_INQUIRY_LENGTH alerting people that it is both the initial probe inquiry length, and the minimum amount of data needed for scsi_print_inquiry() to function. scsi_all.c: Add a comment about SHORT_INQUIRY_LENGTH being the minimum amount of data needed for scsi_print_inquiry() to function. Reviewed by: gibbs Approved by: jkh Reported by: "John W. DeBoskey" <jwd@unx.sas.com>
* Fix a couple of typos in the 'camcontrol negotiate' output.ken2000-02-041-2/+2
| | | | | Submitted by: T-Om <tom@iki.fi> Approved by: jkh
* Do some intptr_t casting for alpha.mjacob2000-01-212-8/+8
| | | | Reviewed by: ken@freebsd.org
* Specify the system directory for which we put in our include pathmjacob2000-01-211-1/+3
| | | | | | | as a separate line so we can override it on the command line if we need to. Reviewed by: ken@freebsd.org
* use XPT_GDEV_STATS- XPT_GDEV_TYPE was deprecated a while backmjacob2000-01-161-12/+12
|
* Fix the example in the bugs section.ken1999-12-171-1/+1
|
* Fix Bus Device Resets from userland, and specifically from camcontrol.ken1999-10-311-11/+41
| | | | | | | | | | | camcontrol was setup to use the old scheme of going through the xpt(4) device, which never worked properly (and has been disabled for a while). camcontrol now sends BDRs through the pass(4) device, and XPT_RESET_DEV CCBs are put on the device queue in the transport layer, as they should be. Submitted by: luoqi Reviewed by: ken
OpenPOWER on IntegriCloud