Files
linux-apfs/include/asm-generic/bug.h
T

85 lines
1.7 KiB
C
Raw Normal View History

2005-04-16 15:20:36 -07:00
#ifndef _ASM_GENERIC_BUG_H
#define _ASM_GENERIC_BUG_H
#include <linux/compiler.h>
2005-05-01 08:59:01 -07:00
#ifdef CONFIG_BUG
2006-12-08 02:36:19 -08:00
#ifdef CONFIG_GENERIC_BUG
#ifndef __ASSEMBLY__
struct bug_entry {
unsigned long bug_addr;
#ifdef CONFIG_DEBUG_BUGVERBOSE
const char *file;
unsigned short line;
#endif
unsigned short flags;
};
#endif /* __ASSEMBLY__ */
#define BUGFLAG_WARNING (1<<0)
#endif /* CONFIG_GENERIC_BUG */
2005-04-16 15:20:36 -07:00
#ifndef HAVE_ARCH_BUG
#define BUG() do { \
2006-03-23 03:00:54 -08:00
printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __FUNCTION__); \
2005-04-16 15:20:36 -07:00
panic("BUG!"); \
} while (0)
#endif
#ifndef HAVE_ARCH_BUG_ON
2007-07-17 04:03:56 -07:00
#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while(0)
2005-04-16 15:20:36 -07:00
#endif
2008-01-30 13:32:50 +01:00
#ifndef __WARN
2008-01-30 13:32:50 +01:00
#ifndef __ASSEMBLY__
extern void warn_on_slowpath(const char *file, const int line);
#define WANT_WARN_ON_SLOWPATH
#endif
#define __WARN() warn_on_slowpath(__FILE__, __LINE__)
2008-01-30 13:32:50 +01:00
#endif
#ifndef WARN_ON
#define WARN_ON(condition) ({ \
2007-07-31 21:12:07 -07:00
int __ret_warn_on = !!(condition); \
2008-01-30 13:32:50 +01:00
if (unlikely(__ret_warn_on)) \
__WARN(); \
unlikely(__ret_warn_on); \
})
2005-04-16 15:20:36 -07:00
#endif
2005-05-01 08:59:01 -07:00
#else /* !CONFIG_BUG */
#ifndef HAVE_ARCH_BUG
#define BUG()
#endif
#ifndef HAVE_ARCH_BUG_ON
#define BUG_ON(condition) do { if (condition) ; } while(0)
#endif
#ifndef HAVE_ARCH_WARN_ON
#define WARN_ON(condition) ({ \
2007-07-31 21:12:07 -07:00
int __ret_warn_on = !!(condition); \
unlikely(__ret_warn_on); \
})
2005-05-01 08:59:01 -07:00
#endif
#endif
#define WARN_ON_ONCE(condition) ({ \
static int __warned; \
2007-07-31 21:12:07 -07:00
int __ret_warn_once = !!(condition); \
\
if (unlikely(__ret_warn_once)) \
if (WARN_ON(!__warned)) \
__warned = 1; \
unlikely(__ret_warn_once); \
2006-06-25 05:48:09 -07:00
})
2006-06-27 02:54:50 -07:00
#ifdef CONFIG_SMP
# define WARN_ON_SMP(x) WARN_ON(x)
#else
# define WARN_ON_SMP(x) do { } while (0)
#endif
2005-04-16 15:20:36 -07:00
#endif