Ignore:
Timestamp:
Aug 26, 2016, 6:57:36 PM (9 years ago)
Author:
Yuri Dario
Message:

Made code completely independent from samba data structures. ticket#274.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/client/src/dircache.h

    r969 r975  
    1313#include <ndextpl2.h>
    1414
    15 //
    16 // enable if not defined in your plugin
    17 //
    18 // dircache code uses only the fname field to scan the directory listing.
    19 // other fields are just passed to FNADD callback as are.
    20 //
    21 #if 0
    22 typedef struct smbwrp_fileinfo
     15
     16/* callback for fsphAddFile32L */
     17typedef void FNADDDIRENTRY(void *plist, void *finfo);
     18typedef FNADDDIRENTRY *PFNADDDIRENTRY;
     19
     20/* callback for releasing memory */
     21typedef void FNFREEDIRENTRY(void *finfo);
     22typedef FNFREEDIRENTRY *PFNFREEDIRENTRY;
     23
     24
     25/*
     26 * An entry holds file name and a pointer to custom data
     27 */
     28typedef struct DirectoryCacheEntryData
    2329{
    24     unsigned long long size;
    25     unsigned long mtime;
    26     unsigned type;
    27     char fname[PATH_MAX];
    28 } smbwrp_fileinfo;
    29 #else
    30 
    31 // define as forward reference here
    32 typedef struct smbwrp_fileinfo smbwrp_fileinfo;
    33 
    34 #endif
     30    const char  fname[PATH_MAX];
     31    const void* customData;
     32} DirectoryCacheEntryData;
    3533
    3634/*
     
    4240    struct DirectoryCacheEntry *pPrev;
    4341
    44     smbwrp_fileinfo *aInfos;
     42    DirectoryCacheEntryData *aInfos;
    4543    int cInfos;
    4644    int cInfosAllocated;
     
    6462    // resource handle, used only for per-share logging
    6563    void* resource;
     64    // callback called to release data structures
     65    PFNFREEDIRENTRY release;
     66
    6667} DirectoryCache;
    6768
     
    7374
    7475/* Directory cache helpers. */
    75 int dircache_create(DirectoryCache **ppdc, void* pRes, int cachetimeout, int cachedepth);
     76int dircache_create(DirectoryCache **ppdc, void* pRes, int cachetimeout, int cachedepth,
     77                    PFNFREEDIRENTRY fn);
    7678void dircache_delete(DirectoryCache *pdc);
    77 
    78 /* callback for fsphAddFile32L */
    79 typedef void FNADDDIRENTRY(const char *mnt, smbwrp_fileinfo *finfo,
    80                            const char *mask, void *state);
    81 typedef FNADDDIRENTRY *PFNADDDIRENTRY;
    8279
    8380/* directory cache scanning */
     
    8885int dircache_find_path(DirectoryCache *pdc,
    8986                       const char *path,
    90                        smbwrp_fileinfo *finfo,
     87                       void **finfo,
    9188                       unsigned long *pulAge);
    9289
     
    9693                           int cFiles);
    9794void dircache_write_entry(DirectoryCache *pdc, void *dircachectx,
    98                           const smbwrp_fileinfo *finfo);
     95                          const char *fname, const void *finfo);
    9996void dircache_write_end(DirectoryCache *pdc, void *dircachectx);
    10097
Note: See TracChangeset for help on using the changeset viewer.