Index: trunk/client/src/dircache.c
===================================================================
--- trunk/client/src/dircache.c	(revision 964)
+++ trunk/client/src/dircache.c	(revision 965)
@@ -1,2 +1,7 @@
+/*
+   Directory caching code for Netdrive plugins.
+   Copyright (C) netlabs.org 2010-2016
+*/
+
 #include <stdio.h>
 #include <stdlib.h>
@@ -5,9 +10,5 @@
 #include <time.h>
 
-#define NDPL_LARGEFILES
-#define INCL_LONGLONG
-#include <ndextpl2.h>
-
-#include "smbwrp.h"
+#include "dircache.h"
 
 extern PLUGINHELPERTABLE2L *ph;
@@ -68,46 +69,5 @@
 }
 
-
-
-/*
- * An entry in the directory cache contains one directory listing.
- */
-typedef struct DirectoryCacheEntry
-{
-    struct DirectoryCacheEntry *pNext;
-    struct DirectoryCacheEntry *pPrev;
-
-    struct DirectoryCache *pdc;
-    
-    smbwrp_fileinfo *aInfos;
-    int cInfos;
-    int cInfosAllocated;
-
-    char *pszPath;
-    ULONG ulHash;
-    ULONG ulLastUpdateTime;
-    int fInvalid;
-} DirectoryCacheEntry;
-
-typedef struct DirectoryCache
-{
-    NDMUTEX mutex;
-
-    DirectoryCacheEntry *pEntriesHead;
-    DirectoryCacheEntry *pEntriesTail;
-    int cEntries;
-
-    int fEnabled;
-    unsigned long ulExpirationTime;
-    int cMaxEntries;
-} DirectoryCache;
-
-enum {
-    CacheFault = 0,
-    CacheOk = 1
-};
-        
-
-static int dceCreate (DirectoryCacheEntry **ppdce, Resource *pRes, const char *path, int cFiles)
+static int dceCreate (DirectoryCacheEntry **ppdce, DirectoryCache* pdc, const char *path, int cFiles)
 {
     DirectoryCacheEntry *pdce = (DirectoryCacheEntry *)malloc(sizeof(DirectoryCacheEntry));
@@ -128,5 +88,5 @@
     pdce->ulHash = computehash (path);
     pdce->ulLastUpdateTime = 0;
-    pdce->pdc = pRes->pdc;
+    pdce->pdc = pdc;
     pdce->fInvalid = 0;
 
@@ -155,5 +115,5 @@
 }
 
-static void dceWriteEntry (Resource *pRes, DirectoryCacheEntry *pdce, const smbwrp_fileinfo *finfo)
+static void dceWriteEntry (DirectoryCache *pdc, DirectoryCacheEntry *pdce, const smbwrp_fileinfo *finfo)
 {
     if (pdce->cInfos >= pdce->cInfosAllocated)
@@ -165,5 +125,5 @@
                                                                 cNewAllocated * sizeof (smbwrp_fileinfo));
 
-        debuglocal(pRes, 9, "dceWriteEntry: [%s] realloc %d -> %d\n", pdce->pszPath, pdce->cInfosAllocated, cNewAllocated);
+        debuglocal(pdc->resource, 9, "dceWriteEntry: [%s] realloc %d -> %d\n", pdce->pszPath, pdce->cInfosAllocated, cNewAllocated);
         if (pNewInfos)
         {
@@ -183,5 +143,5 @@
 }
 
-static void dceAdjust (Resource *pRes, DirectoryCacheEntry *pdce)
+static void dceAdjust (DirectoryCache *pdc, DirectoryCacheEntry *pdce)
 {
     /* If the entry has too many preallocated info structures, adjust the memory allocation */
@@ -196,5 +156,5 @@
                                                                 cNewAllocated * sizeof (smbwrp_fileinfo));
 
-        debuglocal(pRes, 9, "dceAdjust: [%s] realloc %d -> %d\n", pdce->pszPath, pdce->cInfosAllocated, cNewAllocated);
+        debuglocal(pdc->resource, 9, "dceAdjust: [%s] realloc %d -> %d\n", pdce->pszPath, pdce->cInfosAllocated, cNewAllocated);
         if (pNewInfos)
         {
@@ -209,7 +169,7 @@
 }
 
-static int dcePathEqualsTo (Resource *pRes, DirectoryCacheEntry *pdce, const char *path)
-{
-    debuglocal(pRes, 9, "dcePathEqualTo: [%s] [%s]\n", path, pdce->pszPath);
+static int dcePathEqualsTo (DirectoryCache *pdc, DirectoryCacheEntry *pdce, const char *path)
+{
+    debuglocal(pdc->resource, 9, "dcePathEqualTo: [%s] [%s]\n", path, pdce->pszPath);
     return ph->fsphStrICmp (path, pdce->pszPath) == 0; 
 }
@@ -225,15 +185,15 @@
 }
                 
-static struct DirectoryCacheEntry *dcFindDirCache (Resource *pRes, const char *path, int fPrefix)
+static struct DirectoryCacheEntry *dcFindDirCache (DirectoryCache *pdc, const char *path, int fPrefix)
 {
     unsigned long hash = computehash (path);
 
-    DirectoryCacheEntry *iter = pRes->pdc->pEntriesHead;
-
-    debuglocal(pRes, 9, "findDirCache: [%s]\n", path);
+    DirectoryCacheEntry *iter = pdc->pEntriesHead;
+
+    debuglocal(pdc->resource, 9, "findDirCache: [%s]\n", path);
 
     while (iter != NULL)
     {
-        debuglocal(pRes, 9, "findDirCache: entry [%s]\n", iter->pszPath);
+        debuglocal(pdc->resource, 9, "findDirCache: entry [%s]\n", iter->pszPath);
         if (fPrefix)
         {
@@ -246,5 +206,5 @@
         {
             if (    iter->ulHash == hash
-                 && dcePathEqualsTo (pRes, iter, path)
+                 && dcePathEqualsTo (pdc, iter, path)
                )
             {
@@ -255,15 +215,14 @@
     }
 
-    debuglocal(pRes, 9, "findDirCache: %p\n", iter);
+    debuglocal(pdc->resource, 9, "findDirCache: %p\n", iter);
 
     return iter;
 }
 
-static int dcCreate (struct DirectoryCache **ppdc)
+static int dcCreate (struct DirectoryCache **ppdc, void* pRes)
 {
     int rc;
 
     DirectoryCache *pdc = (DirectoryCache *)malloc(sizeof (DirectoryCache));
-    
     if (!pdc)
     {
@@ -272,5 +231,4 @@
 
     rc = lockCreate (&pdc->mutex);
-
     if (rc != NO_ERROR)
     {
@@ -285,4 +243,5 @@
     pdc->fEnabled = 0;
     pdc->ulExpirationTime = -1;
+    pdc->resource = pRes;
     
     *ppdc = pdc;
@@ -363,16 +322,16 @@
 };
 
-static int dcExistsInCache (Resource *pRes, const char *path)
+static int dcExistsInCache (DirectoryCache *pdc, const char *path)
 {
     int rc = CacheFault;
         
-    if (pRes->pdc->fEnabled)
-    {
-        if (dcFindDirCache (pRes, path, 0) != NULL)
+    if (pdc->fEnabled)
+    {
+        if (dcFindDirCache (pdc, path, 0) != NULL)
         {
             rc = CacheOk;
         }
         
-        debuglocal(pRes, 9, "ExistsInCache: [%s], %d\n", path, rc);
+        debuglocal(pdc->resource, 9, "ExistsInCache: [%s], %d\n", path, rc);
     }
     
@@ -380,23 +339,21 @@
 }
         
-static int dcRead (Resource *pRes, const char *path,
+static int dcRead (DirectoryCache *pdc, const char *path,
                    PFNADDDIRENTRY fn,
-                   filelist_state *state,
+                   void* plist,
                    int *ptotal_received, int fForceCache)
 {
     int i;
-    
-    DirectoryCache *pdc = pRes->pdc;
     int rc = CacheFault;
-        
+
     if (pdc->fEnabled)
     {
         DirectoryCacheEntry *pdce;
 
-        pdce = dcFindDirCache (pRes, path, 0);
+        pdce = dcFindDirCache (pdc, path, 0);
         
         if (pdce)
         {
-            debuglocal(pRes, 9, "CacheRead: entry %p found for [%s]\n", pdce, path);
+            debuglocal(pdc->resource, 9, "dcRead: entry %p found for [%s]\n", pdce, path);
             
             if (fForceCache)
@@ -404,5 +361,5 @@
                 for (i = 0; i < pdce->cInfos; i++)
                 {
-                    fn ("", &pdce->aInfos[i], path, state);
+                    fn ("", &pdce->aInfos[i], path, plist);
                 }
 
@@ -413,5 +370,5 @@
                 if (dceExpired (pdce, pdc->ulExpirationTime))
                 {
-                    debuglocal(pRes, 9, "CacheRead: expired\n");
+                    debuglocal(pdc->resource, 9, "dcRead: expired\n");
                     dcRemoveEntry (pdce);
                     dceDelete (pdce);
@@ -421,5 +378,5 @@
                     for (i = 0; i < pdce->cInfos; i++)
                     {
-                        fn ("", &pdce->aInfos[i], path, state);
+                        fn ("", &pdce->aInfos[i], path, plist);
                     }
 
@@ -434,5 +391,5 @@
         }
         
-        debuglocal(pRes, 9, "CacheRead: [%s], %d\n", path, rc);
+        debuglocal(pdc->resource, 9, "dcRead: [%s], %d\n", path, rc);
     }
     
@@ -440,16 +397,16 @@
 }
 
-static DirectoryCacheEntry *dcWriteBegin (Resource *pRes, const char *path, int cFiles)
+static DirectoryCacheEntry *dcWriteBegin (DirectoryCache *pdc, const char *path, int cFiles)
 {
     DirectoryCacheEntry *pdce = NULL;
 
-    if (pRes->pdc->fEnabled)
-    {
-        pdce = dcFindDirCache (pRes, path, 0);
+    if (pdc->fEnabled)
+    {
+        pdce = dcFindDirCache (pdc, path, 0);
         
         if (!pdce)
         {
             /* Does not exist in the cache yet. */
-            dceCreate (&pdce, pRes, path, cFiles);
+            dceCreate (&pdce, pdc, path, cFiles);
         }
         else
@@ -466,5 +423,5 @@
         }
         
-        debuglocal(pRes, 9, "CacheWriteBegin: %s\n", path);
+        debuglocal(pdc->resource, 9, "CacheWriteBegin: %s\n", path);
     }
     
@@ -473,11 +430,11 @@
 
 
-static void dcInvalidate (Resource *pRes, const char *path, int fPrefix)
+static void dcInvalidate (DirectoryCache *pdc, const char *path, int fPrefix)
 {
     DirectoryCacheEntry *pdce;
     
-    debuglocal(pRes, 9, "CacheInvalidate: [%s]\n", path);
-
-    pdce = dcFindDirCache (pRes, path, fPrefix);
+    debuglocal(pdc->resource, 9, "CacheInvalidate: [%s]\n", path);
+
+    pdce = dcFindDirCache (pdc, path, fPrefix);
 
     while (pdce)
@@ -486,9 +443,9 @@
         dceDelete (pdce);
         
-        pdce = dcFindDirCache (pRes, path, fPrefix);
-    }
-}
-
-static int dcFindPath (Resource *pRes, DirectoryCache *pdc,
+        pdce = dcFindDirCache (pdc, path, fPrefix);
+    }
+}
+
+static int dcFindPath (DirectoryCache *pdc,
                        const char *path,
                        const char *parent,
@@ -501,12 +458,12 @@
     unsigned long hash = computehash (parent);
 
-    debuglocal(pRes, 9, "dcFindPath: [%s][%s]\n", parent, name);
+    debuglocal(pdc->resource, 9, "dcFindPath: [%s][%s]\n", parent, name);
 
     while (pdce != NULL)
     {
-        debuglocal(pRes, 9, "dcFindPath: entry [%s]\n", pdce->pszPath);
+        debuglocal(pdc->resource, 9, "dcFindPath: entry [%s]\n", pdce->pszPath);
 
         if (   pdce->ulHash == hash
-            && dcePathEqualsTo (pRes, pdce, parent))
+            && dcePathEqualsTo (pdc, pdce, parent))
         {
             /* This entry should contain the path. */
@@ -518,5 +475,5 @@
                     *finfo = pdce->aInfos[i];
                     *pulAge = timesec () - pdce->ulLastUpdateTime;
-                    debuglocal(pRes, 9, "dircache: FindPath %s found, age %d\n", path, *pulAge);
+                    debuglocal(pdc->resource, 9, "dircache: FindPath %s found, age %d\n", path, *pulAge);
                     return 1;
                 }
@@ -527,9 +484,9 @@
     }
 
-    debuglocal(pRes, 9, "dircache: FindPath %s not found\n", path);
+    debuglocal(pdc->resource, 9, "dircache: FindPath %s not found\n", path);
     return 0;
 }
 
-static int dcCreateDirPath(char *path, int cbPath, filelist_state *state)
+static int dcCreateDirPath(char *path, int cbPath, char* dir_mask, char* fullpath)
 {
     /* State contains the original path passed to the plugin (fullpath) and
@@ -539,5 +496,5 @@
      */
     int cbDir;
-    int cbMask = strlen(state->dir_mask) + 1;
+    int cbMask = strlen(dir_mask) + 1;
     if (cbMask > cbPath)
     {
@@ -551,5 +508,5 @@
     {
        cbDir--; /* Exclude the slash. */
-       memcpy(path, state->fullpath, cbDir);
+       memcpy(path, fullpath, cbDir);
     }
     path[cbDir] = 0;
@@ -562,28 +519,27 @@
  */
 
-int dircache_create(Resource *pRes)
-{
-    struct DirectoryCache **ppdc = &pRes->pdc;
-    unsigned long ulExpirationTime = pRes->cachetimeout;
-    int cMaxEntries = pRes->cachedepth;
+int dircache_create( DirectoryCache **ppdc, void* pRes,
+                     int cachetimeout, int cachedepth)
+{
+    unsigned long ulExpirationTime = cachetimeout;
+    int cMaxEntries = cachedepth;
     int rc;
 
-    debuglocal(pRes, 9, "dircache_create: %u seconds, %d entries\n", ulExpirationTime, cMaxEntries);
-
-    rc = dcCreate(ppdc);
-
+    debuglocal( pRes, 9, "dircache_create: %u seconds, %d entries\n", ulExpirationTime, cMaxEntries);
+
+    rc = dcCreate(ppdc, pRes);
     if (rc == NO_ERROR)
     {
         dcEnable (*ppdc, 1, ulExpirationTime, cMaxEntries);
-    }
-
-    debuglocal(pRes, 9, "dircache_create: %p, rc = %d\n", *ppdc, rc);
+
+    }
+
+    debuglocal( (*ppdc)->resource, 9, "dircache_create: %p, rc = %d\n", *ppdc, rc);
     return rc;
 }
 
-void dircache_delete(Resource *pRes)
-{
-    DirectoryCache *pdc = pRes->pdc;
-    debuglocal(pRes, 9, "dircache_delete: %p\n", pdc);
+void dircache_delete(DirectoryCache *pdc)
+{
+    debuglocal(pdc->resource, 9, "dircache_delete: %p\n", pdc);
 
     if (pdc)
@@ -593,21 +549,19 @@
 }
 
-
-int dircache_list_files(PFNADDDIRENTRY fn,
-                        filelist_state *state,
+int dircache_list_files(DirectoryCache *pdc, PFNADDDIRENTRY fn,
+                        void* plist,
+                        char* dir_mask, char* fullpath,
                         int *ptotal_received)
 {
     int rc;
-    DirectoryCache *pdc = state->pConn->pRes->pdc;
-
-    int cbPath = strlen(state->fullpath) + 1;
-    char *path = alloca(cbPath);
-    if (!dcCreateDirPath(path, cbPath, state))
+
+    int cbPath = strlen(fullpath) + 1;
+    char *path = (char*) alloca(cbPath);
+    if (!dcCreateDirPath(path, cbPath, dir_mask, fullpath))
     {
         return 0;
     }
 
-    debuglocal(state->pConn->pRes, 9, "dircache_list_files [%s]\n", path);
-
+    debuglocal(pdc->resource, 9, "dircache_list_files [%s]\n", path);
     if (!pdc)
     {
@@ -617,5 +571,5 @@
     lockRequest (pdc->mutex);
 
-    rc = dcRead (state->pConn->pRes, path, fn, state, ptotal_received, 0);
+    rc = dcRead (pdc, path, fn, plist, ptotal_received, 0);
 
     lockRelease (pdc->mutex);
@@ -624,18 +578,18 @@
 }
 
-void *dircache_write_begin(filelist_state *state,
+void *dircache_write_begin(DirectoryCache *pdc,
+                           char* dir_mask, char* fullpath,
                            int cFiles)
 {
-    DirectoryCache *pdc = state->pConn->pRes->pdc;
     DirectoryCacheEntry *pdce = NULL;
 
-    int cbPath = strlen(state->fullpath) + 1;
-    char *path = alloca(cbPath);
-    if (!dcCreateDirPath(path, cbPath, state))
+    int cbPath = strlen(fullpath) + 1;
+    char *path = (char*) alloca(cbPath);
+    if (!dcCreateDirPath(path, cbPath, dir_mask, fullpath))
     {
         return NULL;
     }
 
-    debuglocal(state->pConn->pRes, 9, "dircache_write_begin pdc %p path [%s]\n", pdc, path);
+    debuglocal(pdc->resource, 9, "dircache_write_begin pdc %p path [%s]\n", pdc, path);
 
     if (!pdc)
@@ -655,17 +609,18 @@
     }
     
-    pdce = dcWriteBegin (state->pConn->pRes, path, cFiles);
+    pdce = dcWriteBegin (pdc, path, cFiles);
     
     lockRelease (pdc->mutex);
 
-    debuglocal(state->pConn->pRes, 9, "dircache_write_begin returning ctx %p\n", pdce);
+    debuglocal(pdc->resource, 9, "dircache_write_begin returning ctx %p\n", pdce);
     return (void *)pdce;
 }
 
-void dircache_write_entry(Resource *pRes, void *dircachectx, const smbwrp_fileinfo *finfo)
+void dircache_write_entry(DirectoryCache *pdc, void *dircachectx,
+                          const smbwrp_fileinfo *finfo)
 {
     DirectoryCacheEntry *pdce = (DirectoryCacheEntry *)dircachectx;
 
-    debuglocal(pRes, 9, "dircache_write_entry %p\n", pdce);
+    debuglocal(pdc->resource, 9, "dircache_write_entry %p\n", pdce);
     
     if (!pdce)
@@ -676,15 +631,14 @@
     lockRequest (pdce->pdc->mutex);
     
-    dceWriteEntry (pRes, pdce, finfo);
+    dceWriteEntry (pdc, pdce, finfo);
     
     lockRelease (pdce->pdc->mutex);
 }
 
-void dircache_write_end(Resource *pRes, void *dircachectx)
+void dircache_write_end(DirectoryCache *pdc, void *dircachectx)
 {
     DirectoryCacheEntry *pdce = (DirectoryCacheEntry *)dircachectx;
-    DirectoryCache *pdc;
-
-    debuglocal(pRes, 9, "dircache_write_end: pdce %p\n", pdce);
+
+    debuglocal(pdc->resource, 9, "dircache_write_end: pdce %p\n", pdce);
 
     if (!pdce)
@@ -692,6 +646,4 @@
         return;
     }
-    
-    pdc = pdce->pdc;
     
     lockRequest (pdc->mutex);
@@ -704,5 +656,5 @@
     else
     {
-        dceAdjust (pRes, pdce);
+        dceAdjust (pdc, pdce);
         dcInsertEntry (pdce);
     }
@@ -711,10 +663,9 @@
 }
 
-void dircache_invalidate(const char *path,
-                         Resource *pRes,
+void dircache_invalidate(DirectoryCache *pdc,
+                         const char *path,
                          int fParent)
 {
-    struct DirectoryCache *pdc = pRes->pdc;
-    debuglocal(pRes, 9, "dircache_invalidate [%s], parent %d\n", path, fParent);
+    debuglocal(pdc->resource, 9, "dircache_invalidate [%s], parent %d\n", path, fParent);
 
     if (!pdc)
@@ -731,17 +682,19 @@
         memcpy(p, path, cb);
         char *lastSlash = ph->fsphStrRChr(p, '\\');
+        if (!lastSlash)
+            lastSlash = ph->fsphStrRChr(p, '/');
         if (lastSlash)
         {
             *lastSlash = 0;
-            dcInvalidate (pRes, p, 0);
+            dcInvalidate (pdc, p, 0);
         }
         else
         {
-            dcInvalidate (pRes, "", 0);
+            dcInvalidate (pdc, "", 0);
         }
     }
     else
     {
-        dcInvalidate (pRes, path, 0);
+        dcInvalidate (pdc, path, 0);
     }
     
@@ -751,10 +704,9 @@
 }
 
-int dircache_find_path(Resource *pRes,
+int dircache_find_path(DirectoryCache *pdc,
                        const char *path,
                        smbwrp_fileinfo *finfo,
                        unsigned long *pulAge)
 {
-    struct DirectoryCache *pdc = pRes->pdc;
     int cb;
     char *p;
@@ -762,5 +714,5 @@
     int fFound = 0;
 
-    debuglocal(pRes, 9, "dircache_find_path [%s]\n", path);
+    debuglocal(pdc->resource, 9, "dircache_find_path [%s]\n", path);
 
     if (!pdc)
@@ -782,13 +734,15 @@
     memcpy(p, path, cb);
     lastSlash = ph->fsphStrRChr(p, '\\');
+    if (!lastSlash)
+        lastSlash = ph->fsphStrRChr(p, '/');
     if (lastSlash)
     {
         *lastSlash = 0;
-        fFound = dcFindPath (pRes, pdc, path, p, lastSlash + 1, finfo, pulAge);
+        fFound = dcFindPath (pdc, path, p, lastSlash + 1, finfo, pulAge);
     }
     else
     {
         /* Find in the root directory. p is the name. */
-        fFound = dcFindPath (pRes, pdc, path, "", p, finfo, pulAge);
+        fFound = dcFindPath (pdc, path, "", p, finfo, pulAge);
     }
     
Index: trunk/client/src/dircache.h
===================================================================
--- trunk/client/src/dircache.h	(revision 965)
+++ trunk/client/src/dircache.h	(revision 965)
@@ -0,0 +1,105 @@
+/*
+   Directory caching code for Netdrive plugins.
+   Copyright (C) netlabs.org 2010-2016
+*/
+
+#ifndef __DIRCACHE_H__
+#define __DIRCACHE_H__
+
+#include <limits.h>
+
+#define NDPL_LARGEFILES
+#define INCL_LONGLONG
+#include <ndextpl2.h>
+
+#include "smbwrp.h"
+
+//
+// enable if not defined in your plugin
+//
+// dircache code uses only the fname field to scan the directory listing.
+// other fields are just passed to FNADD callback as are.
+//
+#if 0
+typedef struct smbwrp_fileinfo
+{
+    unsigned long long size;
+    unsigned long mtime;
+    unsigned type;
+    char fname[PATH_MAX];
+} smbwrp_fileinfo;
+#endif
+
+/*
+ * An entry in the directory cache contains one directory listing.
+ */
+typedef struct DirectoryCacheEntry
+{
+    struct DirectoryCacheEntry *pNext;
+    struct DirectoryCacheEntry *pPrev;
+
+    struct DirectoryCache *pdc;
+
+    smbwrp_fileinfo *aInfos;
+    int cInfos;
+    int cInfosAllocated;
+
+    char *pszPath;
+    ULONG ulHash;
+    ULONG ulLastUpdateTime;
+    int fInvalid;
+} DirectoryCacheEntry;
+
+typedef struct DirectoryCache
+{
+    NDMUTEX mutex;
+
+    DirectoryCacheEntry *pEntriesHead;
+    DirectoryCacheEntry *pEntriesTail;
+    int cEntries;
+    int fEnabled;
+    unsigned long ulExpirationTime;
+    int cMaxEntries;
+    // resource handle, used only for per-share logging
+    void* resource;
+} DirectoryCache;
+
+enum {
+    CacheFault = 0,
+    CacheOk = 1
+};
+
+
+/* Directory cache helpers. */
+int dircache_create(DirectoryCache **ppdc, void* pRes, int cachetimeout, int cachedepth);
+void dircache_delete(DirectoryCache *pdc);
+
+/* callback for fsphAddFile32L */
+typedef void FNADDDIRENTRY(const char *mnt, smbwrp_fileinfo *finfo,
+                           const char *mask, void *state);
+typedef FNADDDIRENTRY *PFNADDDIRENTRY;
+
+/* directory cache scanning */
+int dircache_list_files(DirectoryCache *pdc, PFNADDDIRENTRY fn,
+                        void *plist,
+                        char* dir_mask, char* fullpath,
+                        int *ptotal_received);
+int dircache_find_path(DirectoryCache *pdc,
+                       const char *path,
+                       smbwrp_fileinfo *finfo,
+                       unsigned long *pulAge);
+
+/* directory cache creation */
+void *dircache_write_begin(DirectoryCache *pdc,
+                           char* dir_mask, char* fullpath,
+                           int cFiles);
+void dircache_write_entry(DirectoryCache *pdc, void *dircachectx,
+                          const smbwrp_fileinfo *finfo);
+void dircache_write_end(DirectoryCache *pdc, void *dircachectx);
+
+/* directory cache invalidation */
+void dircache_invalidate(DirectoryCache *pdc,
+                         const char *path,
+                         int fParent);
+
+#endif // __DIRCACHE_H__
