avoid namespace pollution when debugging

don't panic when printing data for a dead (NULL) connection
This commit is contained in:
mlelstv 2012-06-02 16:52:11 +00:00
parent cf50f3a20b
commit 7c7e8556c3
2 changed files with 13 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: iscsi_globals.h,v 1.2 2011/11/29 03:50:31 tls Exp $ */ /* $NetBSD: iscsi_globals.h,v 1.3 2012/06/02 16:52:11 mlelstv Exp $ */
/*- /*-
* Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc. * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@ -564,12 +564,13 @@ login_isid_t InitiatorISID;
#if defined(ISCSI_PERFTEST) #if defined(ISCSI_PERFTEST)
int perf_level; /* How much info to display */ int iscsi_perf_level; /* How much info to display */
#define PDEBOUT(x) printf x #define PDEBOUT(x) printf x
#define PDEB(lev,x) { if (perf_level >= lev) printf x ;} #define PDEB(lev,x) { if (iscsi_perf_level >= lev) printf x ;}
#define PDEBC(conn,lev,x) { { if (perf_level >= lev) printf("S%dC%d: ", \ #define PDEBC(conn,lev,x) { if (iscsi_perf_level >= lev) { printf("S%dC%d: ", \
conn->session->id, conn->id); printf x ;}} conn ? conn->session->id : -1, \
conn ? conn->id : -1); printf x ;}}
#else #else
#define PDEBOUT(x) #define PDEBOUT(x)
#define PDEB(lev,x) #define PDEB(lev,x)
@ -578,12 +579,13 @@ int perf_level; /* How much info to display */
#ifdef ISCSI_DEBUG #ifdef ISCSI_DEBUG
int debug_level; /* How much debug info to display */ int iscsi_debug_level; /* How much debug info to display */
#define DEBOUT(x) printf x #define DEBOUT(x) printf x
#define DEB(lev,x) { if (debug_level >= lev) printf x ;} #define DEB(lev,x) { if (iscsi_debug_level >= lev) printf x ;}
#define DEBC(conn,lev,x) { if (debug_level >= lev) { printf("S%dC%d: ", \ #define DEBC(conn,lev,x) { if (iscsi_debug_level >= lev) { printf("S%dC%d: ", \
conn->session->id, conn->id); printf x ;}} conn ? conn->session->id : -1, \
conn ? conn->id : -1); printf x ;}}
void dump(void *buf, int len); void dump(void *buf, int len);
#define STATIC static #define STATIC static

View File

@ -41,11 +41,11 @@
extern struct cfdriver iscsi_cd; extern struct cfdriver iscsi_cd;
#if defined(ISCSI_DEBUG) #if defined(ISCSI_DEBUG)
int debug_level = ISCSI_DEBUG; int iscsi_debug_level = ISCSI_DEBUG;
#endif #endif
#if defined(ISCSI_PERFTEST) #if defined(ISCSI_PERFTEST)
int perf_level = 0; int iscsi_perf_level = 0;
#endif #endif
/* Device Structure */ /* Device Structure */