vmci_resource.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * VMware VMCI Driver
  3. *
  4. * Copyright (C) 2012 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 as published by the
  8. * Free Software Foundation version 2 and no later version.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  12. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  13. * for more details.
  14. */
  15. #ifndef _VMCI_RESOURCE_H_
  16. #define _VMCI_RESOURCE_H_
  17. #include <linux/vmw_vmci_defs.h>
  18. #include <linux/types.h>
  19. #include "vmci_context.h"
  20. enum vmci_resource_type {
  21. VMCI_RESOURCE_TYPE_ANY,
  22. VMCI_RESOURCE_TYPE_API,
  23. VMCI_RESOURCE_TYPE_GROUP,
  24. VMCI_RESOURCE_TYPE_DATAGRAM,
  25. VMCI_RESOURCE_TYPE_DOORBELL,
  26. VMCI_RESOURCE_TYPE_QPAIR_GUEST,
  27. VMCI_RESOURCE_TYPE_QPAIR_HOST
  28. };
  29. struct vmci_resource {
  30. struct vmci_handle handle;
  31. enum vmci_resource_type type;
  32. struct hlist_node node;
  33. struct kref kref;
  34. struct completion done;
  35. };
  36. int vmci_resource_add(struct vmci_resource *resource,
  37. enum vmci_resource_type resource_type,
  38. struct vmci_handle handle);
  39. void vmci_resource_remove(struct vmci_resource *resource);
  40. struct vmci_resource *
  41. vmci_resource_by_handle(struct vmci_handle resource_handle,
  42. enum vmci_resource_type resource_type);
  43. struct vmci_resource *vmci_resource_get(struct vmci_resource *resource);
  44. int vmci_resource_put(struct vmci_resource *resource);
  45. struct vmci_handle vmci_resource_handle(struct vmci_resource *resource);
  46. #endif /* _VMCI_RESOURCE_H_ */