Changeset 497
- Timestamp:
- Dec 13, 2010, 4:05:51 PM (15 years ago)
- Location:
- branches/client-2.0/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/client-2.0/src/Makefile.kmk
r442 r497 32 32 printf.c \ 33 33 util.c \ 34 dircache.c \ 34 35 smbwrp.c 35 36 -
branches/client-2.0/src/debug.c
r439 r497 51 51 struct stat filestat; 52 52 53 // do we have to log at all 54 if (!debuglvl(level)) 55 { 56 return; 57 } 58 53 59 // if the file ndpsmb.dbg is around we write a logfile 54 60 if (!debugfile[0]) … … 80 86 } /* endif */ 81 87 82 if (!debuglvl(level))83 {84 return;85 }86 88 do 87 89 { -
branches/client-2.0/src/help/ndpsmb.ipf
r493 r497 138 138 :li.:link reftype=hd res=001.Version 1.0:elink. 139 139 :li.:link reftype=hd res=002.Version 1.5.0:elink. 140 :li.:link reftype=hd res=003.Version 2.0.0:elink. 140 141 :eul 141 142 :h2 res=001.Version 1.0 … … 258 259 :eul. 259 260 :eul. 261 :h2 res=003.Version 2.0.0 262 :ul. 263 :li.beta1 264 :ul. 265 :li.added dir caching 266 :eul. 267 :eul. 260 268 .****************************************************** 261 269 :h1.Credit … … 267 275 :li.Alex Taylor (aka AlexT) 268 276 :li.Nikolay Kolosov (aka nickk) 277 :li.Vitali Pelenyov (aka sunlover) 269 278 :li.and all we missed 270 279 :eul. -
branches/client-2.0/src/help/ndpsmb_de.ipf
r493 r497 141 141 :li.:link reftype=hd res=001.Version 1.0:elink. 142 142 :li.:link reftype=hd res=002.Version 1.5.0:elink. 143 :li.:link reftype=hd res=003.Version 2.0.0:elink. 143 144 :eul 144 145 :h2 res=001.Version 1.0 … … 263 264 :eul. 264 265 :eul. 266 :h2 res=003.Version 2.0.0 267 :ul. 268 :li.beta1 269 :ul. 270 :li.Caching von Verzeichnissen 271 :eul. 272 :eul. 265 273 .****************************************************** 266 274 :h1.Credit … … 272 280 :li.Alex Taylor (aka AlexT) 273 281 :li.Nikolay Kolosov (aka nickk) 282 :li.Vitali Pelenyov (aka sunlover) 274 283 :li.und alle&comma. die wir vergessen haben! 275 284 :eul. -
branches/client-2.0/src/help/ndpsmb_fr.ipf
r493 r497 206 206 :li.:link reftype=hd res=001.Version 1.0:elink. 207 207 :li.:link reftype=hd res=002.Version 1.5.0:elink. 208 :li.:link reftype=hd res=003.Version 2.0.0:elink. 208 209 :eul. 209 210 :h2 res=001.Version 1.0 … … 348 349 :eul. 349 350 :eul. 351 :h2 res=003.Version 2.0.0 352 :ul. 353 :li.beta1 354 :ul. 355 :li.added dir caching 356 :eul. 357 :eul. 350 358 :p. 351 359 .****************************************************** … … 360 368 :li.Alex Taylor (alias AlexT) 361 369 :li.Nikolay Kolosov (alias nickk) 370 :li.Vitali Pelenyov (aka sunlover) 362 371 :li.et tous ceux que nous avons pu oublier 363 372 :eul. -
branches/client-2.0/src/help/readme.txt
r493 r497 254 254 - Fix timestamp problem 255 255 256 v2.0.0 beta1 257 - added dir caching -
branches/client-2.0/src/help/readme_de.txt
r493 r497 265 265 - Zeitzonenproblem behoben 266 266 267 v2.0.0 beta1 268 - Caching von Verzeichnissen 269 -
branches/client-2.0/src/help/readme_fr.txt
r493 r497 326 326 - Fix timestamp problem 327 327 328 v2.0.0 beta1 329 - added dir caching 330 328 331 329 332 Traduction franaise : Guillaume Gay <guillaume.gay@bigfoot.com> -
branches/client-2.0/src/ndpsmb.c
r493 r497 224 224 225 225 226 staticPLUGINHELPERTABLE2L *ph;226 PLUGINHELPERTABLE2L *ph; 227 227 static int ifL; 228 228 … … 397 397 pRes->krb5support = 0; 398 398 #endif 399 pRes->pdc = NULL; 399 400 400 401 t = 0, q = NULL; … … 503 504 } 504 505 } 506 507 /* Create a directory cache with expiration time 15 seconds and up to 32 listings cached. */ 508 dircache_create(&pRes->pdc, 10, 32); 505 509 506 510 return rc; … … 727 731 { 728 732 Resource *pRes = (Resource *)resource; 733 dircache_delete(pRes->pdc); 729 734 MemSet(&pRes->srv, 0, sizeof(pRes->srv)); 730 735 free(pRes); … … 963 968 964 969 do { 970 /* First check if there is information in the directory cache. */ 971 unsigned long ulAge = 0; 972 if (dircache_find_path(pRes->pdc, szPath, &finfo, &ulAge)) 973 { 974 if (ulAge <= 15) /* @todo configurable. */ 975 { 976 rc = NO_ERROR; 977 finfo.easize = -1; 978 getfindinfoL(pConn, plist, &finfo, 0, NULL); 979 break; 980 } 981 } 965 982 966 983 rc = pathparser(pRes, pConn, szPath, path); … … 1092 1109 strcpy( state.dir_mask, mask); 1093 1110 strcpy( state.mask, path); 1111 state.fullpath = szPath; 1112 /* This plugin always reads a complete directory listing and filters results 1113 * using actual mask (state.dir_mask) in getfindinfoL. 1114 * May be this was a workaround for some server bug. 1115 * If this will be changed, then directory listing cache must be changed too, 1116 * and must remember the mask, which was used to obtain a listing. 1117 * Now the directory cache saves complete directory listings and then uses them to find 1118 * information about single files. 1119 * However, with a directory cache, it is probably faster to get a full listing and 1120 * then use it to obtain info about separate files than to perform a network 1121 * list query operation using actual wild cards for each file. Some application, 1122 * for example OpenOffice, do this. 1123 */ 1094 1124 p = getlastslash(state.mask); 1095 1125 if (p) … … 1102 1132 strcpy(state.mask, "\\*"); 1103 1133 } 1134 debuglocal(9,"NdpFindStart: dir [%s], dir_mask [%s], mask [%s], szPath [%s]\n", 1135 state.dir, state.dir_mask, state.mask, state.fullpath); 1104 1136 rc = smbwrp_filelist( &pRes->srv, pConn->cli, &state); 1105 1137 // we need to handle reconnection also here, because NdpQueryPathInfo … … 1468 1500 debuglocal(9,"NdpForceDelete in\n"); 1469 1501 1502 dircache_invalidate(szFile, pRes->pdc, 1); 1503 1470 1504 do { 1471 1505 rc = pathparser(pRes, pConn, szFile, path); … … 1492 1526 debuglocal(9,"NdpCreateDir in\n"); 1493 1527 1528 dircache_invalidate(szDirName, pRes->pdc, 1); 1529 1494 1530 do { 1495 1531 rc = pathparser(pRes, pConn, szDirName, path); … … 1516 1552 debuglocal(9,"NdpDeleteDir in\n"); 1517 1553 1554 dircache_invalidate(szDir, pRes->pdc, 1); 1555 1518 1556 do { 1519 1557 rc = pathparser(pRes, pConn, szDir, path); … … 1541 1579 1542 1580 debuglocal(9,"NdpMove in from <%s> to <%s>\n", szSrc, szDst); 1581 1582 dircache_invalidate(szSrc, pRes->pdc, 1); 1583 dircache_invalidate(szDst, pRes->pdc, 1); 1543 1584 1544 1585 do … … 1595 1636 debuglocal(9,"smbopen in %d\n", pConn->file.fd); 1596 1637 1638 if (flags & O_CREAT) 1639 { 1640 dircache_invalidate(szFileName, pRes->pdc, 1); 1641 } 1597 1642 do { 1598 1643 if (pConn->file.fd > 0) -
branches/client-2.0/src/smbwrp.c
r493 r497 1081 1081 finfo->ctime = def_finfo.ctime_ts.tv_sec; 1082 1082 strncpy(finfo->fname, def_finfo.name, sizeof(finfo->fname) - 1); 1083 debuglocal(9,"fname %s (serverzone %d, level %d)\n",finfo->fname, cli->serverzone, level);1084 1083 1085 1084 switch (level) { … … 1240 1239 pstrcpy(mask,Mask); 1241 1240 1241 /* Try to get the listing from cache. */ 1242 if (dircache_list_files(fn, state, &total_received)) 1243 { 1244 /* Got from cache. */ 1245 return(total_received); 1246 } 1247 1242 1248 while (ff_eos == 0) { 1243 1249 loop_count++; … … 1425 1431 total_received = -1; 1426 1432 } else { 1433 void *dircachectx = dircache_write_begin(state, total_received); 1434 1427 1435 /* no connection problem. let user function add each entry */ 1428 1436 for (p=dirlist,i=0;i<total_received;i++) { … … 1430 1438 &finfo,NULL,NULL,NULL); 1431 1439 fn( mnt,&finfo, Mask, state ); 1440 1441 /* Also add the entry to the cache. */ 1442 dircache_write_entry(dircachectx, &finfo); 1432 1443 } 1444 1445 dircache_write_end(dircachectx); 1433 1446 } 1434 1447 -
branches/client-2.0/src/smbwrp.h
r151 r497 125 125 #endif 126 126 127 struct DirectoryCache; 128 127 129 typedef struct _Resource 128 130 { … … 133 135 int easupport; 134 136 int krb5support; 137 struct DirectoryCache *pdc; 135 138 } Resource; 136 139 … … 157 160 void *plist; 158 161 unsigned long ulAttribute; 162 const char *fullpath; 159 163 } filelist_state; 160 164 … … 186 190 int _System smbwrp_dskattr(cli_state * cli, FSALLOCATE *pfsa); 187 191 192 /* Directory cache helpers. */ 193 int dircache_create(struct DirectoryCache **ppdc, unsigned long ulExpirationTime, int cMaxEntries); 194 void dircache_delete(struct DirectoryCache *pdc); 195 196 typedef void FNADDDIRENTRY(const char*, smbwrp_fileinfo *, const char *, void *); 197 typedef FNADDDIRENTRY *PFNADDDIRENTRY; 198 199 /* Note: dircache_list_files or dircache_write_begin construct the directory path 200 * using information in the filelist_state structure. 201 */ 202 int dircache_list_files(PFNADDDIRENTRY fn, 203 filelist_state *state, 204 int *ptotal_received); 205 206 void *dircache_write_begin(filelist_state *state, 207 int cFiles); 208 void dircache_write_entry(void *dircachectx, const smbwrp_fileinfo *finfo); 209 void dircache_write_end(void *dircachectx); 210 211 void dircache_invalidate(const char *path, 212 struct DirectoryCache *pdc, 213 int fParent); 214 215 int dircache_find_path(struct DirectoryCache *pdc, 216 const char *path, 217 smbwrp_fileinfo *finfo, 218 unsigned long *pulAge); 219 220 /* Prototype the debug log helper. */ 221 void debuglocal(int level, const char * fmt, ...); 222 188 223 #endif /* _SMBWRP_H */
Note:
See TracChangeset
for help on using the changeset viewer.