Changeset 966
- Timestamp:
- Aug 19, 2016, 2:24:06 PM (9 years ago)
- Location:
- trunk/client/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/src/ndpsmb.c
r964 r966 29 29 #define INCL_LONGLONG 30 30 #include <ndextpl2.h> 31 #include "dircache.h" 31 32 #include "smbwrp.h" 32 33 #include "util.h" … … 499 500 * the above values come from the gui. default: timeout 10; listings: 32 500 501 */ 501 dircache_create(pRes); 502 dircache_create(&pRes->pdc, (void*) pRes, 503 pRes->cachetimeout, pRes->cachedepth); 502 504 503 505 return rc; … … 715 717 Resource *pRes = (Resource *)resource; 716 718 ENTER(); 717 dircache_delete(pRes); 719 720 // free cache dir 721 dircache_delete(pRes->pdc); 722 723 // free local resources 718 724 memset(&pRes->srv, 0, sizeof(pRes->srv)); 719 725 debuglocal(pRes, 9, "NdpFreeResource %d\n", NO_ERROR); … … 957 963 // First check if there is information in the directory cache. 958 964 unsigned long ulAge = 0; 959 if (dircache_find_path(pRes , szPath, &finfo, &ulAge))965 if (dircache_find_path(pRes->pdc, szPath, &finfo, &ulAge)) 960 966 { 961 967 if (ulAge <= 15) /* @todo configurable. */ … … 1201 1207 1202 1208 // delete the dir cache 1203 dircache_invalidate( szPathName, pRes, 1);1209 dircache_invalidate(pRes->pdc, szPathName, 1); 1204 1210 1205 1211 do { … … 1514 1520 debuglocal(pRes, 9, "NdpForceDelete in [%p]\n", pConn); 1515 1521 1516 dircache_invalidate( szFile, pRes, 1);1522 dircache_invalidate(pRes->pdc, szFile, 1); 1517 1523 1518 1524 do { … … 1543 1549 debuglocal(pRes, 9, "NdpCreateDir in [%p]\n", pConn); 1544 1550 1545 dircache_invalidate( szDirName, pRes, 1);1551 dircache_invalidate(pRes->pdc, szDirName, 1); 1546 1552 1547 1553 do { … … 1575 1581 debuglocal(pRes, 9, "NdpDeleteDir in [%p]\n", pConn); 1576 1582 1577 dircache_invalidate( szDir, pRes, 1);1583 dircache_invalidate(pRes->pdc, szDir, 1); 1578 1584 1579 1585 do { … … 1605 1611 debuglocal(pRes, 9, "NdpMove in [%p] from <%s> to <%s>\n", pConn, szSrc, szDst); 1606 1612 1607 dircache_invalidate( szSrc, pRes, 1);1608 dircache_invalidate( szDst, pRes, 1);1613 dircache_invalidate(pRes->pdc, szSrc, 1); 1614 dircache_invalidate(pRes->pdc, szDst, 1); 1609 1615 1610 1616 do … … 1669 1675 1670 1676 if (flags & O_CREAT) 1671 dircache_invalidate( szFileName, pRes, 1);1677 dircache_invalidate(pRes->pdc, szFileName, 1); 1672 1678 1673 1679 do { … … 2015 2021 2016 2022 // delete the dir cache 2017 dircache_invalidate(p Conn->file.fullname, pRes, 1);2023 dircache_invalidate(pRes->pdc, pConn->file.fullname, 1); 2018 2024 2019 2025 do { … … 2222 2228 * a new function needs to be done to update only one file in the cache 2223 2229 */ 2224 dircache_invalidate(p Conn->file.fullname, pRes, 1);2230 dircache_invalidate(pRes->pdc, pConn->file.fullname, 1); 2225 2231 2226 2232 do { -
trunk/client/src/smbwrp.c
r960 r966 26 26 #include "libsmb/clirap.h" 27 27 #include "trans2.h" 28 29 #include "dircache.h" 28 30 #include "smbwrp.h" 29 31 … … 806 808 807 809 // Try to get the listing from cache. 808 if (dircache_list_files(fn, state, &num_finfo)) 810 if (dircache_list_files(pRes->pdc, fn, state->plist, 811 state->mask, (char*) state->fullpath, &num_finfo)) 809 812 return(num_finfo); // Got from cache 810 813 … … 838 841 goto fail; 839 842 840 dircachectx = dircache_write_begin(state, num_finfo); 843 dircachectx = dircache_write_begin(pRes->pdc, state->mask, 844 (char*) state->fullpath, num_finfo); 841 845 842 846 debuglocal(pRes, 4,"list_files: got %d files\n", num_finfo); … … 854 858 fn(cli->dfs_mountpoint, &wrpfinfo, mask, state); 855 859 // Also add the entry to the cache. 856 dircache_write_entry(pRes, dircachectx, &wrpfinfo); 857 } 858 859 dircache_write_end(pRes, dircachectx); 860 dircache_write_entry(pRes->pdc, dircachectx, &wrpfinfo); 861 } 862 863 dircache_write_end(pRes->pdc, dircachectx); 864 860 865 fail: 861 866 TALLOC_FREE(frame); … … 988 993 } 989 994 990 991 #pragma pack(1)992 typedef struct _FEA993 {994 unsigned char fEA; // flags995 unsigned char cbName; // name length not including NULL996 unsigned short cbValue; // value length997 } FEA;998 999 typedef struct _FEALIST1000 {1001 unsigned long cbList; // total bytes of structure including full list1002 FEA list[1]; // variable length FEA structures1003 } FEALIST;1004 #pragma pack()1005 995 1006 996 static int unilistea(Resource *pRes, cli_state * cli, char *fname, void * buffer, unsigned long size) -
trunk/client/src/smbwrp.h
r960 r966 130 130 } FSALLOCATE; 131 131 #endif 132 133 struct DirectoryCache;134 132 135 133 typedef struct _Resource … … 203 201 int _System smbwrp_dskattr(Resource *pRes, cli_state * cli, FSALLOCATE *pfsa); 204 202 205 /* Directory cache helpers. */206 int dircache_create(Resource *pRes);207 void dircache_delete(Resource *pRes);208 209 typedef void FNADDDIRENTRY(const char*, smbwrp_fileinfo *, const char *, void *);210 typedef FNADDDIRENTRY *PFNADDDIRENTRY;211 212 /* Note: dircache_list_files or dircache_write_begin construct the directory path213 * using information in the filelist_state structure.214 */215 int dircache_list_files(PFNADDDIRENTRY fn,216 filelist_state *state,217 int *ptotal_received);218 219 void *dircache_write_begin(filelist_state *state,220 int cFiles);221 void dircache_write_entry(Resource *pRes, void *dircachectx, const smbwrp_fileinfo *finfo);222 void dircache_write_end(Resource *pRes, void *dircachectx);223 224 void dircache_invalidate(const char *path,225 Resource *pRes,226 int fParent);227 228 int dircache_find_path(Resource *pRes,229 const char *path,230 smbwrp_fileinfo *finfo,231 unsigned long *pulAge);232 233 203 /* Prototype the debug log helper. */ 234 204 void debuglocal(Resource *pRes, int level, const char * fmt, ...);
Note:
See TracChangeset
for help on using the changeset viewer.