blob: a1c7141af481a0dad25fa541d1013e96df154ec4 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Nathan Scott7b718762005-11-02 14:58:39 +11002 * Copyright (c) 2000-2003,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 */
Vlad Apostolov93c189c2006-11-11 18:03:49 +110018#include <xfs.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070019#include "debug.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070020
Christoph Hellwigefc55752008-12-17 12:27:36 -050021/* xfs_mount.h drags a lot of crap in, sorry.. */
22#include "xfs_sb.h"
23#include "xfs_inum.h"
24#include "xfs_ag.h"
Christoph Hellwigefc55752008-12-17 12:27:36 -050025#include "xfs_mount.h"
Felix Blyakherda5309c2009-03-12 09:33:37 -050026#include "xfs_error.h"
Christoph Hellwigefc55752008-12-17 12:27:36 -050027
Linus Torvalds1da177e2005-04-16 15:20:36 -070028void
Dave Chinner73efe4a2011-01-12 00:35:42 +000029cmn_err(
30 const char *lvl,
31 const char *fmt,
32 ...)
Linus Torvalds1da177e2005-04-16 15:20:36 -070033{
Dave Chinner73efe4a2011-01-12 00:35:42 +000034 struct va_format vaf;
35 va_list args;
Linus Torvalds1da177e2005-04-16 15:20:36 -070036
Dave Chinner73efe4a2011-01-12 00:35:42 +000037 va_start(args, fmt);
38 vaf.fmt = fmt;
39 vaf.va = &args;
40
41 printk("%s%pV", lvl, &vaf);
42 va_end(args);
43
44 BUG_ON(strncmp(lvl, KERN_EMERG, strlen(KERN_EMERG)) == 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -070045}
46
Linus Torvalds1da177e2005-04-16 15:20:36 -070047void
Nathan Scott3762ec62006-01-12 10:29:53 +110048assfail(char *expr, char *file, int line)
49{
Anton Blanchard65a84a02011-01-07 03:30:41 +000050 printk(KERN_CRIT "Assertion failed: %s, file: %s, line: %d\n", expr,
51 file, line);
Nathan Scott3762ec62006-01-12 10:29:53 +110052 BUG();
53}
Eric Sandeend4f3cc02007-10-12 11:13:08 +100054
55void
56xfs_hex_dump(void *p, int length)
57{
Barry Naujok34519da2008-10-30 17:05:58 +110058 print_hex_dump(KERN_ALERT, "", DUMP_PREFIX_ADDRESS, 16, 1, p, length, 1);
Eric Sandeend4f3cc02007-10-12 11:13:08 +100059}