The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/vmware/vmci/vmci_resource.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 2018 VMware, Inc.
    3  *
    4  * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0)
    5  *
    6  * $FreeBSD$
    7  */
    8 
    9 /* VMCI Resource Access Control API. */
   10 
   11 #ifndef _VMCI_RESOURCE_H_
   12 #define _VMCI_RESOURCE_H_
   13 
   14 #include "vmci_defs.h"
   15 #include "vmci_hashtable.h"
   16 #include "vmci_kernel_if.h"
   17 
   18 #define RESOURCE_CONTAINER(ptr, type, member)                           \
   19         ((type *)((char *)(ptr) - offsetof(type, member)))
   20 
   21 typedef void(*vmci_resource_free_cb)(void *resource);
   22 
   23 typedef enum {
   24         VMCI_RESOURCE_TYPE_ANY,
   25         VMCI_RESOURCE_TYPE_API,
   26         VMCI_RESOURCE_TYPE_GROUP,
   27         VMCI_RESOURCE_TYPE_DATAGRAM,
   28         VMCI_RESOURCE_TYPE_DOORBELL,
   29 } vmci_resource_type;
   30 
   31 struct vmci_resource {
   32         struct vmci_hash_entry  hash_entry;
   33         vmci_resource_type      type;
   34         /* Callback to free container object when refCount is 0. */
   35         vmci_resource_free_cb   container_free_cb;
   36         /* Container object reference. */
   37         void                    *container_object;
   38 };
   39 
   40 int     vmci_resource_init(void);
   41 void    vmci_resource_exit(void);
   42 void    vmci_resource_sync(void);
   43 
   44 vmci_id vmci_resource_get_id(vmci_id context_id);
   45 
   46 int     vmci_resource_add(struct vmci_resource *resource,
   47             vmci_resource_type resource_type,
   48             struct vmci_handle resource_handle,
   49             vmci_resource_free_cb container_free_cb, void *container_object);
   50 void    vmci_resource_remove(struct vmci_handle resource_handle,
   51             vmci_resource_type resource_type);
   52 struct  vmci_resource *vmci_resource_get(struct vmci_handle resource_handle,
   53             vmci_resource_type resource_type);
   54 void    vmci_resource_hold(struct vmci_resource *resource);
   55 int     vmci_resource_release(struct vmci_resource *resource);
   56 struct  vmci_handle vmci_resource_handle(struct vmci_resource *resource);
   57 
   58 #endif /* !_VMCI_RESOURCE_H_ */

Cache object: 3ca354597466e377938514d07ec55725


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.