1 | /** @file
|
---|
2 | *
|
---|
3 | * vboxvfs -- VirtualBox Guest Additions for Linux:
|
---|
4 | * Module logging support
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License as published by the Free Software Foundation,
|
---|
14 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
15 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
16 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | */
|
---|
18 |
|
---|
19 | #if 0
|
---|
20 | #include <linux/version.h>
|
---|
21 | #include <linux/kernel.h>
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | #include "the-linux-kernel.h"
|
---|
25 |
|
---|
26 | #include <iprt/cdefs.h>
|
---|
27 | #include "vfsmod.h"
|
---|
28 |
|
---|
29 | /** @todo r=bird: Unless you want to prefix the messages with a module name or
|
---|
30 | * something, use the runtime implementation of these assert workers. If there is
|
---|
31 | * no runtime implementation add it. (Yes, I know this has been the normal way
|
---|
32 | * to do it, but it's not so anylonger.) */
|
---|
33 |
|
---|
34 | /* Runtime assert implementation for Linux ring 0 */
|
---|
35 | RTDECL(void) AssertMsg1(
|
---|
36 | const char *pszExpr,
|
---|
37 | unsigned uLine,
|
---|
38 | const char *pszFile,
|
---|
39 | const char *pszFunction
|
---|
40 | )
|
---|
41 | {
|
---|
42 | printk (KERN_ALERT "!!Assertion Failed!!\n"
|
---|
43 | "Expression: %s\n"
|
---|
44 | "Location : %s(%d) %s\n",
|
---|
45 | pszExpr, pszFile, uLine, pszFunction);
|
---|
46 | }
|
---|
47 |
|
---|
48 | /* Runtime assert implementation for Linux ring 0 */
|
---|
49 | RTDECL(void) AssertMsg2(const char *pszFormat, ...)
|
---|
50 | {
|
---|
51 | va_list ap;
|
---|
52 | char msg[256];
|
---|
53 |
|
---|
54 | va_start(ap, pszFormat);
|
---|
55 | vsnprintf(msg, sizeof(msg) - 1, pszFormat, ap);
|
---|
56 | msg[sizeof(msg) - 1] = '\0';
|
---|
57 | printk ("%s", msg);
|
---|
58 | va_end(ap);
|
---|
59 | }
|
---|
60 |
|
---|
61 | RTDECL(size_t) RTLogBackdoorPrintf (const char *pszFormat, ...)
|
---|
62 | {
|
---|
63 | va_list ap;
|
---|
64 | char msg[256];
|
---|
65 | size_t n;
|
---|
66 |
|
---|
67 | va_start(ap, pszFormat);
|
---|
68 | n = vsnprintf(msg, sizeof(msg) - 1, pszFormat, ap);
|
---|
69 | msg[sizeof(msg) - 1] = '\0';
|
---|
70 | printk ("%s", msg);
|
---|
71 | va_end(ap);
|
---|
72 | return n;
|
---|
73 | }
|
---|