Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * VMware VMCI Driver
0004  *
0005  * Copyright (C) 2012 VMware, Inc. All rights reserved.
0006  */
0007 
0008 #ifndef _VMCI_RESOURCE_H_
0009 #define _VMCI_RESOURCE_H_
0010 
0011 #include <linux/vmw_vmci_defs.h>
0012 #include <linux/types.h>
0013 
0014 #include "vmci_context.h"
0015 
0016 
0017 enum vmci_resource_type {
0018     VMCI_RESOURCE_TYPE_ANY,
0019     VMCI_RESOURCE_TYPE_API,
0020     VMCI_RESOURCE_TYPE_GROUP,
0021     VMCI_RESOURCE_TYPE_DATAGRAM,
0022     VMCI_RESOURCE_TYPE_DOORBELL,
0023     VMCI_RESOURCE_TYPE_QPAIR_GUEST,
0024     VMCI_RESOURCE_TYPE_QPAIR_HOST
0025 };
0026 
0027 struct vmci_resource {
0028     struct vmci_handle handle;
0029     enum vmci_resource_type type;
0030     struct hlist_node node;
0031     struct kref kref;
0032     struct completion done;
0033 };
0034 
0035 
0036 int vmci_resource_add(struct vmci_resource *resource,
0037               enum vmci_resource_type resource_type,
0038               struct vmci_handle handle);
0039 
0040 void vmci_resource_remove(struct vmci_resource *resource);
0041 
0042 struct vmci_resource *
0043 vmci_resource_by_handle(struct vmci_handle resource_handle,
0044             enum vmci_resource_type resource_type);
0045 
0046 struct vmci_resource *vmci_resource_get(struct vmci_resource *resource);
0047 int vmci_resource_put(struct vmci_resource *resource);
0048 
0049 struct vmci_handle vmci_resource_handle(struct vmci_resource *resource);
0050 
0051 #endif /* _VMCI_RESOURCE_H_ */