comm_transp_impl.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. * Linux 2.6.32 and later Kernel module for VMware MVP Hypervisor Support
  3. *
  4. * Copyright (C) 2010-2013 VMware, Inc. All rights reserved.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License version 2 as published by
  8. * the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful, but WITHOUT
  11. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  13. * more details.
  14. *
  15. * You should have received a copy of the GNU General Public License along with
  16. * this program; see the file COPYING. If not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. */
  19. #line 5
  20. /**
  21. * @file
  22. *
  23. * @brief Generic shared memory transport private API.
  24. */
  25. #ifndef _COMM_TRANSP_IMPL_H_
  26. #define _COMM_TRANSP_IMPL_H_
  27. #define INCLUDE_ALLOW_PV
  28. #define INCLUDE_ALLOW_MODULE
  29. #define INCLUDE_ALLOW_MONITOR
  30. #define INCLUDE_ALLOW_GPL
  31. #include "include_check.h"
  32. #include "comm_transp.h"
  33. /* Shared memory opaque descriptor/handle. Only meaningful locally. */
  34. typedef struct CommTranspPriv *CommTransp;
  35. /* Asynchronous signaling initialization arguments. */
  36. typedef enum CommTranspIOEvent {
  37. COMM_TRANSP_IO_DETACH = 0x0,
  38. COMM_TRANSP_IO_IN = 0x1,
  39. COMM_TRANSP_IO_OUT = 0x2,
  40. COMM_TRANSP_IO_INOUT = 0x3
  41. } CommTranspIOEvent;
  42. typedef struct CommTranspEvent {
  43. void (*ioEvent)(CommTransp transp, CommTranspIOEvent event, void *data);
  44. void *ioEventData;
  45. } CommTranspEvent;
  46. /*
  47. * Mechanism to detect and optionally attach to, created shared memory regions.
  48. */
  49. typedef struct CommTranspListener {
  50. int (*probe)(CommTranspInitArgs *transpArgs, void *probeData);
  51. void *probeData;
  52. } CommTranspListener;
  53. /*
  54. * Function prototypes.
  55. */
  56. int CommTranspEvent_Init(void);
  57. void CommTranspEvent_Exit(void);
  58. int CommTranspEvent_Process(CommTranspID *transpID, CommTranspIOEvent event);
  59. int
  60. CommTranspEvent_Raise(unsigned int peerEvID,
  61. CommTranspID *transpID,
  62. CommTranspIOEvent event);
  63. int CommTransp_Init(void);
  64. void CommTransp_Exit(void);
  65. int CommTransp_Register(const CommTranspListener *listener);
  66. void CommTransp_Unregister(const CommTranspListener *listener);
  67. int
  68. CommTransp_Notify(const CommTranspID *notificationCenterID,
  69. CommTranspInitArgs *transpArgs);
  70. int
  71. CommTransp_Open(CommTransp *transp,
  72. CommTranspInitArgs *transpArgs,
  73. CommTranspEvent *transpEvent);
  74. void CommTransp_Close(CommTransp transp);
  75. int CommTransp_EnqueueSpace(CommTransp transp);
  76. int CommTransp_EnqueueReset(CommTransp transp);
  77. int CommTransp_EnqueueCommit(CommTransp transp);
  78. int
  79. CommTransp_EnqueueSegment(CommTransp transp,
  80. const void *buf,
  81. unsigned int bufLen,
  82. int kern);
  83. int CommTransp_DequeueSpace(CommTransp transp);
  84. int CommTransp_DequeueReset(CommTransp transp);
  85. int CommTransp_DequeueCommit(CommTransp transp);
  86. int
  87. CommTransp_DequeueSegment(CommTransp transp,
  88. void *buf,
  89. unsigned int bufLen,
  90. int kern);
  91. unsigned int CommTransp_RequestInlineEvents(CommTransp transp);
  92. unsigned int CommTransp_ReleaseInlineEvents(CommTransp transp);
  93. #endif /* _COMM_TRANSP_IMPL_H_ */