Commit Graph

41 Commits

Author SHA1 Message Date
Mikolaj Golub
f02db7b4e5 Document sbuf_start_section() and sbuf_end_section() functions.
MFC after:	1 month
2013-04-11 19:51:53 +00:00
Mikolaj Golub
b397b9b79a Fix synopsis for sbuf_len.
MFC after:	3 days
2013-04-07 17:54:38 +00:00
Jaakko Heinonen
c5a0813d43 Follow style(9) more closely in the example. 2011-12-21 17:03:30 +00:00
Jaakko Heinonen
569dd0f3be sbuf_data() hasn't returned NULL for overflowed buffers since r71721. 2011-12-09 13:28:41 +00:00
Jaakko Heinonen
c0825cd535 - Fix markup.
- Remove trailing whitespace.
2011-12-09 13:15:19 +00:00
Ulrich Spörlein
6e18fca127 Re-encode files from ISO-8859-1 to UTF-8 2011-05-22 14:03:30 +00:00
Poul-Henning Kamp
c920aa7a9d When adding examples to man-pages, try to make them at least
look like they might work.

Prodded by:	Vadim Goncharov
2011-05-19 13:42:19 +00:00
Poul-Henning Kamp
6ab7244a4d Try to explain what sbufs do and add an example to show it.
Clarify return values.
2011-05-17 18:24:59 +00:00
Andrey V. Elsukov
95d4707398 Remove duplicate sentence. 2011-03-30 11:34:40 +00:00
Matthew D Fleming
00f0e671ff Explicitly wire the user buffer rather than doing it implicitly in
sbuf_new_for_sysctl(9).  This allows using an sbuf with a SYSCTL_OUT
drain for extremely large amounts of data where the caller knows that
appropriate references are held, and sleeping is not an issue.

Inspired by:	rwatson
2011-01-27 00:34:12 +00:00
Matthew D Fleming
7c2dd57bdb Document sbuf_new_for_sysctl(9).
Pointed out by:	lstewart
2011-01-25 17:39:52 +00:00
Matthew D Fleming
4d369413e1 Replace sbuf_overflowed() with sbuf_error(), which returns any error
code associated with overflow or with the drain function.  While this
function is not expected to be used often, it produces more information
in the form of an errno that sbuf_overflowed() did.
2010-09-10 16:42:16 +00:00
Matthew D Fleming
4351ba272c Add drain functionality to sbufs. The drain is a function that is
called when the sbuf internal buffer is filled.  For kernel sbufs with a
drain, the internal buffer will never be expanded.  For userland sbufs
with a drain, the internal buffer may still be expanded by
sbuf_[v]printf(3).

Sbufs now have three basic uses:
1) static string manipulation.  Overflow is marked.
2) dynamic string manipulation.  Overflow triggers string growth.
3) drained string manipulation.  Overflow triggers draining.

In all cases the manipulation is 'safe' in that overflow is detected and
managed.

Reviewed by:	phk (the previous version)
2010-09-09 17:49:18 +00:00
Matthew D Fleming
db960cf00a Fix small errors in the sbuf(9) man page. 2010-09-09 16:27:02 +00:00
Christian Brueffer
72fba9d714 Document sbuf_new_auto().
While here, add a missing `-' in phk's name.

MFC after:	3 days
2009-05-17 21:28:37 +00:00
Ruslan Ermilov
81ae4b8da9 Markup fixes. 2006-09-18 15:24:20 +00:00
Poul-Henning Kamp
49091c48d5 Make sbuf_copyin() return the number of bytes copied on success.
Submitted by:	"Wojciech A. Koszek" <dunstan@freebsd.czest.pl>
2005-12-23 11:49:53 +00:00
Dag-Erling Smørgrav
9f5965dded Bump document date.
Reminded by:	ru
2004-07-09 11:44:49 +00:00
Dag-Erling Smørgrav
4aa90de352 The type and name of sbuf_b{cat,cpy}()'s second argument have changed. 2004-07-09 11:38:59 +00:00
Dag-Erling Smørgrav
09e0653941 I don't normally use my middle name, so remove it from attributions in
man pages (though not from copyright notices).  While I'm here, add email
addresses where appropriate.
2004-01-25 11:39:42 +00:00
Dag-Erling Smørgrav
91c9d24e52 Move the description of sbuf_delete() closer to the description of
sbuf_new(), and try to make them both a little clearer.
2004-01-09 21:16:31 +00:00
Ruslan Ermilov
fe08efe680 mdoc(7): Use the new feature of the .In macro. 2003-09-08 19:57:22 +00:00
Poul-Henning Kamp
c5f9218b48 Add the new function "sbuf_done()" which returns non-zero if the sbuf is
finished.

This allows sbufs to be used for request/response scenarioes without
needing additional communication flags.

Sponsored by:	DARPA & NAI Labs.
2002-10-04 09:58:17 +00:00
Ruslan Ermilov
3b0536fa2a mdoc(7) police: tidy up the previous delta a bit. 2002-01-10 12:53:51 +00:00
Kelly Yancey
371c0c842a Document sbuf_trim() and sbuf_vprintf(); add MLINKs.
Clarify that the contents of a caller-supplied buffer are undefined and
should not be examined directly.

Reviewed by:	des
2002-01-06 08:40:42 +00:00
Andrew R. Reiter
e05f3134d1 - Cross reference the section 9 printf man page since it contains
information with regards to in-kernel format directives that are
  not in printf.3
2001-12-09 08:12:06 +00:00
Bruce Evans
8a5bc77116 Fixed (C) syntax error in synopsis. 2001-10-04 09:01:15 +00:00
Ruslan Ermilov
32eef9aeb1 mdoc(7) police: Use the new .In macro for #include statements. 2001-10-01 16:09:29 +00:00
Dag-Erling Smørgrav
22cbe5e31f 4.4 will have sbufs. 2001-07-19 09:07:51 +00:00
Ruslan Ermilov
3d45e180f4 mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 15:31:11 +00:00
Dag-Erling Smørgrav
8cce2ebaf3 Constify the format string.
Submitted by:	Mike Barcroft <mike@q9media.com>
Forgotten by:	des
2001-07-05 22:34:11 +00:00
Ruslan Ermilov
d68b700a78 mdoc(7) police: mark type with .Vt, sort xrefs. 2001-07-04 15:37:13 +00:00
Dag-Erling Smørgrav
b0def2b548 Add sbuf_copyin(). Also add 'b' variants of sbuf_{cat,copyin,cpy}() which
ignore NUL bytes in the source string.
2001-06-11 17:05:52 +00:00
Dag-Erling Smørgrav
d647935801 sbuf_new(9) now returns a struct sbuf * instead of an int. If the caller
does not provide a struct sbuf, sbuf_new(9) will allocate one and return
a pointer to it.
2001-06-10 15:48:04 +00:00
Ruslan Ermilov
3a3799c99e mdoc(7) police: update HISTORY section.
This interface is not available in 4.3-RELEASE.
2001-04-23 15:22:50 +00:00
Ruslan Ermilov
5f95f24bf4 mdoc(7) police: uppercase document title. 2001-04-18 08:25:26 +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
Bruce Evans
2ba5bb1ff5 Fixed missing and/or wrong and/or extra includes in synopsis. 2001-02-15 11:47:31 +00:00
Dag-Erling Smørgrav
e499b74df0 Document the changes in subr_sbuf.c rev. 1.2. 2001-01-28 00:18:54 +00:00
Sheldon Hearn
67e35919d6 Grammar fix. 2000-12-14 09:36:49 +00:00
Dag-Erling Smørgrav
863edaec4d Add sbuf(9) man page with links to API function names.
Reviewed by:	ru
2000-12-13 19:53:37 +00:00