vmci_resource.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. #ifndef _VMCI_RESOURCE_H_
  8. #define _VMCI_RESOURCE_H_
  9. #include <linux/vmw_vmci_defs.h>
  10. #include <linux/types.h>
  11. #include "vmci_context.h"
  12. enum vmci_resource_type {
  13. VMCI_RESOURCE_TYPE_ANY,
  14. VMCI_RESOURCE_TYPE_API,
  15. VMCI_RESOURCE_TYPE_GROUP,
  16. VMCI_RESOURCE_TYPE_DATAGRAM,
  17. VMCI_RESOURCE_TYPE_DOORBELL,
  18. VMCI_RESOURCE_TYPE_QPAIR_GUEST,
  19. VMCI_RESOURCE_TYPE_QPAIR_HOST
  20. };
  21. struct vmci_resource {
  22. struct vmci_handle handle;
  23. enum vmci_resource_type type;
  24. struct hlist_node node;
  25. struct kref kref;
  26. struct completion done;
  27. };
  28. int vmci_resource_add(struct vmci_resource *resource,
  29. enum vmci_resource_type resource_type,
  30. struct vmci_handle handle);
  31. void vmci_resource_remove(struct vmci_resource *resource);
  32. struct vmci_resource *
  33. vmci_resource_by_handle(struct vmci_handle resource_handle,
  34. enum vmci_resource_type resource_type);
  35. struct vmci_resource *vmci_resource_get(struct vmci_resource *resource);
  36. int vmci_resource_put(struct vmci_resource *resource);
  37. struct vmci_handle vmci_resource_handle(struct vmci_resource *resource);
  38. #endif /* _VMCI_RESOURCE_H_ */