1 | /* $Id: VBoxVideoErr.h 69178 2017-10-23 18:08:12Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox Video driver, common code - iprt and VirtualBox macros and
|
---|
4 | * definitions.
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2017 Oracle Corporation
|
---|
9 | *
|
---|
10 | * Permission is hereby granted, free of charge, to any person obtaining a
|
---|
11 | * copy of this software and associated documentation files (the "Software"),
|
---|
12 | * to deal in the Software without restriction, including without limitation
|
---|
13 | * the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
---|
14 | * and/or sell copies of the Software, and to permit persons to whom the
|
---|
15 | * Software is furnished to do so, subject to the following conditions:
|
---|
16 | *
|
---|
17 | * The above copyright notice and this permission notice shall be included in
|
---|
18 | * all copies or substantial portions of the Software.
|
---|
19 | *
|
---|
20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
---|
23 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
---|
24 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
---|
25 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
---|
26 | * OTHER DEALINGS IN THE SOFTWARE.
|
---|
27 | */
|
---|
28 |
|
---|
29 | #ifndef __VBOX_ERR_H__
|
---|
30 | #define __VBOX_ERR_H__
|
---|
31 |
|
---|
32 | /** @name VirtualBox error macros
|
---|
33 | * @{ */
|
---|
34 |
|
---|
35 | #define VINF_SUCCESS 0
|
---|
36 | #define VERR_INVALID_PARAMETER (-2)
|
---|
37 | #define VERR_INVALID_POINTER (-6)
|
---|
38 | #define VERR_NO_MEMORY (-8)
|
---|
39 | #define VERR_NOT_IMPLEMENTED (-12)
|
---|
40 | #define VERR_INVALID_FUNCTION (-36)
|
---|
41 | #define VERR_NOT_SUPPORTED (-37)
|
---|
42 | #define VERR_TOO_MUCH_DATA (-42)
|
---|
43 | #define VERR_NOT_FOUND (-78)
|
---|
44 | #define VERR_INVALID_STATE (-79)
|
---|
45 | #define VERR_OUT_OF_RESOURCES (-80)
|
---|
46 | #define VERR_ALREADY_EXISTS (-105)
|
---|
47 | #define VERR_INTERNAL_ERROR (-225)
|
---|
48 |
|
---|
49 | #define RT_SUCCESS_NP(rc) ( (int)(rc) >= VINF_SUCCESS )
|
---|
50 | #define RT_SUCCESS(rc) ( likely(RT_SUCCESS_NP(rc)) )
|
---|
51 | #define RT_FAILURE(rc) ( unlikely(!RT_SUCCESS_NP(rc)) )
|
---|
52 |
|
---|
53 | /** @} */
|
---|
54 |
|
---|
55 | /** @name VirtualBox assertions
|
---|
56 | * @{ */
|
---|
57 |
|
---|
58 | /* Unlike BUILD_BUG_ON(), these can be used outside of functions. */
|
---|
59 | extern int vbox_assert_var[1];
|
---|
60 | #define assert_compile(expr) \
|
---|
61 | extern int vbox_assert_var[1] __attribute__((__unused__)), \
|
---|
62 | vbox_assert_var[(expr) ? 1 : 0] __attribute__((__unused__))
|
---|
63 | #define assert_compile_size(type, size) \
|
---|
64 | assert_compile(sizeof(type) == (size))
|
---|
65 |
|
---|
66 | /** @} */
|
---|
67 |
|
---|
68 | #endif
|
---|