-# $OpenBSD: Makefile,v 1.5 2012/09/13 05:50:15 claudio Exp $
+# $OpenBSD: Makefile,v 1.6 2014/04/21 20:20:37 claudio Exp $
.PATH: ${.CURDIR}/../iscsid
CFLAGS+= -Wsign-compare
CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../iscsid
YFLAGS=
+LDADD= -lutil
+DPADD+= ${LIBUTIL}
.include <bsd.prog.mk>
-/* $OpenBSD: iscsictl.c,v 1.7 2014/04/21 18:01:08 claudio Exp $ */
+/* $OpenBSD: iscsictl.c,v 1.8 2014/04/21 20:20:37 claudio Exp $ */
/*
* Copyright (c) 2010 Claudio Jeker <claudio@openbsd.org>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <util.h>
#include "iscsid.h"
#include "iscsictl.h"
show_vscsi_stats(struct ctrlmsghdr *cmh, struct pdu *pdu)
{
struct vscsi_stats *vs;
+ char buf[FMT_SCALED_STRSIZE];
if (cmh->len[0] != sizeof(struct vscsi_stats))
errx(1, "bad size of response");
vs->cnt_i2t_dir[1],
vs->cnt_i2t_dir[2]);
- printf("%llu data reads (%llu bytes read)\n",
- vs->cnt_read, vs->bytes_rd);
- printf("%llu data writes (%llu bytes written)\n",
- vs->cnt_write, vs->bytes_wr);
+ if (fmt_scaled(vs->bytes_rd, buf) != 0)
+ (void)strlcpy(buf, "NaN", sizeof(buf));
+ printf("%llu data reads (%s bytes read)\n", vs->cnt_read, buf);
+ if (fmt_scaled(vs->bytes_wr, buf) != 0)
+ (void)strlcpy(buf, "NaN", sizeof(buf));
+ printf("%llu data writes (%s bytes written)\n", vs->cnt_write, buf);
printf("%llu T2I calls (%llu done, %llu sense errors, %llu errors)\n",
vs->cnt_t2i,