]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Changes in shared code that don't affect open-vm-tools functionality.
authorVMware, Inc <>
Fri, 12 Apr 2013 19:57:08 +0000 (12:57 -0700)
committerDmitry Torokhov <dtor@vmware.com>
Wed, 17 Apr 2013 19:16:57 +0000 (12:16 -0700)
Signed-off-by: Dmitry Torokhov <dtor@vmware.com>
open-vm-tools/lib/file/filePosix.c
open-vm-tools/lib/include/backdoor_def.h
open-vm-tools/lib/include/codeset.h
open-vm-tools/lib/include/includeCheck.h
open-vm-tools/lib/include/loglevel_user.h
open-vm-tools/lib/include/poll.h
open-vm-tools/lib/include/vm_assert.h
open-vm-tools/lib/misc/codesetBase.c

index a4ff4a01dbf9e5e4cea8aa02b5ea1bd476c588c3..58d08230d2328a9965895f86e477eebd58da1e03 100644 (file)
@@ -656,6 +656,20 @@ FileVMFSGetCanonicalPath(ConstUnicode absVMDirName)   // IN
    Unicode dirPath = NULL;
    Unicode canonPath = NULL;  /* result */
 
+   /*
+    * The very first thing that we do is to open the VVol control node.
+    * This will fail if the VVol module is not loaded. In that case we
+    * short circuit to the failure case. This helps systems which do not
+    * use VVols, as we avoid the extra file opens (by File_IsDirectory
+    * and File_GetVMFSFSType) in those cases.
+    * Note that file opens are especially expensive on NFS.
+    * See PR 1007403.
+    */
+   ctrlfd = Posix_Open(VVOL_NAMESPACE_CONTROL_NODE, O_RDONLY);
+   if (ctrlfd < 0) {
+      goto use_same_path;
+   }
+
    /*
     * absVMDirName should start with /vmfs/volumes/.
     */
@@ -689,16 +703,6 @@ FileVMFSGetCanonicalPath(ConstUnicode absVMDirName)   // IN
       goto use_same_path;
    }
 
-   /*
-    * The most likely reason this will fail is if the VVol control node is
-    * not present which means VVol module is not loaded. We can not translate
-    * the pathname in that case.
-    */
-   ctrlfd = Posix_Open(VVOL_NAMESPACE_CONTROL_NODE, O_RDONLY);
-   if (ctrlfd < 0) {
-      goto use_same_path;
-   }
-
    /*
     * VM directory is on an NFS fileystem. It could be a regular NFS filesystem
     * backed storage or an NFS config VVol. We need to check.
index 92d2fd3365f78aa00300f0c63caf40717fb2fe3d..d9a080427cdad5b42a8ce03e94feb9495358fdf2 100644 (file)
 #define   BDOOR_CMD_SET_PCI_HOLE             77 /* CPL 0 only  */
 #define   BDOOR_CMD_GET_PCI_HOLE             78 /* CPL 0 only  */
 #define   BDOOR_CMD_GET_PCI_BAR              79 /* CPL 0 only  */
-#define   BDOOR_CMD_MAX                      80
+#define   BDOOR_CMD_SHOULD_GENERATE_SYSTEMID 80 /* CPL 0 only  */
+#define   BDOOR_CMD_MAX                      81
 
 
 /* 
index 0dfcfacb0fa3470cef82dac567aa5df68fbed96f..f70b8144b1b6c545b4a3f68912d86ceea5ea3d35 100644 (file)
@@ -376,6 +376,9 @@ Bool CodeSet_UTF32ToUTF8(const char *utf32,
 
 int CodeSet_LengthInCodePoints(const char *utf8);
 
+int CodeSet_CodePointOffsetToByteOffset(const char *utf8,
+                                        int codePointOffset);
+
 int CodeSet_GetUtf8(const char *string,
                     const char *end,
                     uint32 *uchar);
@@ -458,7 +461,7 @@ CodeSet_Utf16ToUtf8(const utf16_t *strW)  // IN:
  *      put a NUL terminator.
  *
  * Results:
- *      
+ *
  *      Returns the offset of the byte immediately following the last
  *      complete UTF-8 code point in buf that is entirely within the
  *      range [0, offset-1]. Note that if the final UTF-8 code point
@@ -543,7 +546,7 @@ CodeSet_Utf8FindCodePointBoundary(const char *buf,   // IN
  *      put a NUL terminator.
  *
  * Results:
- *      
+ *
  *      Returns the offset of the byte immediately following the last
  *      complete UTF-16 code point in buf that is entirely within the
  *      range [0, offset-1]. Note that if the final UTF-16 code point
index 4e202c4beaefb0b5df85d7f01f5a46497b3b3ce1..8a7ab0924db482ff9f2c69279e38a9416b7358fc 100644 (file)
 #endif
 #undef INCLUDE_ALLOW_VMIROM
 
-#if defined INCLUDE_ALLOW_MKS && \
-    !(defined LOCALMKS  || defined REMOTEMKS || \
-      defined SERVERMKS || defined CLIENTMKS)
+#if defined INCLUDE_ALLOW_MKS && !(defined COREMKS)
 #error "The surrounding include file is not allowed outside of the MKS."
 #endif
 #undef INCLUDE_ALLOW_MKS
index 4176daa75c37b352caf385079e9b58e69d3947ac..3e345133551093efa1c18b5452c8ab894554334c 100644 (file)
    LOGLEVEL_VAR(mksGLShader), \
    LOGLEVEL_VAR(mksGLState), \
    LOGLEVEL_VAR(mksGLWindow), \
+   LOGLEVEL_VAR(mksGLContextMux), \
    LOGLEVEL_VAR(mksWinBSOD), \
    LOGLEVEL_VAR(vdpPlugin), \
    \
index c123a21018df17a164ab563162c2a1c63cc85a2f..7cb4d475b988d019e1e4a1c2545059868ba13af1 100644 (file)
@@ -164,10 +164,10 @@ PollClassSet_Include(PollClassSet set, PollClass c)
 #define POLL_CS_MAIN    PollClassSet_Singleton(POLL_CLASS_MAIN)
 #define POLL_CS_PAUSE   PollClassSet_Union(POLL_CS_MAIN,            \
                            PollClassSet_Singleton(POLL_CLASS_PAUSE))
-#define POLL_CS_IPC     PollClassSet_Union(POLL_CS_PAUSE,           \
-                           PollClassSet_Singleton(POLL_CLASS_IPC))
-#define POLL_CS_CPT     PollClassSet_Union(POLL_CS_IPC,             \
+#define POLL_CS_CPT     PollClassSet_Union(POLL_CS_PAUSE,           \
                            PollClassSet_Singleton(POLL_CLASS_CPT))
+#define POLL_CS_IPC     PollClassSet_Union(POLL_CS_CPT,             \
+                           PollClassSet_Singleton(POLL_CLASS_IPC))
 #define POLL_CS_VMDB    POLL_CS_PAUSE /* POLL_CLASS_VMDB is retired */
 #define POLL_CS_MKS    PollClassSet_Singleton(POLL_CLASS_MKS)
 /* 
@@ -185,11 +185,11 @@ PollClassSet_Include(PollClassSet set, PollClass c)
  * POLL_CS_CPT
  *    - Only for callbacks which can trigger intermediate Checkpoint 
  *      transitions.
- *      The ONLY such callbacks are CrossUserRPC and VMotion.
+ *      The ONLY such callback is Migrate.
  * POLL_CS_IPC
  *    - Only for callbacks which can contain Msg_(Post|Hint|Question) 
  *      responses, and for signal handlers (why)?
- *      IPC, VMDB, and Foundry can contain Msg_* responses.
+ *      Vigor, VMDB, and Foundry can contain Msg_* responses.
  * POLL_CS_MKS
  *    - Callback runs in MKS thread.
  * POLL_CS_ALWAYS
index 9078d5ff925bd5fb8116034e8d0d4ac45c8dbbf1..12bcb676d526df22f8fad318e254de65bb8bb7ac 100644 (file)
@@ -287,10 +287,10 @@ do {                                                        \
 #define LOG_ONCE(_s) DO_ONCE(Log _s)
 
 #ifdef VMX86_DEVEL
-   #define DEPRECATED(_fix) DO_ONCE(                                        \
-                               Warning("%s:%d: %s is DEPRECATED; %s\n",     \
-                                          __FILE__, __LINE__, __FUNCTION__, \
-                                          _fix))
+   #define DEPRECATED(_fix) DO_ONCE(                                     \
+                               Warning("%s:%d: %s is DEPRECATED. %s\n",  \
+                                       __FILE__, __LINE__, __FUNCTION__, \
+                                       _fix))
 #else
    #define DEPRECATED(_fix) do {} while (0)
 #endif
index 8c4611b1446a70c33658e19485cc9dd4a9a69f23..cf093c870be993850845ef0346334b03a99af5ac 100644 (file)
@@ -73,7 +73,7 @@ CodeSet_GetCurrentCodeSet(void)
 int
 CodeSet_GetUtf8(const char *string,  // IN: string
                 const char *end,     // IN: end of string
-                uint32 *uchar)       // OUT: the Unicode character
+                uint32 *uchar)       // OUT/OPT: the Unicode character
 {
    uint8 *p = (uint8 *) string;
    uint8 *e;
@@ -181,8 +181,7 @@ CodeSet_LengthInCodePoints(const char *utf8)  // IN:
    end = p + strlen(utf8);
 
    while (p < end) {
-      uint32 utf32;
-      uint32 len = CodeSet_GetUtf8(p, end, &utf32);
+      uint32 len = CodeSet_GetUtf8(p, end, NULL);
 
       if (len == 0) {
          return -1;
@@ -196,6 +195,55 @@ CodeSet_LengthInCodePoints(const char *utf8)  // IN:
 }
 
 
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * CodeSet_CodePointOffsetToByteOffset --
+ *
+ *    Return the byte offset of the character at the given codepoint
+ *    offset.
+ *
+ * Results:
+ *    -1 on error
+ *
+ * Side effects:
+ *    None
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+int
+CodeSet_CodePointOffsetToByteOffset(const char *utf8,    // IN
+                                    int codePointOffset) // IN
+{
+   const char *p;
+   const char *end;
+
+   ASSERT(utf8);
+
+   p = utf8;
+   end = p + strlen(utf8);
+
+   while (p < end && codePointOffset > 0) {
+      uint32 utf32;
+      uint32 len = CodeSet_GetUtf8(p, end, &utf32);
+
+      if (len == 0) {
+         return -1;
+      }
+
+      p += len;
+      codePointOffset--;
+   }
+
+   if (codePointOffset == 0) {
+      return p - utf8;
+   } else {
+      return -1;
+   }
+}
+
+
 /*
  *-----------------------------------------------------------------------------
  *