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