149 #include <sys\types.h>
153 #include <sys\stat.h>
155 #include <sys/stat.h>
159 #include <netinet/in.h>
162 #include <sys/types.h>
165 #include <sys/socket.h>
167 #include <sys/socket.h>
207 char cModule[32]=
"rawAddStrings";
226 iString1 = strlen(pcMsg1);
227 iString2 = strlen(pcMsg2);
228 iString = iString1 + iString2;
232 fprintf(
fLogFile,
"\n-D- begin %s\n", cModule);
233 fprintf(
fLogFile,
" string1 (%d byte, max %d byte):\n %s",
234 iString1, iMaxLength1, pcMsg1);
236 fprintf(
fLogFile,
" add msg for errno=%d\n", errno);
238 fprintf(
fLogFile,
" add string2 (%d byte, max %d byte):\n %s",
239 iString2, iMaxLength2, pcMsg2);
242 if ( (iString1 <= iMaxLength1) &&
243 (iString2 <= iMaxLength2) )
247 if (iMaxLength2 >= iMinLen)
249 sprintf(pcMsg2,
" %s\n", strerror(errno));
250 iString2 = strlen(pcMsg2);
251 iString = iString1 + iString2;
257 "-E- %s: 2nd string (%d byte) possibly too small for system error: requ. %d byte\n",
258 cModule, iMaxLength2, iMinLen);
264 if (iString < iMaxLength1)
266 strcat(pcMsg1, pcMsg2);
268 " returned msg (%d byte):\n %s", iString, pcMsg1);
272 strncat(pcMsg1, pcMsg2, iMaxLength1-iString1-1);
273 strncat(pcMsg1,
"\n", 1);
274 iRC = iString -iMaxLength1;
277 fprintf(
fLogFile,
" returned msg:\n %s", pcMsg1);
279 pcc+= iMaxLength1-iString1-1;
280 fprintf(
fLogFile,
" skipped msg part:\n %s", pcc);
286 if (iMaxLength1 <= 0)
289 sprintf(cMsg,
"-E- %s: 1st string length (%d byte) invalid\n",
290 cModule, iMaxLength1);
292 if (iMaxLength2 <= 0)
295 sprintf(cMsg,
"-E- %s: 2nd string length (%d byte) invalid\n",
296 cModule, iMaxLength2);
298 else if (iString == 0)
301 sprintf(cMsg,
"-E- %s: empty strings provided\n", cModule);
303 else if (iString1 > iMaxLength1)
306 sprintf(cMsg,
"-E- %s: 1st string longer (%d byte) than length provided (%d)\n",
307 cModule, iString1, iMaxLength1);
309 else if ( (iString2 > iMaxLength2) && (iErrno == 0) )
312 sprintf(cMsg,
"-E- %s: 2nd string longer (%d byte) than length provided (%d)\n",
313 cModule, iString2, iMaxLength2);
324 iStringE = strlen(cMsg);
326 " error string (%d byte, max %d byte):\n %s\n",
327 iStringE, iMaxLengthE, cMsg);
329 if (iMaxLengthE < iStringE)
332 fprintf(
fLogFile,
"-E- %s: size error string too small: max %d byte (needed %d)",
333 cModule, iMaxLengthE, iStringE);
334 strncat(pcMsgE, cMsg, iMaxLengthE);
335 fprintf(
fLogFile,
", provided: %s\n", pcMsgE);
341 strcpy(pcMsgE, cMsg);
346 fprintf(
fLogFile,
"-D- end %s: rc=%d\n\n", cModule, iRC);
365 char *pcFullFile,
char *pcFile,
char *pcTape)
368 char cModule[32]=
"rawCheckClientFile";
378 char *plocd = NULL, *plocs = NULL;
379 char *pdelim = NULL, *pgen = NULL;
380 const char *pcSemi =
";";
384 "\n-D- begin %s: test file %s\n", cModule, pcFullFile);
386 strcpy(cTemp, pcFullFile);
392 iRC = strncmp(cTemp,
"/dev", 4);
395 "-E- invalid file name: %s\n path names must not contain '%s'\n",
401 pdelim = strrchr(cTemp, *pcFileDelim);
402 if ( (pdelim == NULL) || (pdelim > plocd) )
405 "-E- invalid disk file name: %s\n path names must not contain '%s'\n",
416 "-E- invalid tape file name: %s\n name too long: max %d byte after dev name\n",
422 iRC = strncmp(++pcc,
"\0", 1);
427 "-E- file name must be specified explicitly\n");
429 fprintf(
fLogFile,
"-E- file name missing in %s\n", pcFullFile);
437 plocs = strchr(cTemp, *pcSemi);
441 iRC = isalnum(*plocs);
444 iRC = isalpha(*plocs);
447 "-W- version number in file specification removed\n");
450 "-W- invalid version in file specification removed\n");
454 "-W- semicolon in file specification removed\n");
455 strncpy(--plocs,
"\0", 1);
456 strcpy(pcFullFile, cTemp);
459 iDevType = rawCheckDevice(cTemp, &pcFile, &pcTape);
464 " no device name specified\n");
469 if (strlen(pcFile) == 0)
470 fprintf(
fLogFile,
" disk device %s\n", pcTape);
473 " file %s on disk %s\n", pcFile, pcTape);
479 if (strlen(pcFile) == 0)
480 fprintf(
fLogFile,
" tape device %s\n", pcTape);
482 fprintf(
fLogFile,
" file %s on tape %s\n", pcFile, pcTape);
486 fprintf(
fLogFile,
"-E- invalid file name %s\n", pcFullFile);
500 "-E- node specification not allowed in file name: %s\n",
506 strncpy(plocd++,
"\0", 1);
507 strcpy(pcTape, cTemp);
512 pgen = strchr(pcTape, *
pcStar);
516 "-E- specified device %s has generic path\n", pcTape);
518 " only the relative file name may be generic\n");
523 strcpy(pcFile, plocd);
525 " file %s on tape %s\n", pcFile, pcTape);
526 strcpy(cText,
"tape");
532 strcpy(pcFile, cTemp);
533 strcpy(cText,
"disk");
538 " %s file %s\n", cText, pcFile);
540 pdelim = strrchr(pcFile, *pcFileDelim);
547 "-E- path in tape file name not allowed: %s\n", pcFile);
553 pgen = strchr(pcFile, *
pcStar);
555 pgen = strchr(pcFile, *
pcQM);
556 if ( (pgen != NULL) && (pgen < pdelim) && (iDebug) )
558 " specified %s file %s has wildcard chars in path name\n",
564 else pdelim = pcFile;
567 if (strlen(pdelim) > ii)
570 "-E- rel file name %s too long:\n has %d chars, max allowed %d\n",
571 pdelim, (
int) strlen(pdelim), ii);
582 iloc = isupper(*pcc);
586 "-W- upper case in (relative) file name not supported: %s\n",
589 *pcc = tolower(*pcc);
596 fprintf(
fLogFile,
" instead assumed: %s\n", pdelim);
600 "-D- end %s: file name %s okay\n\n", cModule, pcFullFile);
615 char cModule[32] =
"rawDelFile";
631 "\n-D- begin %s: delete file %s%s%s\n",
637 iFSidWC = ntohl(psComm->
iFSidWC);
642 " object %s%s%s found (objId %u-%u)",
646 ", on %s in read cache FS %d\n", psComm->
cNodeRC, iFSidRC);
650 " on %s in write cache FS %d\n", psComm->
cNodeWC, iFSidWC);
655 pcc = (
char *) psComm;
656 if ( (iRC = send( iSocket, pcc, (
unsigned) iBufComm, 0 )) < iBufComm)
659 "-E- %s: sending delete request for file %s (%d byte)\n",
660 cModule, psComm->
cNamell, iBufComm);
662 "-E- %s: delete request for file %s (%d byte) incompletely sent (%d byte)\n",
663 cModule, psComm->
cNamell, iBufComm, iRC);
665 fprintf(
fLogFile,
" %s\n", strerror(errno));
666 perror(
"-E- sending delete request");
672 " delete command sent to server (%d bytes), look for reply\n",
681 "-E- %s: receiving status buffer\n", cModule);
685 "-E- %s: message received from server:\n", cModule);
690 fprintf(
fLogFile,
"\n-D- end %s\n\n", cModule);
696 " status (%d) received from server (%d bytes)\n",
703 "-I- gStore object %s%s%s successfully deleted",
706 fprintf(
fLogFile,
" from write cache\n");
710 fprintf(
fLogFile,
"-D- end %s\n\n", cModule);
732 char cModule[32] =
"rawDelList";
763 fprintf(
fLogFile,
"\n-D- begin %s\n", cModule);
764 fprintf(
fLogFile,
" initial %d files, first file %s\n",
765 ifile, psFile0->
cFile);
768 pDataMover = pDataMover0;
783 " buffer %d: %d objects, first obj %s%s (server %d)\n",
788 for (ii=1; ii<=iobj; ii++)
795 " obj %d: %s%s, objId %d-%d\n",
801 for (jj=1; jj<=ifile; jj++)
804 " file %d: %s\n", jj, psFile->
cFile);
806 pdelim = strrchr(psFile->
cFile, *pcFileDelim);
810 pdelim = strrchr(psFile->
cFile, *pcFileDelim2);
811 if (pdelim != NULL) pdelim++;
814 pdelim = psFile->
cFile;
818 iRC = strcmp(pdelim, pcc);
831 fprintf(
fLogFile,
" matching file %d: %s, obj %d: %s%s",
835 ", on DM %s in StageFS %d\n",
839 fprintf(
fLogFile,
", on DM %s in ArchiveFS %d\n",
841 fprintf(
fLogFile,
" archived at %s by %s\n",
845 fprintf(
fLogFile,
" (not in disk pool)\n");
891 " current data mover %s, socket %d\n",
892 pDataMover->
cNode, iSocket);
896 pDataMover = pDataMover0;
897 for (kk=1; kk<=iDataMover; kk++)
899 if (strcmp(pDataMover->
cNode,
908 "-E- %s: data mover %s not found in list\n",
916 " new data mover %s, socket %d\n",
917 pDataMover->
cNode, iSocket);
925 fprintf(
fLogFile,
" rawDelFile: rc = %d\n", iRC);
929 "-E- %s: file %s could not be deleted\n",
930 cModule, psFile->
cFile);
932 fprintf(
fLogFile,
"-D- end %s\n\n", cModule);
944 " file %s: obj %s%s not found in gStore\n",
951 piptr = (
int **) psObj;
952 if (*piptr == NULL) bDelDone =
bTrue;
958 fprintf(
fLogFile,
"-D- end %s\n\n", cModule);
973 char cModule[32]=
"rawGetFSpName";
979 fprintf(
fLogFile,
"\n-D- begin %s\n", cModule);
982 if ( (strchr(pcUser, *
pcStar) != NULL) ||
983 (strchr(pcUser, *
pcQM) != NULL) )
986 "-E- %s: generic archive name '%s' not allowed\n",
993 fprintf(
fLogFile,
"-D- %s: FS %s, in %s-%s, delim %s\n",
994 cModule,
cNamefs, pcUser, pc, pcObjDelim);
995 if (strncmp(pc, pcObjDelim, 1) == 0)
1003 if (isalpha(*pc) == 0)
1006 "-E- archive name '%s' must start with a letter\n", pc);
1012 "-D- end %s: FS %s\n",
cNamefs, cModule);
1030 char cModule[32]=
"rawGetHLName";
1036 int ii = 0, ii1 = 0;
1039 "\n-D- begin %s\n path specified: %s\n", cModule, pcPath);
1041 pdelim = strchr(pcPath, *pcObjDelim);
1042 if (pdelim != pcPath)
1046 " delimiter '%s' inserted at begin of archive path\n",
1052 pdelim = strstr(
cNamehl,
"/./");
1056 pdelim = strstr(cNameTemp,
"/./");
1058 while (pdelim != NULL)
1061 strncpy(pdelim,
"\0", 1);
1068 pdelim = strstr(cNameTemp,
"/./");
1071 " %d unnecessary './' removed\n", ii);
1074 pdelim = strstr(
cNamehl,
"/.");
1084 strncpy(pdelim,
"\0", 1);
1086 " trailing '/.' removed\n");
1091 " hl name: %s\n-D- end %s\n\n",
cNamehl, cModule);
1110 char cModule[32] =
"rawGetLLName";
1117 "\n-D- begin %s\n file %s, object delimiter %s\n",
1118 cModule, pcFile, pcDelimiter);
1120 strcpy(cNamell, pcDelimiter);
1122 ploc = strrchr(pcFile, *pcFileDelim);
1124 strcat(cNamell, ++ploc);
1127 ploc = strrchr(pcFile, *pcObjDelimAlt);
1129 strcat(cNamell, ++ploc);
1135 strcat(cNamell, ++ploc);
1139 strcat(cNamell, pcFile);
1142 strcpy(pcObject, cNamell);
1145 " ll name %s\n-D- end %s\n\n", pcObject, cModule);
1159 unsigned long *piSize,
1160 unsigned int *piRecl)
1162 char cModule[32] =
"rawGetFileSize";
1167 unsigned long iSize = 0;
1170 struct _stat sFileStatus, *pFileStatus;
1172 struct stat sFileStatus, *pFileStatus;
1176 "\n-D- begin %s: file %s\n", cModule, pcFile);
1178 pFileStatus = &sFileStatus;
1181 iRC = _stat(pcFile, pFileStatus);
1183 iRC = stat(pcFile, pFileStatus);
1188 "-E- %s: file %s unavailable (stat)\n", cModule, pcFile);
1191 if (strcmp(strerror(errno),
1192 "No such file or directory") != 0)
1193 fprintf(
fLogFile,
" %s\n", strerror(errno));
1196 if (strcmp(strerror(errno),
1197 "Value too large for defined data type") == 0)
1200 "-E- file size %s > 2 GByte: use 64 bit gStore client\n",
1213 iRecl = pFileStatus->st_fab_mrs;
1218 iRecl = pFileStatus->st_blksize;
1221 iSize = pFileStatus->st_size;
1222 if (pFileStatus->st_mode & S_IFREG)
1226 " file %s: size %lu, recl %d (byte)\n",
1227 pcFile, iSize, iRecl);
1231 if (pFileStatus->st_mode & S_IFDIR)
1235 "-W- %s is a directory, size %lu\n", pcFile, iSize);
1239 else if (pFileStatus->st_mode & S_IFLNK)
1243 "-W- %s is a symbolic link, size %lu\n", pcFile, iSize);
1251 "-W- unexpected item %s, size %lu\n", pcFile, iSize);
1258 fprintf(
fLogFile,
"-D- end %s\n\n", cModule);
1276 char cModule[32] =
"rawGetPathName";
1279 char *ploc = NULL, *ploc1 = NULL;
1283 fprintf(
fLogFile,
"-D- begin %s: hl: %s\n", cModule, pcNamehl);
1285 if (strlen(pcNamehl) == 0)
1287 fprintf(
fLogFile,
"-E- %s: high level name empty\n", cModule);
1292 ploc = strchr(pcNamehl, *pcObjDelim);
1293 ploc1 = strchr(pcNamehl, *pcObjDelimAlt);
1294 if ( (ploc != pcc) && (ploc1 != pcc) )
1297 "-E- %s: invalid prefix in high level name %s\n",
1304 "-D- end %s: path %s\n\n", cModule,
cPath);
1325 char cModule[32] =
"rawQueryFile";
1336 int iStatus = 0, iStatusLen = 0;
1337 int iBuf = 0, iBufComm = 0;
1341 int iVersionObjAttr = 0;
1349 int iMediaClass = 0;
1356 char *pcQueryBuffer;
1357 int iQueryBuffer = 0;
1360 iAction = ntohl(pComm->
iAction);
1368 "\n-D- begin %s: query file %s%s in ATL Server %d (socket %d, action %d)\n",
1390 "-E- %s: invalid action %d\n", cModule, iAction);
1395 pcc = (
char *) pComm;
1396 iRC = send(iSocket, pcc, (
unsigned) iBufComm, 0);
1400 "-E- %s: sending command buffer for query file %s%s\n",
1403 "-E- %s: query command buffer incompletely sent (%d of %d byte)\n",
1404 cModule, iRC, iBufComm);
1408 fprintf(
fLogFile,
" %s\n", strerror(errno));
1417 " query command sent to entry server (%d bytes), look for reply\n",
1424 pcc = (
char *) pQuery;
1429 "-E- %s: receiving buffer header with query information\n",
1436 iIdent = ntohl(pQuery->
iIdent);
1438 iAttrLen = ntohl(pQuery->
iAttrLen);
1441 " %d bytes received: iIdent %d, iQuery %d, iAttrLen %d\n",
1442 iRC, iIdent, iQuery, iAttrLen);
1445 iQueryAll += iQuery;
1454 iStatusLen = iAttrLen;
1461 "-E- %s: error status from entry server instead of query data:\n",
1468 "-E- receiving error msg from server, rc = %d\n",
1470 else if ( (iDebug) || (iStatus ==
STA_ERROR) ||
1475 fprintf(
fLogFile,
" no error message available\n");
1485 "-E- %s: unexpected status (type %d) received from server\n",
1490 "-E- %s: unexpected header (type %d) received from server\n",
1502 iQueryBuffer = iQuery * iAttrLen;
1503 if ( (pcQueryBuffer =
1504 (
char *) calloc(iQueryBuffer,
ichar) ) == NULL)
1507 "-E- %s: allocating query info buffer for %d objs (%d byte)\n",
1508 cModule, iQuery, iQueryBuffer);
1510 fprintf(
fLogFile,
" %s\n", strerror(errno));
1514 pcc = pcQueryBuffer;
1517 " query info buffer for %d objs allocated (%d byte)\n",
1518 iQuery, iQueryBuffer);
1524 iQueryBuffer = iAttrLen;
1528 iBuf = iQueryBuffer;
1531 if ( (iRC = recv( iSocket, pcc, (
unsigned) iBuf, 0 )) <= 0 )
1536 "-E- %s: receiving buffer with query results (%d byte)\n",
1537 cModule, iQueryBuffer);
1543 jj = iQueryBuffer - iBuf;
1545 "-E- %s: connection to server broken, only %d bytes of query result (%d byte) received\n",
1546 cModule, jj, iQueryBuffer);
1551 fprintf(
fLogFile,
" %s\n", strerror(errno));
1564 " query data of %d objs received (%d byte)\n",
1565 iQuery, iQueryBuffer);
1575 for (ii=1; ii<=iQuery; ii++)
1577 iPoolId = ntohl(pObjAttr->
iPoolId);
1581 fprintf(
fLogFile,
"%d: %s%s%s (poolId %d)\n",
1593 if ( (ntohl(pObjAttr->
iObjHigh) == 0) &&
1594 (ntohl(pObjAttr->
iObjLow) == 0) )
1608 if ( (iPoolId == 1) || (iPoolId == 2) ||
1622 "-E- %s: unexpected meta data for file %s%s%s: objId High/Low %d-%d, poolId %d, iMediaClass %d\n",
1629 "-E- %s: inconsistent meta data for file %s%s%s: objId High/Low %d-%d, poolId %d, iMediaClass %d\n",
1632 pObjAttr->
iObjLow, iPoolId, iMediaClass);
1659 iVersionObjAttr = ntohl(pObjAttr->
iVersion);
1664 "-E- %d: %s%s%s has invalid cacheDB entry version %d\n",
1666 pObjAttr->
cNamell, iVersionObjAttr);
1675 else if ( (iQuery == 0) && (iDebug) )
1676 fprintf(
fLogFile,
" no objs found\n");
1689 if ( (iNameVar == 0) && (iQueryAll > 0) )
1700 " no matching object %s%s%s in gStore found\n",
1705 " file %s%s%s available in gStore\n",
1710 "-E- %s: query in gStore could not be executed\n",
1715 " requested archive %s not existing in gStore\n",
1720 " access to requested file %s%s%s not allowed\n",
1724 if ( (iQueryAll > 1) && (iNameVar == 0) )
1726 fprintf(
fLogFile,
" %d versions of %s%s exist!\n",
1733 fprintf(
fLogFile,
"-D- end %s\n\n", cModule);
1750 char cModule[32]=
"rawRecvError";
1758 fprintf(
fLogFile,
"\n-D- begin %s\n", cModule);
1767 if ( (iRC = recv(iSocket, pcc, (
unsigned) iBuf, 0 )) <= 0 )
1772 "-E- %s: receiving error message\n", cModule);
1776 fprintf(
fLogFile,
" %s\n", strerror(errno));
1793 "-E- incomplete error message received:\n %s", pcMsg);
1796 "-E- %s: connection to sender broken, %d byte of error message (%d byte) received\n",
1801 fprintf(
fLogFile,
" %s\n", strerror(errno));
1818 "-E- %s: more error data received than expected:\n %s",
1826 fprintf(
fLogFile,
"-D- end %s\n\n", cModule);
1842 " error message received (%d bytes):\n %s",
1844 fprintf(
fLogFile,
"-D- end %s\n\n", cModule);
1862 char cModule[32]=
"rawRecvHead";
1875 fprintf(
fLogFile,
"\n-D- begin %s: socket %d\n", cModule, iSocket);
1887 iRC = recv(iSocket, pcc, (
unsigned) iBuf, 0);
1891 "-E- %s: receiving buffer header\n", cModule);
1896 "-W- %s: connection to sender broken, %d byte of buffer header (%d byte) received\n",
1897 cModule, ii, iBufs);
1902 fprintf(
fLogFile,
" %s\n", strerror(errno));
1914 iIdent = ntohl(*pint);
1916 iStatus = ntohl(*pint);
1918 iDataLen = ntohl(*pint);
1920 " ident %d, status %d, datalen %d\n",
1921 iIdent, iStatus, iDataLen);
1928 "-W- %s: error message available for receive (%d byte)\n",
1936 "-D- end %s: buffer header received (%d bytes)\n\n",
1970 char cModule[32] =
"rawRecvHeadC";
1987 fprintf(
fLogFile,
"\n-D- begin %s\n", cModule);
1989 if (iIdentReq < 0) fprintf(
fLogFile,
1990 " check Ident, expect %d\n", iIdentReq);
1992 fprintf(
fLogFile,
" no check of Ident\n");
1993 if (iStatusReq >= 0) fprintf(
fLogFile,
1994 " check Status, expect %d\n", iStatusReq);
1996 fprintf(
fLogFile,
" no check of Status\n");
2007 if ( (iRC = recv( iSocket, pcc, (
unsigned) iBuf, 0 )) <= 0 )
2011 sprintf(pcMsg,
"-E- %s: receiving buffer header\n",
2019 "-W- %s: connection to sender broken, %d byte of buffer header (%d byte) received\n",
2020 cModule, ii, iBufs);
2026 sprintf(cMsg1,
" %s\n", strerror(errno));
2027 strcat(pcMsg, cMsg1);
2043 " buffer header received (%d bytes)\n", iBufs);
2045 pint = (
int *) pcBuf;
2046 iIdent = ntohl(*pint);
2048 iStatus = ntohl(*pint);
2050 iDataLen = ntohl(*pint);
2053 " ident %d, status %d, datalen %d\n",
2054 iIdent, iStatus, iDataLen);
2060 fprintf(
fLogFile,
" status received");
2063 fprintf(
fLogFile,
" with error message\n");
2076 sprintf(pcMsg,
"-E- %s: receiving error msg, rc=%d\n",
2086 " msg (%d byte): %s\n", iDataLen, pcc);
2088 iRC = strlen(pcMsg);
2092 if ( (iDataLen == 0) &&
2096 "-W- error status received, but no error message\n");
2105 fprintf(
fLogFile,
" check identifier\n");
2107 if (iIdent != iIdentReq)
2110 "-E- %s: unexpected header (ident %d) received\n",
2121 if (iStatusReq >= 0)
2124 fprintf(
fLogFile,
" check status\n");
2126 if (iStatusReq != iStatus)
2129 "-E- %s: unexpected header (status %d) received\n",
2145 fprintf(
fLogFile,
"-D- end %s\n\n", cModule);
2169 char cModule[32]=
"rawRecvRequest";
2183 "\n-D- begin %s: receive request buffer\n", cModule);
2185 pRequest = &sRequest;
2186 pcc = (
char *) pRequest;
2191 if ( (iRC = recv( iSocket, pcc, (
unsigned) iBuf, 0 )) <= 0 )
2196 "-E- %s: receiving buffer header\n", cModule);
2203 "-W- %s: connection to sender broken, %d byte of buffer header (%d byte) received\n",
2204 cModule, ii, iimax);
2208 goto gErrorRecvRequest;
2219 "-E- %s: more buffer header data received than expected\n",
2223 goto gErrorRecvRequest;
2228 " buffer header received (%d bytes, id %d)\n",
2229 iimax, pRequest->
iIdent);
2234 fprintf(
fLogFile,
"-E- %s: invalid buffer received (id %d)\n",
2235 cModule, pRequest->
iIdent);
2237 goto gErrorRecvRequest;
2249 if ( (iRC = recv( iSocket, pcc, (
unsigned) iBuf, 0 )) <= 0 )
2254 "-E- %s: receiving buffer data\n", cModule);
2261 "-W- %s: connection to sender broken, %d byte of data (%d byte) received\n",
2262 cModule, ii, iBuf0);
2268 fprintf(
fLogFile,
" %s\n", strerror(errno));
2272 goto gErrorRecvRequest;
2282 fprintf(
fLogFile,
"-E- %s: more data received than expected\n",
2285 goto gErrorRecvRequest;
2291 " %s: request data received (%d bytes)\n", cModule, iBuf0);
2296 "-E- %s: invalid data size (%d) in request buffer (expected %d byte)\n",
2297 cModule, iBuf0, iRequSize-
HEAD_LEN);
2299 goto gErrorRecvRequest;
2302 *piSeekMode = ntohl(pRequest->
iSeekMode);
2303 *piOffset = ntohl(pRequest->
iOffset);
2307 fprintf(
fLogFile,
"-D- end %s\n\n", cModule);
2318 " %s: status info received: end session\n", cModule);
2325 "-W- %s: error status received: end session\n", cModule);
2327 "-W- %s: error message from client:\n %s\n",
2330 goto gErrorRecvRequest;
2335 "-E- %s: invalid status buffer received (id %d)\n",
2338 goto gErrorRecvRequest;
2342 goto gErrorRecvRequest;
2347 fprintf(
fLogFile,
"-E- %s: invalid buffer received (ident %d)\n",
2348 cModule, pRequest->
iIdent);
2350 goto gErrorRecvRequest;
2355 fprintf(
fLogFile,
"-D- end %s\n\n", cModule);
2375 char cModule[32]=
"rawRecvStatus";
2384 fprintf(
fLogFile,
"\n-D- begin %s\n", cModule);
2389 pcc = (
char *) psStatus;
2395 iRC = recv( iSocket, pcc, (
unsigned) iBuf, 0 );
2399 "-E- %s: receiving status header\n", cModule);
2404 "-W- %s: connection to sender broken, %d byte of status header (%d byte) received\n",
2405 cModule, ii, iBufs);
2410 fprintf(
fLogFile,
" %s\n", strerror(errno));
2426 "-E- %s: more status header data received than expected\n",
2437 fprintf(
fLogFile,
" status header received (%d bytes)\n",
2439 fprintf(
fLogFile,
" ident %d, status %d, status len %d\n",
2446 fprintf(
fLogFile,
"-E- %s: invalid status header received (%d)\n",
2447 cModule, psStatus->
iIdent);
2458 if ( (iRC = recv( iSocket, pcc, (
unsigned) iBuf, 0 )) <= 0 )
2461 "-E- %s: receiving status message\n", cModule);
2466 "-W- %s: connection to sender broken, %d byte of status message (%d byte) received\n",
2472 fprintf(
fLogFile,
" %s\n", strerror(errno));
2487 "-E- %s: more status data received than expected\n",
2493 " status message received (%d bytes):\n%s\n",
2500 fprintf(
fLogFile,
"-D- end %s\n\n", cModule);
2520 char cModule[32]=
"rawSendRequest";
2530 "\n-D- begin %s: send request buffer\n", cModule);
2540 sRequest.
iOffset = htonl(iOffset);
2541 if (iBufferSize < 0)
2544 "-E- %s: invalid buffer size %d\n", cModule, iBufferSize);
2550 pcc = (
char *) &sRequest;
2551 iRC = send(iSocket, pcc, (
unsigned) iBuf, 0);
2555 "-E- %s: sending request buffer\n", cModule);
2557 "-E- %s: request buffer incompletely sent (%d of %d byte)\n",
2558 cModule, iRC, iBuf);
2562 fprintf(
fLogFile,
" %s\n", strerror(errno));
2570 "-D- end %s: request buffer sent\n\n", cModule);
2587 char cModule[32]=
"rawSendStatus";
2596 "\n-D- begin %s: send status buffer (%d) to socket %d\n",
2597 cModule, iStatus, iSocket);
2600 sStatus.
iStatus = htonl(iStatus);
2606 iMsgLen = strlen(pcMsg);
2611 strcpy(sStatus.
cStatus, pcMsg);
2613 " status message (%d bytes):\n %s\n", iMsgLen, pcMsg);
2616 pcc = (
char *) &sStatus;
2620 " now send (iIdent %d, iStatus %d, iStatusLen %d), %d byte:\n",
2626 iRC = send(iSocket, pcc, (
unsigned) iBuf, 0);
2630 "-E- %s: sending status buffer\n", cModule);
2632 "-E- %s: status buffer incompletely sent (%d of %d byte)\n",
2633 cModule, iRC, iBuf);
2637 fprintf(
fLogFile,
" %s\n", strerror(errno));
2645 "-D- end %s: status buffer sent (%d byte)\n\n", cModule, iBuf);
2661 char cModule[32] =
"rawTestFileName";
2667 unsigned long lFileSize = 0;
2668 unsigned int iSize = 0;
2672 "-D- begin %s: input file name %s\n", cModule, pcFile);
2674 if ( (pdir = strrchr(pcFile,
'*')) != NULL)
2677 "-E- invalid file name '%s': '*' not allowed as part of file name\n",
2683 if ( (pdir = strrchr(pcFile,
'?')) != NULL)
2686 "-E- invalid file name '%s': '?' not allowed as part of file name\n",
2692 if ( (pdir = strrchr(pcFile,
'/')) == NULL)
2695 fprintf(
fLogFile,
" name %s okay\n", pcFile);
2699 ilen = strlen(pdir);
2701 " trailor %s (len %d)\n", pdir, ilen);
2704 strncpy(pdir,
"\0", 1);
2706 fprintf(
fLogFile,
" %s is a directory\n", pcFile);
2711 fprintf(
fLogFile,
" rel name %s okay\n", pcFile);
2716 " after rawGetFileSize, rc = %d\n", iRC);
2722 fprintf(
fLogFile,
"-W- %s NOT archived", pcFile);
2724 fprintf(
fLogFile,
" - is a directory\n");
2726 fprintf(
fLogFile,
" - is a symbolic link\n");
2728 fprintf(
fLogFile,
" - is not a regular file\n");
2738 " %s is a regular file\n", pcFile);
2742 fprintf(
fLogFile,
"-D- end %s\n\n", cModule);
int rawTestFileName(char *pcFile)
int rawAddStrings(char *pcMsg1, int iMaxLength1, char *pcMsg2, int iMaxLength2, int iErrno, char *pcMsgE, int iMaxLengthE)
static char cPath[MAX_FULL_FILE]
int rawRecvError(int iSocket, int iLen, char *pcMsg)
int rawRecvHeadC(int iSocket, char *pcBuf, int iIdentReq, int iStatusReq, char *pcMsg)
int rawRecvRequest(int iSocket, int *piSeekMode, int *piOffset, int *piBufferSize)
static char cNamefs[MAX_OBJ_FS]
int rawRecvHead(int iSocket, char *pcBuf)
int rawSendStatus(int iSocket, int iStatus, char *pcMsg)
int rawSendRequest(int iSocket, int iSeekMode, int iOffset, int iBufferSize)
int rawDelFile(int iSocket, srawComm *psComm)
int rawGetFileSize(char *pcFile, unsigned long *piSize, unsigned int *piRecl)
int rawCheckClientFile(char *pcFullFile, char *pcFile, char *pcTape)
char * rawGetPathName(char *pcNamehl)
int rawQueryFile(int iSocket, int iAltMaster, srawComm *pCommBuf, void **pQueryBuf)
char * rawGetHLName(char *pcPath)
char * rawGetFSpName(char *pcUser)
int rawDelList(int iSocketMaster, int iDataMover, srawDataMoverAttr *pDataMover0, srawComm *psComm, char **pcFileList, char **pcObjList)
int rawGetLLName(char *pcFile, const char *pcDelimiter, char *pcObject)
int rawRecvStatus(int iSocket, srawStatus *psStatus)
static char cNamehl[MAX_OBJ_HL]
#define GSI_CACHE_INCOMPLETE
#define GSI_MEDIA_INCOMPLETE
#define IDENT_QUERY_ARCHDB
#define VERSION_SRAWOBJATTR
#define IDENT_NEXT_BUFFER
static const char * pcDevDelim
static const char * pcPerc
static const char * pcStar
char cFile[MAX_FULL_FILE]
char cMoverStage[MAX_NODE]
char cMoverCache[MAX_NODE]
char cArchiveDate[MAX_DATE]