diff options
author | codeworkx <codeworkx@cyanogenmod.com> | 2012-09-17 17:53:57 +0200 |
---|---|---|
committer | codeworkx <codeworkx@cyanogenmod.com> | 2012-09-18 16:31:59 +0200 |
commit | c28265764ec6ad9995eb0c761a376ffc9f141fcd (patch) | |
tree | 3ad899757480d47deb2be6011509a4243e8e0dc2 /drivers/interceptor/sshdebug.h | |
parent | 0ddbcb39c0dc0318f68d858f25a96a074142af2f (diff) | |
download | kernel_samsung_smdk4412-c28265764ec6ad9995eb0c761a376ffc9f141fcd.zip kernel_samsung_smdk4412-c28265764ec6ad9995eb0c761a376ffc9f141fcd.tar.gz kernel_samsung_smdk4412-c28265764ec6ad9995eb0c761a376ffc9f141fcd.tar.bz2 |
applied patches from i9305 jb sources, updated mali to r3p0
Change-Id: Iec4bc4e2fb59e2cf5b4d25568a644d4e3719565e
Diffstat (limited to 'drivers/interceptor/sshdebug.h')
-rw-r--r-- | drivers/interceptor/sshdebug.h | 175 |
1 files changed, 175 insertions, 0 deletions
diff --git a/drivers/interceptor/sshdebug.h b/drivers/interceptor/sshdebug.h new file mode 100644 index 0000000..c1c0836 --- /dev/null +++ b/drivers/interceptor/sshdebug.h @@ -0,0 +1,175 @@ +/* Netfilter Driver for IPSec VPN Client + * + * Copyright(c) 2012 Samsung Electronics + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +/* + * sshdebug.h + * + * Debug macros and assertions. + * + */ + +#ifndef SSHDEBUG_H +#define SSHDEBUG_H + +#ifdef DEBUG_LIGHT + +/* Debug level */ +extern unsigned int ssh_debug_level; + +#define SSH_FATAL(_fmt...) panic(_fmt) + +#define SSH_NOTREACHED \ + panic("%s:%d: Unreachable code reached!", __FILE__, __LINE__) + +#define SSH_DEBUG(level, varcall) \ + do { \ + if ((level) <= ssh_debug_level) \ + { \ + printk("%s:%d: ", __FILE__, __LINE__); \ + printk varcall; \ + printk("\n"); \ + } \ + } while (0) + +#define SSH_ASSERT(cond) \ + do { \ + if (!(cond)) \ + panic("%s:%d: Assertion failed: %s\n", __FILE__, __LINE__, "#cond"); \ + } while (0) +#define SSH_VERIFY(cond) SSH_ASSERT(cond) +#define SSH_PRECOND(cond) SSH_ASSERT(cond) + +static inline void +ssh_debug_hexdump(const unsigned char *buf, const size_t len) +{ + size_t i; + + for (i = 0; (i + 16) < len; i += 16) + printk("%08x: %02x%02x %02x%02x %02x%02x %02x%02x " + "%02x%02x %02x%02x %02x%02x %02x%02x\n", + (unsigned int) i, + (unsigned int) buf[i+0], (unsigned int) buf[i+1], + (unsigned int) buf[i+2], (unsigned int) buf[i+3], + (unsigned int) buf[i+4], (unsigned int) buf[i+5], + (unsigned int) buf[i+6], (unsigned int) buf[i+7], + (unsigned int) buf[i+8], (unsigned int) buf[i+9], + (unsigned int) buf[i+10], (unsigned int) buf[i+11], + (unsigned int) buf[i+12], (unsigned int) buf[i+13], + (unsigned int) buf[i+14], (unsigned int) buf[i+15]); + if (i >= len) + return; + + printk("%08x: ", (unsigned int) i); + for (; i < len; i++) + printk("%02x%s", (unsigned int) buf[i], ((i % 2) == 1 ? " " : "")); + printk("\n"); +} + +#define SSH_DEBUG_HEXDUMP(level, varcall, buf, len) \ + do { \ + if ((level) <= ssh_debug_level) \ + { \ + printk("%s:%d: ", __FILE__, __LINE__); \ + printk varcall; \ + printk("\n"); \ + ssh_debug_hexdump((buf), (len)); \ + } \ + } while (0) + +#else /* !DEBUG_LIGHT */ + +#define SSH_FATAL(_fmt...) panic(_fmt) + +#define SSH_NOTREACHED \ + panic("%s:%d: Unreachable code reached!", __FILE__, __LINE__) + +#define SSH_DEBUG(level, varcall) + +#define SSH_VERIFY(cond) \ + do { \ + if (!(cond)) \ + panic("%s:%d: Verify failed: %s\n", __FILE__, __LINE__, "#cond"); \ + } while (0) + +#ifdef __COVERITY__ +#define SSH_ASSERT(cond) \ + do { \ + if (!(cond)) \ + panic("%s:%d: Assertion failed: %s\n", __FILE__, __LINE__, "#cond"); \ + } while (0) +#else /* __COVERITY__ */ +#define SSH_ASSERT(cond) +#endif /* __COVERITY__ */ + +#define SSH_PRECOND(cond) SSH_ASSERT(cond) + +#define SSH_DEBUG_HEXDUMP(level, varcall, buf, len) + +#endif /* DEBUG_LIGHT */ + + + +/* ********************************************************************* + * DEBUG LEVELS + * *********************************************************************/ + +/* ********************************************************************* + * Debug type definitions for debug level mapping + * *********************************************************************/ + +/* Use debug code definitions below, not the debug level numbers + (except 11-15). */ + +/** Software malfunction. */ +#define SSH_D_ERROR 0 + +/** Software failure, but caused by a packet coming from network. */ +#define SSH_D_NETFAULT 3 + +/** Data formatted incorrectly coming from a network or other outside source.*/ +#define SSH_D_NETGARB 3 + +/** Nonfatal failure in a high or middle-level operation. */ +#define SSH_D_FAIL 3 + +/** Uncommon situation. */ +#define SSH_D_UNCOMMON 6 + +/** Success in a high-level operation. */ +#define SSH_D_HIGHOK 4 + +/** Success in a middle-level operation. */ +#define SSH_D_MIDOK 7 + +/** Success in a low-level operation. */ +#define SSH_D_LOWOK 9 + +/** Start of a high-level operation. */ +#define SSH_D_HIGHSTART 5 + +/** Start of a middle-level operation. */ +#define SSH_D_MIDSTART 8 + +/** Start of a low-level operation. */ +#define SSH_D_LOWSTART 10 + +/** Nice-to-know information. */ +#define SSH_D_NICETOKNOW 7 + +/** Data block dump. */ +#define SSH_D_DATADUMP 8 + +/** Packet dump. */ +#define SSH_D_PCKDMP 9 + +/** Middle result of an operation, loop-internal information. */ +#define SSH_D_MIDRESULT 10 + +#endif /* SSHDEBUG_H */ |