163 #include <sys/socket.h>
164 #include <sys/time.h>
168 #include <netinet/in.h>
182 static unsigned int iint =
sizeof(int);
200 char *pcArchive,
char *pcNodeMaster,
201 int iRecursive,
unsigned int iuTopDir,
202 char *pcTopDir,
char *pcTophl)
204 char cModule[32] =
"rawCheckFileList";
207 char cDelimiter[2] =
"";
227 unsigned int iuTophl = 0;
258 "\n-D- begin %s: initial %d files, %d objects (1st buffer)\n",
259 cModule, ifile0, iobj0);
260 fprintf(
fLogFile,
" first file %s,\n first obj %s%s%s\n",
264 if (iRecursive == 9) fprintf(
fLogFile,
265 " local path with wildcards\n");
268 fprintf(
fLogFile,
" recursive file handling");
269 if (iRecursive == 12)
270 fprintf(
fLogFile,
", local path with wildcards\n");
279 if ( (strchr(pcTopDir , *
pcStar) != NULL) ||
280 (strchr(pcTopDir, *
pcQM) != NULL) ||
281 (strchr(pcTopDir, *
pcPerc) != NULL) )
283 if ( (iRecursive == 9) || (iRecursive == 12) )
288 "-E- %s: inconsistency: wildcarded local path %s, but iRecursive=%d\n",
289 cModule, pcTophl, iRecursive);
294 if (strchr(pcTopDir , *
pcStar) != NULL)
297 pcc += strlen(pcTopDir) - 1;
298 if (strncmp(pcc,
pcStar, 1) == 0)
302 " top dir with trailing '*'\n");
307 iuTophl = strlen(pcTophl);
311 "-E- %s: invalid top gStore directory %s\n",
319 " top directories %s\n top gStore directory %s\n",
322 " top directory %s\n top gStore directory %s\n",
327 iRC = strncmp(psObj->
cNamell, pcObjDelim, 1);
330 iRC = strncmp(psObj->
cNamell, pcObjDelimAlt, 1);
334 "-E- %s: invalid object delimiter %1s found\n",
339 strcpy(cDelimiter, pcObjDelimAlt);
342 strcpy(cDelimiter, pcObjDelim);
345 for (ifcur=1; ifcur<=ifile0; ifcur++)
350 if (strncmp(psFile->
cFile,
"\n", 1) == 0)
354 " filelist position %d empty, to be ignored\n", ifcur);
365 " %d: '%s'\n", ifcur, psFile->
cFile);
369 strcpy(cTopFile, pcTopDir);
372 strcpy(cCurFile, psFile->
cFile);
373 pcc = strrchr(cCurFile,
'/');
381 strcat(cTopFile,
"/");
382 strcat(cTopFile, pcc);
384 "%d: strictly compare '%s' - '%s'\n", ifcur, cTopFile, psFile->
cFile);
387 iRC = fnmatch(cTopFile, psFile->
cFile, FNM_PATHNAME);
392 " '%s' not matching\n", psFile->
cFile);
398 else if (iRecursive == 12)
402 if ( (strlen(cCurFile) > strlen(pcTopDir)) &&
404 strcat(cTopFile,
"/*");
406 strcat(cTopFile,
"/");
407 strcat(cTopFile, pcc);
410 "%d: compare '%s' - '%s'\n",
411 ifcur, cTopFile, psFile->
cFile);
413 iRC = fnmatch(cTopFile, psFile->
cFile, 0);
419 " '%s' not matching\n", psFile->
cFile);
431 strncpy(psFile->
cFile,
"\n", 1);
436 " last file, comparison finished\n");
444 pcc = strrchr(psFile->
cFile,
'/');;
445 strcpy(pcFilell, pcc);
448 fprintf(
fLogFile,
" okay, compare with objs\n");
455 fprintf(
fLogFile,
"\n*** buffer %d: %d objs\n", iobjBuf, iobj);
459 for (iocur=1; iocur<=iobj; iocur++)
465 iRC = strcmp(cFilell, psObj->
cNamell);
471 pcc = strrchr(cFilell,
'/');
475 "-E- %s: missing path in file name %s\n",
483 strcpy(cCurObj, psObj->
cNamehl);
484 strcat(cCurObj, psObj->
cNamell);
488 strcpy(cCurFile, psFile->
cFile);
495 " compare '%s' - '%s'\n", pcc1, pcc);
497 iRC = strcmp(pcc1, pcc);
503 "-W- %s%s%s already archived in gStore\n",
507 strncpy(psFile->
cFile,
"\n", 1);
512 " last file, comparison finished\n");
516 strcpy(cLastll, psObj->
cNamell);
525 piptr = (
int **) psObj;
530 fprintf(
fLogFile,
" %d: last obj buffer\n", iobjBuf);
532 fprintf(
fLogFile,
"*** %d: %s (%s) to be archived\n",
533 ifcur, psFile->
cFile, cFilell);
542 "\n*** new buffer %d: %d objs, first obj '%s'\n",
543 iobjBuf, iobj, psObj->
cNamell);
555 " %d of %d files removed: %d files remaining\n",
556 idel, ifile0, ifile);
562 " %d files ignored: %d files remaining\n",
567 *pcFileList = (
char *) pifl;
569 if ( (ifile > 0) && (idel+iign > 0) )
573 for (ifcur=1; ifcur<=ifile0; ifcur++)
578 iRC = strncmp(psFile->
cFile,
"\n", 1);
590 for (iocur=ifcur+1; iocur<=ifile0; iocur++)
594 iRC = strncmp(psFile->
cFile,
"\n", 1);
604 "*** %d: %s\n", iif, psFile0->
cFile);
616 fprintf(
fLogFile,
" file list compressed\n");
622 fprintf(
fLogFile,
"-D- end %s\n\n", cModule);
672 char cModule[32]=
"rawCheckObjList";
679 int iaValue[iObjAll+1][6];
688 int iaCompValue[iObjComp+1][6];
690 int iaIndex[iObjComp];
693 int iaIndNew[iObjAll+1];
694 int iaValTop[iObjAll+1];
695 int iaValHiHi[iObjAll+1];
696 int iaValHiLo[iObjAll+1];
697 int iaValLoHi[iObjAll+1];
698 int iaValLoLo[iObjAll+1];
700 int iif = 0, ii1 = 0, ii2 = 0;
707 int iihihi1 = 0, iihihi2 = 0, iHiHiValcur = 0, iihihicur = 0;
708 int iihilo1 = 0, iihilo2 = 0, iHiLoValcur = 0, iihilocur = 0;
709 int iilohi1 = 0, iilohi2 = 0, iLoHiValcur = 0, iilohicur = 0;
725 unsigned int iRestoTopValues = 0,
726 iRestoHiHiValues = 0,
727 iRestoHiLoValues = 0,
728 iRestoLoHiValues = 0,
729 iRestoLoLoValues = 0;
731 unsigned int iRestoTopMin = 0,
755 char *pcflcomp, *pcolcomp;
756 int *piflcomp, *piolcomp;
760 char *pcflsort, *pcolsort;
761 int *piflsort, *piolsort;
783 int ii, jj, jjMin = 0;
798 pcolcomp = *pcObjComp;
799 piolcomp = (
int *) pcolcomp;
801 psObjComp0 = psObjComp;
818 "\n-D- begin %s: overall %d objs, in 1st buffer %d objs, compressed: %d objs\n",
819 cModule, iObjAll, iobj0, iObjComp);
821 fprintf(
fLogFile,
" no filelist handling\n");
826 fprintf(
fLogFile,
" sort entries, first obj %s%s",
841 for (jj=1; jj<=iFileAll; jj++)
843 fprintf(
fLogFile,
"DDDD %d: file %s (%p)\n", jj, psFile->
cFile, psFile);
857 for (jj=1; jj<=iObjAll; jj++)
860 if (strlen(psObj->
cNamell) < 2)
863 " object %d(%d): ignored\n", iiObj, jj);
865 goto gNextObjUnstage;
869 memcpy((
char *) psObjComp, (
char *) psObj,
iRetrList);
871 "%d(%d): obj %s%s copied (Comp)\n", iiObj, jj,
872 psObjComp->cNamehl, psObjComp->cNamell);
881 " buffer %d: last obj (no. %d) handled\n",
884 piptr = (
int **) psObj;
888 " buffer %d: last obj buffer\n", iiBuf);
898 " new buffer %d, %d objs, first: %s%s|\n",
899 iiBuf, iobj, psObj->cNamehl, psObj->cNamell);
905 goto gEndCheckObjlist;
913 iFileBufComp =
sizeof(int) + iObjComp*
sizeof(
srawFileList);
914 if ((pcFileComp = (
char *) calloc(
915 (
unsigned) iFileBufComp,
sizeof(
char) ) ) == NULL)
918 "-E- %s: allocating filelist buffer (Comp, %d byte)\n",
919 cModule, iFileBufComp);
921 fprintf(
fLogFile,
" %s\n", strerror(errno));
922 perror(
"-E- allocating filelist buffer (Comp)");
927 " filelist buffer (Comp) allocated (size %d)\n",
930 piflcomp = (
int *) pcFileComp;
931 piflcomp[0] = iObjComp;
933 psFileComp0 = psFileComp;
935 if ( (pcFileSort = (
char *) calloc(
936 (
unsigned) iFileBufComp,
sizeof(
char)) ) == NULL)
939 "-E- %s: allocating filelist buffer (Sort, %d byte)\n",
940 cModule, iFileBufComp);
942 fprintf(
fLogFile,
" %s\n", strerror(errno));
943 perror(
"-E- allocating filelist buffer (Sort)");
949 " filelist buffer (Sort) allocated for %d files (size %d)\n",
950 iObjComp, iFileBufComp);
952 piflsort = (
int *) pcFileSort;
953 piflsort[0] = iObjComp;
955 psFileSort0 = psFileSort;
958 iObjBufComp =
sizeof(int) + iObjComp*
sizeof(
srawRetrList);
959 if ( (pcObjSort = (
char *) calloc(
960 (
unsigned) iObjBufComp,
sizeof(
char)) ) == NULL )
963 "-E- %s: allocating objectlist buffer (%d byte)\n",
964 cModule, iObjBufComp);
966 fprintf(
fLogFile,
" %s\n", strerror(errno));
967 perror(
"-E- allocating objlist buffer");
972 " objlist buffer (Sort) allocated for %d objs (size %d)\n",
973 iObjComp, iObjBufComp);
975 pcolsort = pcObjSort;
976 piolsort = (
int *) pcolsort;
977 piolsort[0] = iObjComp;
979 psObjSort0 = psObjSort;
983 for (jj=1; jj<=iObjComp; jj++)
987 for (jj=1; jj<=iObjAll; jj++)
989 for (ii=0; ii<=5; ii++)
992 iaValue[jj][ii] = -1;
1005 fprintf(
fLogFile,
"scan objects for sort criteria:\n");
1010 for (jj=1; jj<=iObjAll; jj++)
1016 fprintf(
fLogFile,
"DDD %d (all %d): obj %s (%p)", iiObj, jj, psObj->
cNamell, psObj);
1017 if (iFileAll > 0) fprintf(
fLogFile,
", file %s (%p)\n", psFile->
cFile, psFile);
1021 if (strlen(psObj->
cNamell) < 2)
1025 " object %d(%d): ignored\n", iiObj, jj);
1034 " object %d(%d) %s%s: in read cache\n",
1041 memcpy((
char *) psObjComp, (
char *) psObj,
iRetrList);
1049 "%d: read cache obj %s%s (objId %u-%u) copied (Comp)\n",
1050 iReadCache, psObjComp->cNamehl, psObjComp->cNamell,
1051 psObjComp->iObjHigh, psObjComp->iObjLow);
1055 fprintf(
fLogFile,
" orig file name %s (%p)\n", psFile->
cFile, psFile);
1056 fprintf(
fLogFile,
" file name %s copied (Comp: %p)\n", psFileComp->
cFile, psFileComp);
1059 if (jj == iObjAll) fprintf(
fLogFile,
1060 " in last buffer %d: last obj (no. %d) handled\n",
1078 " object %d(%d) %s%s: in write cache\n",
1085 memcpy((
char *) psObjSort, (
char *) psObj,
iRetrList);
1092 "%d: write cache obj %s%s (%u-%u) copied (Sort)\n",
1093 iWriteCache, psObjSort->cNamehl, psObjSort->cNamell,
1094 psObjSort->iObjHigh, psObjSort->iObjLow);
1096 if (jj == iObjAll) fprintf(
fLogFile,
1097 " in last buffer %d: last obj (no. %d) handled\n",
1114 " object %d(%d) %s%s: top restore field %d\n",
1122 "-W- object %d(%d) %s%s: hihi restore field %d\n",
1130 " object %d(%d) %s%s: hilo restore field %d\n",
1138 "-W- object %d(%d) %s%s: lohi restore field %d\n",
1146 " object %d(%d) %s%s: lolo restore field %d\n",
1158 " buffer %d: last obj (no. %d) handled\n",
1161 piptr = (
int **) psObj;
1165 " buffer %d: last obj buffer\n", iiBuf);
1175 " new buffer %d, %d objs, first: %s%s|\n",
1182 " usage of restore fields: %u-%u-%u-%u-%u\n",
1183 iRestoTop, iRestoHiHi, iRestoHiLo, iRestoLoHi, iRestoLoLo);
1189 psObjSort = psObjSort0;
1191 psFileSort = psFileSort0;
1193 for (ii=1; ii<=iWriteCache; ii++)
1195 memcpy((
char *) psObjComp, (
char *) psObjSort,
iRetrList);
1208 if ( ((iReadCache) || (iWriteCache)) && (iDebug == 2) )
1210 psObjComp = psObjComp0;
1212 psFileComp = psFileComp0;
1217 "%d read cache entries (Comp)\n", iReadCache);
1218 for (ii=1; ii<=iReadCache; ii++)
1238 "%d write cache entries (Comp)\n", iWriteCache);
1239 for (ii=1; ii<=iWriteCache; ii++)
1241 jj = iReadCache + ii;
1259 if (iReadCache + iWriteCache + iIgnore == iObjAll)
1262 fprintf(
fLogFile,
"no TSM objects\n");
1264 goto gEndCheckObjlist;
1269 iFileSort = iObjAll - iReadCache - iWriteCache - iIgnore;
1286 " TSM restore values before sorting:\n");
1289 for (jj=1; jj<=iObjAll; jj++)
1292 if (iaValue[jj][0] < 3)
1297 " %d: (%d) ignored", jj, iaValue[jj][0]);
1309 iaCompValue[iiTSM][0] = iaValue[jj][0];
1310 iaCompValue[iiTSM][1] = iaValue[jj][1];
1311 iaCompValue[iiTSM][2] = iaValue[jj][2];
1312 iaCompValue[iiTSM][3] = iaValue[jj][3];
1313 iaCompValue[iiTSM][4] = iaValue[jj][4];
1314 iaCompValue[iiTSM][5] = iaValue[jj][5];
1317 " %d(%d): %d %d-%d-%d-%d-%d\n", jj, iiTSM,
1318 iaValue[jj][0], iaValue[jj][1], iaValue[jj][2],
1319 iaValue[jj][3], iaValue[jj][4], iaValue[jj][5]);
1321 memcpy((
char *) psObjSort, (
char *) psObj,
iRetrList);
1338 " buffer %d: last obj (no. %d) handled\n",
1341 piptr = (
int **) psObj;
1345 " buffer %d: last obj buffer\n", iiBuf);
1355 " new buffer %d, %d objs, first: %s%s\n",
1361 if (iiTSM != iFileSort)
1364 "-E- %s: inconsistent no. of TSM files: %d - %d\n",
1365 cModule, iFileSort, iiTSM);
1376 "DDD list of %d compressed TSM objs/files (ps...Sort):\n",
1379 for (jj=1; jj<=iFileSort; jj++)
1382 iaValTop[jj] = iaCompValue[jj][1];
1387 iaValHiHi[jj] = iaCompValue[jj][2];
1392 iaValHiLo[jj] = iaCompValue[jj][3];
1397 iaValLoHi[jj] = iaCompValue[jj][4];
1402 iaValLoLo[jj] = iaCompValue[jj][5];
1425 iisort2 = iFileSort;
1434 for (jj=iisort1; jj<=iisort2; jj++)
1436 if (iaIndNew[jj] != iaIndex[jj])
1440 iaValHiHi[jj] = iaCompValue[ii1][2];
1442 iaValHiLo[jj] = iaCompValue[ii1][3];
1444 iaValLoHi[jj] = iaCompValue[ii1][4];
1446 iaValLoLo[jj] = iaCompValue[ii1][5];
1452 memcpy(&iaIndex[iisort1], &iaIndNew[iisort1],
1453 (
unsigned) iFileSort*
iint);
1458 "DDD restore order after top sorting (%d changes):\n",
1460 for (jj=iisort1; jj<=iisort2; jj++)
1463 " %d: index %d, values: %u-%u-%u-%u-%u\n",
1464 jj, iaIndNew[jj], iaValTop[jj],
1465 iaValHiHi[jj], iaValHiLo[jj],
1466 iaValLoHi[jj], iaValLoLo[jj]);
1470 iRestoTopValues = 1;
1471 iRestoTopMin = iaValTop[iisort1];
1472 for (jj=iisort1+1; jj<=iisort2; jj++)
1474 if (iaValTop[jj] > iRestoTopMin)
1476 iRestoTopMin = iaValTop[jj];
1482 "%d different top restore values\n", iRestoTopValues);
1488 for (iTopValcur=1; iTopValcur<=iRestoTopValues; iTopValcur++)
1490 if (iTopValcur == iRestoTopValues)
1494 iRestoTopMin = iaValTop[iitop1];
1495 for (jj=iitop1+1; jj<=iFileSort; jj++)
1497 if (iaValTop[jj] > iRestoTopMin)
1503 if (jj == iFileSort)
1508 if (iitop1 == iitop2)
1511 " %d. top restore value %d: only one object (%d)\n",
1512 iTopValcur, iaValTop[iitop1], iitop1);
1514 if (iTopValcur == iRestoTopValues)
1518 iitop1 = iitop2 + 1;
1523 " %d. top restore value %d: objs %d - %d\n",
1524 iTopValcur, iaValTop[iitop1], iitop1, iitop2);
1535 if (iitop2 - iitop1)
1542 for (jj=iitop1; jj<=iitop2; jj++)
1544 if (iaIndNew[jj] != iaIndex[jj])
1548 iaValTop[jj] = iaCompValue[ii1][1];
1550 iaValHiHi[jj] = iaCompValue[ii1][2];
1552 iaValLoHi[jj] = iaCompValue[ii1][4];
1554 iaValLoLo[jj] = iaCompValue[ii1][5];
1560 ii1 = iitop2 - iitop1 + 1;
1561 memcpy(&iaIndex[iitop1], &iaIndNew[iitop1],
1562 (
unsigned) ii1*
iint);
1567 " restore order after hilo sorting (%d - %d: %d changes):\n",
1568 iitop1, iitop2, iDiff);
1569 for (jj=iitop1; jj<=iitop2; jj++)
1572 " %d: index %d, values: %u-%u-%u-%u-%u\n",
1573 jj, iaIndNew[jj], iaValTop[jj],
1574 iaValHiHi[jj], iaValHiLo[jj],
1575 iaValLoHi[jj], iaValLoLo[jj]);
1579 iRestoHiLoValues = 1;
1580 iRestoHiLoMin = iaValHiLo[iitop1];
1582 for (jj=iitop1+1; jj<=iitop2; jj++)
1584 if (iaValHiLo[jj] > iRestoHiLoMin)
1586 iRestoHiLoMin = iaValHiLo[jj];
1592 " %d different hilo restore values\n", iRestoHiLoValues);
1596 iRestoHiLoValues = 1;
1602 for (iHiLoValcur=1; iHiLoValcur<=iRestoHiLoValues; iHiLoValcur++)
1604 if (iHiLoValcur == iRestoHiLoValues)
1608 iRestoHiLoMin = iaValHiLo[iihilo1];
1609 for (jj=iitop1+1; jj<=iitop2; jj++)
1611 if (iaValHiLo[jj] > iRestoHiLoMin)
1622 if (iihilo1 == iihilo2)
1625 " %d. hilo restore value %d: only one object (%d)\n",
1626 iHiLoValcur, iaValHiLo[iihilo1], iihilo1);
1628 if (iHiLoValcur == iRestoHiLoValues)
1632 iihilo1 = iihilo2 + 1;
1637 " %d. hilo restore value %d: objs %d - %d\n",
1638 iHiLoValcur, iaValHiLo[iihilo1], iihilo1, iihilo2);
1648 if (iihilo2 - iihilo1)
1651 iihilo1, iihilo2, iaIndex, iaIndNew);
1655 for (jj=iihilo1; jj<=iihilo2; jj++)
1657 if (iaIndNew[jj] != iaIndex[jj])
1661 iaValTop[jj] = iaCompValue[ii1][1];
1663 iaValHiHi[jj] = iaCompValue[ii1][2];
1665 iaValHiLo[jj] = iaCompValue[ii1][3];
1667 iaValLoHi[jj] = iaCompValue[ii1][4];
1673 ii1 = iihilo2 - iihilo1 + 1;
1674 memcpy(&iaIndex[iihilo1], &iaIndNew[iihilo1],
1675 (
unsigned) ii1*
iint);
1680 " restore order after lolo sorting (%d - %d: %d changes):\n",
1681 iihilo1, iihilo2, iDiff);
1682 for (jj=iihilo1; jj<=iihilo2; jj++)
1685 " %d: index %d, values: %u-%u-%u-%u-%u\n",
1686 jj, iaIndNew[jj], iaValTop[jj],
1687 iaValHiHi[jj], iaValHiLo[jj],
1688 iaValLoHi[jj], iaValLoLo[jj]);
1693 iRestoLoLoValues = 1;
1697 iRestoLoLoValues = 0;
1699 iihilo1 = iihilo2 + 1;
1705 iRestoHiLoValues = 0;
1707 iitop1 = iitop2 + 1;
1712 iRestoTopValues = 0;
1721 "DDD final restore order after sorting (%d-%d):\n",
1723 for (jj=iisort1; jj<=iisort2; jj++)
1727 " %d: index %d, values: %u-%u-%u-%u-%u\n",
1728 jj, iaIndex[jj], iaCompValue[ii][1], iaCompValue[ii][2],
1729 iaCompValue[ii][3], iaCompValue[ii][4], iaCompValue[ii][5]);
1750 "DDD copy TSM objects to temp destination for compression\n");
1752 for (jj = 1; jj <= iObjAll; jj++)
1755 if (iaValue[jj][0] < 3)
1759 fprintf(
fLogFile,
" (%d): ignored", jj);
1773 goto gNextCopy2Temp;
1779 memcpy((
char *) psObjSort, (
char *) psObj,
iRetrList);
1786 " %d(%d): obj %s%s (objId %u-%u) copied (Comp), retrId %u-%u-%u-%u-%u\n",
1787 iiObj, jj, psObjSort->cNamehl, psObjSort->cNamell,
1788 psObjSort->iObjHigh, psObjSort->iObjLow,
1789 psObjSort->iRestoHigh, psObjSort->iRestoHighHigh,
1790 psObjSort->iRestoHighLow, psObjSort->iRestoLowHigh,
1791 psObjSort->iRestoLow);
1808 " buffer %d: last obj (no. %d) handled\n",
1810 piptr = (
int **) psObj;
1814 " %d: last obj buffer\n", iiBuf);
1824 " %d: new buffer, %d objs, first: |%s%s|\n",
1825 iiBuf, iobj, psObj->cNamehl, psObj->cNamell);
1837 "DDD compressed list of TSM objects (not yet sorted):\n");
1839 for (jj=1; jj<=iFileSort; jj++)
1856 if (icount != iFileSort)
1859 "-E- %s: unexpected no. of objects found: %d, expected %d\n",
1860 cModule, icount, iFileSort);
1872 "DDD copy TSM objects in correct order to final destination\n");
1875 for (jj = 1; jj <= iFileSort; jj++)
1882 psFileSort += iDiff;
1886 memcpy((
char *) psObjComp, (
char *) psObjSort,
iRetrList);
1893 " %d: TSM obj %s%s (index %d, objId %u-%u) copied (Comp), retrId %u-%u-%u-%u-%u\n",
1894 jj, psObjSort->cNamehl, psObjSort->cNamell, ii2,
1895 psObjSort->iObjHigh, psObjSort->iObjLow,
1896 psObjSort->iRestoHigh, psObjSort->iRestoHighHigh,
1897 psObjSort->iRestoHighLow, psObjSort->iRestoLowHigh, psObjSort->iRestoLow);
1907 iObjAll = iReadCache + iWriteCache + iFileSort;
1910 psObjComp = psObjComp0;
1912 psFileComp = psFileComp0;
1914 "final list of all objects (compressed and sorted):\n");
1916 for (jj=1; jj<=iObjAll; jj++)
1919 " %d: obj %s%s, objId %u-%u, retrId %u-%u-%u-%u-%u",
1945 if ( (iSort) && (iFileAll > 0) )
1947 memset(pcfl, 0x00, (
unsigned) iFileBufComp);
1948 memcpy(pcfl, pcFileComp, (
unsigned) iFileBufComp);
1952 "-D- end %s\n\n", cModule);
1978 char cModule[32] =
"rawGetFilelistEntries";
1984 int iFilesIgnored = 0;
1992 char cQualifier[16] =
".filelist";
1993 const char *pcLeading =
"@";
2005 int iGenericEntries = 0;
2006 int iSingleEntries = 0;
2008 FILE *fiFile = NULL;
2012 int *piFilelist, *piFilelisto;
2019 printf(
"\n-D- begin %s\n", cModule);
2021 iDataFS = *piDataFS;
2025 if ((
int) strlen(pcFileName) >= imax)
2028 "-E- %s: file name too long (max %d)\n",
2031 goto gErrorFilelist;
2033 strcpy(cFileName, pcFileName);
2035 pccT = (
char *) strrchr(pcFileName, *pcLeading);
2038 pccE = (
char *) strrchr(pccT, *pcObjDelim);
2046 " no leading '%s' in file name %s\n", pcLeading, pcFileName);
2051 ploc = strrchr(cFileName, pcc[0]);
2056 if (strcmp(ploc, pcc) != 0)
2059 " no trailing %s\n", cQualifier);
2066 " no trailing %s in file name %s\n", cQualifier, pcFileName);
2071 " %s is a filelist\n", cFileName);
2073 fiFile = fopen(pcFileName,
"r");
2076 fprintf(
fLogFile,
"-E- %s: opening filelist %s\n",
2077 cModule, pcFileName);
2079 fprintf(
fLogFile,
" %s\n", strerror(errno));
2080 perror(
"-E- opening filelist");
2083 goto gErrorFilelist;
2086 " filelist %s opened\n", pcFileName);
2088 piFilelisto = piFilelist;
2089 iMaxEntries = *piFilelist;
2091 " max no. of entries in filelist buffer: %d\n", iMaxEntries);
2093 "DDD piFilelist %p, *piFilelist %d\n",
2094 piFilelist, *piFilelist);
2098 pFilelistc = pFilelist;
2103 pccE = fgets(cEntry, imax, fiFile);
2105 if ( (pccE != NULL) && (strlen(pccE) > 1) )
2109 memset(cTemp,
'\0', strlen(cTemp));
2114 if ( (*pccE !=
'\0') && (*pccE !=
'\n') && (*pccE !=
'\r') &&
2117 strncpy(pccT, pccE, 1);
2126 strncpy(pccT,
"\0", 1);
2129 "'%s' -> '%s': %d chars removed\n", cEntry, cTemp, iDelCount);
2139 " path prefix '%s' in first filelist entry found\n",
2146 if (strlen(pccT) == 0)
2149 "-W- no path name found after path prefix: %s\n",
2154 ii = strlen(pccT) - 1;
2157 if (strncmp(pcc,
"/", 1) == 0)
2158 strncpy(
cPath, pccT, (
unsigned) ii);
2160 strcpy(
cPath, pccT);
2163 " path '%s' for files in filelist\n",
cPath);
2171 strcpy(pcDataFS,
cPath);
2174 " central data FS path %s\n",
cPath);
2185 "-E- only one path specification in file list allowed, %s and following files ignored\n",
2191 while ( (ploc = strchr(cTemp, *
pcPerc)) != NULL)
2194 fprintf(
fLogFile,
"-W- replace %s", cTemp);
2197 fprintf(
fLogFile,
" by %s\n", cTemp);
2200 if ( (iEntries == iMaxEntries) &&
2205 " entry buffer full, reallocate: max %d entries\n",
2209 piFilelisto = piFilelist;
2210 piFilelist = (
int *) calloc(
2211 (
unsigned) iSizeBuffer,
sizeof(char) );
2212 if (piFilelist == NULL)
2215 "-E- %s: reallocating filelist buffer (size %d)\n",
2216 cModule, iSizeBuffer);
2218 fprintf(
fLogFile,
" %s\n", strerror(errno));
2219 perror(
"-E- reallocating filelist buffer");
2222 goto gErrorFilelist;
2226 " filelist entry buffer reallocated (size %d)\n",
2229 *piFilelist = iMaxEntries;
2231 "DDD piFilelist %p, *piFilelist %d\n",
2232 piFilelist, *piFilelist);
2235 pFilelistco = pFilelist;
2236 pFilelist = pFilelistc;
2238 for (ii=1; ii<=iEntries; ii++)
2241 "DDD pFilelistc %p\n", pFilelistc);
2242 strcpy(pFilelistc->
cFile, pFilelistco->
cFile);
2248 " %d old entries copied to new buffer, next:\n",
2252 "DDD free piFilelisto %p\n", piFilelisto);
2254 piFilelisto = piFilelist;
2259 "DDD pFilelistc %p\n", pFilelistc);
2261 if ( (ploc = strchr(cTemp, *pcObjDelim)) != NULL)
2264 if (iFilesIgnored == 1) fprintf(
fLogFile,
2265 "-W- file-specific path not yet implemented in filelist\n");
2266 fprintf(
fLogFile,
"-W- %s ignored\n", cTemp);
2273 strncat(pFilelistc->
cFile,
"/", 1);
2275 strcat(pFilelistc->
cFile, cTemp);
2279 " %3d: %s \n", iEntries, pFilelistc->
cFile);
2288 *piGlobalDir = iGlobalDir;
2290 pFilelistc = pFilelist;
2293 fprintf(
fLogFile,
" after allocation:\n");
2294 for (ii=1; ii<=iEntries; ii++)
2297 " %3da: %s \n", ii, pFilelistc->
cFile);
2305 pFilelistc = pFilelist;
2307 for (ii=1; ii<iEntries; ii++)
2309 if (strlen(pFilelistc->
cFile) == 0)
2315 pFilelistco = pFilelistc;
2317 for (jj=ii+1; jj<=iEntries; jj++)
2319 if (strcmp(pFilelistc->
cFile, pFilelistco->
cFile) == 0)
2322 fprintf(
fLogFile,
"-W- duplicate entry %s removed\n",
2323 pFilelistco->
cFile);
2324 strcpy(pFilelistco->
cFile,
"");
2336 " %d duplicate entries found in list\n", iRemove);
2338 " no duplicate entries found in list\n");
2344 fprintf(
fLogFile,
" no valid entries found in list\n");
2348 pFilelistc = pFilelist;
2351 fprintf(
fLogFile,
" after removal of duplicates:\n");
2352 for (ii=1; ii<=iEntries; ii++)
2355 " %3db: %s \n", ii, pFilelistc->
cFile);
2363 pFilelistc = pFilelist;
2364 for (ii=1; ii<iEntries; ii++)
2366 if (strlen(pFilelistc->
cFile) == 0)
2368 pFilelistco = pFilelistc;
2370 pFilelistc0 = pFilelistc;
2371 for (jj=ii+1; jj<=iEntries; jj++)
2373 strcpy(pFilelistc0->
cFile, pFilelistco->
cFile);
2382 iEntries -= iRemove;
2385 *piFilelist = iEntries;
2388 pFilelistc = pFilelist;
2389 for (ii=1; ii<=iEntries; ii++)
2396 ploc = strchr(pFilelistc->
cFile, *
pcQM);
2408 if ( (iGeneric) && (iSingle) )
2415 if ( (iGeneric) && (iSingle) )
2417 piFilelisto = piFilelist;
2421 piFilelist = (
int *) calloc((
unsigned) iSizeBuffer,
sizeof(char));
2422 if (piFilelist == NULL)
2425 "-E- %s: allocating ordered filelist buffer (size %d)\n",
2426 cModule, iSizeBuffer);
2428 fprintf(
fLogFile,
" %s\n", strerror(errno));
2429 perror(
"-E- allocating ordered filelist buffer");
2432 goto gErrorFilelist;
2436 " ordered filelist buffer allocated (size %d)\n",
2440 "DDD piFilelist %p, *piFilelist %d\n",
2441 piFilelist, *piFilelist);
2444 pFilelist = pFilelistc;
2446 iGenericEntries = 0;
2449 for (ii=1; ii<=iEntries; ii++)
2458 ploc = strchr(pFilelistco->
cFile, *
pcQM);
2473 strcpy(pFilelistc->
cFile, pFilelistco->
cFile);
2474 strcpy(pFilelistco->
cFile,
"");
2486 for (ii=1; ii<=iEntries; ii++)
2488 if (strlen(pFilelistco->
cFile) != 0)
2490 strcpy(pFilelistc->
cFile, pFilelistco->
cFile);
2498 " %d generic file names, followed by %d non-generic file names\n",
2499 iGenericEntries, iSingleEntries);
2503 pFilelistc = pFilelist;
2506 fprintf(
fLogFile,
" after reordering:\n");
2507 for (ii=1; ii<=iEntries; ii++)
2510 " %3dc: %s \n", ii, pFilelistc->
cFile);
2516 *piEntries = iEntries;
2519 if ( (iDebug == 2) && (pccT) ) fprintf(
fLogFile,
2520 "DDD piFilelist %p, *piFilelist %d\n",
2521 piFilelist, *piFilelist);
2526 iRC = fclose(fiFile);
2529 fprintf(
fLogFile,
"-E- %s: closing filelist %s\n",
2530 cModule, pcFileName);
2532 fprintf(
fLogFile,
" %s\n", strerror(errno));
2533 perror(
"-E- closing filelist");
2537 *piDataFS = iDataFS;
2541 printf(
"-D- end %s\n\n", cModule);
2557 char *pcReportReadCache,
char *pcReportGlobalReadCache)
2559 char cModule[32] =
"rawGetWSInfo";
2565 int iPrintPoolInfo = 0;
2566 int iWorkSpaceInfo = 0;
2577 int iSleepClean = 0;
2583 char cPoolNameRetr[32] =
"RetrievePool";
2584 char cPoolNameStage[32] =
"StagePool";
2585 int iHardwareMax = 0;
2586 int iHardwareFree = 0;
2587 int iPoolRetrMax = 0;
2588 int iPoolRetrFree = 0;
2589 int iPoolRetrFiles = 0;
2590 int iPoolStageMax = 0;
2591 int iPoolStageFree = 0;
2592 int iPoolStageFiles = 0;
2594 int iPoolStageAvail = 0;
2595 int iRandomExcess = 0;
2597 int iPoolStageMaxWS = 0;
2598 int iPoolStageCheck = 0;
2600 int iStageSizeUnavail = 0;
2603 int iWorkSizeNew = 0;
2605 int iWorkSizeAll = 0;
2606 int iWorkFilesAll = 0;
2607 int iWorkSizeSta = 0;
2608 int iWorkFilesSta = 0;
2610 int iWorkSizeStaStage = 0;
2612 int iWorkFilesStaStage = 0;
2613 int iWorkSizeStaRetr = 0;
2615 int iWorkFilesStaRetr = 0;
2616 int iWorkSizeEst = 0;
2617 int iWorkFilesEst = 0;
2619 int iWorkStatus = -1;
2632 char cMsgPref[8] =
"";
2633 char cMisc[1024] =
"";
2640 printf(
"\n-D- begin %s\n", cModule);
2642 piBuffer = pCliActionComm->
piBuffer;
2643 iSocket = pCliActionComm->
iSocket;
2644 iAction = pCliActionComm->
iAction;
2649 iPoolId = pCliActionComm->
iStatus;
2654 iPrintPoolInfo = iPoolId;
2655 if (iPrintPoolInfo == 5)
2661 else if (iAction ==
STAGE)
2663 iPoolId = pCliActionComm->
iStatus;
2664 iPrintPoolInfo = iPoolId;
2665 if (iPrintPoolInfo == 5)
2671 strcpy(pcGenFile, pCliActionComm->
pcFile);
2679 printf(
" action %d", iAction);
2682 printf(
", print pool info");
2687 printf(
", for poolId %d\n", iPoolId);
2689 printf(
", for all pools\n");
2691 else if (iAction ==
STAGE)
2693 printf(
", poolId %d\n", iPoolId);
2704 pcc = (
char *) piBuffer;
2709 printf(
"-E- receiving header pool status from master server\n");
2713 iIdent = ntohl(pPoolInfo->
iIdent);
2714 iStatus = ntohl(pPoolInfo->
iPoolNo);
2718 " header pool status received (%d bytes): ident %d, status %d, attrlen %d\n",
2719 iRC, iIdent, iStatus, iAttrLen);
2728 printf(
"-E- received error status from server");
2730 printf(
" instead of pool info:\n");
2737 if (iRC < 0) printf(
2738 "-E- receiving error msg from server, rc = %d\n",
2740 else printf(
" %s\n", pcc);
2742 else printf(
" no error message available\n");
2748 "-E- unexpected status (type %d) received from server\n",
2755 "-E- unexpected header (%d) received from server\n",
2764 iBufPool = iAttrLen;
2768 pPoolInfoData0 = pPoolInfoData;
2774 if ( (iRC = recv( iSocket, pcc, (
unsigned) iBuf, 0 )) <= 0)
2776 if (iRC < 0) printf(
2777 "-E- %s: receiving pool info\n", cModule);
2780 ii = iBufPool - iBuf;
2782 "-E- %s: connection to entry server broken, %d byte of pool info (%d byte) received\n",
2783 cModule, ii, iBufPool);
2786 printf(
" %s\n", strerror(errno));
2787 perror(
"-E- receiving pool info");
2799 printf(
" status of %d pools received (%d bytes)\n",
2800 iPoolmax, iBufPool);
2805 (iAction ==
STAGE) )
2806 for (iPoolcur=1; iPoolcur<=iPoolmax; iPoolcur++)
2811 iPoolRetrMax = ntohl(pPoolInfoData->
iMaxSize)/1000;
2812 iPoolRetrFree = ntohl(pPoolInfoData->
iFreeSize)/1000;
2814 if (iPoolRetrFree < 0)
2816 iRandomExcess = -iPoolRetrFree;
2819 iPoolRetrFiles = ntohl(pPoolInfoData->
iFiles);
2820 if ( (iPoolRetrFree == iPoolRetrMax) && (iPoolRetrFiles > 0) )
2823 if ( (iPrintPoolInfo == 1) || (iPrintPoolInfo == 6) ||
2826 sprintf(pcReportReadCache,
2827 " %s: used for 'gstore retrieve' to all file systems except lustre\n free space %8d GByte\n no min file lifetime of files\n",
2828 pPoolInfoData->
cPoolName, iPoolRetrFree);
2831 printf(
" info1 created:\n%s", pcReportReadCache);
2838 iHardwareMax = ntohl(pPoolInfoData->
iMaxSizeHW)/1000;
2839 iHardwareFree = ntohl(pPoolInfoData->
iFreeSizeHW)/1000;
2841 iPoolStageMax = ntohl(pPoolInfoData->
iMaxSize)/1000;
2842 iPoolStageFree = ntohl(pPoolInfoData->
iFreeSize)/1000;
2844 if (iPoolStageFree < 0)
2847 iPoolStageFiles = ntohl(pPoolInfoData->
iFiles);
2848 if ( (iPoolStageFree == iPoolStageMax) &&
2849 (iPoolStageFiles > 0) )
2852 iPoolStageAvail = ntohl(pPoolInfoData->
iFileAvail);
2854 ii = iPoolStageFree + iPoolRetrFree;
2855 if (iHardwareFree != ii)
2858 if ( (iPrintPoolInfo == 2) || (iPrintPoolInfo == 6) ||
2862 " %s: used for smaller staging transfers\n free space %8d GByte\n min file availability of %d days guaranteed\n",
2863 pPoolInfoData->
cPoolName, iPoolStageFree,
2865 strcat(pcReportReadCache, cMisc);
2868 printf(
" info21 created:\n%s", cMisc);
2870 if (iPrintPoolInfo != 2)
2873 "-I- StagePool shares available disk space with RetrievePool\n free HW space %8d GByte, total HW space %8d GByte\n",
2874 iHardwareFree, iHardwareMax);
2875 strcat(pcReportReadCache, cMisc);
2878 printf(
" info22 created:\n%s", cMisc);
2885 iPoolStageMaxWS = ntohl(pPoolInfoData->
iMaxWorkSize)/1000;
2886 iPoolStageCheck = ntohl(pPoolInfoData->
iCheckSize)/1000;
2890 if ( (iPoolcur < iPoolmax) &&
2891 ((iPoolcur == 3) || (iPoolcur == 4)) )
2894 " poolNo %d: (%s) ignored\n",
2898 if (iPoolcur == iPoolmax)
2900 iPoolStageFiles = ntohl(pPoolInfoData->
iFiles);
2901 iPoolStageMax = ntohl(pPoolInfoData->
iMaxSize)/1000;
2902 iPoolStageFree = ntohl(pPoolInfoData->
iFreeSize)/1000;
2904 if ( (iPoolStageFree == iPoolStageMax) &&
2905 (iPoolStageFiles > 0) )
2907 if (iPoolStageFree < 0)
2910 iHardwareMax = ntohl(pPoolInfoData->
iMaxSizeHW)/1000;
2911 iHardwareFree = ntohl(pPoolInfoData->
iFreeSizeHW)/1000;
2913 if ( (iPrintPoolInfo == 3) || (iPrintPoolInfo == 6) ||
2916 sprintf(pcReportGlobalReadCache,
2917 " %s: used for larger staging transfers and for archive from lustre\n free space %8d GByte, total HW space %8d GByte\n for staged files min file availability of %d days guaranteed\n",
2919 iPoolStageFree, iPoolStageMax,
2923 printf(
" info3 created:\n%s", pcReportGlobalReadCache);
2931 pPoolInfoData = pPoolInfoData0;
2940 *ppWorkSpace = pWorkSpace;
2945 printf(
"-E- receiving work space buffer header\n");
2949 printf(
"-D- header work space buffer received (%d bytes)\n",
2952 iIdent = ntohl(pWorkSpace->
iIdent);
2953 iStatus = ntohl(pWorkSpace->
iWorkId);
2963 if (iDebug) printf(
"\n");
2964 printf(
"-E- received error status from server");
2966 printf(
" instead of work space info:\n");
2971 pcc = (
char *) piBuffer;
2973 if (iRC < 0) printf(
2974 "-E- receiving error msg from server, rc = %d\n",
2976 else printf(
" %s\n", pcc);
2978 else printf(
" no error message available\n");
2984 "-E- unexpected status (%d) received from server\n",
2991 "-E- unexpected header (%d) received from server\n",
3004 if ( (iRC = recv( iSocket, pcc, (
unsigned) iBuf, 0 )) <= 0)
3006 if (iRC < 0) printf(
3007 "-E- %s: receiving work space info (%d byte)\n",
3011 ii = iAttrLen - iBuf;
3012 printf(
"-E- %s: connection to sender broken, %d byte of work space info (%d byte) received\n",
3013 cModule, ii, iAttrLen);
3016 printf(
" %s\n", strerror(errno));
3017 perror(
"-E- receiving work space info");
3028 printf(
" remainder work space buffer received (%d byte)\n",
3033 iWorkStatus = ntohl(pWorkSpace->
iStatus);
3041 iWorkSizeStaRetr = iWorkSizeSta - iWorkSizeStaStage;
3042 iWorkFilesStaRetr = iWorkFilesSta - iWorkFilesStaStage;
3045 if ( ((iPrintPoolInfo) &&
3051 printf(
" %d matching files, overall size %d MByte\n",
3052 iWorkFilesAll, iWorkSizeAll);
3053 if (iWorkFilesEst) printf(
3054 " size estimated for %d files: %d MByte\n",
3055 iWorkFilesEst, iWorkSizeEst);
3057 if (iWorkSizeSta == iWorkSizeAll)
3060 " all files already available on staging disk\n");
3062 else if (iWorkSizeSta)
3067 " %d files already available on staging disk (%d MByte)\n",
3068 iWorkFilesSta, iWorkSizeSta);
3069 if (iWorkFilesStaStage) printf(
3070 " %d files already in %s (%d MByte)\n",
3071 iWorkFilesStaStage, cPoolNameStage, iWorkSizeStaStage);
3074 printf(
" %d files still to be staged (%d MByte)\n",
3075 iWorkFilesAll-iWorkFilesSta,
3076 iWorkSizeAll - iWorkSizeSta);
3079 printf(
" all files to be staged\n");
3089 if (iWorkStatus != 0)
3092 ((iWorkStatus == 1) || (iWorkStatus == 3)) )
3094 strcpy(cMsgPref,
"-W-");
3095 printf(
"%s requested workspace cannot be staged completely\n",
3099 if (iWorkStatus < 0)
3100 printf(
"%s staging disk pool currently unavailable\n",
3102 else if (iWorkStatus == 3)
3104 printf(
"%s overall size of %s is limited to %d GByte\n",
3105 cMsgPref, cPoolNameStage, iPoolStageMax);
3107 "-I- Please reduce your work space requirements\n");
3109 else if (iWorkStatus == 1)
3111 printf(
" currently free in cache: %d GByte\n",
3114 " still needed: %d MByte (%d files)\n",
3115 iWorkSizeAll-iWorkSizeSta,
3116 iWorkFilesAll-iWorkFilesSta);
3118 printf(
"-I- Check later again!\n");
3120 "-I- Query work space status before retrying later!\n");
3122 else if (iWorkStatus != 2) printf(
3123 "-E- unexpected workspace status received from server (%d)\n",
3130 if ( (iDebug) && (iWorkSizeSta != iWorkSizeAll) )
3134 iWorkSizeNew = iWorkSizeAll - iWorkSizeSta;
3137 if (iWorkSizeNew > iHardwareFree)
3139 printf(
" currently unused in %s: %d GByte\n",
3140 cPoolNameStage, iPoolStageFree);
3142 " currently free in %s: %d GByte, remainder temporarily used by other pools\n",
3143 cPoolNameStage, iHardwareFree);
3146 " currently free in cache: %d GByte\n",
3150 " currently free in cache: %d GByte\n",
3157 if (iWorkStatus >= 9)
3166 printf(
"-D- currently free (HW): %d GByte\n",
3169 " currently %d MByte unused in %s are allocated by other pools\n",
3170 ii*(-1), cPoolNameStage);
3174 strcpy(cMisc,
"must be initiated (gstore stage)");
3176 strcpy(cMisc,
"is initiated");
3178 "-I- a clean job %s to provide the requested space\n",
3181 if (iWorkStatus > 9)
3184 iSleepClean = iWorkStatus;
3197 printf(
"-D- end %s\n\n", cModule);
3214 char cModule[32] =
"rawGetFullFile";
3221 char *pdelim=NULL, *pdelim2=NULL;
3225 fprintf(
fLogFile,
"\n-D- begin %s\n", cModule);
3227 strcpy(
cPath, pcFile);
3228 pdelim = strrchr(
cPath, *pcFileDelim);
3231 strncpy(pdelim,
"\0", 1);
3232 strcpy(cname1, ++pdelim);
3237 pdelim2 = strrchr(
cPath, *pcFileDelim2);
3238 if (pdelim2 != NULL)
3240 strncpy(pdelim2,
"\0", 1);
3241 strcpy(cname1, ++pdelim2);
3246 strncpy(
cPath,
"\0", 1);
3247 strcpy(cname1, pcFile);
3253 ilen = strlen(cname1);
3258 fprintf(
fLogFile,
"-D- %s: path %s], name1: %s (len %d)\n",
3259 cModule,
cPath, cname1, ilen);
3263 if (pdelim2 != NULL)
3264 fprintf(
fLogFile,
"-D- %s: device %s, name1: %s (len %d)\n",
3265 cModule,
cPath, cname1, ilen);
3267 fprintf(
fLogFile,
"-D- %s: no prefix, name1: %s (len %d)\n",
3268 cModule, cname1, ilen);
3272 " path: %s, name1: %s (len %d)\n",
cPath, cname1, ilen);
3278 iRC = strncmp(pcll, pcObjDelim, 1);
3279 if (iRC == 0) pcll++;
3282 iRC = strncmp(pcll, pcObjDelimAlt, 1);
3283 if (iRC == 0) pcll++;
3286 if (strlen(
cPath) > 0)
3289 if (pdelim2 != NULL)
3290 strcat(
cPath, pcFileDelim2);
3293 strcat(
cPath, pcFileDelim);
3295 strcat(
cPath, pcll);
3297 "-D- end %s: full file name found: %s\n\n", cModule,
cPath);
3299 return( (
char *)
cPath);
3317 char cModule[32]=
"rawQueryPrint";
3319 char cMClass[12] =
"";
3321 char cStatus[16] =
"";
3328 int iMediaClass = 0;
3330 unsigned long *plFileSizeC;
3331 unsigned long lFileSize;
3332 int iVersionObjAttr = 0;
3338 iVersionObjAttr = ntohl(pQAttr->
iVersion);
3339 if ( (ipMode == 1) || (ipMode == 11) ) fprintf(
fLogFile,
3340 "\n-D- begin %s: objAttr V%d\n", cModule, iVersionObjAttr);
3346 "-E- %s: invalid cacheDB entry version %d\n",
3347 cModule, iVersionObjAttr);
3359 strcpy(cMClass,
"DISK ");
3362 strcpy(cMClass,
"TAPE ");
3365 strcpy(cMClass,
"NETWORK");
3368 strcpy(cMClass,
"SHELF");
3371 strcpy(cMClass,
"OFFSITE");
3374 strcpy(cMClass,
"UNAVAILABLE");
3378 strcpy(cMClass,
"STAGE");
3379 strcpy(cStatus,
"staged");
3383 strcpy(cMClass,
"STAGE*");
3384 strcpy(cStatus,
"still staging");
3388 strcpy(cMClass,
"STAGE*");
3389 strcpy(cStatus,
"staging failed");
3394 strcpy(cMClass,
"CACHE");
3395 strcpy(cStatus,
"cached");
3399 strcpy(cMClass,
"CACHE*");
3400 strcpy(cStatus,
"still caching");
3404 strcpy(cMClass,
"CACHE");
3405 strcpy(cStatus,
"still copying");
3409 fprintf(
fLogFile,
"-E- Invalid media class %d found\n",
3421 sprintf(cMClass,
"%s%d", cMClass,
iATLServer);
3423 sprintf(cMClass,
"%s", cMClass);
3426 if ( (ipMode == 10) || (ipMode == 11) )
3427 strcat(cMClass,
"??");
3432 fprintf(
fLogFile,
"%s%s%s %s %s %s",
3438 plFileSizeC = (
unsigned long *) &(pQAttr->
iFileSize);
3439 lFileSize = *plFileSizeC;
3444 (
sizeof(long) == 8) )
3445 fprintf(
fLogFile,
" %12lu", lFileSize);
3460 if ( (ipMode == 1) || (ipMode == 11) )
3462 if (ntohl(pQAttr->
iFS))
3463 fprintf(
fLogFile,
" on data mover %s in pool FS %d (poolId %d)\n",
3467 " obj-Id: %u-%u, restore order: %u-%u-%u-%u-%u\n",
3476 " owner: %s, OS: %.8s, mgmt-class: %s, file set %d\n",
3481 if ( (ipMode == 1) || (ipMode == 11) )
3482 fprintf(
fLogFile,
"-D- end %s\n\n", cModule);
3500 char cModule[32] =
"rawQueryString";
3505 char cMClass[12] =
"";
3515 int iMediaClass = 0;
3517 unsigned long *plFileSizeC;
3518 unsigned long lFileSize;
3519 int iVersionObjAttr = 0;
3525 iVersionObjAttr = ntohl(pQAttr->
iVersion);
3527 "\n-D- begin %s: version ObjAttr %d\n", cModule, iVersionObjAttr);
3533 "-E- %s: invalid cacheDB entry version %d\n",
3534 cModule, iVersionObjAttr);
3546 strcpy(cMClass,
"DISK ");
3549 strcpy(cMClass,
"TAPE ");
3552 strcpy(cMClass,
"NETWORK");
3555 strcpy(cMClass,
"SHELF");
3558 strcpy(cMClass,
"OFFSITE");
3561 strcpy(cMClass,
"UNAVAILABLE");
3565 strcpy(cMClass,
"STAGE");
3570 strcpy(cMClass,
"STAGE*");
3574 strcpy(cMClass,
"CACHE");
3579 strcpy(cMClass,
"CACHE*");
3583 fprintf(
fLogFile,
"-E- Invalid media class %d found\n",
3595 sprintf(cMClass,
"%s%d", cMClass,
iATLServer);
3597 sprintf(cMClass,
"%s", cMClass);
3599 if ( (ipMode == 10) || (ipMode == 11) )
3600 strcat(cMClass,
"??");
3606 sprintf(cMsg,
"%s%s%s %s %s %s",
3612 plFileSizeC = (
unsigned long *) &(pQAttr->
iFileSize);
3613 lFileSize = *plFileSizeC;
3622 (
sizeof(
long) == 8) )
3623 sprintf(cMsg1,
" %12lu", lFileSize);
3625 sprintf(cMsg1,
" %s ",
cTooBig);
3626 strcat(cMsg, cMsg1);
3631 strcat(cMsg, cMsg1);
3635 sprintf(cMsg1,
" %s", pQAttr->
cNode);
3636 strcat(cMsg, cMsg1);
3640 if ( (ipMode == 1) || (ipMode == 11) )
3642 if (ntohl(pQAttr->
iFS))
3645 " on data mover %s, FS %d (poolId %d)\n",
3648 strcat(cMsg, cMsg1);
3652 " obj-Id: %u-%u, restore order: %u-%u-%u-%u-%u\n",
3660 strcat(cMsg, cMsg1);
3663 " version %d, owner: %s, OS: %s, mgmt-class: %s, file set %d\n",
3666 strcat(cMsg, cMsg1);
3669 iMsg = strlen(cMsg);
3674 "-W- %s: output string provided too short (%d byte), %d byte needed\n",
3675 cModule, iOut, iMsg);
3676 strncpy(pcOut, cMsg, (
unsigned) iOut-1);
3677 strcat(pcOut,
"\0");
3680 "-W- %s: query information incomplete:\n%s\n", cModule, pcOut);
3687 " %s: length query info %d byte, length of string provided %d byte, msg:\n",
3688 cModule, iMsg, iOut);
3689 strcpy(pcOut, cMsg);
3693 fprintf(
fLogFile,
"-D- end %s\n\n", cModule);
3707 int iObjnoAll,
int *piObjBuf0)
3709 char cModule[32] =
"rawScanObjbuf";
3723 printf(
"\n-D- begin %s: check %d objs for %s%s\n",
3724 cModule, iObjnoAll, pcPath, pcFile);
3726 piObjBuf = piObjBuf0;
3731 iObjnoBuf = *piObjBuf;
3736 printf(
"DDD buffer %d: piObjBuf %p, value %d, psRetrList %p\n",
3737 iBufno, piObjBuf, *piObjBuf, psRetrList);
3742 for (ii=1; ii<=iObjnoBuf; ii++)
3747 printf(
" %d: %s%s, addr %p\n",
3753 if ( (strcmp(pcFile, psRetrList->
cNamell) == 0) &&
3754 (strcmp(pcPath, psRetrList->
cNamehl) == 0) )
3757 " file %s%s already available in list\n",
3767 if (iObjnoCur == iObjnoAll)
3770 " all %d files scanned\n", iObjnoAll);
3776 ppiNextBuf = (
int **) psRetrList;
3777 piObjBuf = *ppiNextBuf;
3781 printf(
"DDD next piObjBuf %p, value %d, psRetrList %p\n",
3782 piObjBuf, *piObjBuf, psRetrList);
3793 printf(
"-D- end %s: %d buffers scanned\n\n", cModule, iBufno);
3817 char cModule[32] =
"rawSortValues";
3820 int ii, ii1, iif, jj;
3824 int iaValNew[iAll+1];
3826 iLoop = iLast - iFirst + 1;
3829 printf(
"\n-D- begin %s\n", cModule);
3833 printf(
" numbers on input:\n value index\n");
3834 for (ii=iFirst; ii<=iLast; ii++)
3836 printf(
" %6d: %10d %6d\n", ii, iaValue[ii], iaIndex[ii]);
3840 iFound = iFirst - 1;
3841 for (jj=iFirst; jj<=iLast; jj++)
3843 if (iFound >= iFirst)
3845 for (iif=iFirst; iif<=iFound; iif++)
3847 if ( (iaValue[jj] < iaValNew[iif]) && (iaValNew[iif]) )
3849 for (ii1=iFound; ii1>=iif; ii1--)
3851 iaValNew[ii1+1] = iaValNew[ii1];
3852 iaIndNew[ii1+1] = iaIndNew[ii1];
3855 iaValNew[iif] = iaValue[jj];
3856 iaIndNew[iif] = iaIndex[jj];
3859 " at pos %d inserted: val %d, ind %d\n",
3860 iif, iaValNew[iif], iaIndNew[iif]);
3869 iaValNew[iFound] = iaValue[jj];
3870 iaIndNew[iFound] = iaIndex[jj];
3872 " at pos %d appended: val %d, ind %d\n",
3873 iFound, iaValNew[iFound], iaIndNew[iFound]);
3884 iaValNew[iFirst] = iaValue[jj];
3885 iaIndNew[iFirst] = iaIndex[jj];
3889 " start value: val %d, ind %d\n",
3890 iaValNew[iFound], iaIndNew[iFound]);
3894 memcpy(&iaValue[iFirst], &iaValNew[iFirst], (
unsigned) iLoop*
iint);
3898 printf(
" numbers on output:\n value index\n");
3899 for (ii=iFirst; ii<=iLast; ii++)
3901 printf(
" %6d: %10d %6d\n", ii, iaValue[ii], iaIndNew[ii]);
3906 printf(
"-D- end %s\n\n", cModule);
3931 unsigned long ielpst(
unsigned long iScale,
3932 unsigned long *iBuf )
3934 char cModule[32] =
"ielpst";
3937 struct timestruc_t stv;
3938 unsigned long iTemp[2];
3940 gettimer( TIMEOFDAY, &stv );
3942 if ( iScale <= 0 ) iScale = 1;
3943 iTemp[1] = stv.tv_sec - iBuf[1];
3944 if ( ( iTemp[0] = stv.tv_nsec - iBuf[0] ) & 0x80000000 ) {
3945 iTemp[0] += 1000000000L; iTemp[1] -= 1;
3947 iBuf[1] = stv.tv_sec; iBuf[0] = stv.tv_nsec;
3948 return( iTemp[1] * ( 1000000L / iScale ) + ( iTemp[0] / 1000 ) / iScale );
3953 unsigned long ielpst_(
unsigned long *iScale,
3954 unsigned long *iBuf )
3956 return( ielpst( *iScale, iBuf ) );
static unsigned int iFileList
int rawCheckFileList(char **pcFileList, char **pcObjList, char *pcArchive, char *pcNodeMaster, int iRecursive, unsigned int iuTopDir, char *pcTopDir, char *pcTophl)
static char cPath[MAX_FULL_FILE]
int rawGetWSInfo(srawCliActionComm *pCliActionComm, srawPoolStatus *pPoolInfo, srawWorkSpace **ppWorkSpace, char *pcReportReadCache, char *pcReportGlobalReadCache)
int rawQueryString(srawObjAttr *pQAttr, int ipMode, int iOut, char *pcOut)
int rawCheckObjList(int iObjAll, int iObjComp, int iSort, char **pcObjList, char **pcFileList, char **pcObjComp)
int rawSortValues(int *iaValue, int iAll, int iFirst, int iLast, int *iaIndex, int *iaIndNew)
int rawScanObjbuf(char *pcPath, char *pcFile, int iObjnoAll, int *piObjBuf0)
void rawQueryPrint(srawObjAttr *pQAttr, int ipMode)
static unsigned int iRetrList
char * rawGetFullFile(char *pcFile, char *pcNamell)
int rawGetFilelistEntries(char *pcFileName, int *piDataFS, char *pcDataFS, int *piEntries, int *piGlobalDir)
#define GSI_STAGE_INVALID
#define GSI_CACHE_INCOMPLETE
#define GSI_MEDIA_INCOMPLETE
#define MEDIA_UNAVAILABLE
static char cPathPrefix[16]
static char cDataFSHigh2[16]
static const char cTooBig[8]
static char cDataFSHigh1[16]
#define VERSION_SRAWOBJATTR
#define MIN_SEQUENTIAL_FILES
static const char * pcPerc
static const char * pcStar
int rawGetLLName(char *, const char *, char *)
int rawRecvError(int, int, char *)
int rawRecvHead(int, char *)
char * rawGetPathName(char *)
char cFile[MAX_FULL_FILE]
char cDateCreate[MAX_DATE]
unsigned int iRestoLowHigh
unsigned int iRestoHighHigh
char cMgmtClass[MAX_MC+2]
unsigned int iRestoHighLow
char cStageUser[MAX_OWNER]
unsigned int iRestoLowHigh
unsigned int iRestoHighLow
unsigned int iRestoHighHigh