]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Rename VMCI_Has*Device to VMCI_*PersonalityActive
authorVMware, Inc <>
Tue, 29 Mar 2011 20:20:59 +0000 (13:20 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Tue, 29 Mar 2011 20:20:59 +0000 (13:20 -0700)
Since the host device is more or less always there and since
it isn't really a device, the name VMCI_HasHostDevice is kind
of misleading. Rename the two functions to mean that the given
personality of the vmci driver is active.

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/modules/linux/shared/vmci_kernel_if.h
open-vm-tools/modules/linux/vmci/common/vmciContext.c
open-vm-tools/modules/linux/vmci/common/vmciDatagram.c
open-vm-tools/modules/linux/vmci/common/vmciDoorbell.c
open-vm-tools/modules/linux/vmci/common/vmciDriver.c
open-vm-tools/modules/linux/vmci/common/vmciHashtable.c
open-vm-tools/modules/linux/vmci/common/vmciQPair.c
open-vm-tools/modules/linux/vmci/common/vmciQueuePair.c
open-vm-tools/modules/linux/vmci/common/vmciRoute.c
open-vm-tools/modules/linux/vmci/linux/driver.c

index f726658a7544fc606a0cfcac5b8e5447c2e1039f..023149878db75bc1fbe347ba34cd32981da9118f 100644 (file)
@@ -405,15 +405,15 @@ Bool VMCI_DeviceShutdown(void);
 #  define VMCI_DeviceShutdown() FALSE
 #endif // !_WIN32
 #if defined(_WIN32) || (defined(linux) && !defined(VMKERNEL))
-  Bool VMCI_HasGuestDevice(void);
-  Bool VMCI_HasHostDevice(void);
+  Bool VMCI_GuestPersonalityActive(void);
+  Bool VMCI_HostPersonalityActive(void);
 #else
 #  if defined(VMX86_TOOLS)
-#    define VMCI_HasGuestDevice() TRUE
-#    define VMCI_HasHostDevice()  FALSE
+#    define VMCI_GuestPersonalityActive() TRUE
+#    define VMCI_HostPersonalityActive()  FALSE
 #  else // VMX86_TOOLS
-#    define VMCI_HasGuestDevice() FALSE
-#    define VMCI_HasHostDevice()  TRUE
+#    define VMCI_GuestPersonalityActive() FALSE
+#    define VMCI_HostPersonalityActive()  TRUE
 #  endif // !VMX86_TOOLS
 #endif // !(_WIN32 || (linux && !VMKERNEL))
 
index e91fbe90adc1c5af20afcc3b934ad64753bdd25e..e36e32e5f65cf5fec540794bd5293ae420fe7af4 100644 (file)
@@ -30,6 +30,7 @@
 #include "vmciContext.h"
 #include "vmciDatagram.h"
 #include "vmciDoorbell.h"
+#include "vmciDriver.h"
 #include "vmciEvent.h"
 #include "vmciKernelAPI.h"
 #include "vmciQueuePair.h"
@@ -38,9 +39,6 @@
 #  include "vmciVmkInt.h"
 #  include "vm_libc.h"
 #  include "helper_ext.h"
-#  include "vmciDriver.h"
-#else
-#  include "vmciDriver.h"
 #endif
 
 #define LGPFX "VMCIContext: "
@@ -1292,7 +1290,7 @@ VMCI_EXPORT_SYMBOL(VMCIContext_GetPrivFlags)
 VMCIPrivilegeFlags
 VMCIContext_GetPrivFlags(VMCIId contextID)  // IN
 {
-   if (VMCI_HasHostDevice()) {
+   if (VMCI_HostPersonalityActive()) {
       VMCIPrivilegeFlags flags;
       VMCIContext *context;
 
@@ -2320,7 +2318,7 @@ int
 VMCI_IsContextOwner(VMCIId contextID,   // IN
                     void *hostUser)     // IN
 {
-   if (VMCI_HasHostDevice()) {
+   if (VMCI_HostPersonalityActive()) {
       VMCIContext *context;
       VMCIHostUser *user = (VMCIHostUser *)hostUser;
       int retval;
index 08e1259ed94ab5432cc5004ab28c62b2bbfe4d94..392fa833fb8f24d8721c5709fb8d4eed30188d9e 100644 (file)
@@ -29,6 +29,7 @@
 #include "vmciCommonInt.h"
 #include "vmciContext.h"
 #include "vmciDatagram.h"
+#include "vmciDriver.h"
 #include "vmciEvent.h"
 #include "vmciHashtable.h"
 #include "vmciKernelAPI.h"
@@ -38,9 +39,6 @@
 #  include "vmciVmkInt.h"
 #  include "vm_libc.h"
 #  include "helper_ext.h"
-#  include "vmciDriver.h"
-#else
-#  include "vmciDriver.h"
 #endif
 
 #define LGPFX "VMCIDatagram: "
@@ -578,7 +576,7 @@ VMCIDatagramDispatchAsHost(VMCIId contextID,  // IN:
    char dstDomain[VMCI_DOMAIN_NAME_MAXLEN]; /* Not used on hosted. */
 
    ASSERT(dg);
-   ASSERT(VMCI_HasHostDevice());
+   ASSERT(VMCI_HostPersonalityActive());
 
    dgSize = VMCI_DG_SIZE(dg);
 
@@ -826,7 +824,7 @@ VMCIDatagramDispatchAsGuest(VMCIDatagram *dg)
    int retval;
    VMCIResource *resource;
 
-   ASSERT(VMCI_HasGuestDevice());
+   ASSERT(VMCI_GuestPersonalityActive());
 
    resource = VMCIResource_Get(dg->src, VMCI_RESOURCE_TYPE_DATAGRAM);
    if (NULL == resource) {
@@ -926,7 +924,7 @@ VMCIDatagram_InvokeGuestHandler(VMCIDatagram *dg) // IN
    DatagramEntry *dstEntry;
 
    ASSERT(dg);
-   ASSERT(VMCI_HasGuestDevice());
+   ASSERT(VMCI_GuestPersonalityActive());
 
    resource = VMCIResource_Get(dg->dst, VMCI_RESOURCE_TYPE_DATAGRAM);
    if (NULL == resource) {
index e5957ccdf62ffd9fcc8524e18a9ae2a1146b7289..abaea624ee1a0ffa0c560a42921c98b901f05d47 100644 (file)
@@ -29,6 +29,7 @@
 #include "vmciCommonInt.h"
 #include "vmciDatagram.h"
 #include "vmciDoorbell.h"
+#include "vmciDriver.h"
 #include "vmciKernelAPI.h"
 #include "vmciResource.h"
 #include "vmciRoute.h"
@@ -36,9 +37,6 @@
 #  include "vmciVmkInt.h"
 #  include "vm_libc.h"
 #  include "helper_ext.h"
-#  include "vmciDriver.h"
-#else
-#  include "vmciDriver.h"
 #endif
 
 #define LGPFX "VMCIDoorbell: "
@@ -300,7 +298,7 @@ VMCIDoorbellIndexTableFind(uint32 idx) // IN
    uint32 bucket = VMCI_DOORBELL_HASH(idx);
    VMCIListItem *iter;
 
-   ASSERT(VMCI_HasGuestDevice());
+   ASSERT(VMCI_GuestPersonalityActive());
 
    VMCIList_Scan(iter, &vmciDoorbellIT.entries[bucket]) {
       VMCIDoorbellEntry *cur =
@@ -343,7 +341,7 @@ VMCIDoorbellIndexTableAdd(VMCIDoorbellEntry *entry) // IN/OUT
    VMCILockFlags flags;
 
    ASSERT(entry);
-   ASSERT(VMCI_HasGuestDevice());
+   ASSERT(VMCI_GuestPersonalityActive());
 
    VMCIResource_Hold(&entry->resource);
 
@@ -417,7 +415,7 @@ VMCIDoorbellIndexTableRemove(VMCIDoorbellEntry *entry) // IN/OUT
    VMCILockFlags flags;
 
    ASSERT(entry);
-   ASSERT(VMCI_HasGuestDevice());
+   ASSERT(VMCI_GuestPersonalityActive());
 
    VMCIDoorbellGrabLock(&vmciDoorbellIT.lock, &flags);
 
@@ -476,7 +474,7 @@ VMCIDoorbellLink(VMCIHandle handle, // IN
    VMCIDoorbellLinkMsg linkMsg;
 
    ASSERT(!VMCI_HANDLE_INVALID(handle));
-   ASSERT(VMCI_HasGuestDevice());
+   ASSERT(VMCI_GuestPersonalityActive());
 
    if (isDoorbell) {
       resourceID = VMCI_DOORBELL_LINK;
@@ -525,7 +523,7 @@ VMCIDoorbellUnlink(VMCIHandle handle, // IN
    VMCIDoorbellUnlinkMsg unlinkMsg;
 
    ASSERT(!VMCI_HANDLE_INVALID(handle));
-   ASSERT(VMCI_HasGuestDevice());
+   ASSERT(VMCI_GuestPersonalityActive());
 
    if (isDoorbell) {
       resourceID = VMCI_DOORBELL_UNLINK;
@@ -618,7 +616,7 @@ VMCIDoorbell_Create(VMCIHandle *handle,            // IN/OUT
       if (VMCI_HOST_CONTEXT_ID == handle->context) {
          validContext = TRUE;
       }
-      if (VMCI_HasGuestDevice() && VMCI_GetContextID() == handle->context) {
+      if (VMCI_GuestPersonalityActive() && VMCI_GetContextID() == handle->context) {
          validContext = TRUE;
       }
 
@@ -649,7 +647,7 @@ VMCIDoorbell_Create(VMCIHandle *handle,            // IN/OUT
       goto destroy;
    }
 
-   if (VMCI_HasGuestDevice()) {
+   if (VMCI_GuestPersonalityActive()) {
       result = VMCIDoorbellLink(newHandle, entry->isDoorbell, entry->idx);
       if (VMCI_SUCCESS != result) {
          goto destroyResource;
@@ -710,7 +708,7 @@ VMCIDoorbell_Destroy(VMCIHandle handle)  // IN
    }
    entry = RESOURCE_CONTAINER(resource, VMCIDoorbellEntry, resource);
 
-   if (VMCI_HasGuestDevice()) {
+   if (VMCI_GuestPersonalityActive()) {
       int result;
 
       VMCIDoorbellIndexTableRemove(entry);
@@ -788,7 +786,7 @@ VMCIDoorbellNotifyAsGuest(VMCIHandle handle,            // IN
 #else // VMKERNEL
    VMCIDoorbellNotifyMsg notifyMsg;
 
-   ASSERT(VMCI_HasGuestDevice());
+   ASSERT(VMCI_GuestPersonalityActive());
 
    notifyMsg.hdr.dst = VMCI_MAKE_HANDLE(VMCI_HYPERVISOR_CONTEXT_ID,
                                         VMCI_DOORBELL_NOTIFY);
@@ -904,7 +902,7 @@ VMCIDoorbellHostContextNotify(VMCIId srcCID,     // IN
    VMCIResource *resource;
    int result;
 
-   ASSERT(VMCI_HasHostDevice());
+   ASSERT(VMCI_HostPersonalityActive());
 
    resource = VMCIResource_Get(handle, VMCI_RESOURCE_TYPE_DOORBELL);
    if (resource == NULL) {
@@ -968,7 +966,7 @@ VMCIDoorbell_Hibernate(Bool enterHibernate)
    VMCIListItem *iter;
    VMCILockFlags flags;
 
-   if (!VMCI_HasGuestDevice() || enterHibernate) {
+   if (!VMCI_GuestPersonalityActive() || enterHibernate) {
       return;
    }
 
@@ -1093,7 +1091,7 @@ VMCIDoorbellFireEntries(uint32 notifyIdx) // IN
    VMCIListItem *iter;
    VMCILockFlags flags;
 
-   ASSERT(VMCI_HasGuestDevice());
+   ASSERT(VMCI_GuestPersonalityActive());
 
    VMCIDoorbellGrabLock(&vmciDoorbellIT.lock, &flags);
 
@@ -1148,7 +1146,7 @@ VMCI_ScanNotificationBitmap(uint8 *bitmap)
    uint32 idx;
 
    ASSERT(bitmap);
-   ASSERT(VMCI_HasGuestDevice());
+   ASSERT(VMCI_GuestPersonalityActive());
 
    for (idx = 0; idx < maxNotifyIdx; idx++) {
       if (bitmap[idx] & 0x1) {
index 07b0df0b2279524a3700fa9f4ef64b4992272d16..a2b3edd01d36a54c467a4a4853dedc210a219dad 100644 (file)
@@ -562,7 +562,7 @@ VMCI_EXPORT_SYMBOL(VMCI_GetContextID)
 VMCIId
 VMCI_GetContextID(void)
 {
-   if (VMCI_HasGuestDevice()) {
+   if (VMCI_GuestPersonalityActive()) {
       if (Atomic_Read(&vmContextID) == VMCI_INVALID_ID) {
          uint32 result;
          VMCIDatagram getCidMsg;
@@ -574,7 +574,7 @@ VMCI_GetContextID(void)
          Atomic_Write(&vmContextID, result);
       }
       return Atomic_Read(&vmContextID);
-   } else if (VMCI_HasHostDevice()) {
+   } else if (VMCI_HostPersonalityActive()) {
       return VMCI_HOST_CONTEXT_ID;
    }
    return VMCI_INVALID_ID;
index 46fa43e3ae554f0249fd9fbbf7bb0e34c7a24e78..fcfb0870cb39697df70677dd26d4167b405ed059 100644 (file)
 #include "vmci_defs.h"
 #include "vmci_infrastructure.h"
 #include "vmciCommonInt.h"
+#include "vmciDriver.h"
 #include "vmciHashtable.h"
 #if defined(VMKERNEL)
 #  include "vmciVmkInt.h"
 #  include "vm_libc.h"
 #  include "helper_ext.h"
-#  include "vmciDriver.h"
-#else
-#  include "vmciDriver.h"
 #endif
 
 #define LGPFX "VMCIHashTable: "
index 9aafba908126d93ff0542c15bcba27155d6c7901..2a62b4182e6e85e73c62c32e3cb12af87844bca1 100644 (file)
@@ -142,7 +142,7 @@ VMCIQPair_Alloc(VMCIQPair **qpair,            // OUT
 
    retval = VMCI_Route(&src, &dst, FALSE, &route);
    if (retval < VMCI_SUCCESS) {
-      if (VMCI_HasGuestDevice()) {
+      if (VMCI_GuestPersonalityActive()) {
          route = VMCI_ROUTE_AS_GUEST;
       } else {
          route = VMCI_ROUTE_AS_HOST;
index 1fa4ce35258161f31e3983fd2f349fc4f0bf150f..a70430812118dd9eea663b4eeca8e2e1ff473d4a 100644 (file)
@@ -30,6 +30,7 @@
 #include "vmciCommonInt.h"
 #include "vmciContext.h"
 #include "vmciDatagram.h"
+#include "vmciDriver.h"
 #include "vmciEvent.h"
 #include "vmciHashtable.h"
 #include "vmciKernelAPI.h"
@@ -40,9 +41,6 @@
 #  include "vmciVmkInt.h"
 #  include "vm_libc.h"
 #  include "helper_ext.h"
-#  include "vmciDriver.h"
-#else
-#  include "vmciDriver.h"
 #endif
 
 #define LGPFX "VMCIQueuePair: "
index 7ba4b65592dac1c5a355c370e3d74066b92d901b..7a9da8e2c5b330e31321399a7c431205f89b4be1 100644 (file)
 #include "vmci_infrastructure.h"
 #include "vmciCommonInt.h"
 #include "vmciContext.h"
+#include "vmciDriver.h"
 #include "vmciKernelAPI.h"
 #include "vmciRoute.h"
 #if defined(VMKERNEL)
 #  include "vmciVmkInt.h"
 #  include "vm_libc.h"
 #  include "helper_ext.h"
-#  include "vmciDriver.h"
-#else
-#  include "vmciDriver.h"
 #endif
 
 #define LGPFX "VMCIRoute: "
@@ -87,8 +85,8 @@ VMCI_Route(VMCIHandle *src,       // IN/OUT
     * device.
     */
 
-   hasHostDevice = VMCI_HasHostDevice();
-   hasGuestDevice = VMCI_HasGuestDevice();
+   hasHostDevice = VMCI_HostPersonalityActive();
+   hasGuestDevice = VMCI_GuestPersonalityActive();
 
    /* Must have a valid destination context. */
    if (VMCI_INVALID_ID == dst->context) {
index d540444ec57b718bd6e84dfdb8f735f5da41d462..266625b638d8d764431ef03f27c99947079dbaf7 100644 (file)
@@ -2163,7 +2163,7 @@ vmci_interrupt_bm(int irq,               // IN
 Bool
 VMCI_DeviceEnabled(void)
 {
-   return VMCI_HasGuestDevice() || VMCI_HasHostDevice();
+   return VMCI_GuestPersonalityActive() || VMCI_HostPersonalityActive();
 }
 
 
@@ -2321,7 +2321,7 @@ process_bitmap(unsigned long data)
 /*
  *-----------------------------------------------------------------------------
  *
- * VMCI_HasGuestDevice --
+ * VMCI_GuestPersonalityActive --
  *
  *      Determines whether the VMCI PCI device has been successfully
  *      initialized.
@@ -2336,7 +2336,7 @@ process_bitmap(unsigned long data)
  */
 
 Bool
-VMCI_HasGuestDevice(void)
+VMCI_GuestPersonalityActive(void)
 {
    return guestDeviceInit && atomic_read(&guestDeviceActive) > 0;
 }
@@ -2345,15 +2345,15 @@ VMCI_HasGuestDevice(void)
 /*
  *-----------------------------------------------------------------------------
  *
- * VMCI_HasHostDevice --
+ * VMCI_HostPersonalityActive --
  *
- *      Determines whether the VMCI host device is available. Since
- *      the core functionality of the host driver is always present,
- *      all guests could possibly use the host personality. However,
- *      to minimize the deviation from the pre-unified driver state of
- *      affairs, we only consider the host device active, if there is
- *      no active guest device, or if there are VMX'en with active
- *      VMCI contexts using the host device.
+ *      Determines whether the VMCI host personality is
+ *      available. Since the core functionality of the host driver is
+ *      always present, all guests could possibly use the host
+ *      personality. However, to minimize the deviation from the
+ *      pre-unified driver state of affairs, we only consider the host
+ *      device active, if there is no active guest device, or if there
+ *      are VMX'en with active VMCI contexts using the host device.
  *
  * Results:
  *      TRUE, if VMCI host driver is operational, FALSE otherwise.
@@ -2365,10 +2365,11 @@ VMCI_HasGuestDevice(void)
  */
 
 Bool
-VMCI_HasHostDevice(void)
+VMCI_HostPersonalityActive(void)
 {
    return hostDeviceInit &&
-      (!VMCI_HasGuestDevice() || atomic_read(&linuxState.activeContexts) > 0);
+      (!VMCI_GuestPersonalityActive() ||
+       atomic_read(&linuxState.activeContexts) > 0);
 }
 
 
@@ -2418,7 +2419,7 @@ vmci_init(void)
          Warning(LGPFX"VMCI PCI device not initialized (err=%d).\n", retval);
       }
       guestDeviceInit = (retval == 0);
-      if (VMCI_HasGuestDevice()) {
+      if (VMCI_GuestPersonalityActive()) {
          Log(LGPFX"Using guest personality\n");
       }
    }