From acedd1b3012e5529da66ae7fd78969a50ba818c5 Mon Sep 17 00:00:00 2001 From: adilger Date: Fri, 14 Oct 2005 09:57:47 +0000 Subject: [PATCH] Branch b1_4_newconfig Update the CDEBUG macros to match the current portals HEAD. This re-instantiates the CDEBUG_LIMIT() macro, and fixes liblustre CDEBUG() from being a no-op. Improving the CDEBUG_LIMIT() code is the subject of bug 6411 and can be discussed separately. Fix conflicting subsystem macros between HEAD and b_hd_newconfig. b=6411 --- lnet/include/libcfs/libcfs.h | 99 ++++++++++++++++++++------------------------ 1 file changed, 46 insertions(+), 53 deletions(-) diff --git a/lnet/include/libcfs/libcfs.h b/lnet/include/libcfs/libcfs.h index 6e49ca2..bd49c4a 100644 --- a/lnet/include/libcfs/libcfs.h +++ b/lnet/include/libcfs/libcfs.h @@ -74,8 +74,10 @@ extern unsigned int libcfs_catastrophe; #define S_LMV 0x00800000 #define S_CMOBD 0x01000000 #define S_SEC 0x02000000 -#define S_MGC 0x04000000 -#define S_MGS 0x08000000 +#define S_GSS 0x04000000 +#define S_GKS 0x08000000 +#define S_MGC 0x10000000 +#define S_MGS 0x20000000 /* If you change these values, please keep these files up to date... * portals/utils/debug.c * utils/lconf @@ -120,14 +122,13 @@ extern unsigned int libcfs_catastrophe; #endif #ifdef __KERNEL__ -#if 1 #define CDEBUG(mask, format, a...) \ do { \ CHECK_STACK(CDEBUG_STACK); \ if (((mask) & (D_ERROR | D_EMERG | D_WARNING | D_CONSOLE)) || \ (libcfs_debug & (mask) && \ libcfs_subsystem_debug & DEBUG_SUBSYSTEM)) \ - libcfs_debug_msg(DEBUG_SUBSYSTEM, mask, \ + libcfs_debug_msg(DEBUG_SUBSYSTEM, mask, \ __FILE__, __FUNCTION__, __LINE__, \ CDEBUG_STACK, format, ## a); \ } while (0) @@ -141,14 +142,14 @@ do { \ \ CHECK_STACK(CDEBUG_STACK); \ if (cfs_time_after(cfs_time_current(), cdebug_next)) { \ - libcfs_debug_msg(DEBUG_SUBSYSTEM, cdebug_mask, __FILE__, \ + libcfs_debug_msg(DEBUG_SUBSYSTEM, cdebug_mask, __FILE__, \ __FUNCTION__, __LINE__, CDEBUG_STACK, \ cdebug_format, ## a); \ if (cdebug_count) { \ - libcfs_debug_msg(DEBUG_SUBSYSTEM, cdebug_mask, \ - __FILE__, __FUNCTION__, __LINE__, \ - 0, "skipped %d similar messages\n", \ - cdebug_count); \ + libcfs_debug_msg(DEBUG_SUBSYSTEM, cdebug_mask, \ + __FILE__, __FUNCTION__, __LINE__, 0, \ + "previously skipped %d similar " \ + "messages\n", cdebug_count); \ cdebug_count = 0; \ } \ if (cfs_time_after(cfs_time_current(), \ @@ -162,17 +163,42 @@ do { \ cdebug_delay*2; \ cdebug_next = cfs_time_current() + cdebug_delay; \ } else { \ - libcfs_debug_msg(DEBUG_SUBSYSTEM, \ - libcfs_debug & ~(D_EMERG|D_ERROR|D_WARNING),\ - __FILE__, __FUNCTION__, __LINE__, \ - CDEBUG_STACK, cdebug_format, ## a); \ + libcfs_debug_msg(DEBUG_SUBSYSTEM, \ + libcfs_debug & \ + ~(D_EMERG|D_ERROR|D_WARNING|D_CONSOLE), \ + __FILE__, __FUNCTION__, __LINE__, \ + CDEBUG_STACK, cdebug_format, ## a); \ cdebug_count++; \ } \ } while (0) -#define CWARN(format, a...) CDEBUG(D_WARNING, format, ## a) -#define CERROR(format, a...) CDEBUG(D_ERROR, format, ## a) -#define CEMERG(format, a...) CDEBUG(D_EMERG, format, ## a) +#elif defined(LUSTRE_UTILS) + +#define CDEBUG(mask, format, a...) \ +do { \ + if ((mask) & (D_ERROR | D_EMERG | D_WARNING | D_CONSOLE)) \ + fprintf(stderr, "(%s:%d:%s()) " format, \ + __FILE__, __LINE__, __FUNCTION__, ## a); \ +} while (0) +#define CDEBUG_LIMIT CDEBUG + +#else /* !__KERNEL__ && !LUSTRE_UTILS*/ + +#define CDEBUG(mask, format, a...) \ +do { \ + if (((mask) & (D_ERROR | D_EMERG | D_WARNING | D_CONSOLE)) || \ + (libcfs_debug & (mask) && \ + libcfs_subsystem_debug & DEBUG_SUBSYSTEM)) \ + fprintf(stderr, "(%s:%d:%s()) " format, \ + __FILE__, __LINE__, __FUNCTION__, ## a); \ +} while (0) +#define CDEBUG_LIMIT CDEBUG + +#endif /* !__KERNEL__ */ + +#define CWARN(format, a...) CDEBUG_LIMIT(D_WARNING, format, ## a) +#define CERROR(format, a...) CDEBUG_LIMIT(D_ERROR, format, ## a) +#define CEMERG(format, a...) CDEBUG_LIMIT(D_EMERG, format, ## a) #define LCONSOLE(mask, format, a...) CDEBUG(D_CONSOLE | (mask), format, ## a) #define LCONSOLE_INFO(format, a...) CDEBUG_LIMIT(D_CONSOLE, format, ## a) @@ -189,9 +215,8 @@ do { \ goto label; \ } while (0) -#define CDEBUG_ENTRY_EXIT (0) - -#ifdef CDEBUG_ENTRY_EXIT +#define CDEBUG_ENTRY_EXIT 1 +#if CDEBUG_ENTRY_EXIT /* * if rc == NULL, we need to code as RETURN((void *)NULL), otherwise @@ -220,43 +245,11 @@ do { \ #else /* !CDEBUG_ENTRY_EXIT */ #define RETURN(rc) return (rc) -#define ENTRY -#define EXIT +#define ENTRY do { } while (0) +#define EXIT do { } while (0) #endif /* !CDEBUG_ENTRY_EXIT */ -#else /* !1 */ -#define CDEBUG_LIMIT(mask, format, a...) do { } while (0) -#define CDEBUG(mask, format, a...) do { } while (0) -#define CWARN(format, a...) printk(KERN_WARNING format, ## a) -#define CERROR(format, a...) printk(KERN_ERR format, ## a) -#define CEMERG(format, a...) printk(KERN_EMERG format, ## a) -#define LCONSOLE(mask, format, a...) printk(format, ## a) -#define LCONSOLE_INFO(format, a...) printk(KERN_INFO format, ## a) -#define LCONSOLE_WARN(format, a...) printk(KERN_WARNING format, ## a) -#define LCONSOLE_ERROR(format, a...) printk(KERN_ERROR format, ## a) -#define LCONSOLE_EMERG(format, a...) printk(KERN_EMERG format, ## a) -#define GOTO(label, rc) do { (void)(rc); goto label; } while (0) -#define RETURN(rc) return (rc) -#define ENTRY do { } while (0) -#define EXIT do { } while (0) -#endif /* !1 */ -#else /* !__KERNEL__ */ -#define CDEBUG_LIMIT(mask, format, a...) do { } while (0) -#define CDEBUG(mask, format, a...) do { } while (0) -#define LCONSOLE(mask, format, a...) fprintf(stderr, format, ## a) -#define CWARN(format, a...) fprintf(stderr, format, ## a) -#define CERROR(format, a...) fprintf(stderr, format, ## a) -#define CEMERG(format, a...) fprintf(stderr, format, ## a) -#define LCONSOLE_INFO(format, a...) fprintf(stderr, format, ## a) -#define LCONSOLE_WARN(format, a...) fprintf(stderr, format, ## a) -#define LCONSOLE_ERROR(format, a...) fprintf(stderr, format, ## a) -#define LCONSOLE_EMERG(format, a...) fprintf(stderr, format, ## a) -#define GOTO(label, rc) do { (void)(rc); goto label; } while (0) -#define RETURN(rc) return (rc) -#define ENTRY do { } while (0) -#define EXIT do { } while (0) -#endif /* !__KERNEL__ */ #define LUSTRE_SRV_LNET_PID LUSTRE_LNET_PID -- 1.8.3.1