X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=blobdiff_plain;f=module%2Fp2pkp_debug.h;fp=module%2Fp2pkp_debug.h;h=2b8e9443148c54c0a614d5b2c6c3eea527d1bec6;hb=2d6f09bf6e183a2a889d52af3c0acc48c5998043;hp=0000000000000000000000000000000000000000;hpb=fcb994dd60875ff212c21ee44c0398316be9731c;p=p2p-kernel-protocol.git diff --git a/module/p2pkp_debug.h b/module/p2pkp_debug.h new file mode 100644 index 0000000..2b8e944 --- /dev/null +++ b/module/p2pkp_debug.h @@ -0,0 +1,37 @@ +#ifndef _P2PKP_DEBUG_H_ +#define _P2PKP_DEBUG_H_ + +//#include "linux/kernel.h" + +#ifndef P2PKP_DEBUG + /* uncomment to turn debugging off */ + #define P2PKP_DEBUG yes +#endif + +#ifdef P2PKP_DEBUG +#define DEBUG(format, args...) \ + do { \ + printk(KERN_DEBUG "[%s:%d] " format "\n", __func__, __LINE__, ## args); \ + } while (0) +#else +#define LOG(s) \ + do {} while (0) +#endif + +/* p2pkp error func */ +#define ERROR(format, args...) \ + do { \ + printk(KERN_ERR "[%s:%d] " format "\n", __func__, __LINE__, ## args); \ + } while (0) + +#define print_sock_address(addr) \ + do { \ + printk(LOG_DEBUG "connection established to " \ + NIPQUAD_FMT ":%d\n", \ + NIPQUAD(addr.sin_addr.s_addr), \ + ntohs(addr.sin_port)); \ + } while (0) + + +#endif /* _P2PKP_DEBUG_H_ */ +