162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * VMware VMCI Driver 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 2012 VMware, Inc. All rights reserved. 662306a36Sopenharmony_ci */ 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci#ifndef _VMCI_RESOURCE_H_ 962306a36Sopenharmony_ci#define _VMCI_RESOURCE_H_ 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#include <linux/vmw_vmci_defs.h> 1262306a36Sopenharmony_ci#include <linux/types.h> 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci#include "vmci_context.h" 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_cienum vmci_resource_type { 1862306a36Sopenharmony_ci VMCI_RESOURCE_TYPE_ANY, 1962306a36Sopenharmony_ci VMCI_RESOURCE_TYPE_API, 2062306a36Sopenharmony_ci VMCI_RESOURCE_TYPE_GROUP, 2162306a36Sopenharmony_ci VMCI_RESOURCE_TYPE_DATAGRAM, 2262306a36Sopenharmony_ci VMCI_RESOURCE_TYPE_DOORBELL, 2362306a36Sopenharmony_ci VMCI_RESOURCE_TYPE_QPAIR_GUEST, 2462306a36Sopenharmony_ci VMCI_RESOURCE_TYPE_QPAIR_HOST 2562306a36Sopenharmony_ci}; 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_cistruct vmci_resource { 2862306a36Sopenharmony_ci struct vmci_handle handle; 2962306a36Sopenharmony_ci enum vmci_resource_type type; 3062306a36Sopenharmony_ci struct hlist_node node; 3162306a36Sopenharmony_ci struct kref kref; 3262306a36Sopenharmony_ci struct completion done; 3362306a36Sopenharmony_ci}; 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ciint vmci_resource_add(struct vmci_resource *resource, 3762306a36Sopenharmony_ci enum vmci_resource_type resource_type, 3862306a36Sopenharmony_ci struct vmci_handle handle); 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_civoid vmci_resource_remove(struct vmci_resource *resource); 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_cistruct vmci_resource * 4362306a36Sopenharmony_civmci_resource_by_handle(struct vmci_handle resource_handle, 4462306a36Sopenharmony_ci enum vmci_resource_type resource_type); 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_cistruct vmci_resource *vmci_resource_get(struct vmci_resource *resource); 4762306a36Sopenharmony_ciint vmci_resource_put(struct vmci_resource *resource); 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_cistruct vmci_handle vmci_resource_handle(struct vmci_resource *resource); 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ci#endif /* _VMCI_RESOURCE_H_ */ 52