| 1 | /*
|
|---|
| 2 | Directory caching code for Netdrive plugins.
|
|---|
| 3 | Copyright (C) netlabs.org 2010-2016
|
|---|
| 4 | */
|
|---|
| 5 |
|
|---|
| 6 | #ifndef __DIRCACHE_H__
|
|---|
| 7 | #define __DIRCACHE_H__
|
|---|
| 8 |
|
|---|
| 9 | #include <limits.h>
|
|---|
| 10 |
|
|---|
| 11 | #define NDPL_LARGEFILES
|
|---|
| 12 | #define INCL_LONGLONG
|
|---|
| 13 | #include <ndextpl2.h>
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 | /* callback for fsphAddFile32L */
|
|---|
| 17 | typedef void FNADDDIRENTRY(void *plist, void *finfo);
|
|---|
| 18 | typedef FNADDDIRENTRY *PFNADDDIRENTRY;
|
|---|
| 19 |
|
|---|
| 20 | /* callback for releasing memory */
|
|---|
| 21 | typedef void FNFREEDIRENTRY(void *finfo);
|
|---|
| 22 | typedef FNFREEDIRENTRY *PFNFREEDIRENTRY;
|
|---|
| 23 |
|
|---|
| 24 | /* forward declarations */
|
|---|
| 25 | typedef struct DirectoryCache DirectoryCache;
|
|---|
| 26 |
|
|---|
| 27 | /* Directory cache helpers. */
|
|---|
| 28 | int dircache_create(DirectoryCache **ppdc, void* pRes, int cachetimeout, int cachedepth,
|
|---|
| 29 | PFNFREEDIRENTRY fn);
|
|---|
| 30 | void dircache_delete(DirectoryCache *pdc);
|
|---|
| 31 |
|
|---|
| 32 | /* directory cache scanning */
|
|---|
| 33 | int dircache_list_files(DirectoryCache *pdc, PFNADDDIRENTRY fn,
|
|---|
| 34 | void *plist,
|
|---|
| 35 | char* dir_mask, char* fullpath,
|
|---|
| 36 | int *ptotal_received);
|
|---|
| 37 | int dircache_find_path(DirectoryCache *pdc,
|
|---|
| 38 | const char *path,
|
|---|
| 39 | void **finfo,
|
|---|
| 40 | unsigned long *pulAge);
|
|---|
| 41 |
|
|---|
| 42 | /* directory cache creation */
|
|---|
| 43 | void *dircache_write_begin(DirectoryCache *pdc,
|
|---|
| 44 | char* dir_mask, char* fullpath,
|
|---|
| 45 | int cFiles);
|
|---|
| 46 | void dircache_write_entry(DirectoryCache *pdc, void *dircachectx,
|
|---|
| 47 | const char *fname, const void *finfo);
|
|---|
| 48 | void dircache_write_end(DirectoryCache *pdc, void *dircachectx);
|
|---|
| 49 |
|
|---|
| 50 | /* directory cache invalidation */
|
|---|
| 51 | void dircache_invalidate(DirectoryCache *pdc,
|
|---|
| 52 | const char *path,
|
|---|
| 53 | int fParent);
|
|---|
| 54 |
|
|---|
| 55 | #endif // __DIRCACHE_H__
|
|---|