1 | /* $Id: VBoxVideoErr.h 93115 2022-01-01 11:31:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox Video driver, common code - iprt and VirtualBox macros and
|
---|
4 | * definitions.
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2017-2022 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_INCLUDED_Graphics_VBoxVideoErr_h
|
---|
33 | #define VBOX_INCLUDED_Graphics_VBoxVideoErr_h
|
---|
34 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
35 | # pragma once
|
---|
36 | #endif
|
---|
37 |
|
---|
38 | /** @name VirtualBox error macros
|
---|
39 | * @{ */
|
---|
40 |
|
---|
41 | #define VINF_SUCCESS 0
|
---|
42 | #define VERR_INVALID_PARAMETER (-2)
|
---|
43 | #define VERR_INVALID_POINTER (-6)
|
---|
44 | #define VERR_NO_MEMORY (-8)
|
---|
45 | #define VERR_NOT_IMPLEMENTED (-12)
|
---|
46 | #define VERR_INVALID_FUNCTION (-36)
|
---|
47 | #define VERR_NOT_SUPPORTED (-37)
|
---|
48 | #define VERR_TOO_MUCH_DATA (-42)
|
---|
49 | #define VERR_NOT_FOUND (-78)
|
---|
50 | #define VERR_INVALID_STATE (-79)
|
---|
51 | #define VERR_OUT_OF_RESOURCES (-80)
|
---|
52 | #define VERR_ALREADY_EXISTS (-105)
|
---|
53 | #define VERR_INTERNAL_ERROR (-225)
|
---|
54 |
|
---|
55 | #define RT_SUCCESS_NP(rc) ( (int)(rc) >= VINF_SUCCESS )
|
---|
56 | #define RT_SUCCESS(rc) ( likely(RT_SUCCESS_NP(rc)) )
|
---|
57 | #define RT_FAILURE(rc) ( unlikely(!RT_SUCCESS_NP(rc)) )
|
---|
58 |
|
---|
59 | /** @} */
|
---|
60 |
|
---|
61 | /** @name VirtualBox assertions
|
---|
62 | * @{ */
|
---|
63 |
|
---|
64 | /* Unlike BUILD_BUG_ON(), these can be used outside of functions. */
|
---|
65 | extern int vbox_assert_var[1];
|
---|
66 | #define assert_compile(expr) \
|
---|
67 | extern int vbox_assert_var[1] __attribute__((__unused__)), \
|
---|
68 | vbox_assert_var[(expr) ? 1 : 0] __attribute__((__unused__))
|
---|
69 | #define assert_compile_size(type, size) \
|
---|
70 | assert_compile(sizeof(type) == (size))
|
---|
71 | #define assert_ptr_return(ptr,ret) \
|
---|
72 | do { if (unlikely(!(ptr))) { WARN_ON_ONCE(!(ptr)); return ret; } } while (0)
|
---|
73 |
|
---|
74 | /** @} */
|
---|
75 |
|
---|
76 | #endif /* !VBOX_INCLUDED_Graphics_VBoxVideoErr_h */
|
---|