summaryrefslogtreecommitdiffstats
path: root/lib/libscsi
diff options
context:
space:
mode:
authordufault <dufault@FreeBSD.org>1995-04-28 19:23:51 +0000
committerdufault <dufault@FreeBSD.org>1995-04-28 19:23:51 +0000
commitd1214fe1e858f03c29ab0eee597e36e45f26ea21 (patch)
tree447aeb093905662522162978cc7f96d880bca42d /lib/libscsi
parentcd052cdfd3cde0a4478a61850561b50a0046463d (diff)
downloadFreeBSD-src-d1214fe1e858f03c29ab0eee597e36e45f26ea21.zip
FreeBSD-src-d1214fe1e858f03c29ab0eee597e36e45f26ea21.tar.gz
Fix a few problems with the debugging output. Add a new "visit" function.
Diffstat (limited to 'lib/libscsi')
-rw-r--r--lib/libscsi/scsi.c13
-rw-r--r--lib/libscsi/scsi.h2
2 files changed, 12 insertions, 3 deletions
diff --git a/lib/libscsi/scsi.c b/lib/libscsi/scsi.c
index e597bb4..051970a 100644
--- a/lib/libscsi/scsi.c
+++ b/lib/libscsi/scsi.c
@@ -30,7 +30,7 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- * $Id: scsi.c,v 1.2 1995/01/25 00:33:50 dufault Exp $
+ * $Id: scsi.c,v 1.3 1995/01/26 23:48:41 dufault Exp $
*/
#include <stdlib.h>
#include <stdio.h>
@@ -371,6 +371,13 @@ int scsireq_buff_decode(u_char *buff, size_t len, char *fmt, ...)
return do_buff_decode(buff, len, 0, 0, fmt, ap);
}
+int scsireq_buff_decode_visit(u_char *buff, size_t len, char *fmt,
+void (*arg_put)(void *, int, void *, int, char *), void *puthook)
+{
+ va_list ap = (va_list)0;
+ return do_buff_decode(buff, len, arg_put, puthook, fmt, ap);
+}
+
/* next_field: Return the next field in a command specifier. This
* builds up a SCSI command using this trivial grammar:
*
@@ -860,7 +867,7 @@ void scsi_dump(FILE *f, char *text, u_char *p, int req, int got, int dump_print)
fprintf(f, "%s (%d of %d):\n", text, got, req);
- if (behave.db_level == 0 && (behave.db_trunc != -1 && got > behave.db_trunc))
+ if (behave.db_trunc != -1 && got > behave.db_trunc)
{
trunc = 1;
got = behave.db_trunc;
@@ -1063,7 +1070,7 @@ int scsi_debug(FILE *f, int ret, scsireq_t *scsireq)
fputc('\n', f);
- if (ret == 0 && (scsireq->status || scsireq->retsts))
+ if (ret == 0 && (scsireq->status || scsireq->retsts || behave.db_level))
{
scsi_retsts_dump(f, scsireq);
diff --git a/lib/libscsi/scsi.h b/lib/libscsi/scsi.h
index c9aa0f3..4555d7f 100644
--- a/lib/libscsi/scsi.h
+++ b/lib/libscsi/scsi.h
@@ -52,6 +52,8 @@ scsireq_t *scsireq_reset __P((scsireq_t *));
scsireq_t *scsireq_new __P((void));
int scsireq_buff_decode __P((u_char *, size_t, char *, ...));
+int scsireq_buff_decode_visit __P((u_char *, size_t, char *,
+void (*a)(void *, int, void *, int, char *), void *));
int scsireq_decode __P((scsireq_t *, char *, ...));
int scsireq_decode_visit __P((scsireq_t *, char *,
OpenPOWER on IntegriCloud