/
usr
/
src
/
file_protector-1.1-1497
/
File Upload :
llllll
Current File: //usr/src/file_protector-1.1-1497/debug.h
/** @file @brief Debugging printing @details Copyright (c) 2017-2021 Acronis International GmbH @author Mikhail Krivtsov (mikhail.krivtsov@acronis.com) @since $Id: $ */ #pragma once #include <asm/current.h> // struct task_struct *current #include <linux/printk.h> #include <linux/ratelimit.h> // __ratelimit() #include <linux/sched.h> // struct task_struct #include <linux/string.h> // strrchr() #define xPRINTF(prefix, format, args...) \ do { \ const char *f = __FILE__; \ const char *n = strrchr(f, '/'); \ printk(PRINTK_TAG "|%5u:%5u:%s:%u:%s| " prefix format "\n", \ (unsigned)current->tgid, \ (unsigned)current->pid, \ (n) ? n+1 : f, __LINE__, __FUNCTION__, ##args); \ } while(0) // in descending order of importance #define FPRINTF(format, args...) xPRINTF("EMERGENCY: ", format, ##args) #define APRINTF(format, args...) xPRINTF( "ALERT: ", format, ##args) #define CPRINTF(format, args...) xPRINTF( "CRITICAL: ", format, ##args) #define EPRINTF(format, args...) xPRINTF( "ERROR: ", format, ##args) #define WPRINTF(format, args...) xPRINTF( "WARNING: ", format, ##args) #define NPRINTF(format, args...) xPRINTF( "NOTICE: ", format, ##args) #define IPRINTF(format, args...) xPRINTF( "INFO: ", format, ##args) #ifdef __DEBUG__ #define DPRINTF(format, args...) xPRINTF( "DEBUG: ", format, ##args) #else #define DPRINTF(format, args...) #endif #define xPRINTF_RATELIMITED(prefix, format, args...) \ do { \ static DEFINE_RATELIMIT_STATE(ratelimit_state, \ DEFAULT_RATELIMIT_INTERVAL, \ DEFAULT_RATELIMIT_BURST); \ if (__ratelimit(&ratelimit_state)) \ xPRINTF(prefix, format, ##args); \ } while(0) #define FPRINTF_RATELIMITED(format, args...) xPRINTF_RATELIMITED("EMERGENCY: ", format, ##args) #define APRINTF_RATELIMITED(format, args...) xPRINTF_RATELIMITED( "ALERT: ", format, ##args) #define CPRINTF_RATELIMITED(format, args...) xPRINTF_RATELIMITED( "CRITICAL: ", format, ##args) #define EPRINTF_RATELIMITED(format, args...) xPRINTF_RATELIMITED( "ERROR: ", format, ##args) #define WPRINTF_RATELIMITED(format, args...) xPRINTF_RATELIMITED( "WARNING: ", format, ##args) #define NPRINTF_RATELIMITED(format, args...) xPRINTF_RATELIMITED( "NOTICE: ", format, ##args) #define IPRINTF_RATELIMITED(format, args...) xPRINTF_RATELIMITED( "INFO: ", format, ##args) #ifdef __DEBUG__ #define DPRINTF_RATELIMITED(format, args...) xPRINTF_RATELIMITED( "DEBUG: ", format, ##args) #else #define DPRINTF_RATELIMITED(format, args...) #endif #define HEX_DUMP(dump_prefix, addr, size) \ print_hex_dump(PRINTK_TAG "|", dump_prefix, DUMP_PREFIX_OFFSET, \ 16, 1, addr, size, true)
Copyright ©2k19 -
Hexid
|
Tex7ure