130 #include <sys/socket.h>
131 #include <sys/time.h>
135 #include <netinet/in.h>
149 static unsigned int iint =
sizeof(int);
166 char *pcArchive,
char *pcNodeMaster)
168 char cModule[32] =
"rawCheckFilelist";
171 char cDelimiter[1] =
"";
212 "\n-D- begin %s: initial %d files, %d objects (1st buffer)\n",
213 cModule, ifile0, iobj0);
214 fprintf(
fLogFile,
" first file %s, first obj %s%s%s\n",
218 iRC = strncmp(psObj->
cNamell, pcObjDelim, 1);
221 iRC = strncmp(psObj->
cNamell, pcObjDelimAlt, 1);
225 "-E- %s: invalid object delimiter %1s found\n",
230 strcpy(cDelimiter, pcObjDelimAlt);
233 strcpy(cDelimiter, pcObjDelim);
235 for (ii = 1; ii <= ifile0; ii++)
243 fprintf(
fLogFile,
" %d: '%s'\n", ii, cFilell);
248 fprintf(
fLogFile,
"\n*** buffer %d: %d objs\n", iobjBuf, iobj);
253 for (jj = 1; jj <= iobj; jj++)
256 iRC = strcmp(cFilell, psObj->
cNamell);
260 " %s%s%s already archived in gStore\n",
261 pcArchive, psObj->
cNamehl, pcFilell);
263 "-W- %s%s%s already archived in gStore\n",
264 pcArchive, psObj->
cNamehl, pcFilell);
266 strncpy(psFile->
cFile,
"\n", 1);
271 " last file, comparison finished\n");
281 piptr = (
int **) psObj;
286 fprintf(
fLogFile,
" %d: last obj buffer\n", iobjBuf);
288 fprintf(
fLogFile,
"*** %d: %s (%s) to be archived\n",
289 ii, psFile->
cFile, cFilell);
298 "\n*** new buffer %d: %d objs, first obj '%s'\n",
299 iobjBuf, iobj, psObj->
cNamell);
311 " %d of %d files removed: %d files remaining\n",
312 idel, ifile0, ifile);
315 *pcFileList = (
char *) pifl;
317 if ( (ifile > 0) && (idel > 0) )
321 for (ii = 1; ii <= ifile0; ii++)
324 iRC = strncmp(psFile->
cFile,
"\n", 1);
336 for (jj = ii+1; jj <= ifile0; jj++)
340 iRC = strncmp(psFile->
cFile,
"\n", 1);
350 "*** %d: %s\n", iif, psFile0->
cFile);
362 fprintf(
fLogFile,
" file list compressed\n");
369 fprintf(
fLogFile,
"-D- end %s\n\n", cModule);
417 char cModule[32]=
"rawCheckObjlist";
449 int iif = 0, ii1 = 0, ii2 = 0;
456 int iihihi1 = 0, iihihi2 = 0, iHiHiValcur = 0, iihihicur = 0;
457 int iihilo1 = 0, iihilo2 = 0, iHiLoValcur = 0, iihilocur = 0;
458 int iilohi1 = 0, iilohi2 = 0, iLoHiValcur = 0, iilohicur = 0;
472 unsigned int iRestoTopValues = 0,
473 iRestoHiHiValues = 0,
474 iRestoHiLoValues = 0,
475 iRestoLoHiValues = 0,
476 iRestoLoLoValues = 0;
478 unsigned int iRestoTopMin = 0,
502 char *pcflcomp, *pcolcomp;
503 int *piflcomp, *piolcomp;
507 char *pcflsort, *pcolsort;
508 int *piflsort, *piolsort;
530 int ii, jj, jjMin = 0;
553 pcolcomp = *pcObjComp;
554 piolcomp = (
int *) pcolcomp;
556 psObjComp0 = psObjComp;
563 "-E- %s: file list too long: %d entries, only %d allowed\n",
564 cModule, iFileComp, ii);
571 "\n-D- begin %s: overall %d objects, in 1st buffer %d objects\n",
572 cModule, iFileAll, iobj0);
573 fprintf(
fLogFile,
" compressed: %d objects\n", iFileComp);
577 " first file %s, first obj %s%s\n",
586 for (jj=1; jj<=iFileAll; jj++)
589 "DDDD %d: file %s (%d)\n", jj, psFile->
cFile, psFile);
603 for (jj=1; jj<=iFileAll; jj++)
606 if (strlen(psObj->
cNamell) < 2)
609 " object %d(%d): ignored\n", iiObj, jj);
611 goto gNextObjUnstage;
615 memcpy((
char *) psObjComp, (
char *) psObj,
iRetrList);
617 "%d(%d): obj %s%s copied (Comp)\n", iiObj, jj,
627 " buffer %d: last obj (no. %d) handled\n",
630 piptr = (
int **) psObj;
634 " buffer %d: last obj buffer\n", iiBuf);
644 " new buffer %d, %d objs, first: %s%s|\n",
651 goto gEndCheckObjlist;
657 iFileBufComp =
sizeof(int) + iFileComp*
sizeof(
srawFileList);
658 if ((pcFileComp = (
char *) calloc(
659 (
unsigned) iFileBufComp,
sizeof(
char) ) ) == NULL)
662 "-E- %s: allocating filelist buffer (Comp, %d byte)\n",
663 cModule, iFileBufComp);
665 fprintf(
fLogFile,
" %s\n", strerror(errno));
666 perror(
"-E- allocating filelist buffer (Comp)");
671 " filelist buffer (Comp) allocated (size %d)\n", iFileBufComp);
673 piflcomp = (
int *) pcFileComp;
674 piflcomp[0] = iFileComp;
676 psFileComp0 = psFileComp;
678 if ( (pcFileSort = (
char *) calloc(
679 (
unsigned) iFileBufComp,
sizeof(
char)) ) == NULL)
682 "-E- %s: allocating filelist buffer (Sort, %d byte)\n",
683 cModule, iFileBufComp);
685 fprintf(
fLogFile,
" %s\n", strerror(errno));
686 perror(
"-E- allocating filelist buffer (Sort)");
691 " filelist buffer (Sort) allocated (size %d)\n", iFileBufComp);
693 piflsort = (
int *) pcFileSort;
694 piflsort[0] = iFileComp;
696 psFileSort0 = psFileSort;
698 iObjBufComp =
sizeof(int) + iFileComp*
sizeof(
srawRetrList);
699 if ( (pcObjSort = (
char *) calloc(
700 (
unsigned) iObjBufComp,
sizeof(
char)) ) == NULL )
703 "-E- %s: allocating objectlist buffer (%d byte)\n",
704 cModule, iObjBufComp);
706 fprintf(
fLogFile,
" %s\n", strerror(errno));
707 perror(
"-E- allocating objlist buffer");
712 " objlist buffer (Sort) allocated (size %d)\n", iObjBufComp);
714 pcolsort = pcObjSort;
715 piolsort = (
int *) pcolsort;
716 piolsort[0] = iFileComp;
718 psObjSort0 = psObjSort;
722 for (jj=1; jj<=iFileAll; jj++)
725 for (ii=0; ii<=5; ii++)
728 iaValue[jj][ii] = -1;
740 fprintf(
fLogFile,
"scan objects for sort criteria:\n");
743 for (jj=1; jj<=iFileAll; jj++)
748 "DDD %d (comp %d): obj %s (%d), file %s (%d)\n",
749 iiObj, jj, psObj->
cNamell, psObj, psFile->
cFile, psFile);
751 if (strlen(psObj->
cNamell) < 2)
755 " object %d(%d): ignored\n", iiObj, jj);
763 " object %d(%d) %s%s: in read cache\n",
770 memcpy((
char *) psObjComp, (
char *) psObj,
iRetrList);
776 "%d: read cache obj %s%s (objId %u-%u) copied (Comp)\n",
780 " orig file name %s (%d)\n",
781 psFile->
cFile, psFile);
783 " file name %s copied (Comp: %d)\n",
784 psFileComp->
cFile, psFileComp);
785 if (jj == iFileAll) fprintf(
fLogFile,
786 " in last buffer %d: last obj (no. %d) handled\n",
801 " object %d(%d) %s%s: in write cache\n",
808 memcpy((
char *) psObjSort, (
char *) psObj,
iRetrList);
813 "%d: write cache obj %s%s (%u-%u) copied (Sort)\n",
817 if (jj == iFileAll) fprintf(
fLogFile,
818 " in last buffer %d: last obj (no. %d) handled\n",
833 " object %d(%d) %s%s: top restore field %d\n",
841 "-W- object %d(%d) %s%s: hihi restore field %d\n",
849 " object %d(%d) %s%s: hilo restore field %d\n",
857 "-W- object %d(%d) %s%s: lohi restore field %d\n",
865 " object %d(%d) %s%s: lolo restore field %d\n",
875 " buffer %d: last obj (no. %d) handled\n",
878 piptr = (
int **) psObj;
882 " buffer %d: last obj buffer\n", iiBuf);
892 " new buffer %d, %d objs, first: %s%s|\n",
899 " usage of restore fields: %u-%u-%u-%u-%u\n",
900 iRestoTop, iRestoHiHi, iRestoHiLo, iRestoLoHi, iRestoLoLo);
906 psObjSort = psObjSort0;
907 psFileSort = psFileSort0;
909 for (ii=1; ii<=iWriteCache; ii++)
911 memcpy((
char *) psObjComp, (
char *) psObjSort,
iRetrList);
922 if ( ((iReadCache) || (iWriteCache)) && (iDebug == 2) )
924 psObjComp = psObjComp0;
925 psFileComp = psFileComp0;
930 "%d read cache entries (Comp)\n", iReadCache);
931 for (ii=1; ii<=iReadCache; ii++)
933 fprintf(
fLogFile,
" %d: obj %s%s, file %s\n",
944 "%d write cache entries (Comp)\n", iWriteCache);
945 for (ii=1; ii<=iWriteCache; ii++)
947 jj = iReadCache + ii;
948 fprintf(
fLogFile,
" %d: obj %s%s, file %s\n",
958 if (iReadCache + iWriteCache == iFileComp)
959 goto gEndCheckObjlist;
963 iFileSort = iFileComp - iReadCache - iWriteCache;
974 "DDD TSM restore values before sorting:\n");
977 for (jj=1; jj<=iFileAll; jj++)
980 if (iaValue[jj][0] < 3)
985 " %d: (%d) ignored", jj, iaValue[jj][0]);
994 goto gNextObjCompress;
998 iaCompValue[ii][0] = iaValue[jj][0];
999 iaCompValue[ii][1] = iaValue[jj][1];
1000 iaCompValue[ii][2] = iaValue[jj][2];
1001 iaCompValue[ii][3] = iaValue[jj][3];
1002 iaCompValue[ii][4] = iaValue[jj][4];
1003 iaCompValue[ii][5] = iaValue[jj][5];
1006 " %d(%d): %d %d-%d-%d-%d-%d\n", jj, ii,
1007 iaValue[jj][0], iaValue[jj][1], iaValue[jj][2],
1008 iaValue[jj][3], iaValue[jj][4], iaValue[jj][5]);
1010 memcpy((
char *) psObjSort, (
char *) psObj,
iRetrList);
1021 " buffer %d: last obj (no. %d) handled\n",
1024 piptr = (
int **) psObj;
1028 " buffer %d: last obj buffer\n", iiBuf);
1038 " new buffer %d, %d objs, first: %s%s\n",
1044 if (ii != iFileSort)
1047 "-E- %s: inconsistent no. of TSM files: %d - %d\n",
1048 cModule, iFileSort, ii);
1058 "DDD list of compressed TSM objs/files (ps...Sort):\n");
1060 for (jj=1; jj<=iFileSort; jj++)
1063 iaValTop[jj] = iaCompValue[jj][1];
1068 iaValHiHi[jj] = iaCompValue[jj][2];
1073 iaValHiLo[jj] = iaCompValue[jj][3];
1078 iaValLoHi[jj] = iaCompValue[jj][4];
1083 iaValLoLo[jj] = iaCompValue[jj][5];
1091 fprintf(
fLogFile,
" %d: obj %s%s, file %s\n",
1101 iisort2 = iFileSort;
1110 for (jj=iisort1; jj<=iisort2; jj++)
1112 if (iaIndNew[jj] != iaIndex[jj])
1116 iaValHiHi[jj] = iaCompValue[ii1][2];
1118 iaValHiLo[jj] = iaCompValue[ii1][3];
1120 iaValLoHi[jj] = iaCompValue[ii1][4];
1122 iaValLoLo[jj] = iaCompValue[ii1][5];
1128 memcpy(&iaIndex[iisort1], &iaIndNew[iisort1],
1129 (
unsigned) iFileSort*
iint);
1134 "DDD restore order after top sorting (%d changes):\n",
1136 for (jj=iisort1; jj<=iisort2; jj++)
1139 " %d: index %d, values: %u-%u-%u-%u-%u\n",
1140 jj, iaIndNew[jj], iaValTop[jj],
1141 iaValHiHi[jj], iaValHiLo[jj],
1142 iaValLoHi[jj], iaValLoLo[jj]);
1146 iRestoTopValues = 1;
1147 iRestoTopMin = iaValTop[iisort1];
1148 for (jj=iisort1+1; jj<=iisort2; jj++)
1150 if (iaValTop[jj] > iRestoTopMin)
1152 iRestoTopMin = iaValTop[jj];
1158 "%d different top restore values\n", iRestoTopValues);
1164 for (iTopValcur=1; iTopValcur<=iRestoTopValues; iTopValcur++)
1166 if (iTopValcur == iRestoTopValues)
1170 iRestoTopMin = iaValTop[iitop1];
1171 for (jj=iitop1+1; jj<=iFileSort; jj++)
1173 if (iaValTop[jj] > iRestoTopMin)
1179 if (jj == iFileSort)
1184 if (iitop1 == iitop2)
1187 " %d. top restore value %d: only one object (%d)\n",
1188 iTopValcur, iaValTop[iitop1], iitop1);
1190 if (iTopValcur == iRestoTopValues)
1194 iitop1 = iitop2 + 1;
1199 " %d. top restore value %d: objs %d - %d\n",
1200 iTopValcur, iaValTop[iitop1], iitop1, iitop2);
1211 if (iitop2 - iitop1)
1218 for (jj=iitop1; jj<=iitop2; jj++)
1220 if (iaIndNew[jj] != iaIndex[jj])
1224 iaValTop[jj] = iaCompValue[ii1][1];
1226 iaValHiHi[jj] = iaCompValue[ii1][2];
1228 iaValLoHi[jj] = iaCompValue[ii1][4];
1230 iaValLoLo[jj] = iaCompValue[ii1][5];
1236 ii1 = iitop2 - iitop1 + 1;
1237 memcpy(&iaIndex[iitop1], &iaIndNew[iitop1],
1238 (
unsigned) ii1*iint);
1243 " restore order after hilo sorting (%d - %d: %d changes):\n",
1244 iitop1, iitop2, iDiff);
1245 for (jj=iitop1; jj<=iitop2; jj++)
1248 " %d: index %d, values: %u-%u-%u-%u-%u\n",
1249 jj, iaIndNew[jj], iaValTop[jj],
1250 iaValHiHi[jj], iaValHiLo[jj],
1251 iaValLoHi[jj], iaValLoLo[jj]);
1255 iRestoHiLoValues = 1;
1256 iRestoHiLoMin = iaValHiLo[iitop1];
1258 for (jj=iitop1+1; jj<=iitop2; jj++)
1260 if (iaValHiLo[jj] > iRestoHiLoMin)
1262 iRestoHiLoMin = iaValHiLo[jj];
1268 " %d different hilo restore values\n", iRestoHiLoValues);
1272 iRestoHiLoValues = 1;
1278 for (iHiLoValcur=1; iHiLoValcur<=iRestoHiLoValues; iHiLoValcur++)
1280 if (iHiLoValcur == iRestoHiLoValues)
1284 iRestoHiLoMin = iaValHiLo[iihilo1];
1285 for (jj=iitop1+1; jj<=iitop2; jj++)
1287 if (iaValHiLo[jj] > iRestoHiLoMin)
1298 if (iihilo1 == iihilo2)
1301 " %d. hilo restore value %d: only one object (%d)\n",
1302 iHiLoValcur, iaValHiLo[iihilo1], iihilo1);
1304 if (iHiLoValcur == iRestoHiLoValues)
1308 iihilo1 = iihilo2 + 1;
1313 " %d. hilo restore value %d: objs %d - %d\n",
1314 iHiLoValcur, iaValHiLo[iihilo1], iihilo1, iihilo2);
1324 if (iihilo2 - iihilo1)
1327 iihilo1, iihilo2, iaIndex, iaIndNew);
1331 for (jj=iihilo1; jj<=iihilo2; jj++)
1333 if (iaIndNew[jj] != iaIndex[jj])
1337 iaValTop[jj] = iaCompValue[ii1][1];
1339 iaValHiHi[jj] = iaCompValue[ii1][2];
1341 iaValHiLo[jj] = iaCompValue[ii1][3];
1343 iaValLoHi[jj] = iaCompValue[ii1][4];
1349 ii1 = iihilo2 - iihilo1 + 1;
1350 memcpy(&iaIndex[iihilo1], &iaIndNew[iihilo1],
1351 (
unsigned) ii1*iint);
1356 " restore order after lolo sorting (%d - %d: %d changes):\n",
1357 iihilo1, iihilo2, iDiff);
1358 for (jj=iihilo1; jj<=iihilo2; jj++)
1361 " %d: index %d, values: %u-%u-%u-%u-%u\n",
1362 jj, iaIndNew[jj], iaValTop[jj],
1363 iaValHiHi[jj], iaValHiLo[jj],
1364 iaValLoHi[jj], iaValLoLo[jj]);
1369 iRestoLoLoValues = 1;
1373 iRestoLoLoValues = 0;
1375 iihilo1 = iihilo2 + 1;
1381 iRestoHiLoValues = 0;
1383 iitop1 = iitop2 + 1;
1388 iRestoTopValues = 0;
1396 "DDD final restore order after sorting:\n");
1397 for (jj=iisort1; jj<=iisort2; jj++)
1401 " %d: index %d, values: %u-%u-%u-%u-%u\n",
1402 jj, iaIndex[jj], iaCompValue[ii][1], iaCompValue[ii][2],
1403 iaCompValue[ii][3], iaCompValue[ii][4], iaCompValue[ii][5]);
1420 "DDD copy TSM objects to temp destination for compression\n");
1422 for (jj = 1; jj <= iFileAll; jj++)
1425 if (iaValue[jj][0] < 3)
1429 fprintf(
fLogFile,
" (%d): ignored", jj);
1442 goto gNextCopy2Temp;
1448 memcpy((
char *) psObjSort, (
char *) psObj,
iRetrList);
1454 " %d(%d): obj %s%s (objId %u-%u) copied (Comp), retrId %u-%u-%u-%u-%u\n",
1472 " buffer %d: last obj (no. %d) handled\n",
1474 piptr = (
int **) psObj;
1478 " %d: last obj buffer\n", iiBuf);
1488 " %d: new buffer, %d objs, first: |%s%s|\n",
1499 "DDD compressed list of TSM objects (not yet sorted):\n");
1501 for (jj=1; jj<=iFileSort; jj++)
1503 fprintf(
fLogFile,
" %d: obj %s%s, file %s\n",
1511 if (icount != iFileSort)
1514 "-E- %s: unexpected no. of objects found: %d, expected %d\n",
1515 cModule, icount, iFileSort);
1526 "DDD copy TSM objects in correct order to final destination\n");
1529 for (jj = 1; jj <= iFileSort; jj++)
1534 psFileSort += iDiff;
1538 memcpy((
char *) psObjComp, (
char *) psObjSort,
iRetrList);
1544 " %d: TSM obj %s%s (index %d, objId %u-%u) copied (Comp), retrId %u-%u-%u-%u-%u\n",
1557 iFileAll = iReadCache + iWriteCache + iFileSort;
1560 psObjComp = psObjComp0;
1561 psFileComp = psFileComp0;
1563 "final list of all objects (compressed and sorted):\n");
1565 for (jj=1; jj<=iFileAll; jj++)
1568 " %d: obj %s%s, file %s, objId %u-%u, retrId %u-%u-%u-%u-%u",
1590 memset(pcfl, 0x00, (
unsigned) iFileBufComp);
1591 memcpy(pcfl, pcFileComp, (
unsigned) iFileBufComp);
1595 "-D- end %s\n\n", cModule);
1610 char cModule[32] =
"rawDelFile";
1626 "\n-D- begin %s: delete file %s%s%s\n",
1632 iFSidWC = ntohl(psComm->
iFSidWC);
1636 printf(
" object %s%s%s found (objId %u-%u)",
1639 if (iFSidRC) printf(
1640 ", on %s in read cache FS %d\n", psComm->
cNodeRC, iFSidRC);
1643 if (iFSidWC) printf(
1644 " on %s in write cache FS %d\n", psComm->
cNodeWC, iFSidWC);
1649 pcc = (
char *) psComm;
1650 if ( (iRC = send( iSocket, pcc, (
unsigned) iBufComm, 0 )) < iBufComm)
1652 if (iRC < 0) printf(
1653 "-E- %s: sending delete request for file %s (%d byte)\n",
1654 cModule, psComm->
cNamell, iBufComm);
1656 "-E- %s: delete request for file %s (%d byte) incompletely sent (%d byte)\n",
1657 cModule, psComm->
cNamell, iBufComm, iRC);
1659 printf(
" %s\n", strerror(errno));
1660 perror(
"-E- sending delete request");
1666 " delete command sent to server (%d bytes), look for reply\n",
1671 pcc = (
char *) &sStatus;
1676 "-E- %s: receiving status buffer\n", cModule);
1679 printf(
"-E- %s: message received from server:\n", cModule);
1680 printf(
"%s", sStatus.
cStatus);
1683 printf(
"\n-D- end %s\n\n", cModule);
1689 printf(
" status (%d) received from server (%d bytes)\n",
1692 printf(
"-I- Object %s%s%s successfully deleted",
1695 printf(
" (staged)\n");
1699 printf(
" was in write cache\n");
1702 printf(
"-D- end %s\n\n", cModule);
1723 char cModule[32] =
"rawDelList";
1739 bool_t bDelete, bDelDone;
1746 pifl = (
int *) pcfl;
1754 printf(
"\n-D- begin %s\n", cModule);
1755 printf(
" initial %d files, first file %s\n",
1756 ifile, psFile0->
cFile);
1759 pDataMover = pDataMover0;
1761 piol = (
int *) pcol;
1774 printf(
" buffer %d: %d objects, first obj %s%s (server %d)\n",
1778 for (ii=1; ii<=iobj; ii++)
1781 pcc = (
char *) psObj->
cNamell;
1785 " obj %d: %s%s, objId %d-%d\n",
1791 for (jj=1; jj<=ifile; jj++)
1794 " file %d: %s\n", jj, psFile->
cFile);
1796 pdelim = strrchr(psFile->
cFile, *pcFileDelim);
1800 pdelim = strrchr(psFile->
cFile, *pcFileDelim2);
1801 if (pdelim != NULL) pdelim++;
1804 pdelim = psFile->
cFile;
1808 iRC = strcmp(pdelim, pcc);
1821 printf(
" matching file %d: %s, obj %d: %s%s",
1824 printf(
", on DM %s in StageFS %d\n",
1828 printf(
", on DM %s in ArchiveFS %d\n",
1830 printf(
" archived at %s by %s\n",
1834 printf(
" (not in disk pool)\n");
1878 iSocket = pDataMover->
iSocket;
1880 " current data mover %s, socket %d\n",
1881 pDataMover->
cNode, iSocket);
1885 pDataMover = pDataMover0;
1886 for (kk=1; kk<=iDataMover; kk++)
1888 if (strcmp(pDataMover->
cNode,
1894 if (kk > iDataMover)
1896 printf(
"-E- %s: data mover %s not found in list\n",
1901 iSocket = pDataMover->
iSocket;
1903 " new data mover %s, socket %d\n",
1904 pDataMover->
cNode, iSocket);
1912 printf(
" rawDelFile: rc = %d\n", iRC);
1915 printf(
"-E- %s: file %s could not be deleted\n",
1916 cModule, psFile->
cFile);
1918 printf(
"-D- end %s\n\n", cModule);
1929 else if (iDebug) printf(
1930 " file %s: obj %s%s not found in gStore\n",
1937 piptr = (
int **) psObj;
1938 if (*piptr == NULL) bDelDone =
bTrue;
1944 printf(
"-D- end %s\n\n", cModule);
1970 char cModule[32] =
"rawGetFilelistEntries";
1976 int iFilesIgnored = 0;
1984 char cQualifier[16] =
".filelist";
1985 const char *pcLeading =
"@";
1997 int iGenericEntries = 0;
1998 int iSingleEntries = 0;
2000 FILE *fiFile = NULL;
2004 int *piFilelist, *piFilelisto;
2011 printf(
"\n-D- begin %s\n", cModule);
2013 iDataFS = *piDataFS;
2017 if ((
int) strlen(pcFileName) >= imax)
2020 "-E- %s: file name too long (max %d)\n",
2023 goto gErrorFilelist;
2025 strcpy(cFileName, pcFileName);
2027 pccT = (
char *) strrchr(pcFileName, *pcLeading);
2030 pccE = (
char *) strrchr(pccT, *pcObjDelim);
2038 " no leading '%s' in file name %s\n", pcLeading, pcFileName);
2043 ploc = strrchr(cFileName, pcc[0]);
2048 if (strcmp(ploc, pcc) != 0)
2051 " no trailing %s\n", cQualifier);
2058 " no trailing %s in file name %s\n", cQualifier, pcFileName);
2063 " %s is a filelist\n", cFileName);
2065 fiFile = fopen(pcFileName,
"r");
2068 fprintf(
fLogFile,
"-E- %s: opening filelist %s\n",
2069 cModule, pcFileName);
2071 fprintf(
fLogFile,
" %s\n", strerror(errno));
2072 perror(
"-E- opening filelist");
2075 goto gErrorFilelist;
2078 " filelist %s opened\n", pcFileName);
2080 piFilelisto = piFilelist;
2081 iMaxEntries = *piFilelist;
2083 " max no. of entries in filelist buffer: %d\n", iMaxEntries);
2085 "DDD piFilelist %p, *piFilelist %d\n",
2086 piFilelist, *piFilelist);
2090 pFilelistc = pFilelist;
2095 pccE = fgets(cEntry, imax, fiFile);
2097 if ( (pccE != NULL) && (strlen(pccE) > 1) )
2101 memset(cTemp,
'\0', strlen(cTemp));
2106 if ( (*pccE !=
'\0') && (*pccE !=
'\n') && (*pccE !=
'\r') &&
2109 strncpy(pccT, pccE, 1);
2118 strncpy(pccT,
"\0", 1);
2121 "'%s' -> '%s': %d chars removed\n", cEntry, cTemp, iDelCount);
2131 " path prefix '%s' in first filelist entry found\n",
2138 if (strlen(pccT) == 0)
2141 "-W- no path name found after path prefix: %s\n",
2146 ii = strlen(pccT) - 1;
2149 if (strncmp(pcc,
"/", 1) == 0)
2150 strncpy(cPath, pccT, (
unsigned) ii);
2152 strcpy(cPath, pccT);
2155 " path '%s' for files in filelist\n", cPath);
2163 strcpy(pcDataFS, cPath);
2166 " central data FS path %s\n", cPath);
2177 "-E- only one path specification in file list allowed, %s and following files ignored\n",
2183 while ( (ploc = strchr(cTemp, *
pcPerc)) != NULL)
2186 fprintf(
fLogFile,
"-W- replace %s", cTemp);
2189 fprintf(
fLogFile,
" by %s\n", cTemp);
2192 if ( (iEntries == iMaxEntries) &&
2195 iMaxEntries += iMaxEntries;
2197 " entry buffer full, reallocate: max %d entries\n",
2201 piFilelisto = piFilelist;
2202 piFilelist = (
int *) calloc(
2203 (
unsigned) iSizeBuffer,
sizeof(char) );
2204 if (piFilelist == NULL)
2207 "-E- %s: reallocating filelist buffer (size %d)\n",
2208 cModule, iSizeBuffer);
2210 fprintf(
fLogFile,
" %s\n", strerror(errno));
2211 perror(
"-E- reallocating filelist buffer");
2214 goto gErrorFilelist;
2218 " filelist entry buffer reallocated (size %d)\n",
2221 *piFilelist = iMaxEntries;
2223 "DDD piFilelist %p, *piFilelist %d\n",
2224 piFilelist, *piFilelist);
2227 pFilelistco = pFilelist;
2228 pFilelist = pFilelistc;
2230 for (ii=1; ii<=iEntries; ii++)
2233 "DDD pFilelistc %p\n", pFilelistc);
2234 strcpy(pFilelistc->
cFile, pFilelistco->
cFile);
2240 " %d old entries copied to new buffer, next:\n",
2244 "DDD free piFilelisto %p\n", piFilelisto);
2246 piFilelisto = piFilelist;
2251 "DDD pFilelistc %p\n", pFilelistc);
2253 if ( (ploc = strchr(cTemp, *pcObjDelim)) != NULL)
2256 if (iFilesIgnored == 1) fprintf(
fLogFile,
2257 "-W- file-specific path not yet implemented in filelist\n");
2258 fprintf(
fLogFile,
"-W- %s ignored\n", cTemp);
2264 strcpy(pFilelistc->
cFile, cPath);
2265 strncat(pFilelistc->
cFile,
"/", 1);
2267 strcat(pFilelistc->
cFile, cTemp);
2271 " %3d: %s \n", iEntries, pFilelistc->
cFile);
2280 *piGlobalDir = iGlobalDir;
2282 pFilelistc = pFilelist;
2285 fprintf(
fLogFile,
" after allocation:\n");
2286 for (ii=1; ii<=iEntries; ii++)
2289 " %3da: %s \n", ii, pFilelistc->
cFile);
2297 pFilelistc = pFilelist;
2299 for (ii=1; ii<iEntries; ii++)
2301 if (strlen(pFilelistc->
cFile) == 0)
2307 pFilelistco = pFilelistc;
2309 for (jj=ii+1; jj<=iEntries; jj++)
2311 if (strcmp(pFilelistc->
cFile, pFilelistco->
cFile) == 0)
2314 fprintf(
fLogFile,
"-W- duplicate entry %s removed\n",
2315 pFilelistco->
cFile);
2316 strcpy(pFilelistco->
cFile,
"");
2328 " %d duplicate entries found in list\n", iRemove);
2330 " no duplicate entries found in list\n");
2336 fprintf(
fLogFile,
" no valid entries found in list\n");
2340 pFilelistc = pFilelist;
2343 fprintf(
fLogFile,
" after removal of duplicates:\n");
2344 for (ii=1; ii<=iEntries; ii++)
2347 " %3db: %s \n", ii, pFilelistc->
cFile);
2355 pFilelistc = pFilelist;
2356 for (ii=1; ii<iEntries; ii++)
2358 if (strlen(pFilelistc->
cFile) == 0)
2360 pFilelistco = pFilelistc;
2362 pFilelistc0 = pFilelistc;
2363 for (jj=ii+1; jj<=iEntries; jj++)
2365 strcpy(pFilelistc0->
cFile, pFilelistco->
cFile);
2374 iEntries -= iRemove;
2377 *piFilelist = iEntries;
2380 pFilelistc = pFilelist;
2381 for (ii=1; ii<=iEntries; ii++)
2388 ploc = strchr(pFilelistc->
cFile, *
pcQM);
2400 if ( (iGeneric) && (iSingle) )
2407 if ( (iGeneric) && (iSingle) )
2409 piFilelisto = piFilelist;
2413 piFilelist = (
int *) calloc((
unsigned) iSizeBuffer,
sizeof(char));
2414 if (piFilelist == NULL)
2417 "-E- %s: allocating ordered filelist buffer (size %d)\n",
2418 cModule, iSizeBuffer);
2420 fprintf(
fLogFile,
" %s\n", strerror(errno));
2421 perror(
"-E- allocating ordered filelist buffer");
2424 goto gErrorFilelist;
2428 " ordered filelist buffer allocated (size %d)\n",
2432 "DDD piFilelist %p, *piFilelist %d\n",
2433 piFilelist, *piFilelist);
2436 pFilelist = pFilelistc;
2438 iGenericEntries = 0;
2441 for (ii=1; ii<=iEntries; ii++)
2450 ploc = strchr(pFilelistco->
cFile, *
pcQM);
2465 strcpy(pFilelistc->
cFile, pFilelistco->
cFile);
2466 strcpy(pFilelistco->
cFile,
"");
2478 for (ii=1; ii<=iEntries; ii++)
2480 if (strlen(pFilelistco->
cFile) != 0)
2482 strcpy(pFilelistc->
cFile, pFilelistco->
cFile);
2490 " %d generic file names, followed by %d non-generic file names\n",
2491 iGenericEntries, iSingleEntries);
2495 pFilelistc = pFilelist;
2498 fprintf(
fLogFile,
" after reordering:\n");
2499 for (ii=1; ii<=iEntries; ii++)
2502 " %3dc: %s \n", ii, pFilelistc->
cFile);
2508 *piEntries = iEntries;
2511 if ( (iDebug == 2) && (pccT) ) fprintf(
fLogFile,
2512 "DDD piFilelist %p, *piFilelist %d\n",
2513 piFilelist, *piFilelist);
2518 iRC = fclose(fiFile);
2521 fprintf(
fLogFile,
"-E- %s: closing filelist %s\n",
2522 cModule, pcFileName);
2524 fprintf(
fLogFile,
" %s\n", strerror(errno));
2525 perror(
"-E- closing filelist");
2529 *piDataFS = iDataFS;
2533 printf(
"-D- end %s\n\n", cModule);
2550 char cModule[32] =
"rawGetWSInfo";
2571 int iSleepClean = 0;
2577 char cPoolNameRand[32] =
"RetrievePool";
2578 char cPoolNameTemp[32] =
"StagePool";
2579 int iHardwareFree = 0;
2580 int iPoolRandFree = 0;
2582 int iRandomExcess = 0;
2584 int iPoolTempAvail = 0;
2585 int iPoolTempMax = 0;
2586 int iPoolTempMaxWS = 0;
2587 int iPoolTempFree = 0;
2591 int iTempSizeUnavail = 0;
2598 int iWorkSizeSta = 0;
2599 int iWorkFilesSta = 0;
2601 int iWorkSizeStaTemp = 0;
2603 int iWorkFilesStaTemp = 0;
2604 int iWorkSizeStaRand = 0;
2606 int iWorkFilesStaRand = 0;
2607 int iWorkSizeEst = 0;
2608 int iWorkFilesEst = 0;
2610 int iWorkStatus = 0;
2615 char cMsgPref[8] =
"";
2616 char cMisc[128] =
"";
2623 printf(
"\n-D- begin %s\n", cModule);
2625 piBuffer = pCliActionComm->
piBuffer;
2626 iSocket = pCliActionComm->
iSocket;
2627 iAction = pCliActionComm->
iAction;
2632 iPoolId = pCliActionComm->
iStatus;
2638 strcpy(pcGenFile, pCliActionComm->
pcFile);
2649 printf(
" action %d", iAction);
2651 printf(
", print pool info");
2653 printf(
", poolId %d\n", iPoolId);
2660 pcc = (
char *) piBuffer;
2665 printf(
"-E- receiving header pool status from master server\n");
2669 iIdent = ntohl(pPoolInfo->
iIdent);
2670 iStatus = ntohl(pPoolInfo->
iPoolNo);
2674 " header pool status received (%d bytes): ident %d, status %d, attrlen %d\n",
2675 iRC, iIdent, iStatus, iAttrLen);
2684 printf(
"-E- received error status from server");
2686 printf(
" instead of pool info:\n");
2693 if (iRC < 0) printf(
2694 "-E- receiving error msg from server, rc = %d\n",
2696 else printf(
" %s\n", pcc);
2698 else printf(
" no error message available\n");
2704 "-E- unexpected status (type %d) received from server\n",
2711 "-E- unexpected header (%d) received from server\n",
2720 iBufPool = iAttrLen;
2724 pPoolInfoData0 = pPoolInfoData;
2730 if ( (iRC = recv( iSocket, pcc, (
unsigned) iBuf, 0 )) <= 0)
2732 if (iRC < 0) printf(
2733 "-E- %s: receiving pool info\n", cModule);
2736 ii = iBufPool - iBuf;
2738 "-E- %s: connection to entry server broken, %d byte of pool info (%d byte) received\n",
2739 cModule, ii, iBufPool);
2742 printf(
" %s\n", strerror(errno));
2743 perror(
"-E- receiving pool info");
2754 " stage pool status received (%d bytes)\n", iBufPool);
2759 (iAction ==
STAGE) )
2760 for (iPoolcur=1; iPoolcur<=iPoolmax; iPoolcur++)
2764 iHardwareFree = ntohl(pPoolInfoData->
iFreeSizeHW);
2765 iPoolRandFree = ntohl(pPoolInfoData->
iFreeSize);
2768 iPoolTempFree = ntohl(pPoolInfoData->
iFreeSize);
2770 if (strcmp(pPoolInfoData->
cPoolName,
"RetrievePool") == 0)
2772 if (strcmp(pPoolInfoData->
cPoolName,
"StagePool") == 0)
2779 if (iPrintPoolInfo) printf(
2780 "-I- overall HW space ATL server%d %8d MByte, free %8d MByte\n",
2782 ntohl(pPoolInfoData->
iMaxSizeHW), iHardwareFree);
2784 if ( (iPoolId == iPoolMode) || (iPoolId == 0) )
2786 printf(
" %s: used for 'gstore retrieve'\n",
2789 iPoolRandUsed = ntohl(pPoolInfoData->
iMaxSize) -
2791 if (iPoolRandFree < 0)
2792 iRandomExcess = -iPoolRandFree;
2795 " used space %8d MByte, %d files stored\n",
2796 iPoolRandUsed, ntohl(pPoolInfoData->
iFiles));
2800 if (iHardwareFree > 0) printf(
2801 " free space (%8d MByte) shared with StagePool\n",
2803 printf(
" no min file lifetime\n");
2811 if ( (iPoolId == iPoolMode) || (iPoolId == 0) )
2813 if (iPrintPoolInfo) printf(
2814 " %s: used for 'gstore stage'\n",
2816 iPoolTempAvail = ntohl(pPoolInfoData->
iFileAvail);
2818 iPoolTempUsed = ntohl(pPoolInfoData->
iMaxSize) -
2820 iPoolTempFree = iHardwareFree;
2821 if (iPoolTempFree < 0)
2824 if (iHardwareFree < iPoolTempFree)
2825 iTempSizeUnavail = iPoolTempFree - iHardwareFree;
2827 if ( (iPoolTempFree >= 0) && (iPrintPoolInfo) )
2829 printf(
" used space %8d MByte, %d files stored\n",
2830 iPoolTempUsed, ntohl(pPoolInfoData->
iFiles));
2832 (iPoolTempFree > 0) ) printf(
2833 " free space (%8d MByte) shared with RetrievePool\n",
2836 if (iPrintPoolInfo) printf(
2837 " min file availability of %d days guaranteed\n",
2844 if ( (iPoolMode == 2) &&
2847 iPoolTempMax = ntohl(pPoolInfoData->
iMaxSize);
2849 iPoolTempCheck = ntohl(pPoolInfoData->
iCheckSize);
2855 pPoolInfoData = pPoolInfoData0;
2864 *ppWorkSpace = pWorkSpace;
2869 printf(
"-E- receiving work space buffer header\n");
2873 printf(
"-D- header work space buffer received (%d bytes)\n",
2876 iIdent = ntohl(pWorkSpace->
iIdent);
2877 iStatus = ntohl(pWorkSpace->
iWorkId);
2887 if (iDebug) printf(
"\n");
2888 printf(
"-E- received error status from server");
2890 printf(
" instead of work space info:\n");
2895 pcc = (
char *) piBuffer;
2897 if (iRC < 0) printf(
2898 "-E- receiving error msg from server, rc = %d\n",
2900 else printf(
" %s\n", pcc);
2902 else printf(
" no error message available\n");
2908 "-E- unexpected status (%d) received from server\n",
2915 "-E- unexpected header (%d) received from server\n",
2928 if ( (iRC = recv( iSocket, pcc, (
unsigned) iBuf, 0 )) <= 0)
2930 if (iRC < 0) printf(
2931 "-E- %s: receiving work space info (%d byte)\n",
2935 ii = iAttrLen - iBuf;
2936 printf(
"-E- %s: connection to sender broken, %d byte of work space info (%d byte) received\n",
2937 cModule, ii, iAttrLen);
2940 printf(
" %s\n", strerror(errno));
2941 perror(
"-E- receiving work space info");
2952 printf(
" remainder work space buffer received (%d byte)\n",
2957 iWorkStatus = ntohl(pWorkSpace->
iStatus);
2965 iWorkSizeStaRand = iWorkSizeSta - iWorkSizeStaTemp;
2966 iWorkFilesStaRand = iWorkFilesSta - iWorkFilesStaTemp;
2973 printf(
" %d files, overall size %d MByte",
2974 iWorkFilesAll, iWorkSizeAll);
2976 printf(
", size estimated for %d files (%d MByte)\n",
2977 iWorkFilesEst, iWorkSizeEst);
2980 if (iWorkSizeSta == iWorkSizeAll)
2985 "\n all files already available on central disk\n");
2986 if ( (iPoolId == 2) &&
2990 " to get a guaranteed availability of %d days on disk pool use 'gstore stage'\n",
2994 else if (iWorkSizeSta)
2999 "\n %d files already available on central disk (%d MByte)\n",
3000 iWorkFilesSta, iWorkSizeSta);
3001 if (iWorkFilesStaTemp)
3003 " %d files already in %s (%d MByte)\n",
3004 iWorkFilesStaTemp, cPoolNameTemp, iWorkSizeStaTemp);
3006 " %d files still to be staged or currently being staged (%d MByte)\n",
3007 iWorkFilesAll-iWorkFilesSta,
3008 iWorkSizeAll - iWorkSizeSta);
3012 printf(
", all to be staged\n");
3025 if ( (iWorkStatus < 9) && (iWorkStatus != 0) )
3028 (iWorkStatus == 2) )
3030 strcpy(cMsgPref,
"-W-");
3031 printf(
"%s staging requested workspace '%s' completely may fail\n",
3032 cMsgPref, pcGenFile);
3036 strcpy(cMsgPref,
"-E-");
3037 printf(
"%s requested workspace '%s' cannot be staged:\n",
3038 cMsgPref, pcGenFile);
3041 if (iWorkStatus < 0)
3042 printf(
"%s staging disk pool currently unavailable\n",
3044 else if (iWorkStatus == 1)
3046 printf(
" currently free in %s: %d MByte\n",
3047 cPoolNameTemp, iPoolTempFree);
3049 " still needed: %d MByte (%d files)\n",
3050 iWorkSizeAll-iWorkSizeSta,
3051 iWorkFilesAll-iWorkFilesSta);
3053 printf(
"-I- Check later again!\n");
3055 "-I- Query work space status before retrying later!\n");
3057 else if ( (iWorkStatus == 2) || (iWorkStatus == 3) )
3059 if (iWorkStatus == 2) printf(
3060 "%s max work space allowed in '%s' is currently limited to %d MByte\n",
3061 cMsgPref, cPoolNameTemp, iPoolTempMaxWS);
3063 "%s overall size of %s is limited to %d MByte\n",
3064 cMsgPref, cPoolNameTemp, iPoolTempMax);
3066 if (iWorkStatus == 3) printf(
3067 "-I- Please reduce your work space requirements\n");
3069 else if (iWorkStatus < 9)
3071 "-E- unexpected workspace status received from server (%d)\n",
3075 printf(
"-D- end %s\n\n", cModule);
3080 if ( (iDebug) && (iWorkSizeSta != iWorkSizeAll) )
3084 iWorkSizeNew = iWorkSizeAll - iWorkSizeSta;
3087 if (iWorkSizeNew > iHardwareFree)
3089 printf(
"-D- currently unused in %s: %d MByte\n",
3090 cPoolNameTemp, iPoolTempFree);
3091 printf(
" currently free in %s: %d MByte, remainder temporarily used by other pools\n",
3092 cPoolNameTemp, iHardwareFree);
3095 printf(
"-D- currently free in %s: %d MByte\n",
3096 cPoolNameTemp, iHardwareFree);
3099 printf(
"-D- currently free in %s: %d MByte\n",
3100 cPoolNameTemp, iPoolTempFree);
3102 " to get all files on disk pool with a guaranteed availability of %d days:\n",
3104 printf(
" -> use 'gstore stage'\n");
3114 if (iWorkStatus >= 9)
3123 printf(
"-D- currently free (HW): %d MByte\n",
3126 " currently %d MByte unused in %s are allocated by other pools\n",
3127 ii*(-1), cPoolNameTemp);
3131 strcpy(cMisc,
"must be initiated (gstore stage)");
3133 strcpy(cMisc,
"is initiated");
3135 "-I- a clean job %s to provide the requested space\n",
3138 if (iWorkStatus > 9)
3141 iSleepClean = iWorkStatus;
3154 printf(
"-D- end %s\n\n", cModule);
3171 char cModule[32] =
"rawGetFullFile";
3178 char *pdelim=NULL, *pdelim2=NULL;
3182 fprintf(
fLogFile,
"\n-D- begin %s\n", cModule);
3184 strcpy(
cPath, pcFile);
3185 pdelim = strrchr(
cPath, *pcFileDelim);
3188 strncpy(pdelim,
"\0", 1);
3189 strcpy(cname1, ++pdelim);
3194 pdelim2 = strrchr(
cPath, *pcFileDelim2);
3195 if (pdelim2 != NULL)
3197 strncpy(pdelim2,
"\0", 1);
3198 strcpy(cname1, ++pdelim2);
3203 strncpy(
cPath,
"\0", 1);
3204 strcpy(cname1, pcFile);
3210 ilen = strlen(cname1);
3215 fprintf(
fLogFile,
"-D- %s: path %s], name1: %s (len %d)\n",
3216 cModule,
cPath, cname1, ilen);
3220 if (pdelim2 != NULL)
3221 fprintf(
fLogFile,
"-D- %s: device %s, name1: %s (len %d)\n",
3222 cModule,
cPath, cname1, ilen);
3224 fprintf(
fLogFile,
"-D- %s: no prefix, name1: %s (len %d)\n",
3225 cModule, cname1, ilen);
3229 " path: %s, name1: %s (len %d)\n",
cPath, cname1, ilen);
3235 iRC = strncmp(pcll, pcObjDelim, 1);
3236 if (iRC == 0) pcll++;
3239 iRC = strncmp(pcll, pcObjDelimAlt, 1);
3240 if (iRC == 0) pcll++;
3243 if (strlen(
cPath) > 0)
3246 if (pdelim2 != NULL)
3247 strcat(
cPath, pcFileDelim2);
3250 strcat(
cPath, pcFileDelim);
3252 strcat(
cPath, pcll);
3254 "-D- end %s: full file name found: %s\n\n", cModule,
cPath);
3256 return( (
char *)
cPath);
3274 char cModule[32]=
"rawQueryPrint";
3276 char cMClass[12] =
"";
3278 char cStatus[16] =
"";
3285 int iMediaClass = 0;
3287 unsigned long *plFileSizeC;
3288 unsigned long lFileSize;
3289 int iVersionObjAttr = 0;
3295 iVersionObjAttr = ntohl(pQAttr->
iVersion);
3296 if ( (ipMode == 1) || (ipMode == 11) ) fprintf(
fLogFile,
3297 "\n-D- begin %s: objAttr V%d\n", cModule, iVersionObjAttr);
3303 "-E- %s: invalid cacheDB entry version %d\n",
3304 cModule, iVersionObjAttr);
3316 strcpy(ctype,
"FB");
3319 strcpy(ctype,
"U ");
3322 fprintf(
fLogFile,
"-E- Invalid record format %d found\n",
3330 strcpy(cMClass,
"DISK ");
3333 strcpy(cMClass,
"TAPE ");
3336 strcpy(cMClass,
"NETWORK");
3339 strcpy(cMClass,
"SHELF");
3342 strcpy(cMClass,
"OFFSITE");
3345 strcpy(cMClass,
"UNAVAILABLE");
3349 strcpy(cMClass,
"STAGE");
3350 strcpy(cStatus,
"staged");
3354 strcpy(cMClass,
"STAGE*");
3355 strcpy(cStatus,
"still staging");
3359 strcpy(cMClass,
"STAGE*");
3360 strcpy(cStatus,
"staging failed");
3365 strcpy(cMClass,
"CACHE");
3366 strcpy(cStatus,
"cached");
3371 strcpy(cMClass,
"CACHE*");
3372 strcpy(cStatus,
"still caching");
3376 fprintf(
fLogFile,
"-E- Invalid media class %d found\n",
3388 sprintf(cMClass,
"%s%d", cMClass, iATLServer);
3390 sprintf(cMClass,
"%s", cMClass);
3393 if ( (ipMode == 10) || (ipMode == 11) )
3394 strcat(cMClass,
"??");
3399 fprintf(
fLogFile,
"%s%s%s %s %s %s",
3405 plFileSizeC = (
unsigned long *) &(pQAttr->
iFileSize);
3406 lFileSize = *plFileSizeC;
3411 (
sizeof(long) == 8) )
3412 fprintf(
fLogFile,
" %12lu", lFileSize);
3427 if ( (ipMode == 1) || (ipMode == 11) )
3429 if (ntohl(pQAttr->
iFS))
3430 fprintf(
fLogFile,
" %s on data mover %s, FS %d (poolId %d)\n",
3431 cStatus, pQAttr->
cNode, ntohl(pQAttr->
iFS),
3434 " obj-Id: %u-%u, restore order: %u-%u-%u-%u-%u\n",
3443 " owner: %s, OS: %.8s, mgmt-class: %s, file set %d\n",
3448 if ( (ipMode == 1) || (ipMode == 11) )
3449 fprintf(
fLogFile,
"-D- end %s\n\n", cModule);
3467 char cModule[32] =
"rawQueryString";
3472 char cMClass[12] =
"";
3474 char cMsg[4096] =
"";
3475 char cMsg1[1024] =
"";
3482 int iMediaClass = 0;
3484 unsigned long *plFileSizeC;
3485 unsigned long lFileSize;
3486 int iVersionObjAttr = 0;
3492 iVersionObjAttr = ntohl(pQAttr->
iVersion);
3494 "\n-D- begin %s: version ObjAttr %d\n", cModule, iVersionObjAttr);
3500 "-E- %s: invalid cacheDB entry version %d\n",
3501 cModule, iVersionObjAttr);
3513 strcpy(ctype,
"FB");
3516 strcpy(ctype,
"U ");
3519 fprintf(
fLogFile,
"-E- Invalid record format %d found\n",
3527 strcpy(cMClass,
"DISK ");
3530 strcpy(cMClass,
"TAPE ");
3533 strcpy(cMClass,
"NETWORK");
3536 strcpy(cMClass,
"SHELF");
3539 strcpy(cMClass,
"OFFSITE");
3542 strcpy(cMClass,
"UNAVAILABLE");
3546 strcpy(cMClass,
"STAGE");
3551 strcpy(cMClass,
"STAGE*");
3555 strcpy(cMClass,
"CACHE");
3560 strcpy(cMClass,
"CACHE*");
3564 fprintf(
fLogFile,
"-E- Invalid media class %d found\n",
3576 sprintf(cMClass,
"%s%d", cMClass, iATLServer);
3578 sprintf(cMClass,
"%s", cMClass);
3580 if ( (ipMode == 10) || (ipMode == 11) )
3581 strcat(cMClass,
"??");
3587 sprintf(cMsg,
"%s%s%s %s %s %s",
3593 plFileSizeC = (
unsigned long *) &(pQAttr->
iFileSize);
3594 lFileSize = *plFileSizeC;
3603 (
sizeof(
long) == 8) )
3604 sprintf(cMsg1,
" %12lu", lFileSize);
3606 sprintf(cMsg1,
" %s ",
cTooBig);
3607 strcat(cMsg, cMsg1);
3612 strcat(cMsg, cMsg1);
3616 sprintf(cMsg1,
" %s", pQAttr->
cNode);
3617 strcat(cMsg, cMsg1);
3621 if ( (ipMode == 1) || (ipMode == 11) )
3623 if (ntohl(pQAttr->
iFS))
3626 " staged on data mover %s, FS %d (poolId %d)\n",
3629 strcat(cMsg, cMsg1);
3633 " obj-Id: %u-%u, restore order: %u-%u-%u-%u-%u\n",
3641 strcat(cMsg, cMsg1);
3644 " version %d, owner: %s, OS: %s, mgmt-class: %s, file set %d\n",
3647 strcat(cMsg, cMsg1);
3650 iMsg = strlen(cMsg);
3655 "-W- %s: output string provided too short (%d byte), %d byte needed\n",
3656 cModule, iOut, iMsg);
3657 strncpy(pcOut, cMsg, (
unsigned) iOut-1);
3658 strcat(pcOut,
"\0");
3661 "-W- %s: query information incomplete:\n%s\n", cModule, pcOut);
3668 " %s: length query info %d byte, length of string provided %d byte, msg:\n",
3669 cModule, iMsg, iOut);
3670 strcpy(pcOut, cMsg);
3674 fprintf(
fLogFile,
"-D- end %s\n\n", cModule);
3688 int iObjnoAll,
int *piObjBuf0)
3690 char cModule[32] =
"rawScanObjbuf";
3704 printf(
"\n-D- begin %s: check %d objs for %s%s\n",
3705 cModule, iObjnoAll, pcPath, pcFile);
3707 piObjBuf = piObjBuf0;
3712 iObjnoBuf = *piObjBuf;
3717 printf(
"DDD buffer %d: piObjBuf %p, value %d, psRetrList %p\n",
3718 iBufno, piObjBuf, *piObjBuf, psRetrList);
3723 for (ii=1; ii<=iObjnoBuf; ii++)
3728 printf(
" %d: %s%s, addr %p\n",
3734 if ( (strcmp(pcFile, psRetrList->
cNamell) == 0) &&
3735 (strcmp(pcPath, psRetrList->
cNamehl) == 0) )
3738 " file %s%s already available in list\n",
3748 if (iObjnoCur == iObjnoAll)
3751 " all %d files scanned\n", iObjnoAll);
3757 ppiNextBuf = (
int **) psRetrList;
3758 piObjBuf = *ppiNextBuf;
3762 printf(
"DDD next piObjBuf %p, value %d, psRetrList %p\n",
3763 piObjBuf, *piObjBuf, psRetrList);
3774 printf(
"-D- end %s: %d buffers scanned\n\n", cModule, iBufno);
3798 char cModule[32] =
"rawSortValues";
3801 int ii, ii1, iif, jj;
3807 iLoop = iLast - iFirst + 1;
3810 printf(
"\n-D- begin %s\n", cModule);
3814 printf(
" numbers on input:\n value index\n");
3815 for (ii=iFirst; ii<=iLast; ii++)
3817 printf(
" %6d: %10d %6d\n", ii, iaValue[ii], iaIndex[ii]);
3821 iFound = iFirst - 1;
3822 for (jj=iFirst; jj<=iLast; jj++)
3824 if (iFound >= iFirst)
3826 for (iif=iFirst; iif<=iFound; iif++)
3828 if ( (iaValue[jj] < iaValNew[iif]) && (iaValNew[iif]) )
3830 for (ii1=iFound; ii1>=iif; ii1--)
3832 iaValNew[ii1+1] = iaValNew[ii1];
3833 iaIndNew[ii1+1] = iaIndNew[ii1];
3836 iaValNew[iif] = iaValue[jj];
3837 iaIndNew[iif] = iaIndex[jj];
3840 " at pos %d inserted: val %d, ind %d\n",
3841 iif, iaValNew[iif], iaIndNew[iif]);
3850 iaValNew[iFound] = iaValue[jj];
3851 iaIndNew[iFound] = iaIndex[jj];
3853 " at pos %d appended: val %d, ind %d\n",
3854 iFound, iaValNew[iFound], iaIndNew[iFound]);
3865 iaValNew[iFirst] = iaValue[jj];
3866 iaIndNew[iFirst] = iaIndex[jj];
3870 " start value: val %d, ind %d\n",
3871 iaValNew[iFound], iaIndNew[iFound]);
3875 memcpy(&iaValue[iFirst], &iaValNew[iFirst], (
unsigned) iLoop*
iint);
3879 printf(
" numbers on output:\n value index\n");
3880 for (ii=iFirst; ii<=iLast; ii++)
3882 printf(
" %6d: %10d %6d\n", ii, iaValue[ii], iaIndNew[ii]);
3887 printf(
"-D- end %s\n\n", cModule);
3912 unsigned long ielpst(
unsigned long iScale,
3913 unsigned long *iBuf )
3915 char cModule[32] =
"ielpst";
3918 struct timestruc_t stv;
3919 unsigned long iTemp[2];
3921 gettimer( TIMEOFDAY, &stv );
3923 if ( iScale <= 0 ) iScale = 1;
3924 iTemp[1] = stv.tv_sec - iBuf[1];
3925 if ( ( iTemp[0] = stv.tv_nsec - iBuf[0] ) & 0x80000000 ) {
3926 iTemp[0] += 1000000000L; iTemp[1] -= 1;
3928 iBuf[1] = stv.tv_sec; iBuf[0] = stv.tv_nsec;
3929 return( iTemp[1] * ( 1000000L / iScale ) + ( iTemp[0] / 1000 ) / iScale );
3934 unsigned long ielpst_(
unsigned long *iScale,
3935 unsigned long *iBuf )
3937 return( ielpst( *iScale, iBuf ) );
char cMoverStage[MAX_NODE]
unsigned int iRestoHighHigh
int rawGetLLName(char *, const char *, char *)
#define VERSION_SRAWOBJATTR
char cDateCreate[MAX_DATE]
char * rawGetPathName(char *)
static unsigned int iFileList
unsigned int iRestoHighHigh
int rawCheckFilelist(char **pcFileList, char **pcObjList, char *pcArchive, char *pcNodeMaster)
static const char * pcStar
char cStageUser[MAX_OWNER]
char cArchiveDate[MAX_DATE]
int rawCheckObjlist(int iFileComp, int iSort, char **pcObjList, char **pcFileList, char **pcObjComp)
int rawScanObjbuf(char *pcPath, char *pcFile, int iObjnoAll, int *piObjBuf0)
char cMoverCache[MAX_NODE]
char cMgmtClass[MAX_MC+2]
int rawDelFile(int iSocket, srawComm *psComm)
int rawGetFilelistEntries(char *pcFileName, int *piDataFS, char *pcDataFS, int *piEntries, int *piGlobalDir)
static const char cTooBig[8]
static char cPath[MAX_FULL_FILE]
void rawQueryPrint(srawObjAttr *pQAttr, int ipMode)
int rawQueryString(srawObjAttr *pQAttr, int ipMode, int iOut, char *pcOut)
char * rawGetFullFile(char *pcFile, char *pcNamell)
static const char * pcPerc
static char cDataFSHigh2[16]
unsigned int iRestoLowHigh
unsigned int iRestoHighLow
int rawDelList(int iSocketMaster, int iDataMover, srawDataMoverAttr *pDataMover0, srawComm *psComm, char **pcFileList, char **pcObjList)
char cFile[MAX_FULL_FILE]
#define GSI_STAGE_INVALID
static unsigned int iRetrList
int rawRecvError(int, int, char *)
static char cDataFSHigh1[16]
unsigned int iRestoLowHigh
#define MEDIA_UNAVAILABLE
function if(typeof JSROOT!="object")
#define GSI_MEDIA_INCOMPLETE
int rawRecvStatus(int, char *)
unsigned int iRestoHighLow
int rawSortValues(int *iaValue, int iAll, int iFirst, int iLast, int *iaIndex, int *iaIndNew)
#define GSI_CACHE_INCOMPLETE
int rawGetWSInfo(srawCliActionComm *pCliActionComm, srawPoolStatus *pPoolInfo, srawWorkSpace **ppWorkSpace)
int rawRecvHead(int, char *)
static char cPathPrefix[16]