fs/jffs2/debug.h

Source file repositories/reference/linux-study-clean/fs/jffs2/debug.h

File Facts

System
Linux kernel
Corpus path
fs/jffs2/debug.h
Extension
.h
Size
8472 bytes
Lines
277
Domain
Core OS
Bucket
VFS And Filesystem Core
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

#ifndef _JFFS2_DEBUG_H_
#define _JFFS2_DEBUG_H_

#include <linux/printk.h>
#include <linux/sched.h>

#ifndef CONFIG_JFFS2_FS_DEBUG
#define CONFIG_JFFS2_FS_DEBUG 0
#endif

#if CONFIG_JFFS2_FS_DEBUG > 0
/* Enable "paranoia" checks and dumps */
#define JFFS2_DBG_PARANOIA_CHECKS
#define JFFS2_DBG_DUMPS

/*
 * By defining/undefining the below macros one may select debugging messages
 * fro specific JFFS2 subsystems.
 */
#define JFFS2_DBG_READINODE_MESSAGES
#define JFFS2_DBG_FRAGTREE_MESSAGES
#define JFFS2_DBG_DENTLIST_MESSAGES
#define JFFS2_DBG_NODEREF_MESSAGES
#define JFFS2_DBG_INOCACHE_MESSAGES
#define JFFS2_DBG_SUMMARY_MESSAGES
#define JFFS2_DBG_FSBUILD_MESSAGES
#endif

#if CONFIG_JFFS2_FS_DEBUG > 1
#define JFFS2_DBG_FRAGTREE2_MESSAGES
#define JFFS2_DBG_READINODE2_MESSAGES
#define JFFS2_DBG_MEMALLOC_MESSAGES
#endif

/* Sanity checks are supposed to be light-weight and enabled by default */
#define JFFS2_DBG_SANITY_CHECKS

/*
 * Dx() are mainly used for debugging messages, they must go away and be
 * superseded by nicer dbg_xxx() macros...
 */
#if CONFIG_JFFS2_FS_DEBUG > 0
#define DEBUG
#define D1(x) x
#else
#define D1(x)
#endif

#if CONFIG_JFFS2_FS_DEBUG > 1
#define D2(x) x
#else
#define D2(x)
#endif

#define jffs2_dbg(level, fmt, ...)		\
do {						\
	if (CONFIG_JFFS2_FS_DEBUG >= level)	\
		pr_debug(fmt, ##__VA_ARGS__);	\
} while (0)

/* The prefixes of JFFS2 messages */
#define JFFS2_DBG		KERN_DEBUG
#define JFFS2_DBG_PREFIX	"[JFFS2 DBG]"
#define JFFS2_DBG_MSG_PREFIX	JFFS2_DBG JFFS2_DBG_PREFIX

/* JFFS2 message macros */
#define JFFS2_ERROR(fmt, ...)					\
	pr_err("error: (%d) %s: " fmt,				\
	       task_pid_nr(current), __func__, ##__VA_ARGS__)

#define JFFS2_WARNING(fmt, ...)						\
	pr_warn("warning: (%d) %s: " fmt,				\
		task_pid_nr(current), __func__, ##__VA_ARGS__)

#define JFFS2_NOTICE(fmt, ...)						\
	pr_notice("notice: (%d) %s: " fmt,				\
		  task_pid_nr(current), __func__, ##__VA_ARGS__)

#define JFFS2_DEBUG(fmt, ...)						\
	printk(KERN_DEBUG "[JFFS2 DBG] (%d) %s: " fmt,			\
	       task_pid_nr(current), __func__, ##__VA_ARGS__)

/*
 * We split our debugging messages on several parts, depending on the JFFS2
 * subsystem the message belongs to.
 */
/* Read inode debugging messages */
#ifdef JFFS2_DBG_READINODE_MESSAGES
#define dbg_readinode(fmt, ...)	JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else

Annotation

Implementation Notes