/* IOCTL Buffer Size */
#undef OBD_MAX_IOCTL_BUFFER
+/* temporary pinger */
+#undef ENABLE_PINGER
+
+/* experimental orphans */
+#undef ENABLE_ORPHANS
#ifndef _KP30_INCLUDED
#define _KP30_INCLUDED
-
#define PORTAL_DEBUG
#ifndef offsetof
extern unsigned int portal_stack;
extern unsigned int portal_debug;
extern unsigned int portal_printk;
-/* Debugging subsystems (8 bit ID)
- *
- * If you add debug subsystem #32, you need to send email to phil, because
- * you're going to break kernel subsystem debug filtering. */
-#define S_UNDEFINED (0 << 24)
-#define S_MDC (1 << 24)
-#define S_MDS (2 << 24)
-#define S_OSC (3 << 24)
-#define S_OST (4 << 24)
-#define S_CLASS (5 << 24)
-#define S_OBDFS (6 << 24) /* obsolete */
-#define S_LLITE (7 << 24)
-#define S_RPC (8 << 24)
-#define S_EXT2OBD (9 << 24) /* obsolete */
-#define S_PORTALS (10 << 24)
-#define S_SOCKNAL (11 << 24)
-#define S_QSWNAL (12 << 24)
-#define S_PINGER (13 << 24)
-#define S_FILTER (14 << 24)
-#define S_TRACE (15 << 24) /* obsolete */
-#define S_ECHO (16 << 24)
-#define S_LDLM (17 << 24)
-#define S_LOV (18 << 24)
-#define S_GMNAL (19 << 24)
-#define S_PTLROUTER (20 << 24)
-#define S_COBD (21 << 24)
-#define S_PTLBD (22 << 24)
-#define S_LOG (23 << 24)
-#define S_MGMT (24 << 24)
-
-/* If you change these values, please keep portals/linux/utils/debug.c
+/* Debugging subsystems (32 bits, non-overlapping) */
+#define S_UNDEFINED (1 << 0)
+#define S_MDC (1 << 1)
+#define S_MDS (1 << 2)
+#define S_OSC (1 << 3)
+#define S_OST (1 << 4)
+#define S_CLASS (1 << 5)
+#define S_LOG (1 << 6)
+#define S_LLITE (1 << 7)
+#define S_RPC (1 << 8)
+#define S_MGMT (1 << 9)
+#define S_PORTALS (1 << 10)
+#define S_SOCKNAL (1 << 11)
+#define S_QSWNAL (1 << 12)
+#define S_PINGER (1 << 13)
+#define S_FILTER (1 << 14)
+#define S_PTLBD (1 << 15)
+#define S_ECHO (1 << 16)
+#define S_LDLM (1 << 17)
+#define S_LOV (1 << 18)
+#define S_GMNAL (1 << 19)
+#define S_PTLROUTER (1 << 20)
+#define S_COBD (1 << 21)
+
+/* If you change these values, please keep portals/utils/debug.c
* up to date! */
-/* Debugging masks (24 bits, non-overlapping) */
+/* Debugging masks (32 bits, non-overlapping) */
#define D_TRACE (1 << 0) /* ENTRY/EXIT markers */
#define D_INODE (1 << 1)
#define D_SUPER (1 << 2)
CHECK_STACK(CDEBUG_STACK); \
if (!(mask) || ((mask) & (D_ERROR | D_EMERG)) || \
(portal_debug & (mask) && \
- portal_subsystem_debug & (1 << (DEBUG_SUBSYSTEM >> 24)))) \
+ portal_subsystem_debug & DEBUG_SUBSYSTEM)) \
portals_debug_msg(DEBUG_SUBSYSTEM, mask, \
__FILE__, __FUNCTION__, __LINE__, \
CDEBUG_STACK, format, ## a); \
#define EXIT do { } while (0)
#endif
-
#ifdef __KERNEL__
# include <linux/vmalloc.h>
# include <linux/time.h>
int portals_debug_clear_buffer(void);
int portals_debug_mark_buffer(char *text);
int portals_debug_set_daemon(unsigned int cmd, unsigned int length,
- char *file, unsigned int size);
+ char *file, unsigned int size);
__s32 portals_debug_copy_to_user(char *buf, unsigned long len);
#if (__GNUC__)
/* Use the special GNU C __attribute__ hack to have the compiler check the
const char *format, ...)
__attribute__ ((format (printf, 7, 8)));
#else
-void portals_debug_msg (int subsys, int mask, char *file, const char *fn,
- const int line, unsigned long stack,
- const char *format, ...);
+void portals_debug_msg(int subsys, int mask, char *file, const char *fn,
+ const int line, unsigned long stack,
+ const char *format, ...);
#endif /* __GNUC__ */
void portals_debug_set_level(unsigned int debug_level);
# define PORTAL_ALLOC(ptr, size) do { (ptr) = malloc(size); } while (0);
# define PORTAL_FREE(a, b) do { free(a); } while (0);
# define portals_debug_msg(subsys, mask, file, fn, line, stack, format, a...) \
- printf ("%02x:%06x (@%lu %s:%s,l. %d %d %lu): " format, \
- (subsys) >> 24, (mask), (long)time(0), file, fn, line, \
- getpid() , stack, ## a);
+ printf("%02x:%06x (@%lu %s:%s,l. %d %d %lu): " format, \
+ (subsys), (mask), (long)time(0), file, fn, line, \
+ getpid() , stack, ## a);
#endif
#ifndef CURRENT_TIME
void kportal_put_ni (int nal);
#ifdef __CYGWIN__
-#ifndef BITS_PER_LONG
-#if (~0UL) == 0xffffffffUL
-#define BITS_PER_LONG 32
-#else
-#define BITS_PER_LONG 64
-#endif
-#endif
+# ifndef BITS_PER_LONG
+# if (~0UL) == 0xffffffffUL
+# define BITS_PER_LONG 32
+# else
+# define BITS_PER_LONG 64
+# endif
+# endif
#endif
#if (BITS_PER_LONG == 32 || __WORDSIZE == 32)
do_gettimeofday(&tv);
prefix_nob = snprintf(debug_buf + debug_off, max_nob,
- "%02x:%06x:%d:%lu.%06lu ",
- subsys >> 24, mask, smp_processor_id(),
+ "%06x:%06x:%d:%lu.%06lu ",
+ subsys, mask, smp_processor_id(),
tv.tv_sec, tv.tv_usec);
max_nob -= prefix_nob;
va_start(ap, format);
msg_nob += vsnprintf(debug_buf + debug_off + prefix_nob + msg_nob,
- max_nob, format, ap);
+ max_nob, format, ap);
max_nob -= msg_nob;
va_end(ap);
#include <portals/api-support.h>
int ptl_init;
-unsigned int portal_subsystem_debug = 0xfff7e3ff;
+unsigned int portal_subsystem_debug = ~0 - (S_PORTALS | S_QSWNAL | S_SOCKNAL | S_GMNAL);
unsigned int portal_debug = ~0;
unsigned int portal_printk;
unsigned int portal_stack;
static int debug_mask = ~0;
static const char *portal_debug_subsystems[] =
- {"undefined", "mdc", "mds", "osc", "ost", "class", "obdfs", "llite",
- "rpc", "ext2obd", "portals", "socknal", "qswnal", "pinger", "filter",
- "obdtrace", "echo", "ldlm", "lov", "gmnal", "router", "ptldb", NULL};
+ {"undefined", "mdc", "mds", "osc", "ost", "class", "log", "llite",
+ "rpc", "mgmt", "portals", "socknal", "qswnal", "pinger", "filter",
+ "ptlbd", "echo", "ldlm", "lov", "gmnal", "router", "cobd", NULL};
static const char *portal_debug_masks[] =
{"trace", "inode", "super", "ext2", "malloc", "cache", "info", "ioctl",
"blocks", "net", "warning", "buffs", "other", "dentry", "portals",
- "page", "dlmtrace", "error", "emerg", "ha", "rpctrace", "vfstrace", NULL};
+ "page", "dlmtrace", "error", "emerg", "ha", "rpctrace", "vfstrace",
+ NULL};
struct debug_daemon_cmd {
char *cmd;
{
char *p, *z;
unsigned long subsystem, debug, dropped = 0, kept = 0;
- int max_sub, max_type;
+ int max_sub, max_type, warn = 0;
for (max_sub = 0; portal_debug_subsystems[max_sub] != NULL; max_sub++)
;
z++;
/* for some reason %*s isn't working. */
*p = '\0';
- if (subsystem < max_sub &&
- subsystem_array[subsystem] &&
+ if (subsystem >= max_sub && warn == 0) {
+ fprintf(stderr, "warning: unrecognized debug subsystem "
+ "%lx; did someone update kp30.h but not "
+ "portals/utils/debug.c?\n", subsystem);
+ warn = 1;
+ }
+ if ((subsystem >= max_sub || subsystem_array[subsystem]) &&
(!debug || (debug_mask & debug))) {
if (raw)
fprintf(fd, "%s\n", buf);
/* IOCTL Buffer Size */
#undef OBD_MAX_IOCTL_BUFFER
+/* temporary pinger */
+#undef ENABLE_PINGER
+
+/* experimental orphans */
+#undef ENABLE_ORPHANS
#ifndef _KP30_INCLUDED
#define _KP30_INCLUDED
-
#define PORTAL_DEBUG
#ifndef offsetof
extern unsigned int portal_stack;
extern unsigned int portal_debug;
extern unsigned int portal_printk;
-/* Debugging subsystems (8 bit ID)
- *
- * If you add debug subsystem #32, you need to send email to phil, because
- * you're going to break kernel subsystem debug filtering. */
-#define S_UNDEFINED (0 << 24)
-#define S_MDC (1 << 24)
-#define S_MDS (2 << 24)
-#define S_OSC (3 << 24)
-#define S_OST (4 << 24)
-#define S_CLASS (5 << 24)
-#define S_OBDFS (6 << 24) /* obsolete */
-#define S_LLITE (7 << 24)
-#define S_RPC (8 << 24)
-#define S_EXT2OBD (9 << 24) /* obsolete */
-#define S_PORTALS (10 << 24)
-#define S_SOCKNAL (11 << 24)
-#define S_QSWNAL (12 << 24)
-#define S_PINGER (13 << 24)
-#define S_FILTER (14 << 24)
-#define S_TRACE (15 << 24) /* obsolete */
-#define S_ECHO (16 << 24)
-#define S_LDLM (17 << 24)
-#define S_LOV (18 << 24)
-#define S_GMNAL (19 << 24)
-#define S_PTLROUTER (20 << 24)
-#define S_COBD (21 << 24)
-#define S_PTLBD (22 << 24)
-#define S_LOG (23 << 24)
-#define S_MGMT (24 << 24)
-
-/* If you change these values, please keep portals/linux/utils/debug.c
+/* Debugging subsystems (32 bits, non-overlapping) */
+#define S_UNDEFINED (1 << 0)
+#define S_MDC (1 << 1)
+#define S_MDS (1 << 2)
+#define S_OSC (1 << 3)
+#define S_OST (1 << 4)
+#define S_CLASS (1 << 5)
+#define S_LOG (1 << 6)
+#define S_LLITE (1 << 7)
+#define S_RPC (1 << 8)
+#define S_MGMT (1 << 9)
+#define S_PORTALS (1 << 10)
+#define S_SOCKNAL (1 << 11)
+#define S_QSWNAL (1 << 12)
+#define S_PINGER (1 << 13)
+#define S_FILTER (1 << 14)
+#define S_PTLBD (1 << 15)
+#define S_ECHO (1 << 16)
+#define S_LDLM (1 << 17)
+#define S_LOV (1 << 18)
+#define S_GMNAL (1 << 19)
+#define S_PTLROUTER (1 << 20)
+#define S_COBD (1 << 21)
+
+/* If you change these values, please keep portals/utils/debug.c
* up to date! */
-/* Debugging masks (24 bits, non-overlapping) */
+/* Debugging masks (32 bits, non-overlapping) */
#define D_TRACE (1 << 0) /* ENTRY/EXIT markers */
#define D_INODE (1 << 1)
#define D_SUPER (1 << 2)
CHECK_STACK(CDEBUG_STACK); \
if (!(mask) || ((mask) & (D_ERROR | D_EMERG)) || \
(portal_debug & (mask) && \
- portal_subsystem_debug & (1 << (DEBUG_SUBSYSTEM >> 24)))) \
+ portal_subsystem_debug & DEBUG_SUBSYSTEM)) \
portals_debug_msg(DEBUG_SUBSYSTEM, mask, \
__FILE__, __FUNCTION__, __LINE__, \
CDEBUG_STACK, format, ## a); \
#define EXIT do { } while (0)
#endif
-
#ifdef __KERNEL__
# include <linux/vmalloc.h>
# include <linux/time.h>
int portals_debug_clear_buffer(void);
int portals_debug_mark_buffer(char *text);
int portals_debug_set_daemon(unsigned int cmd, unsigned int length,
- char *file, unsigned int size);
+ char *file, unsigned int size);
__s32 portals_debug_copy_to_user(char *buf, unsigned long len);
#if (__GNUC__)
/* Use the special GNU C __attribute__ hack to have the compiler check the
const char *format, ...)
__attribute__ ((format (printf, 7, 8)));
#else
-void portals_debug_msg (int subsys, int mask, char *file, const char *fn,
- const int line, unsigned long stack,
- const char *format, ...);
+void portals_debug_msg(int subsys, int mask, char *file, const char *fn,
+ const int line, unsigned long stack,
+ const char *format, ...);
#endif /* __GNUC__ */
void portals_debug_set_level(unsigned int debug_level);
# define PORTAL_ALLOC(ptr, size) do { (ptr) = malloc(size); } while (0);
# define PORTAL_FREE(a, b) do { free(a); } while (0);
# define portals_debug_msg(subsys, mask, file, fn, line, stack, format, a...) \
- printf ("%02x:%06x (@%lu %s:%s,l. %d %d %lu): " format, \
- (subsys) >> 24, (mask), (long)time(0), file, fn, line, \
- getpid() , stack, ## a);
+ printf("%02x:%06x (@%lu %s:%s,l. %d %d %lu): " format, \
+ (subsys), (mask), (long)time(0), file, fn, line, \
+ getpid() , stack, ## a);
#endif
#ifndef CURRENT_TIME
void kportal_put_ni (int nal);
#ifdef __CYGWIN__
-#ifndef BITS_PER_LONG
-#if (~0UL) == 0xffffffffUL
-#define BITS_PER_LONG 32
-#else
-#define BITS_PER_LONG 64
-#endif
-#endif
+# ifndef BITS_PER_LONG
+# if (~0UL) == 0xffffffffUL
+# define BITS_PER_LONG 32
+# else
+# define BITS_PER_LONG 64
+# endif
+# endif
#endif
#if (BITS_PER_LONG == 32 || __WORDSIZE == 32)
do_gettimeofday(&tv);
prefix_nob = snprintf(debug_buf + debug_off, max_nob,
- "%02x:%06x:%d:%lu.%06lu ",
- subsys >> 24, mask, smp_processor_id(),
+ "%06x:%06x:%d:%lu.%06lu ",
+ subsys, mask, smp_processor_id(),
tv.tv_sec, tv.tv_usec);
max_nob -= prefix_nob;
va_start(ap, format);
msg_nob += vsnprintf(debug_buf + debug_off + prefix_nob + msg_nob,
- max_nob, format, ap);
+ max_nob, format, ap);
max_nob -= msg_nob;
va_end(ap);
#include <portals/api-support.h>
int ptl_init;
-unsigned int portal_subsystem_debug = 0xfff7e3ff;
+unsigned int portal_subsystem_debug = ~0 - (S_PORTALS | S_QSWNAL | S_SOCKNAL | S_GMNAL);
unsigned int portal_debug = ~0;
unsigned int portal_printk;
unsigned int portal_stack;
static int debug_mask = ~0;
static const char *portal_debug_subsystems[] =
- {"undefined", "mdc", "mds", "osc", "ost", "class", "obdfs", "llite",
- "rpc", "ext2obd", "portals", "socknal", "qswnal", "pinger", "filter",
- "obdtrace", "echo", "ldlm", "lov", "gmnal", "router", "ptldb", NULL};
+ {"undefined", "mdc", "mds", "osc", "ost", "class", "log", "llite",
+ "rpc", "mgmt", "portals", "socknal", "qswnal", "pinger", "filter",
+ "ptlbd", "echo", "ldlm", "lov", "gmnal", "router", "cobd", NULL};
static const char *portal_debug_masks[] =
{"trace", "inode", "super", "ext2", "malloc", "cache", "info", "ioctl",
"blocks", "net", "warning", "buffs", "other", "dentry", "portals",
- "page", "dlmtrace", "error", "emerg", "ha", "rpctrace", "vfstrace", NULL};
+ "page", "dlmtrace", "error", "emerg", "ha", "rpctrace", "vfstrace",
+ NULL};
struct debug_daemon_cmd {
char *cmd;
{
char *p, *z;
unsigned long subsystem, debug, dropped = 0, kept = 0;
- int max_sub, max_type;
+ int max_sub, max_type, warn = 0;
for (max_sub = 0; portal_debug_subsystems[max_sub] != NULL; max_sub++)
;
z++;
/* for some reason %*s isn't working. */
*p = '\0';
- if (subsystem < max_sub &&
- subsystem_array[subsystem] &&
+ if (subsystem >= max_sub && warn == 0) {
+ fprintf(stderr, "warning: unrecognized debug subsystem "
+ "%lx; did someone update kp30.h but not "
+ "portals/utils/debug.c?\n", subsystem);
+ warn = 1;
+ }
+ if ((subsystem >= max_sub || subsystem_array[subsystem]) &&
(!debug || (debug_mask & debug))) {
if (raw)
fprintf(fd, "%s\n", buf);