blob: 05699f67d47521f9eb3c78a8007b6fcc0ad16473 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Nathan Scott7b718762005-11-02 14:58:39 +11002 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 *
Nathan Scott7b718762005-11-02 14:58:39 +11005 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 * published by the Free Software Foundation.
8 *
Nathan Scott7b718762005-11-02 14:58:39 +11009 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
Linus Torvalds1da177e2005-04-16 15:20:36 -070013 *
Nathan Scott7b718762005-11-02 14:58:39 +110014 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Linus Torvalds1da177e2005-04-16 15:20:36 -070017 */
18#ifndef __XFS_SUPPORT_DEBUG_H__
19#define __XFS_SUPPORT_DEBUG_H__
20
21#include <stdarg.h>
22
Dave Chinner73efe4a2011-01-12 00:35:42 +000023struct xfs_mount;
Linus Torvalds1da177e2005-04-16 15:20:36 -070024
Dave Chinner73efe4a2011-01-12 00:35:42 +000025#define CE_DEBUG KERN_DEBUG
26#define CE_CONT KERN_INFO
27#define CE_NOTE KERN_NOTICE
28#define CE_WARN KERN_WARNING
29#define CE_ALERT KERN_ALERT
30#define CE_PANIC KERN_EMERG
31
32void cmn_err(const char *lvl, const char *fmt, ...)
33 __attribute__ ((format (printf, 2, 3)));
34void xfs_fs_cmn_err( const char *lvl, struct xfs_mount *mp,
35 const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
36void xfs_cmn_err( int panic_tag, const char *lvl, struct xfs_mount *mp,
37 const char *fmt, ...) __attribute__ ((format (printf, 4, 5)));
38
Nathan Scott3762ec62006-01-12 10:29:53 +110039extern void assfail(char *expr, char *f, int l);
40
Nathan Scott3762ec62006-01-12 10:29:53 +110041#define ASSERT_ALWAYS(expr) \
Christoph Hellwigee5c8022007-08-16 15:38:08 +100042 (unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
Nathan Scott3762ec62006-01-12 10:29:53 +110043
44#ifndef DEBUG
Christoph Hellwigee5c8022007-08-16 15:38:08 +100045#define ASSERT(expr) ((void)0)
Linus Torvalds1da177e2005-04-16 15:20:36 -070046
47#ifndef STATIC
David Chinner7989cb82007-02-10 18:34:56 +110048# define STATIC static noinline
Linus Torvalds1da177e2005-04-16 15:20:36 -070049#endif
50
David Chinner7989cb82007-02-10 18:34:56 +110051#else /* DEBUG */
52
Christoph Hellwigee5c8022007-08-16 15:38:08 +100053#define ASSERT(expr) \
54 (unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
David Chinner7989cb82007-02-10 18:34:56 +110055
56#ifndef STATIC
57# define STATIC noinline
58#endif
59
David Chinner7989cb82007-02-10 18:34:56 +110060#endif /* DEBUG */
Linus Torvalds1da177e2005-04-16 15:20:36 -070061#endif /* __XFS_SUPPORT_DEBUG_H__ */