From d4c32f2a63b6ed94ff5b06f0c022e9917f7a95f1 Mon Sep 17 00:00:00 2001 From: mjacob Date: Thu, 28 Dec 2000 22:27:46 +0000 Subject: [PATCH] Apply nearly all of Bill Sommerfeld's -Wformat patches. The one change I didn't take is the %llu format- I can't have a common across multiple platform module assume a %ll argument capability- which really pointed out that I shouldn't be trying to *print* something which could long long. --- sys/dev/ic/isp.c | 52 ++++++++++++++++++++--------------------- sys/dev/ic/isp_netbsd.c | 4 ++-- sys/dev/ic/ispvar.h | 8 ++++++- 3 files changed, 35 insertions(+), 29 deletions(-) diff --git a/sys/dev/ic/isp.c b/sys/dev/ic/isp.c index 20906021fc9a..7863a39edb6a 100644 --- a/sys/dev/ic/isp.c +++ b/sys/dev/ic/isp.c @@ -1,4 +1,4 @@ -/* $NetBSD: isp.c,v 1.65 2000/12/28 08:26:12 mjacob Exp $ */ +/* $NetBSD: isp.c,v 1.66 2000/12/28 22:27:46 mjacob Exp $ */ /* * This driver, which is contained in NetBSD in the files: * @@ -92,43 +92,43 @@ /* * Local static data */ -static char *warnlun = +static const char warnlun[] = "WARNING- cannot determine Expanded LUN capability- limiting to one LUN"; -static char *portshift = +static const char portshift[] = "Target %d Loop ID 0x%x (Port 0x%x) => Loop 0x%x (Port 0x%x)"; -static char *portdup = +static const char portdup[] = "Target %d duplicates Target %d- killing off both"; -static char *retained = +static const char retained[] = "Retaining Loop ID 0x%x for Target %d (Port 0x%x)"; #ifdef ISP2100_FABRIC -static char *lretained = +static const char lretained[] = "Retained login of Target %d (Loop ID 0x%x) Port 0x%x"; -static char *plogout = +static const char plogout[] = "Logging out Target %d at Loop ID 0x%x (Port 0x%x)"; -static char *plogierr = +static const char plogierr[] = "Command Error in PLOGI for Port 0x%x (0x%x)"; -static char *nopdb = +static const char nopdb[] = "Could not get PDB for Device @ Port 0x%x"; -static char *pdbmfail1 = +static const char pdbmfail1[] = "PDB Loop ID info for Device @ Port 0x%x does not match up (0x%x)"; -static char *pdbmfail2 = +static const char pdbmfail2[] = "PDB Port info for Device @ Port 0x%x does not match up (0x%x)"; -static char *ldumped = +static const char ldumped[] = "Target %d (Loop ID 0x%x) Port 0x%x dumped after login info mismatch"; #endif -static char *notresp = +static const char notresp[] = "Not RESPONSE in RESPONSE Queue (type 0x%x) @ idx %d (next %d) nlooked %d"; -static char *xact1 = +static const char xact1[] = "HBA attempted queued transaction with disconnect not set for %d.%d.%d"; -static char *xact2 = +static const char xact2[] = "HBA attempted queued transaction to target routine %d on target %d bus %d"; -static char *xact3 = +static const char xact3[] = "HBA attempted queued cmd for %d.%d.%d when queueing disabled"; -static char *pskip = +static const char pskip[] = "SCSI phase skipped for target %d.%d.%d"; -static char *topology = +static const char topology[] = "Loop ID %d, AL_PA 0x%x, Port ID 0x%x, Loop State 0x%x, Topology '%s'"; -static char *finmsg = +static const char finmsg[] = "(%d.%d.%d): FIN dl%d resid%d STS 0x%x SKEY %c XS_ERR=0x%x"; /* * Local function prototypes. @@ -257,7 +257,7 @@ isp_reset(isp) * XXX: Should probably do some bus sensing. */ } else if (IS_ULTRA2(isp)) { - static char *m = "bus %d is in %s Mode"; + static const char m[] = "bus %d is in %s Mode"; u_int16_t l; sdparam *sdp = isp->isp_param; @@ -1318,16 +1318,16 @@ isp_fclink_test(isp, usdelay) */ enano = NANOTIME_SUB(&hrb, &hra); + isp_prt(isp, ISP_LOGDEBUG3, "usec%d: 0x%lx->0x%lx enano %lu", + count, (long) GET_NANOSEC(&hra), (long) GET_NANOSEC(&hrb), + (enano > ((u_int64_t)0xffffffff))? 0xffffffff : + (unsigned long) (enano & 0xffffffff)); + /* * If the elapsed time is less than 1 millisecond, * delay a period of time up to that millisecond of * waiting. - */ - isp_prt(isp, ISP_LOGDEBUG3, "usec%d: 0x%lx->0x%lx enano %u", - count, (long) GET_NANOSEC(&hra), (long) GET_NANOSEC(&hrb), - enano); - - /* + * * This peculiar code is an attempt to try and avoid * invoking u_int64_t math support functions for some * platforms where linkage is a problem. diff --git a/sys/dev/ic/isp_netbsd.c b/sys/dev/ic/isp_netbsd.c index 3601b399c72c..c56eea712899 100644 --- a/sys/dev/ic/isp_netbsd.c +++ b/sys/dev/ic/isp_netbsd.c @@ -1,4 +1,4 @@ -/* $NetBSD: isp_netbsd.c,v 1.36 2000/12/28 21:37:04 mjacob Exp $ */ +/* $NetBSD: isp_netbsd.c,v 1.37 2000/12/28 22:27:47 mjacob Exp $ */ /* * This driver, which is contained in NetBSD in the files: * @@ -708,7 +708,7 @@ isp_async(isp, cmd, arg) break; case ISPASYNC_PDB_CHANGED: if (IS_FC(isp) && isp->isp_dblev) { - const char *fmt = "Target %d (Loop 0x%x) Port ID 0x%x " + const char fmt[] = "Target %d (Loop 0x%x) Port ID 0x%x " "role %s %s\n Port WWN 0x%08x%08x\n Node WWN 0x%08x%08x"; const static char *roles[4] = { "No", "Target", "Initiator", "Target/Initiator" diff --git a/sys/dev/ic/ispvar.h b/sys/dev/ic/ispvar.h index 68ff860c0ea7..5d74814b7926 100644 --- a/sys/dev/ic/ispvar.h +++ b/sys/dev/ic/ispvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: ispvar.h,v 1.38 2000/12/28 08:24:17 mjacob Exp $ */ +/* $NetBSD: ispvar.h,v 1.39 2000/12/28 22:27:47 mjacob Exp $ */ /* * This driver, which is contained in NetBSD in the files: * @@ -565,7 +565,13 @@ int isp_async __P((struct ispsoftc *, ispasync_t, void *)); /* * Platform Dependent Error and Debug Printout */ +#ifdef __GNUC__ +void isp_prt __P((struct ispsoftc *, int level, const char *, ...)) + __attribute__((__format__(__printf__,3,4))); +#else void isp_prt __P((struct ispsoftc *, int level, const char *, ...)); +#endif + #define ISP_LOGALL 0x0 /* log always */ #define ISP_LOGCONFIG 0x1 /* log configuration messages */ #define ISP_LOGINFO 0x2 /* log informational messages */