Changeset 507
- Timestamp:
- Dec 28, 2010, 10:47:09 AM (15 years ago)
- Location:
- branches/client-2.0/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/client-2.0/src/debug.c
r497 r507 30 30 #include <sys/stat.h> 31 31 32 int debuglevel = 9; // we set it to 9, so we get all messages32 int debuglevel = 1; // we set it to 9, so we get all messages 33 33 char logfile[_MAX_PATH +1] = {0}; 34 34 char debugfile[_MAX_PATH +1] = {0}; … … 43 43 BOOL writeLog() 44 44 { 45 45 return do_logging; 46 46 } 47 47 48 48 void debuglocal(int level, const char * fmt, ...) 49 49 { 50 51 50 FILE *f=NULL; 51 struct stat filestat; 52 52 53 54 if (!debuglvl(level))53 // do we have to log at all 54 /* if (!debuglvl(level)) 55 55 { 56 56 return; 57 } 57 } */ 58 58 59 60 61 62 63 64 65 66 67 68 59 // if the file ndpsmb.dbg is around we write a logfile 60 if (!debugfile[0]) 61 { 62 strncpy(debugfile, getenv("ETC"), 2); 63 strncat(debugfile, "\\", sizeof(debugfile) - strlen(debugfile) -1); 64 strncat(debugfile, "ndpsmb.dbg", sizeof(debugfile) - strlen(debugfile) -1); 65 } /* endif */ 66 67 if (stat(debugfile, &filestat) !=0) 68 return; 69 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 70 //we create the logfile variable only once 71 if (!logfile[0]) 72 { 73 char *env = getenv("LOGFILES"); 74 if (env != NULL) 75 { 76 strncpy(logfile, env, sizeof(logfile) -1); 77 strncat(logfile, "\\", sizeof(logfile) - strlen(logfile) -1); 78 strncat(logfile, logfilename, sizeof(logfile) - strlen(logfile) -1); 79 } 80 else 81 { 82 strncpy(logfile, logfilename, sizeof(logfile) -1); 83 } 84 // set the samba logging stuff 85 do_logging = TRUE; 86 } /* endif */ 87 87 88 88 do -
branches/client-2.0/src/ndpsmb.c
r497 r507 904 904 905 905 *pconn = (HCONNECTION)pConn; 906 debuglocal(9,"NdpCreateConnection %d\n", rc);906 debuglocal(9,"NdpCreateConnection [%p] %d\n", pConn, rc); 907 907 return rc; 908 908 } … … 916 916 int rc; 917 917 918 debuglocal(9,"NdpFreeConnection in \n");918 debuglocal(9,"NdpFreeConnection in [%p]\n", pConn); 919 919 if (pConn->file.fd >= 0) 920 920 { … … 958 958 int retry = 0; 959 959 960 debuglocal(9,"NdpQueryPathInfo in <%s>, retry = %d\n", szPath, retry);960 debuglocal(9,"NdpQueryPathInfo in [%p] <%s>, retry = %d\n", pConn, szPath, retry); 961 961 962 962 // is wildcard is specified, we suppose parent dir exist, so exit immediately … … 1075 1075 char * p; 1076 1076 1077 debug_printf("NdpFindStart in \n");1077 debug_printf("NdpFindStart in [%p]\n", pConn); 1078 1078 1079 1079 StrNCpy(dir, szPath, sizeof(dir) - 1); … … 1186 1186 smbwrp_fileinfo finfo; 1187 1187 1188 debug_printf("NdpSetPathInfo in FIXME \n");1188 debug_printf("NdpSetPathInfo in FIXME [%p]\n", pConn); 1189 1189 1190 1190 do { … … 1296 1296 path = finfo->fname; 1297 1297 1298 debuglocal(9,"NdpEAQuery in <%s> %08x %d\n", path, pGEAList, pGEAList ? pGEAList->cbList : 0);1298 debuglocal(9,"NdpEAQuery in [%p] <%s> %08x %d\n", pConn, path, pGEAList, pGEAList ? pGEAList->cbList : 0); 1299 1299 1300 1300 do { … … 1342 1342 smbwrp_fileinfo *finfo; 1343 1343 1344 debuglocal(9,"NdpEASet in \n");1344 debuglocal(9,"NdpEASet in [%p]\n", pConn); 1345 1345 1346 1346 if (!pfi || !pfi->pszName || !pFEAList || pFEAList->cbList <= sizeof(long)) … … 1422 1422 } 1423 1423 1424 debuglocal(9,"NdpEASize in <%s> \n", path);1424 debuglocal(9,"NdpEASize in [%p] <%s>\n", pConn, path); 1425 1425 1426 1426 do { … … 1462 1462 char path[CCHMAXPATH+1] = {0}; 1463 1463 1464 debuglocal(9,"NdpSetCurrentDir in \n");1464 debuglocal(9,"NdpSetCurrentDir in [%p]\n", pConn); 1465 1465 1466 1466 do { … … 1498 1498 char path[CCHMAXPATH+1] = {0}; 1499 1499 1500 debuglocal(9,"NdpForceDelete in \n");1500 debuglocal(9,"NdpForceDelete in [%p]\n", pConn); 1501 1501 1502 1502 dircache_invalidate(szFile, pRes->pdc, 1); … … 1524 1524 char path[CCHMAXPATH+1] = {0}; 1525 1525 1526 debuglocal(9,"NdpCreateDir in \n");1526 debuglocal(9,"NdpCreateDir in [%p]\n", pConn); 1527 1527 1528 1528 dircache_invalidate(szDirName, pRes->pdc, 1); … … 1550 1550 char path[CCHMAXPATH+1] = {0}; 1551 1551 1552 debuglocal(9,"NdpDeleteDir in \n");1552 debuglocal(9,"NdpDeleteDir in [%p]\n", pConn); 1553 1553 1554 1554 dircache_invalidate(szDir, pRes->pdc, 1); … … 1578 1578 char * p = szDst; 1579 1579 1580 debuglocal(9,"NdpMove in from <%s> to <%s>\n", szSrc, szDst);1580 debuglocal(9,"NdpMove in [%p] from <%s> to <%s>\n", pConn, szSrc, szDst); 1581 1581 1582 1582 dircache_invalidate(szSrc, pRes->pdc, 1); … … 1634 1634 char path[CCHMAXPATH+1] = {0}; 1635 1635 1636 debuglocal(9,"smbopen in %d\n", pConn->file.fd);1636 debuglocal(9,"smbopen in [%p] %d\n", pConn, pConn->file.fd); 1637 1637 1638 1638 if (flags & O_CREAT) … … 1715 1715 char path[CCHMAXPATH+1] = {0}; 1716 1716 1717 debuglocal(9,"NdpSetFileAttribute in \n");1717 debuglocal(9,"NdpSetFileAttribute in [%p]\n", pConn); 1718 1718 do { 1719 1719 rc = pathparser(pRes, pConn, szFileName, path); … … 1763 1763 smbwrp_fileinfo finfo; 1764 1764 1765 debug_printf("NdpFileQueryInfo in \n");1765 debug_printf("NdpFileQueryInfo in [%p]\n", pConn); 1766 1766 do { 1767 1767 if (pConn->file.fd < 0 || !*pConn->file.fname) … … 1801 1801 } 1802 1802 1803 debuglocal(9,"NdpFileEAQuery in <%s>/%d pGEAList=%08x\n", pConn->file.fname, pConn->file.fd, pGEAList);1803 debuglocal(9,"NdpFileEAQuery in [%p] <%s>/%d pGEAList=%08x\n", pConn, pConn->file.fname, pConn->file.fd, pGEAList); 1804 1804 do { 1805 1805 if (pConn->file.fd < 0) … … 1848 1848 unsigned long action; 1849 1849 1850 debuglocal(9,"NdpFileEASet in \n");1850 debuglocal(9,"NdpFileEASet in [%p]\n", pConn); 1851 1851 1852 1852 if (!pFEAList || pFEAList->cbList <= sizeof(long)) … … 1906 1906 } 1907 1907 1908 debuglocal(9,"NdpFileEASize in <%s>/%d \n", pConn->file.fname, pConn->file.fd);1908 debuglocal(9,"NdpFileEASize in [%p] <%s>/%d \n", pConn, pConn->file.fname, pConn->file.fd); 1909 1909 do { 1910 1910 if (pConn->file.fd < 0) … … 1949 1949 unsigned long action, attrFile; 1950 1950 1951 debug_printf("NdpFileSetInfo in \n");1951 debug_printf("NdpFileSetInfo in [%p]\n", pConn); 1952 1952 do { 1953 1953 if (pConn->file.fd < 0 || !*pConn->file.fname) … … 1974 1974 unsigned long action; 1975 1975 1976 debuglocal(9,"NdpFileSetFilePtrl in \n");1976 debuglocal(9,"NdpFileSetFilePtrl in [%p]\n", pConn); 1977 1977 1978 1978 do { … … 2009 2009 unsigned long action; 2010 2010 2011 debuglocal(9,"NdpFileClose in %d <%s>\n", pConn->file.fd, pConn->file.fd < 0 ? "!null!" : pConn->file.fname);2011 debuglocal(9,"NdpFileClose in [%p] %d <%s>\n", pConn, pConn->file.fd, pConn->file.fd < 0 ? "!null!" : pConn->file.fname); 2012 2012 2013 2013 do { … … 2048 2048 unsigned long action; 2049 2049 2050 debuglocal(9,"NdpFileNewSizeL in \n");2050 debuglocal(9,"NdpFileNewSizeL in [%p]\n", pConn); 2051 2051 2052 2052 do { … … 2065 2065 } 2066 2066 2067 #define NDPSMB_READ_MAX_SIZE (65536 - 4096) 2068 2067 2069 int APIENTRY NdpFileRead (HCONNECTION conn, NDFILEHANDLE handle, void *pBuffer, ULONG ulRead, ULONG *pulActual) 2068 2070 { … … 2073 2075 unsigned long onedone; 2074 2076 unsigned long action; 2075 2076 debuglocal(9,"NdpFileRead in\n"); 2077 ULONG ulReadCompleted = 0; 2078 2079 debuglocal(9,"NdpFileRead in [%p]\n", pConn); 2077 2080 2078 2081 do { … … 2082 2085 break; 2083 2086 } 2084 rc = smbwrp_read(pConn->cli, &pConn->file, pBuffer, ulRead, pulActual); 2087 2088 while (ulReadCompleted < ulRead) 2089 { 2090 ULONG ulActual; 2091 ULONG ulToRead = ulRead - ulReadCompleted; 2092 debuglocal(9,"NdpFileRead completed %d, to read %d\n", ulReadCompleted, ulToRead); 2093 if (ulToRead > NDPSMB_READ_MAX_SIZE) 2094 { 2095 ulToRead = NDPSMB_READ_MAX_SIZE; 2096 } 2097 rc = smbwrp_read(pConn->cli, &pConn->file, (char *)pBuffer + ulReadCompleted, ulToRead, &ulActual); 2098 if (ulActual == 0 || rc != NO_ERROR) 2099 { 2100 break; 2101 } 2102 ulReadCompleted += ulActual; 2103 } 2104 2085 2105 //*pulActual = ulRead; 2086 2106 //DosSleep(0); 2087 2107 2088 2108 } while (0); 2109 2110 if (ulReadCompleted > 0) 2111 { 2112 rc = NO_ERROR; /* Still were able to read some data. */ 2113 } 2114 2115 if (rc == NO_ERROR) 2116 { 2117 *pulActual = ulReadCompleted; 2118 } 2119 2089 2120 debuglocal(9,"NdpFileRead <%s> %lu %lu %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, ulRead, *pulActual, rc); 2090 2121 … … 2101 2132 unsigned long action; 2102 2133 2103 debuglocal(9,"NdpFileWrite in \n");2134 debuglocal(9,"NdpFileWrite in [%p]\n", pConn); 2104 2135 2105 2136 do {
Note:
See TracChangeset
for help on using the changeset viewer.