]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
HGFS: Cleanup the directory entry code to be really platform specific - part IV
authorVMware, Inc <>
Wed, 26 Dec 2012 21:25:33 +0000 (13:25 -0800)
committerDmitry Torokhov <dtor@vmware.com>
Thu, 27 Dec 2012 19:47:00 +0000 (11:47 -0800)
Migrate over the remainining directory entry usage in the platform independent
code over to the platform specific code. The remaining use is the debug only
dump dents function.

Signed-off-by: Dmitry Torokhov <dtor@vmware.com>
open-vm-tools/lib/hgfsServer/hgfsServer.c
open-vm-tools/lib/hgfsServer/hgfsServerInt.h
open-vm-tools/lib/hgfsServer/hgfsServerLinux.c

index 923e3e64c50af7ca65c3628a8094e3153e973e3d..7063907433ea0a3b16f7f802b284dc63c769f01e 100644 (file)
@@ -4928,46 +4928,39 @@ HgfsServerIsSharedFolderOnly(char const *cpName,// IN:  Cross-platform filename
 }
 
 
+#ifdef VMX86_LOG
 /*
  *-----------------------------------------------------------------------------
  *
- * HgfsServerDumpDents --
+ * HgfsServerDirDumpDents --
  *
  *    Dump a set of directory entries (debugging code)
  *
  * Results:
- *    None
+ *    None.
  *
  * Side effects:
- *    None
+ *    None.
  *
  *-----------------------------------------------------------------------------
  */
 
 void
-HgfsServerDumpDents(HgfsHandle searchHandle,  // IN: Handle to dump dents from
-                    HgfsSessionInfo *session) // IN: Session info
+HgfsServerDirDumpDents(HgfsHandle searchHandle,  // IN: Handle to dump dents from
+                       HgfsSessionInfo *session) // IN: Session info
 {
-#ifdef VMX86_LOG
-   unsigned int i;
    HgfsSearch *search;
 
    MXUser_AcquireExclLock(session->searchArrayLock);
 
    search = HgfsSearchHandle2Search(searchHandle, session);
    if (search != NULL) {
-      Log("%s: %u dents in \"%s\"\n", __FUNCTION__, search->numDents,
-          search->utf8Dir);
-
-      Log("Dumping dents:\n");
-      for (i = 0; i < search->numDents; i++) {
-         Log("\"%s\"\n", search->dents[i]->d_name);
-      }
+      HgfsPlatformDirDumpDents(search);
    }
 
    MXUser_ReleaseExclLock(session->searchArrayLock);
-#endif
 }
+#endif
 
 
 /*
index 21cd38dfd74254010bbf2a944bd02bf727b17663..6b0c4dfa02e4d825f71866fb5791a76a3072913f 100644 (file)
@@ -561,9 +561,20 @@ Bool
 HgfsRemoveSearch(HgfsHandle searchHandle,
                  HgfsSessionInfo *session);
 
+#ifdef VMX86_LOG
+#define HGFS_SERVER_DIR_DUMP_DENTS(_searchHandle, _session) do {    \
+      if (DOLOG(4)) {                                               \
+         HgfsServerDirDumpDents(_searchHandle, _session);           \
+      }                                                             \
+   } while (0)
+
 void
-HgfsServerDumpDents(HgfsHandle searchHandle,   // IN: Handle to dump dents from
-                    HgfsSessionInfo *session); // IN: Session info
+HgfsServerDirDumpDents(HgfsHandle searchHandle,   // IN: Handle to dump dents from
+                       HgfsSessionInfo *session); // IN: Session info
+#else
+#define HGFS_SERVER_DIR_DUMP_DENTS(_searchHandle, _session) do {} while (0)
+#endif
+
 
 DirectoryEntry *
 HgfsGetSearchResult(HgfsHandle handle,        // IN: Handle to search
@@ -1173,6 +1184,11 @@ HgfsInternalStatus
 HgfsPlatformRestartSearchDir(HgfsHandle handle,               // IN: search handle
                              HgfsSessionInfo *session,        // IN: session info
                              DirectorySearchType searchType); // IN: Kind of search
+#ifdef VMX86_LOG
+void
+HgfsPlatformDirDumpDents(HgfsSearch *search);         // IN: search
+#endif
+
 HgfsInternalStatus
 HgfsPlatformReadFile(HgfsHandle file,             // IN: Hgfs file handle
                      HgfsSessionInfo *session,    // IN: session info
index 55ee3ca326ddb797f300c05282f930b1fe0f7557..7e7a8edb719aa01e662a968d0982b524cde6bb0f 100644 (file)
@@ -3180,6 +3180,40 @@ HgfsPlatformVDirStatsFs(HgfsSessionInfo *session,  // IN: session info
 }
 
 
+#ifdef VMX86_LOG
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * HgfsPlatformDirDumpDents --
+ *
+ *    Dump a set of directory entries (debugging code).
+ *    Note: this must be called with the session search lock acquired.
+ *
+ * Results:
+ *    None.
+ *
+ * Side effects:
+ *    None.
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+void
+HgfsPlatformDirDumpDents(HgfsSearch *search)         // IN: search
+{
+   unsigned int i;
+
+   ASSERT(search != NULL);
+
+   Log("%s: %u dents in \"%s\"\n", __FUNCTION__, search->numDents, search->utf8Dir);
+
+   for (i = 0; i < search->numDents; i++) {
+      Log("\"%s\"\n", search->dents[i]->d_name);
+   }
+}
+#endif
+
+
 /*
  *-----------------------------------------------------------------------------
  *
@@ -4243,8 +4277,8 @@ HgfsPlatformSearchDir(HgfsNameStatus nameStatus,       // IN: name status
       status = HgfsPlatformConvertFromNameStatus(nameStatus);
    }
 
-   if (DOLOG(4)) {
-      HgfsServerDumpDents(*handle, session);
+   if (status == 0) {
+      HGFS_SERVER_DIR_DUMP_DENTS(*handle, session);
    }
 
    return status;