Changeset 189
- Timestamp:
- May 12, 2009, 8:09:42 AM (16 years ago)
- Location:
- branches/client-1.5/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/client-1.5/src/debug.c
r188 r189 28 28 #include <sys/types.h> 29 29 #include <sys/time.h> 30 #include <sys/stat.h> 30 31 31 // #include "smbwrp.h" 32 33 int debuglevel = 0; 34 char *logfile = NULL; 35 36 37 void dbgfileinit(char *file, int loglevel) 38 { 39 logfile = file; 40 debuglevel = loglevel; 41 } 32 int debuglevel = 9; // we set it to 9, so we get all messages 33 char logfile[_MAX_PATH +1] = {0}; 34 char debugfile[_MAX_PATH +1] = {0}; 35 char logfilename[] = "ndpsmb.log"; 42 36 43 37 int debuglvl(int level) … … 46 40 } 47 41 48 int debugheader(int level, char * file, char * func, int line)49 {50 int rc;51 if (!debuglvl(level))52 {53 return 0;54 }55 rc = 1;56 do57 {58 FILE * f;59 struct timeval tv;60 time_t t;61 char buf[80] = {0};62 if (logfile)63 {64 f = fopen(logfile, "a");65 if (!f)66 {67 rc = 0;68 break;69 }70 }71 else72 {73 f = stdout;74 }75 gettimeofday(&tv, NULL);76 t = time(NULL);77 strftime(buf,sizeof(buf)-1,"%Y/%m/%d %H:%M:%S", localtime(&t));78 fprintf(f, "%s.%d: %d %d: %s:%s(%d) :", buf, tv.tv_usec / 10000, level, (long)_gettid(), file, func, line);79 if (logfile)80 {81 fclose(f);82 }83 }84 while (0);85 return rc;86 }87 88 int debugmessage(char * fmt, ...)89 {90 do91 {92 FILE * f;93 va_list args;94 if (logfile)95 {96 f = fopen(logfile, "a");97 if (!f)98 {99 break;100 }101 }102 else103 {104 f = stdout;105 }106 va_start(args, fmt);107 vfprintf(f, fmt, args);108 va_end(args);109 if (logfile)110 {111 fclose(f);112 }113 }114 while (0);115 return 0;116 }117 118 42 void debuglocal(int level, const char * fmt, ...) 119 43 { 44 FILE *f=NULL; 45 struct stat filestat; 46 47 // if the file ndpsmb.dbg is around we write a logfile 48 if (!debugfile[0]) 49 { 50 strncpy(debugfile, getenv("ETC"), 2); 51 strncat(debugfile, "\\", sizeof(debugfile) - strlen(debugfile) -1); 52 strncat(debugfile, "ndpsmb.dbg", sizeof(debugfile) - strlen(debugfile) -1); 53 } /* endif */ 54 55 if (stat(debugfile, &filestat) !=0) 56 return; 57 58 //we create the logfile variable only once 59 if (!logfile[0]) 60 { 61 char *env = getenv("LOGFILES"); 62 if (env != NULL) 63 { 64 strncpy(logfile, env, sizeof(logfile) -1); 65 strncat(logfile, "\\", sizeof(logfile) - strlen(logfile) -1); 66 strncat(logfile, logfilename, sizeof(logfile) - strlen(logfile) -1); 67 } 68 else 69 { 70 strncpy(logfile, logfilename, sizeof(logfile) -1); 71 } 72 } /* endif */ 120 73 121 74 if (!debuglvl(level)) … … 125 78 do 126 79 { 127 FILE * f;128 80 struct timeval tv; 129 81 char buf[80] = {0}; 130 82 va_list args; 131 if (logfile )83 if (logfile[0]) 132 84 { 133 85 f = fopen(logfile, "a"); -
branches/client-1.5/src/ndpsmb.c
r188 r189 31 31 #include "util.h" 32 32 33 #if 0 34 33 35 #ifndef DEBUG_PRINTF 34 36 #define debug_printf( ...) … … 36 38 37 39 #define log debug_printf 38 39 #if 040 void log(const char *fmt, ...)41 {42 char *ndpsmb_debug = getenv("NDPSMB_DEBUG");43 44 if (ndpsmb_debug != NULL)45 {46 FILE * logfile = NULL;47 va_list args;48 time_t t = time(NULL);49 char timebuf[80] = {0};50 strftime(timebuf,sizeof(timebuf)-1,"%Y/%m/%d %H:%M:%S", localtime(&t));51 logfile = fopen("smblog","a");52 if (logfile == NULL)53 {54 DosBeep(400,400);55 }56 else57 {58 fprintf(logfile, "%s: (%02d) ", timebuf, _gettid());59 va_start(args, fmt);60 vfprintf(logfile, fmt, args);61 va_end(args);62 fclose(logfile);63 }64 }65 }66 40 #endif 41 42 #define debug_printf(...) debuglocal(9, __VA_ARGS__) 67 43 68 44 // ------------------------------------------------------------- … … 266 242 ifL = 1; 267 243 } 268 log("Working with %s bit fileio NDFS\n", ifL ? "64" : "32");244 debuglocal(9,"Working with %s bit fileio NDFS\n", ifL ? "64" : "32"); 269 245 return NO_ERROR; 270 246 } … … 560 536 } 561 537 #endif 562 563 // init the debug part564 dbgfileinit(&pRes->logfile, pRes->loglevel);565 538 566 539 return rc; … … 744 717 Resource *pRes = NULL; 745 718 746 log("NdpMountResource in\n");719 debuglocal(9,"NdpMountResource in\n"); 747 720 748 721 // init code … … 778 751 } 779 752 } 780 log("NdpMountResource rc=%d\n", rc);753 debuglocal(9,"NdpMountResource rc=%d\n", rc); 781 754 return rc; 782 755 } … … 789 762 MemSet(&pRes->srv, 0, sizeof(pRes->srv)); 790 763 free(pRes); 791 log("NdpFreeResource %d\n", NO_ERROR);764 debuglocal(9,"NdpFreeResource %d\n", NO_ERROR); 792 765 return NO_ERROR; 793 766 } … … 801 774 int rc = ND_RSRC_DIFFERENT; 802 775 803 log("NdpRsrcCompare in\n");776 debuglocal(9,"NdpRsrcCompare in\n"); 804 777 if (ph->fsphStrICmp(pRes->srv.server_name, pRes2->srv.server_name) == 0 805 778 && ph->fsphStrICmp(pRes->srv.share_name, pRes2->srv.share_name) == 0 … … 811 784 } 812 785 813 log("NdpRsrcCompare %d\n", rc);786 debuglocal(9,"NdpRsrcCompare %d\n", rc); 814 787 815 788 return rc; … … 819 792 { 820 793 // do nothing 821 log("NdpRsrcUpdate %d\n", NO_ERROR);794 debuglocal(9,"NdpRsrcUpdate %d\n", NO_ERROR); 822 795 return NO_ERROR; 823 796 } … … 829 802 char s[4096]; 830 803 831 log("NdpRsrcQueryInfo in\n");804 debuglocal(9,"NdpRsrcQueryInfo in\n"); 832 805 833 806 switch (pRes->rootlevel) … … 860 833 } 861 834 862 log("NdpRsrcQueryInfo %d\n", rc);835 debuglocal(9,"NdpRsrcQueryInfo %d\n", rc); 863 836 864 837 return rc; … … 881 854 FSALLOCATE fsa; 882 855 883 log("NdpRsrcQueryFSAllocate %08x\n", pfsa);856 debuglocal(9,"NdpRsrcQueryFSAllocate %08x\n", pfsa); 884 857 885 858 if (!pfsa) … … 892 865 if (rc) 893 866 { 894 log("NdpCreateConnection failed rc=%d\n", rc);867 debuglocal(9,"NdpCreateConnection failed rc=%d\n", rc); 895 868 pfsa->cSectorUnit = 1; 896 869 pfsa->cUnit = 123456; … … 920 893 smbwrp_disconnect( pRes, cli); 921 894 922 log("NdpRsrcQueryFSAllocate %d/%d (cUnit = %d/cUnitAvail = %d/cbSector = %d)\n", rc, rc1, pfsa->cUnit, pfsa->cUnitAvail, pfsa->cbSector);895 debuglocal(9,"NdpRsrcQueryFSAllocate %d/%d (cUnit = %d/cUnitAvail = %d/cbSector = %d)\n", rc, rc1, pfsa->cUnit, pfsa->cUnitAvail, pfsa->cbSector); 923 896 return rc; 924 897 } … … 933 906 Connection *pConn = NULL; 934 907 935 log("NdpCreateConnection in\n");908 debuglocal(9,"NdpCreateConnection in\n"); 936 909 937 910 pConn = malloc( sizeof(Connection)); … … 942 915 if (rc) 943 916 { 944 log("NdpCreateConnection ERROR_NOT_ENOUGH_MEMORY %d\n", rc);917 debuglocal(9,"NdpCreateConnection ERROR_NOT_ENOUGH_MEMORY %d\n", rc); 945 918 return rc; 946 919 } … … 949 922 pConn->file.fd = -1; 950 923 951 log("NdpCreateConnection send CONNECT\n");924 debuglocal(9,"NdpCreateConnection send CONNECT\n"); 952 925 rc = smbwrp_connect( pRes, &pConn->cli); 953 926 if (rc) … … 959 932 960 933 *pconn = (HCONNECTION)pConn; 961 log("NdpCreateConnection %d\n", rc);934 debuglocal(9,"NdpCreateConnection %d\n", rc); 962 935 return rc; 963 936 } … … 971 944 int rc; 972 945 973 log("NdpFreeConnection in\n");946 debuglocal(9,"NdpFreeConnection in\n"); 974 947 if (pConn->file.fd >= 0) 975 948 { … … 981 954 982 955 free(pConn); 983 log("NdpFreeConnection %d\n", NO_ERROR);956 debuglocal(9,"NdpFreeConnection %d\n", NO_ERROR); 984 957 return NO_ERROR; 985 958 } … … 1013 986 int retry = 0; 1014 987 1015 log("NdpQueryPathInfo in <%s>, retry = %d\n", szPath, retry);988 debuglocal(9,"NdpQueryPathInfo in <%s>, retry = %d\n", szPath, retry); 1016 989 1017 990 // is wildcard is specified, we suppose parent dir exist, so exit immediately … … 1025 998 1026 999 rc = pathparser(pRes, pConn, szPath, path); 1027 log("NdpQueryPathInfo pathparser for <%s> rc=%d\n", path, rc);1000 debuglocal(9,"NdpQueryPathInfo pathparser for <%s> rc=%d\n", path, rc); 1028 1001 switch (rc) 1029 1002 { … … 1046 1019 } 1047 1020 StrNCpy(finfo.fname, path, sizeof(finfo.fname) - 1); 1048 log("NdpQueryPathInfo smbwrp_getattr for <%s>\n", path);1021 debuglocal(9,"NdpQueryPathInfo smbwrp_getattr for <%s>\n", path); 1049 1022 rc = smbwrp_getattr( &pRes->srv, pConn->cli, &finfo); 1050 1023 if (rc) … … 1059 1032 // try file list again 1060 1033 rc = smbwrp_getattr( &pRes->srv, pConn->cli, &finfo); 1061 log("NdpQueryPathInfo remote connection lost, retry rc = %d\n", rc);1034 debuglocal(9,"NdpQueryPathInfo remote connection lost, retry rc = %d\n", rc); 1062 1035 } 1063 1036 switch (rc) … … 1091 1064 if (rc) 1092 1065 { 1093 log("NdpQueryPathInfo upper path in <%s>, retry = %d\n", finfo.fname, retry);1066 debuglocal(9,"NdpQueryPathInfo upper path in <%s>, retry = %d\n", finfo.fname, retry); 1094 1067 rc = rc ? ERROR_PATH_NOT_FOUND : ERROR_INVALID_PARAMETER; 1095 1068 } … … 1097 1070 } 1098 1071 } while (0); 1099 log("NdpQueryPathInfo <%s> (%s) %d\n", szPath, path, rc);1072 debuglocal(9,"NdpQueryPathInfo <%s> (%s) %d\n", szPath, path, rc); 1100 1073 1101 1074 return rc; … … 1173 1146 // try file list again next loop 1174 1147 rc = smbwrp_filelist( &pRes->srv, pConn->cli, &state); 1175 log("NdpFindStart remote connection lost, retry rc = %d\n", rc);1176 } 1177 1178 log("NdpFindStart <%s> (%s) cnt %d %d\n", szPath, path, count, rc);1148 debuglocal(9,"NdpFindStart remote connection lost, retry rc = %d\n", rc); 1149 } 1150 1151 debuglocal(9,"NdpFindStart <%s> (%s) cnt %d %d\n", szPath, path, count, rc); 1179 1152 1180 1153 return rc; … … 1183 1156 int APIENTRY NdpDeletePathInfo (HRESOURCE resource, NDFILEINFOL *pfi) 1184 1157 { 1185 // log("NdpDeletePathInfo %d\n", 0);1158 // debuglocal(9,"NdpDeletePathInfo %d\n", 0); 1186 1159 return NO_ERROR; 1187 1160 } … … 1189 1162 int APIENTRY NdpRefresh (HCONNECTION conn, char *path, int tree) 1190 1163 { 1191 log("NdpRefresh <%s> %d\n", path, 0);1164 debuglocal(9,"NdpRefresh <%s> %d\n", path, 0); 1192 1165 return NO_ERROR; 1193 1166 } … … 1201 1174 // deallocated by NetDrive. 1202 1175 1203 log("NdpDicardresourceData %d\n", 0);1176 debuglocal(9,"NdpDicardresourceData %d\n", 0); 1204 1177 return NO_ERROR; 1205 1178 } … … 1230 1203 rc = smbwrp_setattr(pConn->cli, &finfo); 1231 1204 } while (0); 1232 log("NdpSetPathInfo <%s> (%s) %d\n", szPathName, path, rc);1205 debuglocal(9,"NdpSetPathInfo <%s> (%s) %d\n", szPathName, path, rc); 1233 1206 1234 1207 return rc; … … 1246 1219 pfeadest = pFEAList->list; 1247 1220 dsize = pFEAList->cbList; 1248 // log("buildFEALIST in destsize %d srcsize %d pGEAList=%08x pGEAList->cbList=%d\n", dsize, ddone, size, pGEAList, pGEAList ? pGEAList->cbList : 0);1221 //debuglocal(9,"buildFEALIST in destsize %d srcsize %d pGEAList=%08x pGEAList->cbList=%d\n", dsize, ddone, size, pGEAList, pGEAList ? pGEAList->cbList : 0); 1249 1222 while (done < size) 1250 1223 { … … 1258 1231 while (done < size) 1259 1232 { 1260 // log("comp <%s> <%s>\n", name, pgea->szName);1233 //debuglocal(9,"comp <%s> <%s>\n", name, pgea->szName); 1261 1234 if (!ph->fsphStrNCmp(name, pgea->szName, pgea->cbName)) 1262 1235 { … … 1282 1255 } 1283 1256 done += sizeof(FEA) + pfea->cbName + 1 + pfea->cbValue; 1284 // log("buuildfea <%s> insert=%d pfea->cbName=%d pfea->cbValue=%d srcdone=%d destdone=%d pfeadest=%08x pfea=%08x\n", name, insert, pfea->cbName, pfea->cbValue, done, ddone, pfeadest, pfea);1257 //debuglocal(9,"buuildfea <%s> insert=%d pfea->cbName=%d pfea->cbValue=%d srcdone=%d destdone=%d pfeadest=%08x pfea=%08x\n", name, insert, pfea->cbName, pfea->cbValue, done, ddone, pfeadest, pfea); 1285 1258 pfea = (FEA *)((char *)pFEASrc + done); 1286 1259 } … … 1290 1263 rc = ERROR_BUFFER_OVERFLOW; 1291 1264 } 1292 log("buildFEALIST rc=%d destsize=%d destdone=%d srcsize=%d pGEAList=%08x\n", rc, dsize, ddone, size, pGEAList);1265 debuglocal(9,"buildFEALIST rc=%d destsize=%d destdone=%d srcsize=%d pGEAList=%08x\n", rc, dsize, ddone, size, pGEAList); 1293 1266 return rc; 1294 1267 } … … 1318 1291 if (rc || !fdata.ulSize || !fdata.pData) 1319 1292 { 1320 log("NdpEAQuery: ph->fsphGetFileInfoData = %d/%d %08x\n", rc, fdata.ulSize, fdata.pData);1293 debuglocal(9,"NdpEAQuery: ph->fsphGetFileInfoData = %d/%d %08x\n", rc, fdata.ulSize, fdata.pData); 1321 1294 return ERROR_EAS_NOT_SUPPORTED; 1322 1295 } … … 1324 1297 path = finfo->fname; 1325 1298 1326 log("NdpEAQuery in <%s> %08x %d\n", path, pGEAList, pGEAList ? pGEAList->cbList : 0);1299 debuglocal(9,"NdpEAQuery in <%s> %08x %d\n", path, pGEAList, pGEAList ? pGEAList->cbList : 0); 1327 1300 1328 1301 do { … … 1355 1328 } 1356 1329 } while (0); 1357 log("NdpEAQuery <%s> %d %d %d\n", pfi->pszName, rc, pFEASrc->cbList, pFEAList->cbList);1330 debuglocal(9,"NdpEAQuery <%s> %d %d %d\n", pfi->pszName, rc, pFEASrc->cbList, pFEAList->cbList); 1358 1331 1359 1332 return rc; … … 1370 1343 smbwrp_fileinfo *finfo; 1371 1344 1372 log("NdpEASet in\n");1345 debuglocal(9,"NdpEASet in\n"); 1373 1346 1374 1347 if (!pfi || !pfi->pszName || !pFEAList || pFEAList->cbList <= sizeof(long)) … … 1384 1357 if (rc || !fdata.ulSize || !fdata.pData) 1385 1358 { 1386 log("NdpEASet: ph->fsphGetFileInfoData = %d/%d/%08x\n", rc, fdata.ulSize, fdata.pData);1359 debuglocal(9,"NdpEASet: ph->fsphGetFileInfoData = %d/%d/%08x\n", rc, fdata.ulSize, fdata.pData); 1387 1360 return ERROR_EAS_NOT_SUPPORTED; 1388 1361 } … … 1406 1379 } 1407 1380 } while (0); 1408 log("NdpEASet %d\n", rc);1381 debuglocal(9,"NdpEASet %d\n", rc); 1409 1382 1410 1383 return rc; … … 1436 1409 if (rc || !fdata.ulSize || !fdata.pData) 1437 1410 { 1438 log("NdpEASize: ph->fsphGetFileInfoData = %d/%d/%08x\n", rc, fdata.ulSize, fdata.pData);1411 debuglocal(9,"NdpEASize: ph->fsphGetFileInfoData = %d/%d/%08x\n", rc, fdata.ulSize, fdata.pData); 1439 1412 return ERROR_EAS_NOT_SUPPORTED; 1440 1413 } … … 1446 1419 { 1447 1420 *pulEASize = easize; 1448 log("NdpEASize <%s> cached %d\n", path, easize);1421 debuglocal(9,"NdpEASize <%s> cached %d\n", path, easize); 1449 1422 return NO_ERROR; 1450 1423 } 1451 1424 1452 log("NdpEASize in <%s> \n", path);1425 debuglocal(9,"NdpEASize in <%s> \n", path); 1453 1426 1454 1427 do { … … 1477 1450 *pulEASize = pfealist->cbList; 1478 1451 } while (0); 1479 log("NdpEASize <%s> %d %d\n", pfi->pszName, *pulEASize, rc);1452 debuglocal(9,"NdpEASize <%s> %d %d\n", pfi->pszName, *pulEASize, rc); 1480 1453 1481 1454 return rc; … … 1490 1463 char path[CCHMAXPATH+1] = {0}; 1491 1464 1492 log("NdpSetCurrentDir in\n");1465 debuglocal(9,"NdpSetCurrentDir in\n"); 1493 1466 1494 1467 do { … … 1501 1474 rc = smbwrp_chdir(&pRes->srv, pConn->cli, path); 1502 1475 } while (0); 1503 log("NdpSetCurrentDir <%s> (%s) %d\n", szPath, path, rc);1476 debuglocal(9,"NdpSetCurrentDir <%s> (%s) %d\n", szPath, path, rc); 1504 1477 1505 1478 return rc; … … 1508 1481 int APIENTRY NdpCopy (HCONNECTION conn, NDFILEINFOL *pfiDst, char *szDst, NDFILEINFOL *pfiSrc, char *szSrc, ULONG ulOption) 1509 1482 { 1510 log("NdpCopy <%s> -> <%s> %d\n", szSrc, szDst, ERROR_CANNOT_COPY);1483 debuglocal(9,"NdpCopy <%s> -> <%s> %d\n", szSrc, szDst, ERROR_CANNOT_COPY); 1511 1484 return ERROR_CANNOT_COPY; 1512 1485 } … … 1514 1487 int APIENTRY NdpCopy2 (HCONNECTION conn, HRESOURCE resDst, NDFILEINFOL *pfiDst, char *szDst, NDFILEINFOL *pfiSrc, char *szSrc, ULONG ulOption) 1515 1488 { 1516 log("NdpCopy2 <%s> -> <%s> %d\n", szSrc, szDst, ERROR_CANNOT_COPY);1489 debuglocal(9,"NdpCopy2 <%s> -> <%s> %d\n", szSrc, szDst, ERROR_CANNOT_COPY); 1517 1490 return ERROR_CANNOT_COPY; 1518 1491 } … … 1526 1499 char path[CCHMAXPATH+1] = {0}; 1527 1500 1528 log("NdpForceDelete in\n");1501 debuglocal(9,"NdpForceDelete in\n"); 1529 1502 1530 1503 do { … … 1537 1510 rc = smbwrp_unlink(pConn->cli, path); 1538 1511 } while (0); 1539 log("NdpForceDelete <%s> (%s) %d\n", szFile, path, rc);1512 debuglocal(9,"NdpForceDelete <%s> (%s) %d\n", szFile, path, rc); 1540 1513 1541 1514 return rc; … … 1550 1523 char path[CCHMAXPATH+1] = {0}; 1551 1524 1552 log("NdpCreateDir in\n");1525 debuglocal(9,"NdpCreateDir in\n"); 1553 1526 1554 1527 do { … … 1561 1534 rc = smbwrp_mkdir(pConn->cli, path); 1562 1535 } while (0); 1563 log("NdpCreateDir <%s> (%s) %d\n", szDirName, path, rc);1536 debuglocal(9,"NdpCreateDir <%s> (%s) %d\n", szDirName, path, rc); 1564 1537 1565 1538 return rc; … … 1574 1547 char path[CCHMAXPATH+1] = {0}; 1575 1548 1576 log("NdpDeleteDir in\n");1549 debuglocal(9,"NdpDeleteDir in\n"); 1577 1550 1578 1551 do { … … 1585 1558 rc = smbwrp_rmdir(pConn->cli, path); 1586 1559 } while (0); 1587 log("NdpDeleteDir <%s> (%s) %d\n", szDir, path, rc);1560 debuglocal(9,"NdpDeleteDir <%s> (%s) %d\n", szDir, path, rc); 1588 1561 1589 1562 return rc; … … 1600 1573 char * p = szDst; 1601 1574 1602 log("NdpMove in from <%s> to <%s>\n", szSrc, szDst);1575 debuglocal(9,"NdpMove in from <%s> to <%s>\n", szSrc, szDst); 1603 1576 1604 1577 do … … 1624 1597 rc = smbwrp_rename(pConn->cli, src, p); 1625 1598 } while (0); 1626 log("NdpMove <%s> -> <%s> (%s) %d\n", szSrc, szDst, src, rc);1599 debuglocal(9,"NdpMove <%s> -> <%s> (%s) %d\n", szSrc, szDst, src, rc); 1627 1600 1628 1601 return rc; … … 1631 1604 int APIENTRY NdpMove2 (HCONNECTION conn, HRESOURCE resDst, NDFILEINFOL *pfiDst, char *szDst, NDFILEINFOL *pfiSrc, char *szSrc) 1632 1605 { 1633 log("NdpMove2 <%s> -> <%s> %d\n", szSrc, szDst, ERROR_WRITE_PROTECT);1606 debuglocal(9,"NdpMove2 <%s> -> <%s> %d\n", szSrc, szDst, ERROR_WRITE_PROTECT); 1634 1607 return ERROR_WRITE_PROTECT; 1635 1608 } … … 1653 1626 char path[CCHMAXPATH+1] = {0}; 1654 1627 1655 log("smbopen in %d\n", pConn->file.fd);1628 debuglocal(9,"smbopen in %d\n", pConn->file.fd); 1656 1629 1657 1630 do { … … 1683 1656 rc = smbwrp_open(pConn->cli, &pConn->file); 1684 1657 } while (0); 1685 log("smbopen <%s> (%s) %08x %08x %08x %d. file = %d\n", szFileName, path, flags, ulOpenMode, ulAttribute, rc, pConn->file.fd);1658 debuglocal(9,"smbopen <%s> (%s) %08x %08x %08x %d. file = %d\n", szFileName, path, flags, ulOpenMode, ulAttribute, rc, pConn->file.fd); 1686 1659 if (!rc && pFEAList) 1687 1660 { 1688 1661 int rc1 = NdpFileEASet((HCONNECTION)pConn, (NDFILEHANDLE)0, pFEAList); 1689 log("smbopen NdpFileEASet %d. pFEAList->cbList %d\n", rc1, pFEAList->cbList);1662 debuglocal(9,"smbopen NdpFileEASet %d. pFEAList->cbList %d\n", rc1, pFEAList->cbList); 1690 1663 } 1691 1664 … … 1730 1703 char path[CCHMAXPATH+1] = {0}; 1731 1704 1732 log("NdpSetFileAttribute in\n");1705 debuglocal(9,"NdpSetFileAttribute in\n"); 1733 1706 do { 1734 1707 rc = pathparser(pRes, pConn, szFileName, path); … … 1743 1716 rc = smbwrp_setattr(pConn->cli, &finfo); 1744 1717 } while (0); 1745 log("NdpSetFileAttribute <%s> (%s) %04x %d\n", szFileName, path, usAttr, rc);1718 debuglocal(9,"NdpSetFileAttribute <%s> (%s) %04x %d\n", szFileName, path, usAttr, rc); 1746 1719 1747 1720 return rc; … … 1750 1723 int APIENTRY NdpFlush (HRESOURCE resource) 1751 1724 { 1752 log("NdpFlush %d\n", ERROR_NOT_SUPPORTED);1725 debuglocal(9,"NdpFlush %d\n", ERROR_NOT_SUPPORTED); 1753 1726 return ERROR_NOT_SUPPORTED; 1754 1727 } … … 1756 1729 int APIENTRY NdpIOCTL (int type, HRESOURCE resource, char *path, int function, void *in, ULONG insize, PULONG poutlen) 1757 1730 { 1758 log("NdpIOCTL <%s> %d\n", path, function);1731 debuglocal(9,"NdpIOCTL <%s> %d\n", path, function); 1759 1732 1760 1733 if (in && insize > 4096) … … 1793 1766 } 1794 1767 } while (0); 1795 log("NdpFileQueryInfo <%s> %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, rc);1768 debuglocal(9,"NdpFileQueryInfo <%s> %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, rc); 1796 1769 1797 1770 return rc; … … 1816 1789 } 1817 1790 1818 log("NdpFileEAQuery in <%s>/%d pGEAList=%08x\n", pConn->file.fname, pConn->file.fd, pGEAList);1791 debuglocal(9,"NdpFileEAQuery in <%s>/%d pGEAList=%08x\n", pConn->file.fname, pConn->file.fd, pGEAList); 1819 1792 do { 1820 1793 if (pConn->file.fd < 0) … … 1851 1824 } 1852 1825 } while (0); 1853 log("NdpFileEAQuery out <%s>/%d pFEASrc->cbList=%d pFEAList->cbList=%d rc=%d\n", pConn->file.fname, pConn->file.fd, pFEASrc->cbList, pFEAList->cbList, rc);1826 debuglocal(9,"NdpFileEAQuery out <%s>/%d pFEASrc->cbList=%d pFEAList->cbList=%d rc=%d\n", pConn->file.fname, pConn->file.fd, pFEASrc->cbList, pFEAList->cbList, rc); 1854 1827 1855 1828 return rc; … … 1863 1836 unsigned long action; 1864 1837 1865 log("NdpFileEASet in\n");1838 debuglocal(9,"NdpFileEASet in\n"); 1866 1839 1867 1840 if (!pFEAList || pFEAList->cbList <= sizeof(long)) … … 1897 1870 1898 1871 } while (0); 1899 log("NdpFileEASet %d\n", rc);1872 debuglocal(9,"NdpFileEASet %d\n", rc); 1900 1873 1901 1874 return rc; … … 1921 1894 } 1922 1895 1923 log("NdpFileEASize in <%s>/%d \n", pConn->file.fname, pConn->file.fd);1896 debuglocal(9,"NdpFileEASize in <%s>/%d \n", pConn->file.fname, pConn->file.fd); 1924 1897 do { 1925 1898 if (pConn->file.fd < 0) … … 1952 1925 *pulEASize = pFEAList->cbList; 1953 1926 } while (0); 1954 log("NdpFileEASize %d %d\n", *pulEASize, rc);1927 debuglocal(9,"NdpFileEASize %d %d\n", *pulEASize, rc); 1955 1928 1956 1929 return rc; … … 1977 1950 debug_printf("NdpFileSetInfo mtime %d\n", pConn->file.mtime); 1978 1951 } while (0); 1979 log("NdpFileSetInfo <%s> %08x %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, attrFile, rc);1952 debuglocal(9,"NdpFileSetInfo <%s> %08x %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, attrFile, rc); 1980 1953 1981 1954 return NO_ERROR; … … 1989 1962 unsigned long action; 1990 1963 1991 log("NdpFileSetFilePtrl in\n");1964 debuglocal(9,"NdpFileSetFilePtrl in\n"); 1992 1965 1993 1966 do { … … 2003 1976 2004 1977 } while (0); 2005 log("NdpFileSetFilePtrL <%s> %lld %lu %lld %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, llOffset, ulMethod, *pllActual, rc);1978 debuglocal(9,"NdpFileSetFilePtrL <%s> %lld %lu %lld %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, llOffset, ulMethod, *pllActual, rc); 2006 1979 2007 1980 return rc; … … 2013 1986 int rc = NdpFileSetFilePtrL(conn, handle, lOffset, ulMethod, &llActual); 2014 1987 *pulActual = llActual & 0xFFFFFFFF; 2015 log("NdpFileSetFilePtr %ld %lu %ld %d\n", lOffset, ulMethod, *pulActual, rc);1988 debuglocal(9,"NdpFileSetFilePtr %ld %lu %ld %d\n", lOffset, ulMethod, *pulActual, rc); 2016 1989 return rc; 2017 1990 } … … 2024 1997 unsigned long action; 2025 1998 2026 log("NdpFileClose in %d <%s>\n", pConn->file.fd, pConn->file.fd < 0 ? "!null!" : pConn->file.fname);1999 debuglocal(9,"NdpFileClose in %d <%s>\n", pConn->file.fd, pConn->file.fd < 0 ? "!null!" : pConn->file.fname); 2027 2000 2028 2001 do { … … 2036 2009 2037 2010 } while (0); 2038 log("NdpFileClose %d %d\n", pConn->file.fd, rc);2011 debuglocal(9,"NdpFileClose %d %d\n", pConn->file.fd, rc); 2039 2012 2040 2013 pConn->file.fd = -1; … … 2044 2017 int APIENTRY NdpFileCommit (HCONNECTION conn, NDFILEHANDLE handle) 2045 2018 { 2046 log("NdpFileCommit %d\n", NO_ERROR);2019 debuglocal(9,"NdpFileCommit %d\n", NO_ERROR); 2047 2020 return NO_ERROR; 2048 2021 } … … 2052 2025 { 2053 2026 int rc = NdpFileNewSizeL(conn, handle, ulLen); 2054 log("NdpFileNewSize %ld %d\n", ulLen, rc);2027 debuglocal(9,"NdpFileNewSize %ld %d\n", ulLen, rc); 2055 2028 return rc; 2056 2029 } … … 2063 2036 unsigned long action; 2064 2037 2065 log("NdpFileNewSizeL in\n");2038 debuglocal(9,"NdpFileNewSizeL in\n"); 2066 2039 2067 2040 do { … … 2075 2048 2076 2049 } while (0); 2077 log("NdpFileNewSizeL <%s> %lld %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, llLen, rc);2050 debuglocal(9,"NdpFileNewSizeL <%s> %lld %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, llLen, rc); 2078 2051 2079 2052 return rc; … … 2089 2062 unsigned long action; 2090 2063 2091 log("NdpFileRead in\n");2064 debuglocal(9,"NdpFileRead in\n"); 2092 2065 2093 2066 do { … … 2102 2075 2103 2076 } while (0); 2104 log("NdpFileRead <%s> %lu %lu %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, ulRead, *pulActual, rc);2077 debuglocal(9,"NdpFileRead <%s> %lu %lu %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, ulRead, *pulActual, rc); 2105 2078 2106 2079 return rc; … … 2116 2089 unsigned long action; 2117 2090 2118 log("NdpFileWrite in\n");2091 debuglocal(9,"NdpFileWrite in\n"); 2119 2092 2120 2093 do { … … 2127 2100 2128 2101 } while (0); 2129 log("NdpFileWrite <%s> %lu %lu %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, ulWrite, *pulActual, rc); 2130 2131 return rc; 2132 } 2133 2134 2102 debuglocal(9,"NdpFileWrite <%s> %lu %lu %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, ulWrite, *pulActual, rc); 2103 2104 return rc; 2105 } 2106 -
branches/client-1.5/src/rc/rc.ipf
r9 r189 7 7 .nameit symbol=ndcp text='NetDrive for OS/2 Control Panel' 8 8 .nameit symbol=mp text='mount point' 9 .nameit symbol=ressmb text='S AMBAResource Properties'9 .nameit symbol=ressmb text='Samba Resource Properties' 10 10 11 11 :title.NetDrive for OS/2 Control Panel Help … … 41 41 :pd.0 if 'master' is the name of master server, 1 if 'master' is the name of master workgroup. 42 42 43 :pt.Memlen44 :pd.The size of shared memory buffer allocated for every NDFS connection in size of 64k blocks.45 46 :pt.Logfile47 :pd.File to log records from smbcd.exe. Used only if smbcd.exe is run by ndpsmb.dll plugin, not manually.48 49 :pt.Loglevel50 :pd.Level of logging (0-9) for smbcd.exe. Used only if smbcd.exe is run by ndpsmb.dll plugin, not manually.51 52 43 :pt.EA Support 53 44 :pd.Switches on/off EA support. 54 45 55 46 :eparml. 47 :p. 48 .br 49 .br 50 :hp2.To produce a logfile add an empty file called ndpsmb.dbg into the root drive. :ehp2. 51 .br 52 .br 53 The logfile is placed to your LOGFILES env path, if available. If the LOGFILES env is missing 54 the logfile is placed into the netdrive directory. The logfile is called ndpsmb.log. 56 55 .****************************************************** 57 56 :euserdoc. -
branches/client-1.5/src/rc/rc.rc
r116 r189 150 150 RCDATA (DLG_ID + 12) 151 151 { 152 0152 1 153 153 } 154 154 -
branches/client-1.5/src/smbwrp.c
r187 r189 23 23 #include "smbwrp.h" 24 24 25 #ifndef DEBUG_PRINTF26 #define debug_printf( ...)27 #endif28 25 29 26 static int … … 858 855 return EINVAL; 859 856 } 860 debug_printf( "smbwrp_getattr\n");861 857 debuglocal(4,"getattr %d %d <%s>\n", cli->capabilities & CAP_NOPATHINFO2, cli->capabilities & CAP_NT_SMBS, finfo->fname); 862 858 if (!(cli->capabilities & CAP_NOPATHINFO2) && … … 1057 1053 finfo->ctime = def_finfo.ctime_ts.tv_sec; 1058 1054 strncpy(finfo->fname, def_finfo.name, sizeof(finfo->fname) - 1); 1059 debug _printf("fname %s (serverzone %d, level %d)\n",finfo->fname, cli->serverzone, level);1055 debuglocal(9,"fname %s (serverzone %d, level %d)\n",finfo->fname, cli->serverzone, level); 1060 1056 1061 1057 switch (level) { … … 1426 1422 } 1427 1423 debuglocal(1,"Filelist <%s> on master <%s> wgrp <%s> server <%s> share <%s> clidev <%s>\n", state->mask, srv->master, srv->workgroup, srv->server_name, srv->share_name, cli->dev); 1428 debug_printf( "Filelist <%s> on master <%s> wgrp <%s> server <%s> share <%s> clidev <%s>\n", state->mask, srv->master, srv->workgroup, srv->server_name, srv->share_name, cli->dev);1429 1424 if (*srv->workgroup == 0 && *srv->server_name == 0) 1430 1425 { -
branches/client-1.5/src/util.c
r183 r189 92 92 case 66 : return ERROR_BUSY_DRIVE ; /* EALREADY - Operation already in progress */ 93 93 } 94 debug_printf( "Unhandled return code %d\n");94 // debug_printf( "Unhandled return code %d\n"); 95 95 return rc + 40000; 96 96 }
Note:
See TracChangeset
for help on using the changeset viewer.