1/*
2 * debug.h - Debugging output functions. Originated from the Linux-NTFS project.
3 *
4 * Copyright (c) 2002-2004 Anton Altaparmakov
5 *
6 * This program/include file is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as published
8 * by the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program/include file is distributed in the hope that it will be
12 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program (in the main directory of the NTFS-3G
18 * distribution in the file COPYING); if not, write to the Free Software
19 * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20 */
21
22#ifndef _NTFS_DEBUG_H
23#define _NTFS_DEBUG_H
24
25#ifdef HAVE_CONFIG_H
26#include "config.h"
27#endif
28
29#include "logging.h"
30
31struct _runlist_element;
32
33#ifdef DEBUG
34extern void ntfs_debug_runlist_dump(const struct _runlist_element *rl);
35#else
36static __inline__ void ntfs_debug_runlist_dump(const struct _runlist_element *rl __attribute__((unused))) {}
37#endif
38
39#define NTFS_BUG(msg)							\
40{									\
41	int ___i = 1;							\
42	ntfs_log_critical("Bug in %s(): %s\n", __FUNCTION__, msg);	\
43	ntfs_log_debug("Forcing segmentation fault!");			\
44	___i = ((int*)NULL)[___i];					\
45}
46
47#endif /* defined _NTFS_DEBUG_H */
48