From: VMware, Inc <> Date: Wed, 26 Dec 2012 21:25:33 +0000 (-0800) Subject: HGFS: Cleanup the directory entry code to be really platform specific - part IV X-Git-Tag: 2012.12.26-958366~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=665b714a1f35c2e55b67418c8e6b7f513cb01e8b;p=thirdparty%2Fopen-vm-tools.git HGFS: Cleanup the directory entry code to be really platform specific - part IV 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 --- diff --git a/open-vm-tools/lib/hgfsServer/hgfsServer.c b/open-vm-tools/lib/hgfsServer/hgfsServer.c index 923e3e64c..706390743 100644 --- a/open-vm-tools/lib/hgfsServer/hgfsServer.c +++ b/open-vm-tools/lib/hgfsServer/hgfsServer.c @@ -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 /* diff --git a/open-vm-tools/lib/hgfsServer/hgfsServerInt.h b/open-vm-tools/lib/hgfsServer/hgfsServerInt.h index 21cd38dfd..6b0c4dfa0 100644 --- a/open-vm-tools/lib/hgfsServer/hgfsServerInt.h +++ b/open-vm-tools/lib/hgfsServer/hgfsServerInt.h @@ -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 diff --git a/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c b/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c index 55ee3ca32..7e7a8edb7 100644 --- a/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c +++ b/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c @@ -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;