linux/include/linux/vmw_vmci_api.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0-only */
   2/*
   3 * VMware VMCI Driver
   4 *
   5 * Copyright (C) 2012 VMware, Inc. All rights reserved.
   6 */
   7
   8#ifndef __VMW_VMCI_API_H__
   9#define __VMW_VMCI_API_H__
  10
  11#include <linux/uidgid.h>
  12#include <linux/vmw_vmci_defs.h>
  13
  14#undef  VMCI_KERNEL_API_VERSION
  15#define VMCI_KERNEL_API_VERSION_1 1
  16#define VMCI_KERNEL_API_VERSION_2 2
  17#define VMCI_KERNEL_API_VERSION   VMCI_KERNEL_API_VERSION_2
  18
  19struct msghdr;
  20typedef void (vmci_device_shutdown_fn) (void *device_registration,
  21                                        void *user_data);
  22typedef void (*vmci_vsock_cb) (bool is_host);
  23
  24int vmci_datagram_create_handle(u32 resource_id, u32 flags,
  25                                vmci_datagram_recv_cb recv_cb,
  26                                void *client_data,
  27                                struct vmci_handle *out_handle);
  28int vmci_datagram_create_handle_priv(u32 resource_id, u32 flags, u32 priv_flags,
  29                                     vmci_datagram_recv_cb recv_cb,
  30                                     void *client_data,
  31                                     struct vmci_handle *out_handle);
  32int vmci_datagram_destroy_handle(struct vmci_handle handle);
  33int vmci_datagram_send(struct vmci_datagram *msg);
  34int vmci_doorbell_create(struct vmci_handle *handle, u32 flags,
  35                         u32 priv_flags,
  36                         vmci_callback notify_cb, void *client_data);
  37int vmci_doorbell_destroy(struct vmci_handle handle);
  38int vmci_doorbell_notify(struct vmci_handle handle, u32 priv_flags);
  39u32 vmci_get_context_id(void);
  40bool vmci_is_context_owner(u32 context_id, kuid_t uid);
  41int vmci_register_vsock_callback(vmci_vsock_cb callback);
  42
  43int vmci_event_subscribe(u32 event,
  44                         vmci_event_cb callback, void *callback_data,
  45                         u32 *subid);
  46int vmci_event_unsubscribe(u32 subid);
  47u32 vmci_context_get_priv_flags(u32 context_id);
  48int vmci_qpair_alloc(struct vmci_qp **qpair,
  49                     struct vmci_handle *handle,
  50                     u64 produce_qsize,
  51                     u64 consume_qsize,
  52                     u32 peer, u32 flags, u32 priv_flags);
  53int vmci_qpair_detach(struct vmci_qp **qpair);
  54int vmci_qpair_get_produce_indexes(const struct vmci_qp *qpair,
  55                                   u64 *producer_tail,
  56                                   u64 *consumer_head);
  57int vmci_qpair_get_consume_indexes(const struct vmci_qp *qpair,
  58                                   u64 *consumer_tail,
  59                                   u64 *producer_head);
  60s64 vmci_qpair_produce_free_space(const struct vmci_qp *qpair);
  61s64 vmci_qpair_produce_buf_ready(const struct vmci_qp *qpair);
  62s64 vmci_qpair_consume_free_space(const struct vmci_qp *qpair);
  63s64 vmci_qpair_consume_buf_ready(const struct vmci_qp *qpair);
  64ssize_t vmci_qpair_enqueue(struct vmci_qp *qpair,
  65                           const void *buf, size_t buf_size, int mode);
  66ssize_t vmci_qpair_dequeue(struct vmci_qp *qpair,
  67                           void *buf, size_t buf_size, int mode);
  68ssize_t vmci_qpair_peek(struct vmci_qp *qpair, void *buf, size_t buf_size,
  69                        int mode);
  70ssize_t vmci_qpair_enquev(struct vmci_qp *qpair,
  71                          struct msghdr *msg, size_t iov_size, int mode);
  72ssize_t vmci_qpair_dequev(struct vmci_qp *qpair,
  73                          struct msghdr *msg, size_t iov_size, int mode);
  74ssize_t vmci_qpair_peekv(struct vmci_qp *qpair, struct msghdr *msg, size_t iov_size,
  75                         int mode);
  76
  77#endif /* !__VMW_VMCI_API_H__ */
  78