Lines Matching refs:resource

32 	return hash_32(handle.resource, VMCI_RESOURCE_HASH_BITS);  in vmci_resource_hash()
41 struct vmci_resource *r, *resource = NULL; in vmci_resource_lookup() local
48 u32 rid = r->handle.resource; in vmci_resource_lookup()
51 rid == handle.resource && in vmci_resource_lookup()
54 resource = r; in vmci_resource_lookup()
60 return resource; in vmci_resource_lookup()
99 int vmci_resource_add(struct vmci_resource *resource, in vmci_resource_add() argument
109 if (handle.resource == VMCI_INVALID_ID) { in vmci_resource_add()
110 handle.resource = vmci_resource_find_id(handle.context, in vmci_resource_add()
112 if (handle.resource == VMCI_INVALID_ID) { in vmci_resource_add()
121 resource->handle = handle; in vmci_resource_add()
122 resource->type = resource_type; in vmci_resource_add()
123 INIT_HLIST_NODE(&resource->node); in vmci_resource_add()
124 kref_init(&resource->kref); in vmci_resource_add()
125 init_completion(&resource->done); in vmci_resource_add()
127 idx = vmci_resource_hash(resource->handle); in vmci_resource_add()
128 hlist_add_head_rcu(&resource->node, &vmci_resource_table.entries[idx]); in vmci_resource_add()
137 void vmci_resource_remove(struct vmci_resource *resource) in vmci_resource_remove() argument
139 struct vmci_handle handle = resource->handle; in vmci_resource_remove()
147 if (vmci_handle_is_equal(r->handle, resource->handle)) { in vmci_resource_remove()
156 vmci_resource_put(resource); in vmci_resource_remove()
157 wait_for_completion(&resource->done); in vmci_resource_remove()
164 struct vmci_resource *r, *resource = NULL; in vmci_resource_by_handle() local
172 resource = vmci_resource_get(r); in vmci_resource_by_handle()
177 return resource; in vmci_resource_by_handle()
183 struct vmci_resource *vmci_resource_get(struct vmci_resource *resource) in vmci_resource_get() argument
185 kref_get(&resource->kref); in vmci_resource_get()
187 return resource; in vmci_resource_get()
192 struct vmci_resource *resource = in vmci_release_resource() local
196 WARN_ON(!hlist_unhashed(&resource->node)); in vmci_release_resource()
199 complete(&resource->done); in vmci_release_resource()
208 int vmci_resource_put(struct vmci_resource *resource) in vmci_resource_put() argument
214 return kref_put(&resource->kref, vmci_release_resource) ? in vmci_resource_put()
218 struct vmci_handle vmci_resource_handle(struct vmci_resource *resource) in vmci_resource_handle() argument
220 return resource->handle; in vmci_resource_handle()