blob: eaeaa17ef4b81c8106ff07e9c241e1b0704c7e42 [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)));
Dave Chinner73efe4a2011-01-12 00:35:42 +000036
Nathan Scott3762ec62006-01-12 10:29:53 +110037extern void assfail(char *expr, char *f, int l);
38
Nathan Scott3762ec62006-01-12 10:29:53 +110039#define ASSERT_ALWAYS(expr) \
Christoph Hellwigee5c8022007-08-16 15:38:08 +100040 (unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
Nathan Scott3762ec62006-01-12 10:29:53 +110041
42#ifndef DEBUG
Christoph Hellwigee5c8022007-08-16 15:38:08 +100043#define ASSERT(expr) ((void)0)
Linus Torvalds1da177e2005-04-16 15:20:36 -070044
45#ifndef STATIC
David Chinner7989cb82007-02-10 18:34:56 +110046# define STATIC static noinline
Linus Torvalds1da177e2005-04-16 15:20:36 -070047#endif
48
David Chinner7989cb82007-02-10 18:34:56 +110049#else /* DEBUG */
50
Christoph Hellwigee5c8022007-08-16 15:38:08 +100051#define ASSERT(expr) \
52 (unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
David Chinner7989cb82007-02-10 18:34:56 +110053
54#ifndef STATIC
55# define STATIC noinline
56#endif
57
David Chinner7989cb82007-02-10 18:34:56 +110058#endif /* DEBUG */
Linus Torvalds1da177e2005-04-16 15:20:36 -070059#endif /* __XFS_SUPPORT_DEBUG_H__ */