Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
[linux/fpc-iii.git] / drivers / misc / vmw_vmci / vmci_resource.h
blob9190cd298bee3c5104060764249ac795571bac64
1 /*
2 * VMware VMCI Driver
4 * Copyright (C) 2012 VMware, Inc. All rights reserved.
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.
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.
16 #ifndef _VMCI_RESOURCE_H_
17 #define _VMCI_RESOURCE_H_
19 #include <linux/vmw_vmci_defs.h>
20 #include <linux/types.h>
22 #include "vmci_context.h"
25 enum vmci_resource_type {
26 VMCI_RESOURCE_TYPE_ANY,
27 VMCI_RESOURCE_TYPE_API,
28 VMCI_RESOURCE_TYPE_GROUP,
29 VMCI_RESOURCE_TYPE_DATAGRAM,
30 VMCI_RESOURCE_TYPE_DOORBELL,
31 VMCI_RESOURCE_TYPE_QPAIR_GUEST,
32 VMCI_RESOURCE_TYPE_QPAIR_HOST
35 struct vmci_resource {
36 struct vmci_handle handle;
37 enum vmci_resource_type type;
38 struct hlist_node node;
39 struct kref kref;
40 struct completion done;
44 int vmci_resource_add(struct vmci_resource *resource,
45 enum vmci_resource_type resource_type,
46 struct vmci_handle handle);
48 void vmci_resource_remove(struct vmci_resource *resource);
50 struct vmci_resource *
51 vmci_resource_by_handle(struct vmci_handle resource_handle,
52 enum vmci_resource_type resource_type);
54 struct vmci_resource *vmci_resource_get(struct vmci_resource *resource);
55 int vmci_resource_put(struct vmci_resource *resource);
57 struct vmci_handle vmci_resource_handle(struct vmci_resource *resource);
59 #endif /* _VMCI_RESOURCE_H_ */