mirror of
https://github.com/torvalds/linux.git
synced 2024-11-29 23:51:37 +00:00
43aa31327b
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose good title or non infringement see the gnu general public license for more details extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 9 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Alexios Zavras <alexios.zavras@intel.com> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190529141900.459653302@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
46 lines
1.6 KiB
C
46 lines
1.6 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Kernel/userspace transport abstraction for Hyper-V util driver.
|
|
*
|
|
* Copyright (C) 2015, Vitaly Kuznetsov <vkuznets@redhat.com>
|
|
*/
|
|
|
|
#ifndef _HV_UTILS_TRANSPORT_H
|
|
#define _HV_UTILS_TRANSPORT_H
|
|
|
|
#include <linux/connector.h>
|
|
#include <linux/miscdevice.h>
|
|
|
|
enum hvutil_transport_mode {
|
|
HVUTIL_TRANSPORT_INIT = 0,
|
|
HVUTIL_TRANSPORT_NETLINK,
|
|
HVUTIL_TRANSPORT_CHARDEV,
|
|
HVUTIL_TRANSPORT_DESTROY,
|
|
};
|
|
|
|
struct hvutil_transport {
|
|
int mode; /* hvutil_transport_mode */
|
|
struct file_operations fops; /* file operations */
|
|
struct miscdevice mdev; /* misc device */
|
|
struct cb_id cn_id; /* CN_*_IDX/CN_*_VAL */
|
|
struct list_head list; /* hvt_list */
|
|
int (*on_msg)(void *, int); /* callback on new user message */
|
|
void (*on_reset)(void); /* callback when userspace drops */
|
|
void (*on_read)(void); /* callback on message read */
|
|
u8 *outmsg; /* message to the userspace */
|
|
int outmsg_len; /* its length */
|
|
wait_queue_head_t outmsg_q; /* poll/read wait queue */
|
|
struct mutex lock; /* protects struct members */
|
|
struct completion release; /* synchronize with fd release */
|
|
};
|
|
|
|
struct hvutil_transport *hvutil_transport_init(const char *name,
|
|
u32 cn_idx, u32 cn_val,
|
|
int (*on_msg)(void *, int),
|
|
void (*on_reset)(void));
|
|
int hvutil_transport_send(struct hvutil_transport *hvt, void *msg, int len,
|
|
void (*on_read_cb)(void));
|
|
void hvutil_transport_destroy(struct hvutil_transport *hvt);
|
|
|
|
#endif /* _HV_UTILS_TRANSPORT_H */
|