Commit Graph

98 Commits

Author SHA1 Message Date
Kenneth D. Merry
42cb6a80b6 Implement 'camcontrol reportluns'. This allows users to send the SCSI
REPORT LUNS command to a device.

camcontrol.[c8]:	Implement reportluns.  This tries to print the LUNs
			out in a reasonable format.  Only the periph
			addressing method has been tested, since very little
			hardware that I know of supports the other methods.

scsi_all.[ch]:		Revamp the report luns CDB structure and helper
			functions.  This constitutes a little bit of an API
			change, but since the old CDB length was 10 bytes,
			and the REPORT LUNS CDB length is actually 12 bytes,
			it's clear that no one was using this API in the
			first place.

MFC After:	1 week
2006-08-21 13:24:50 +00:00
Ruslan Ermilov
55c82bf0d4 Markup fixes.
Approved by:	re (blanket)
2005-06-14 11:24:56 +00:00
Kenneth D. Merry
e9e4d3e4d4 Add "report only" functionality to 'camcontrol format', so users can get a
report on the status of a format already running on a drive.

Fix status reporting for 'camcontrol format'.  This was broken in rev 1.34
of camcontrol.c, almost 4 years ago!

Submitted by:	joerg (most of the reportonly changes)
MFC after:	3 days
2005-03-26 05:34:54 +00:00
Ruslan Ermilov
0227791b40 Expand *n't contractions. 2005-02-13 22:25:33 +00:00
Ruslan Ermilov
bac7835b60 Deal with double whitespace. 2004-07-03 00:13:43 +00:00
Ruslan Ermilov
9806e23132 Mechanically kill hard sentence breaks. 2004-07-02 21:45:06 +00:00
Olivier Houchard
c1b2de5af0 Use WARNS?=3 for these in the arm case for now, due to toolchain issues. 2004-05-14 13:31:21 +00:00
Kenneth D. Merry
2a413b2918 Fix a couple of camcontrol issues that popped up on sparc64:
- bzero the CCB header in getdevtree() and set the path properly, to
   avoid having random garbage in the CCB header.
 - if the lun isn't specified in a device specifier, it should default to
   0, not whatever random data happens to be in the lun variable.
 - move the prototype for getdevtree() out from under #ifndef MINIMALISTIC,
   since it is used in both cases.

Submitted by:	Marius Strobl <marius@alchemy.franken.de> (mostly)
MFC After:	2 weeks
2004-03-03 01:51:24 +00:00
Peter Grehan
5cfe0423e6 Userland signed char fixes for PPC build. Problems were using a char
return for getopt() and comparing to -1, ditto with fgetc() and EOF,
and using the kg_nice value from <sys/user.h>

Submitted by: Stefan Farfeleder <stefan@fafoe.narf.at>
Reviewed by: obrien, bde (a while back)
Tested lightly on: ppc, i386, make universe
2004-01-22 07:23:36 +00:00
Warner Losh
3c33210ce8 Fix alignment of the trailing \ 2003-08-22 01:56:17 +00:00
Johan Karlsson
398676131f Make this WARNS=6 clean by:
1: add 'const' to char * where needed;
 2: mark unused variables with __unused;
 3: remove double prototypes for mode_edit and mode_list.
 4: moves the global variables 'bus', 'target', and 'lun' into
        the main function and protect them with #ifndef MINIMALISTIC,
 5: renames 3 variable in order not to shadow other things
        index -> indx -- in modepage_dump since index is a function
		from <strings.h.>
        arglist -> arglst -- in the function parse_btl since arglist
                is also a global variable
        convertend -> convertend2 -- in the function editentry_set
                since that name is used two times within the function.
 6: cast 0xffffffff in the macro RESOLUTION_MAX(size) to (int)
        since it is unsigned otherwise.

Tested by:	make universe
Approved by:	ken
2003-08-05 09:19:07 +00:00
Kenneth D. Merry
50a7fdaed8 Remove MAINTAINER= lines in the makefiles for camcontrol, iostat, libcam
and libdevstat, since the new way of doing things is to just list
maintainership in src/MAINTAINERS.

Also, remove duplicate entries in src/MAINTAINERS for those utilities.  I
already had entries for them.
2003-06-14 05:28:01 +00:00
David E. O'Brien
8e7d2436a1 Set WARNS=1. RESOLUTION_MAX macro has major signed/unsigned issues. 2003-05-02 06:56:32 +00:00
David E. O'Brien
bf2783a016 Use __FBSDID. 2003-05-02 06:49:10 +00:00
Ruslan Ermilov
024ae00499 Fixed (soon might be fatal) -Wformat warnings. 2003-03-15 07:56:59 +00:00
Johan Karlsson
c7cf7aa684 Make camcontrol WARNS=2 clean.
Approved by:	ken
2003-02-20 21:07:59 +00:00
Nate Lawson
a7e5261e30 Add PERIPH and XPT debug options to camcontrol. This makes all CAM debug
options tunable from userland.

Approved by:	ken
MFC after:	3 days
2002-12-17 06:05:21 +00:00
Matthew N. Dodd
d4e731a642 Split cam_argmask and move "commands" into cam_cmdmask. This addresses
the issue of not having any free bits left for additional commands.

Approved by:	 ken
MFC after:	 4 weeks
2002-09-08 05:39:36 +00:00
Matthew N. Dodd
f9cecca2d4 Add 'camcontrol load' as a complement to 'camcontrol eject'.
Approved by:	 ken
MFC after:	 4 weeks
2002-09-06 18:16:26 +00:00
Johan Karlsson
72abe188fb Take care of WARNS=3 warnings by using unsigned/signed variable
as needed.

Approved by:	ken, sheldonh (mentor)
2002-08-20 20:54:03 +00:00
Johan Karlsson
0319a6a43b Remove unused variable. camcontrol is now WARNS=2 clean on i386.
Approved by: 	ken, sheldonh (mentor)
2002-08-18 21:46:32 +00:00
Philippe Charnier
e1205e80e5 The .Nm utility 2002-07-06 19:34:18 +00:00
Garrett Wollman
b055b157dc Fix syntax errors (labels with no statement). 2002-05-30 21:38:58 +00:00
Kenneth D. Merry
515f06ebc0 Fix a bzero length calculation. sizeof(struct ccb_getdev) should have been
sizeof(struct ccb_getdevstats).

MFC after:	3 days
2002-04-01 03:58:51 +00:00
David E. O'Brien
3d438ad61f Remove 'register' keyword.
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?)
2002-03-20 17:55:10 +00:00
Maxim Konovalov
e9ef556dd8 Correct an out of date device node name. We do not have /dev/rsd0.ctl
nowadays.

Spotted by:	Sergey Osokin <osa@freebsd.org.ru>
Reviewed by:	ken, ru
Approved by:	ken, ru
MFC after:	1 week
2002-02-11 14:35:28 +00:00
Ruslan Ermilov
485318d4d8 Style.
Approved by:	ken
2002-01-24 16:53:08 +00:00
Joerg Wunsch
7f3aade047 By popular demand, also include the "devlist" subcommand into the set
of commands available in the boot floppy environment.

MFC after:	1 week
2002-01-18 22:42:51 +00:00
Joerg Wunsch
075828a91a Well, RELEASE_BUILD_FIXIT has now been renamed into RELEASE_CRUNCH.
At least, the old version is still good for the MFC though (where
everything is still going the old way). ;-)
2002-01-18 22:17:35 +00:00
Kenneth D. Merry
5710d224b6 Add 'camcontrol rescan all' and 'camcontrol reset all' functionality to
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
2002-01-18 18:00:00 +00:00
Joerg Wunsch
6437601ca1 Provide an option to make camcontrol `minimalistic': if the (env/make)
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
2002-01-17 20:26:14 +00:00
Kenneth D. Merry
8a8e67f308 Fix breakage in 'camcontrol defects' introduced in rev 1.34 (the new error
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
2001-12-05 03:41:40 +00:00
David E. O'Brien
2d68bf45bf Default to WARNS=2.
Binary builds that cannot handle this must explicitly set WARNS=0.

Reviewed by:	mike
2001-12-04 02:19:58 +00:00
Ruslan Ermilov
9916c5d299 mdoc(7) police: replace \*(Ba' with a simple |', it's handled specially. 2001-08-16 11:09:00 +00:00
Ruslan Ermilov
753d686d34 mdoc(7) police: s/BSD/.Bx/ where appropriate. 2001-08-14 10:01:54 +00:00
Ruslan Ermilov
c4d9468ea0 mdoc(7) police:
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.
2001-08-07 15:48:51 +00:00
Sheldon Hearn
e1b4d8d074 Use STD{ERR,IN,OUT}_FILENO instead of their numeric values. The
definitions are more readable, and it's possible that they're
more portable to pathalogical platforms.

Submitted by:   David Hill <david@phobia.ms>
2001-07-26 11:02:39 +00:00
Dima Dorfman
7ebcc426ef Remove whitespace at EOL. 2001-07-15 07:53:42 +00:00
Kenneth D. Merry
3393f8daa3 Rewrite of the CAM error recovery code.
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
2001-03-27 05:45:52 +00:00
Ruslan Ermilov
0a5779d45b - Backout botched attempt to introduce MANSECT feature.
- MAN[1-9] -> MAN.
2001-03-26 14:33:27 +00:00
Ruslan Ermilov
fe655281c5 Set the default manual section for sbin/ to 8. 2001-03-20 18:13:31 +00:00
Ruslan Ermilov
1252c1bb05 Prepare for mdoc(7)NG. 2000-12-18 15:16:24 +00:00
Chris D. Faulhaber
b673f44d6d Properly check malloc(3) return values
Approved by:	ken
2000-12-01 12:02:16 +00:00
Kris Kennaway
797376317f Fix format string warnings 2000-11-27 07:28:15 +00:00
Ruslan Ermilov
7c7fb079b9 mdoc(7) police: use the new features of the Nm macro. 2000-11-20 16:52:27 +00:00
Kenneth D. Merry
de2464d3bc Adjust 'camcontrol negotiate -v' so it prints out the initiator ID from the
Path Inquiry CCB.
2000-09-17 20:42:28 +00:00
Warner Losh
fdcd5596ff optreset is declared in unistd.h, so we don't need to declare it here again.
Reviews by: ken
2000-08-16 15:36:14 +00:00
Kelly Yancey
354a0adabf Fix an order-of-operations bug and properly shift page_control values for
comparison with SMS_PAGE_CTRL_* macros.
2000-08-10 01:20:43 +00:00
Kelly Yancey
d996f0a884 Include new modepage list (-l) option in the verbose usage. 2000-08-09 21:29:22 +00:00
John Baldwin
34f71eeb3c Fix a typo in the last commit so that this compiles. 2000-08-09 00:28:09 +00:00