linux/drivers/virt/vboxguest/vboxguest_core.h

/* SPDX-License-Identifier: (GPL-2.0 OR CDDL-1.0) */
/* Copyright (C) 2010-2016 Oracle Corporation */

#ifndef __VBOXGUEST_CORE_H__
#define __VBOXGUEST_CORE_H__

#include <linux/input.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/miscdevice.h>
#include <linux/spinlock.h>
#include <linux/wait.h>
#include <linux/workqueue.h>
#include <linux/vboxguest.h>
#include "vmmdev.h"

/*
 * The mainline kernel version (this version) of the vboxguest module
 * contained a bug where it defined VBGL_IOCTL_VMMDEV_REQUEST_BIG and
 * VBGL_IOCTL_LOG using _IOC(_IOC_READ | _IOC_WRITE, 'V', ...) instead
 * of _IO(V, ...) as the out of tree VirtualBox upstream version does.
 *
 * These _ALT definitions keep compatibility with the wrong defines the
 * mainline kernel version used for a while.
 * Note the VirtualBox userspace bits have always been built against
 * VirtualBox upstream's headers, so this is likely not necessary. But
 * we must never break our ABI so we keep these around to be 100% sure.
 */
#define VBG_IOCTL_VMMDEV_REQUEST_BIG_ALT
#define VBG_IOCTL_LOG_ALT(s)

struct vbg_session;

/** VBox guest memory balloon. */
struct vbg_mem_balloon {};

/**
 * Per bit usage tracker for a u32 mask.
 *
 * Used for optimal handling of guest properties and event filter.
 */
struct vbg_bit_usage_tracker {};

/** VBox guest device (data) extension. */
struct vbg_dev {};

/** The VBoxGuest per session data. */
struct vbg_session {};

int  vbg_core_init(struct vbg_dev *gdev, u32 fixed_events);
void vbg_core_exit(struct vbg_dev *gdev);
struct vbg_session *vbg_core_open_session(struct vbg_dev *gdev, u32 requestor);
void vbg_core_close_session(struct vbg_session *session);
int  vbg_core_ioctl(struct vbg_session *session, unsigned int req, void *data);
int  vbg_core_set_mouse_status(struct vbg_dev *gdev, u32 features);

irqreturn_t vbg_core_isr(int irq, void *dev_id);

void vbg_linux_mouse_event(struct vbg_dev *gdev);

/* Private (non exported) functions form vboxguest_utils.c */
void *vbg_req_alloc(size_t len, enum vmmdev_request_type req_type,
		    u32 requestor);
void vbg_req_free(void *req, size_t len);
int vbg_req_perform(struct vbg_dev *gdev, void *req);
int vbg_hgcm_call32(
	struct vbg_dev *gdev, u32 requestor, u32 client_id, u32 function,
	u32 timeout_ms, struct vmmdev_hgcm_function_parameter32 *parm32,
	u32 parm_count, int *vbox_status);

#endif