Commit | Line | Data |
---|---|---|
579db9d4 HG |
1 | /* SPDX-License-Identifier: (GPL-2.0 OR CDDL-1.0) */ |
2 | /* Copyright (C) 2006-2016 Oracle Corporation */ | |
3 | ||
4 | #ifndef __VBOX_UTILS_H__ | |
5 | #define __VBOX_UTILS_H__ | |
6 | ||
7 | #include <linux/printk.h> | |
8 | #include <linux/vbox_vmmdev_types.h> | |
9 | ||
10 | struct vbg_dev; | |
11 | ||
12 | /** | |
13 | * vboxguest logging functions, these log both to the backdoor and call | |
14 | * the equivalent kernel pr_foo function. | |
15 | */ | |
16 | __printf(1, 2) void vbg_info(const char *fmt, ...); | |
17 | __printf(1, 2) void vbg_warn(const char *fmt, ...); | |
18 | __printf(1, 2) void vbg_err(const char *fmt, ...); | |
19 | ||
20 | /* Only use backdoor logging for non-dynamic debug builds */ | |
21 | #if defined(DEBUG) && !defined(CONFIG_DYNAMIC_DEBUG) | |
22 | __printf(1, 2) void vbg_debug(const char *fmt, ...); | |
23 | #else | |
24 | #define vbg_debug pr_debug | |
25 | #endif | |
26 | ||
579db9d4 HG |
27 | int vbg_hgcm_connect(struct vbg_dev *gdev, |
28 | struct vmmdev_hgcm_service_location *loc, | |
29 | u32 *client_id, int *vbox_status); | |
30 | ||
31 | int vbg_hgcm_disconnect(struct vbg_dev *gdev, u32 client_id, int *vbox_status); | |
32 | ||
33 | int vbg_hgcm_call(struct vbg_dev *gdev, u32 client_id, u32 function, | |
34 | u32 timeout_ms, struct vmmdev_hgcm_function_parameter *parms, | |
35 | u32 parm_count, int *vbox_status); | |
36 | ||
579db9d4 HG |
37 | /** |
38 | * Convert a VirtualBox status code to a standard Linux kernel return value. | |
39 | * Return: 0 or negative errno value. | |
40 | * @rc: VirtualBox status code to convert. | |
41 | */ | |
42 | int vbg_status_code_to_errno(int rc); | |
43 | ||
44 | /** | |
45 | * Helper for the vboxsf driver to get a reference to the guest device. | |
46 | * Return: a pointer to the gdev; or a ERR_PTR value on error. | |
47 | */ | |
48 | struct vbg_dev *vbg_get_gdev(void); | |
49 | ||
50 | /** | |
51 | * Helper for the vboxsf driver to put a guest device reference. | |
52 | * @gdev: Reference returned by vbg_get_gdev to put. | |
53 | */ | |
54 | void vbg_put_gdev(struct vbg_dev *gdev); | |
55 | ||
56 | #endif |