]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
lib/file/filePosix.c: Implement File_GetMountPath() for POSIX
authorOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:23:51 +0000 (11:23 -0700)
committerOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:23:51 +0000 (11:23 -0700)
  - The change implements File_GetMountPath() for POSIX,
    using realpath(3) and readlink(2).

Changes to common header files; not applicable to open-vm-tools.

open-vm-tools/lib/asyncsocket/asyncSocketVTable.h
open-vm-tools/lib/file/filePosix.c
open-vm-tools/lib/include/asyncsocket.h

index afb5e544b1b05b299035a465bc654c7154ac93bc..54ad31b2a98ac77fb8aed0658331567c5a1c011b 100644 (file)
@@ -67,7 +67,10 @@ typedef struct AsyncSocketVTable {
                     socklen_t inBufLen);
    /*
     * A setOption() implementation must have a symmetrical getOption()
-    * counterpart.
+    * counterpart.  The converse is not true -- a getOption()
+    * implementation need not have a setOption() counterpart.  (One
+    * way to look at this is that an option may be read-only, but it
+    * must not be write-only.)
     */
    int (*getOption)(AsyncSocket *asyncSocket,
                     AsyncSocketOpts_Layer layer,
index 6f3d7b2fbb71c8d3104513dc0bcba1bc73cbde39..6f45d84651284ae4c25fd9545678cab34f73420c 100644 (file)
@@ -3288,6 +3288,24 @@ char *
 File_GetMountPath(const char *pathName,  // IN:
                   Bool checkEntirePath)  // IN:
 {
-   NOT_IMPLEMENTED();
+   char *mountPath;
+
+   if (pathName == NULL) {
+      return NULL;
+   }
+
+   if (checkEntirePath) {
+      return Posix_RealPath(pathName);
+   }
+
+   mountPath = Posix_ReadLink(pathName);
+   if (mountPath != NULL) {
+      return mountPath;
+   }
+
+   if (!Posix_Access(pathName, F_OK)) {
+      return Util_SafeStrdup(pathName);
+   }
+
    return NULL;
 }
index b1ab8624fb6f2733994fb675b3d7c55d13dbacd8..f5cf148eb3a973e7e689d58cd853cc2977656fd6 100644 (file)
@@ -313,6 +313,9 @@ typedef enum {
     *    ASYNC_SOCKET_OPTS_LAYER_<layer name 1>,
     *    ASYNC_SOCKET_OPTS_LAYER_<layer name 2>, ...
     */
+
+   ASYNC_SOCKET_OPTS_LAYER_BLAST_PROXY,
+
 } AsyncSocketOpts_Layer;
 
 /*