00001
00002
00003
00004
00005
00006
00007
00008 #include "rmCollOld.h"
00009 #include "collCreate.h"
00010 #include "icatHighLevelRoutines.h"
00011 #include "rodsLog.h"
00012 #include "icatDefines.h"
00013 #include "dataObjRename.h"
00014 #include "dataObjOpr.h"
00015 #include "objMetaOpr.h"
00016 #include "collection.h"
00017 #include "specColl.h"
00018 #include "fileRmdir.h"
00019 #include "subStructFileRmdir.h"
00020 #include "genQuery.h"
00021 #include "dataObjUnlink.h"
00022
00023 int
00024 rsRmCollOld (rsComm_t *rsComm, collInp_t *rmCollInp)
00025 {
00026 int status;
00027 rodsServerHost_t *rodsServerHost = NULL;
00028
00029
00030 status = getAndConnRcatHost (rsComm, MASTER_RCAT, rmCollInp->collName,
00031 &rodsServerHost);
00032 if (status < 0 || NULL == rodsServerHost ) {
00033 return(status);
00034 }
00035
00036 if (rodsServerHost->localFlag == LOCAL_HOST) {
00037 #ifdef RODS_CAT
00038 status = _rsRmCollOld (rsComm, rmCollInp);
00039 #else
00040 status = SYS_NO_RCAT_SERVER_ERR;
00041 #endif
00042 } else {
00043 status = rcRmCollOld (rodsServerHost->conn, rmCollInp);
00044 }
00045
00046 return (status);
00047 }
00048
00049 int
00050 _rsRmCollOld (rsComm_t *rsComm, collInp_t *rmCollInp)
00051 {
00052 int status;
00053 dataObjInfo_t *dataObjInfo = NULL;
00054
00055 #if 0
00056 dataObjInp_t dataObjInp;
00057 memset (&dataObjInp, 0, sizeof (dataObjInp));
00058 rstrcpy (dataObjInp.objPath, rmCollInp->collName, MAX_NAME_LEN);
00059 #endif
00060 status = resolvePathInSpecColl (rsComm, rmCollInp->collName,
00061 WRITE_COLL_PERM, 0, &dataObjInfo);
00062
00063
00064 if (status == COLL_OBJ_T && dataObjInfo->specColl != NULL) {
00065 status = svrRmSpecColl (rsComm, rmCollInp, dataObjInfo);
00066 } else {
00067 status = svrRmCollOld (rsComm, rmCollInp);
00068 }
00069
00070 return (0);
00071 }
00072
00073 int
00074 svrRmCollOld (rsComm_t *rsComm, collInp_t *rmCollInp)
00075 {
00076 int status;
00077 collInfo_t collInfo;
00078
00079 if (getValByKey (&rmCollInp->condInput, RECURSIVE_OPR__KW) != NULL) {
00080 status = _rsRmCollRecurOld (rsComm, rmCollInp);
00081 return (status);
00082 }
00083
00084 memset (&collInfo, 0, sizeof (collInfo));
00085
00086 rstrcpy (collInfo.collName, rmCollInp->collName, MAX_NAME_LEN);
00087 #ifdef RODS_CAT
00088 if (getValByKey (&rmCollInp->condInput, IRODS_ADMIN_RMTRASH_KW) != NULL) {
00089 status = chlDelCollByAdmin (rsComm, &collInfo);
00090 if (status >= 0) {
00091 chlCommit(rsComm);
00092 }
00093 } else {
00094 status = chlDelColl (rsComm, &collInfo);
00095 }
00096 return (status);
00097 #else
00098 return (SYS_NO_RCAT_SERVER_ERR);
00099 #endif
00100 }
00101
00102 int
00103 _rsRmCollRecurOld (rsComm_t *rsComm, collInp_t *rmCollInp)
00104 {
00105 int status;
00106 ruleExecInfo_t rei;
00107 int trashPolicy;
00108
00109 if (getValByKey (&rmCollInp->condInput, FORCE_FLAG_KW) != NULL) {
00110 status = rsPhyRmCollRecurOld (rsComm, rmCollInp);
00111 } else {
00112 initReiWithDataObjInp (&rei, rsComm, NULL);
00113 status = applyRule ("acTrashPolicy", NULL, &rei, NO_SAVE_REI);
00114 trashPolicy = rei.status;
00115
00116 if (trashPolicy != NO_TRASH_CAN) {
00117 status = rsMvCollToTrash (rsComm, rmCollInp);
00118 return status;
00119 } else {
00120 status = rsPhyRmCollRecurOld (rsComm, rmCollInp);
00121 }
00122 }
00123
00124 return (status);
00125 }
00126
00127 int
00128 rsPhyRmCollRecurOld (rsComm_t *rsComm, collInp_t *rmCollInp)
00129 {
00130 int status, i;
00131 int savedStatus = 0;
00132 genQueryInp_t genQueryInp;
00133 genQueryOut_t *genQueryOut = NULL;
00134 dataObjInp_t dataObjInp;
00135 int collLen;
00136 int continueInx;
00137 collInfo_t collInfo;
00138 collInp_t tmpCollInp;
00139 int rmtrashFlag;
00140
00141 memset (&dataObjInp, 0, sizeof (dataObjInp));
00142 memset (&tmpCollInp, 0, sizeof (tmpCollInp));
00143 addKeyVal (&tmpCollInp.condInput, FORCE_FLAG_KW, "");
00144 addKeyVal (&dataObjInp.condInput, FORCE_FLAG_KW, "");
00145
00146 if (getValByKey (&rmCollInp->condInput, IRODS_ADMIN_RMTRASH_KW) != NULL) {
00147 if (isTrashPath (rmCollInp->collName) == False) {
00148 return (SYS_INVALID_FILE_PATH);
00149 }
00150 if (rsComm->clientUser.authInfo.authFlag != LOCAL_PRIV_USER_AUTH) {
00151 return(CAT_INSUFFICIENT_PRIVILEGE_LEVEL);
00152 }
00153 addKeyVal (&tmpCollInp.condInput, IRODS_ADMIN_RMTRASH_KW, "");
00154 addKeyVal (&dataObjInp.condInput, IRODS_ADMIN_RMTRASH_KW, "");
00155 rmtrashFlag = 2;
00156
00157 } else if (getValByKey (&rmCollInp->condInput, IRODS_RMTRASH_KW) != NULL) {
00158 if (isTrashPath (rmCollInp->collName) == False) {
00159 return (SYS_INVALID_FILE_PATH);
00160 }
00161 addKeyVal (&tmpCollInp.condInput, IRODS_RMTRASH_KW, "");
00162 addKeyVal (&dataObjInp.condInput, IRODS_RMTRASH_KW, "");
00163 rmtrashFlag = 1;
00164 }
00165
00166 collLen = strlen (rmCollInp->collName);
00167
00168
00169
00170 memset (&genQueryInp, 0, sizeof (genQueryInp));
00171
00172 status = rsQueryDataObjInCollReCur (rsComm, rmCollInp->collName,
00173 &genQueryInp, &genQueryOut, NULL, 1);
00174
00175 if (status < 0 && status != CAT_NO_ROWS_FOUND) {
00176 rodsLog (LOG_ERROR,
00177 "rsPhyRmCollRecurOld: rsQueryDataObjInCollReCur error for %s, stat=%d",
00178 rmCollInp->collName, status);
00179 return (status);
00180 }
00181
00182 while (status >= 0) {
00183 sqlResult_t *subColl, *dataObj;
00184
00185 if ((subColl = getSqlResultByInx (genQueryOut, COL_COLL_NAME))
00186 == NULL) {
00187 rodsLog (LOG_ERROR,
00188 "rsPhyRmCollRecurOld: getSqlResultByInx for COL_COLL_NAME failed");
00189 return (UNMATCHED_KEY_OR_INDEX);
00190 }
00191
00192 if ((dataObj = getSqlResultByInx (genQueryOut, COL_DATA_NAME))
00193 == NULL) {
00194 rodsLog (LOG_ERROR,
00195 "rsPhyRmCollRecurOld: getSqlResultByInx for COL_DATA_NAME failed");
00196 return (UNMATCHED_KEY_OR_INDEX);
00197 }
00198
00199 for (i = 0; i < genQueryOut->rowCnt; i++) {
00200 char *tmpSubColl, *tmpDataName;
00201
00202 tmpSubColl = &subColl->value[subColl->len * i];
00203 tmpDataName = &dataObj->value[dataObj->len * i];
00204
00205 snprintf (dataObjInp.objPath, MAX_NAME_LEN, "%s/%s",
00206 tmpSubColl, tmpDataName);
00207 status = rsDataObjUnlink (rsComm, &dataObjInp);
00208 if (status < 0) {
00209 rodsLog (LOG_ERROR,
00210 "rsPhyRmCollRecurOld:rsDataObjUnlink failed for %s. stat = %d",
00211 dataObjInp.objPath, status);
00212
00213 savedStatus = status;
00214 }
00215 }
00216
00217 continueInx = genQueryOut->continueInx;
00218
00219 freeGenQueryOut (&genQueryOut);
00220
00221 if (continueInx > 0) {
00222
00223 genQueryInp.continueInx = continueInx;
00224 status = rsGenQuery (rsComm, &genQueryInp, &genQueryOut);
00225 } else {
00226 break;
00227 }
00228 }
00229
00230 clearKeyVal (&dataObjInp.condInput);
00231
00232
00233
00234
00235 status = rsQueryCollInColl (rsComm, rmCollInp->collName, &genQueryInp,
00236 &genQueryOut);
00237
00238 while (status >= 0) {
00239 sqlResult_t *subColl;
00240
00241 if ((subColl = getSqlResultByInx (genQueryOut, COL_COLL_NAME))
00242 == NULL) {
00243 rodsLog (LOG_ERROR,
00244 "rsPhyRmCollRecurOld: getSqlResultByInx for COL_COLL_NAME failed");
00245 return (UNMATCHED_KEY_OR_INDEX);
00246 }
00247
00248 for (i = 0; i < genQueryOut->rowCnt; i++) {
00249 char *tmpSubColl;
00250
00251 tmpSubColl = &subColl->value[subColl->len * i];
00252 if ((int) strlen (tmpSubColl) < collLen)
00253 continue;
00254
00255 rstrcpy (tmpCollInp.collName, tmpSubColl, MAX_NAME_LEN);
00256 status = rsPhyRmCollRecurOld (rsComm, &tmpCollInp);
00257 if (status < 0) {
00258 rodsLogError (LOG_ERROR, status,
00259 "rsPhyRmCollRecurOld: rsPhyRmCollRecurOld of %s failed, status = %d",
00260 tmpSubColl, status);
00261 savedStatus = status;
00262 }
00263 }
00264 continueInx = genQueryOut->continueInx;
00265
00266 freeGenQueryOut (&genQueryOut);
00267
00268 if (continueInx > 0) {
00269
00270 genQueryInp.continueInx = continueInx;
00271 status = rsGenQuery (rsComm, &genQueryInp, &genQueryOut);
00272 } else {
00273 break;
00274 }
00275 }
00276 clearKeyVal (&tmpCollInp.condInput);
00277
00278
00279 memset (&collInfo, 0, sizeof (collInfo));
00280
00281 rstrcpy (collInfo.collName, rmCollInp->collName, MAX_NAME_LEN);
00282 #ifdef RODS_CAT
00283 if (rmtrashFlag > 0 && isTrashHome (rmCollInp->collName) > 0) {
00284
00285 status = 0;
00286 } else {
00287 memset (&collInfo, 0, sizeof (collInfo));
00288 rstrcpy (collInfo.collName, rmCollInp->collName, MAX_NAME_LEN);
00289 if (rmtrashFlag == 2) {
00290 status = chlDelCollByAdmin (rsComm, &collInfo);
00291 if (status >= 0) {
00292 chlCommit(rsComm);
00293 }
00294 } else {
00295 status = chlDelColl (rsComm, &collInfo);
00296 }
00297 }
00298
00299 if (status < 0) {
00300 rodsLog (LOG_ERROR,
00301 "rsPhyRmCollRecurOld: chlDelColl of %s failed, status = %d",
00302 rmCollInp->collName, status);
00303 }
00304
00305 clearGenQueryInp (&genQueryInp);
00306
00307 if (savedStatus < 0) {
00308 return (savedStatus);
00309 } else if (status == CAT_NO_ROWS_FOUND) {
00310 return (0);
00311 } else {
00312 return (status);
00313 }
00314 #else
00315 return (SYS_NO_RCAT_SERVER_ERR);
00316 #endif
00317 }
00318
00319 int
00320 rsMvCollToTrash (rsComm_t *rsComm, collInp_t *rmCollInp)
00321 {
00322 int status;
00323 char trashPath[MAX_NAME_LEN];
00324 dataObjCopyInp_t dataObjRenameInp;
00325 genQueryInp_t genQueryInp;
00326 genQueryOut_t *genQueryOut = NULL;
00327 int continueInx;
00328 dataObjInfo_t dataObjInfo;
00329
00330
00331
00332 memset (&genQueryInp, 0, sizeof (genQueryInp));
00333 status = rsQueryDataObjInCollReCur (rsComm, rmCollInp->collName,
00334 &genQueryInp, &genQueryOut, ACCESS_DELETE_OBJECT, 0);
00335
00336 memset (&dataObjInfo, 0, sizeof (dataObjInfo));
00337 while (status >= 0) {
00338 sqlResult_t *subColl, *dataObj, *rescName;
00339 ruleExecInfo_t rei;
00340
00341
00342
00343 if ((subColl = getSqlResultByInx (genQueryOut, COL_COLL_NAME))
00344 == NULL) {
00345 rodsLog (LOG_ERROR,
00346 "rsMvCollToTrash: getSqlResultByInx for COL_COLL_NAME failed");
00347 return (UNMATCHED_KEY_OR_INDEX);
00348 }
00349
00350 if ((dataObj = getSqlResultByInx (genQueryOut, COL_DATA_NAME))
00351 == NULL) {
00352 rodsLog (LOG_ERROR,
00353 "rsMvCollToTrash: getSqlResultByInx for COL_DATA_NAME failed");
00354 return (UNMATCHED_KEY_OR_INDEX);
00355 }
00356
00357 if ((rescName = getSqlResultByInx (genQueryOut, COL_D_RESC_NAME))
00358 == NULL) {
00359 rodsLog (LOG_ERROR,
00360 "rsMvCollToTrash: getSqlResultByInx for COL_D_RESC_NAME failed");
00361 return (UNMATCHED_KEY_OR_INDEX);
00362 }
00363
00364 snprintf (dataObjInfo.objPath, MAX_NAME_LEN, "%s/%s",
00365 subColl->value, dataObj->value);
00366 rstrcpy (dataObjInfo.rescName, rescName->value, NAME_LEN);
00367
00368 initReiWithDataObjInp (&rei, rsComm, NULL);
00369 rei.doi = &dataObjInfo;
00370
00371 status = applyRule ("acDataDeletePolicy", NULL, &rei, NO_SAVE_REI);
00372
00373 if (status < 0 && status != NO_MORE_RULES_ERR &&
00374 status != SYS_DELETE_DISALLOWED) {
00375 rodsLog (LOG_NOTICE,
00376 "rsMvCollToTrash: acDataDeletePolicy error for %s. status = %d",
00377 dataObjInfo.objPath, status);
00378 return (status);
00379 }
00380
00381 if (rei.status == SYS_DELETE_DISALLOWED) {
00382 rodsLog (LOG_NOTICE,
00383 "rsMvCollToTrash:disallowed for %s via DataDeletePolicy,status=%d",
00384 dataObjInfo.objPath, rei.status);
00385 return (rei.status);
00386 }
00387
00388 continueInx = genQueryOut->continueInx;
00389
00390 freeGenQueryOut (&genQueryOut);
00391
00392 if (continueInx > 0) {
00393
00394 genQueryInp.continueInx = continueInx;
00395 status = rsGenQuery (rsComm, &genQueryInp, &genQueryOut);
00396 } else {
00397 break;
00398 }
00399 }
00400
00401 if (status < 0 && status != CAT_NO_ROWS_FOUND) {
00402 rodsLog (LOG_ERROR,
00403 "rsMvCollToTrash: rsQueryDataObjInCollReCur error for %s, stat=%d",
00404 rmCollInp->collName, status);
00405 return (status);
00406 }
00407
00408 status = rsMkTrashPath (rsComm, rmCollInp->collName, trashPath);
00409
00410 if (status < 0) {
00411 appendRandomToPath (trashPath);
00412 status = rsMkTrashPath (rsComm, rmCollInp->collName, trashPath);
00413 if (status < 0) {
00414 return (status);
00415 }
00416 }
00417
00418 memset (&dataObjRenameInp, 0, sizeof (dataObjRenameInp));
00419
00420 dataObjRenameInp.srcDataObjInp.oprType =
00421 dataObjRenameInp.destDataObjInp.oprType = RENAME_COLL;
00422
00423 rstrcpy (dataObjRenameInp.destDataObjInp.objPath, trashPath, MAX_NAME_LEN);
00424 rstrcpy (dataObjRenameInp.srcDataObjInp.objPath, rmCollInp->collName,
00425 MAX_NAME_LEN);
00426
00427 status = rsDataObjRename (rsComm, &dataObjRenameInp);
00428
00429 while (status == CAT_NAME_EXISTS_AS_COLLECTION) {
00430 appendRandomToPath (dataObjRenameInp.destDataObjInp.objPath);
00431 status = rsDataObjRename (rsComm, &dataObjRenameInp);
00432 #if 0
00433 if (status < 0) {
00434 rodsLog (LOG_ERROR,
00435 "mvCollToTrash: rcDataObjRename error for %s",
00436 dataObjRenameInp.destDataObjInp.objPath);
00437 return (status);
00438 }
00439 #endif
00440 }
00441
00442 if (status < 0) {
00443 rodsLog (LOG_ERROR,
00444 "mvCollToTrash: rcDataObjRename error for %s, status = %d",
00445 dataObjRenameInp.destDataObjInp.objPath, status);
00446 return (status);
00447 }
00448
00449 return (status);
00450 }
00451
00452 int
00453 rsMkTrashPath (rsComm_t *rsComm, char *objPath, char *trashPath)
00454 {
00455 int status;
00456 char *tmpStr;
00457 char startTrashPath[MAX_NAME_LEN];
00458 char destTrashColl[MAX_NAME_LEN], myFile[MAX_NAME_LEN];
00459 char *trashPathPtr;
00460
00461 trashPathPtr = trashPath;
00462 *trashPathPtr = '/';
00463 trashPathPtr++;
00464 tmpStr = objPath + 1;
00465
00466 while (*tmpStr != '\0') {
00467 *trashPathPtr = *tmpStr;
00468 trashPathPtr ++;
00469 if (*tmpStr == '/') {
00470 tmpStr ++;
00471 break;
00472 }
00473 tmpStr ++;
00474 }
00475
00476 if (*tmpStr == '\0') {
00477 rodsLog (LOG_ERROR,
00478 "rsMkTrashPath: input path %s too short", objPath);
00479 return (USER_INPUT_PATH_ERR);
00480 }
00481
00482
00483
00484 if (strncmp (tmpStr, "home/", 5) == 0) {
00485 int nameLen;
00486 tmpStr += 5;
00487 nameLen = strlen (rsComm->clientUser.userName);
00488 if (strncmp (tmpStr, rsComm->clientUser.userName, nameLen) == 0 &&
00489 (*(tmpStr + nameLen) == '/' || *(tmpStr + nameLen) == '#')) {
00490
00491 tmpStr = strchr (tmpStr, '/') + 1;
00492 }
00493 }
00494
00495
00496
00497 *trashPathPtr = '\0';
00498 snprintf (startTrashPath, MAX_NAME_LEN, "%strash/home", trashPath);
00499
00500
00501
00502 if (rsComm->clientUser.authInfo.authFlag == REMOTE_USER_AUTH ||
00503 rsComm->clientUser.authInfo.authFlag == REMOTE_PRIV_USER_AUTH) {
00504
00505 snprintf (trashPathPtr, MAX_NAME_LEN, "trash/home/%s#%s/%s",
00506 rsComm->clientUser.userName, rsComm->clientUser.rodsZone, tmpStr);
00507 } else {
00508 snprintf (trashPathPtr, MAX_NAME_LEN, "trash/home/%s/%s",
00509 rsComm->clientUser.userName, tmpStr);
00510 }
00511
00512 if ((status = splitPathByKey (trashPath, destTrashColl, myFile, '/')) < 0) {
00513 rodsLog (LOG_ERROR,
00514 "rsMkTrashPath: splitPathByKey error for %s ", trashPath);
00515 return (USER_INPUT_PATH_ERR);
00516 }
00517
00518 status = rsMkCollR (rsComm, startTrashPath, destTrashColl);
00519
00520 if (status < 0) {
00521 rodsLog (LOG_ERROR,
00522 "rsMkTrashPath: rsMkCollR error for startPath %s, destPath %s ",
00523 startTrashPath, destTrashColl);
00524 }
00525
00526 return (status);
00527 }
00528
00529 int
00530 svrRmSpecColl (rsComm_t *rsComm, collInp_t *rmCollInp,
00531 dataObjInfo_t *dataObjInfo)
00532 {
00533 int status;
00534
00535 if (getValByKey (&rmCollInp->condInput, RECURSIVE_OPR__KW) != NULL) {
00536
00537 status = svrRmSpecCollRecur (rsComm, dataObjInfo);
00538 } else {
00539
00540 status = l3Rmdir (rsComm, dataObjInfo);
00541 }
00542 return (status);
00543 }
00544
00545 int
00546 l3Rmdir (rsComm_t *rsComm, dataObjInfo_t *dataObjInfo)
00547 {
00548 int rescTypeInx;
00549 fileRmdirInp_t fileRmdirInp;
00550 int status;
00551
00552 if (getStructFileType (dataObjInfo->specColl) >= 0) {
00553 subFile_t subFile;
00554 memset (&subFile, 0, sizeof (subFile));
00555 rstrcpy (subFile.subFilePath, dataObjInfo->subPath,
00556 MAX_NAME_LEN);
00557 rstrcpy (subFile.addr.hostAddr, dataObjInfo->rescInfo->rescLoc,
00558 NAME_LEN);
00559 subFile.specColl = dataObjInfo->specColl;
00560 status = rsSubStructFileRmdir (rsComm, &subFile);
00561 } else {
00562 rescTypeInx = dataObjInfo->rescInfo->rescTypeInx;
00563
00564 switch (RescTypeDef[rescTypeInx].rescCat) {
00565 case FILE_CAT:
00566 memset (&fileRmdirInp, 0, sizeof (fileRmdirInp));
00567 fileRmdirInp.fileType = (fileDriverType_t)RescTypeDef[rescTypeInx].driverType;
00568 rstrcpy (fileRmdirInp.dirName, dataObjInfo->filePath,
00569 MAX_NAME_LEN);
00570 rstrcpy (fileRmdirInp.addr.hostAddr,
00571 dataObjInfo->rescInfo->rescLoc, NAME_LEN);
00572 status = rsFileRmdir (rsComm, &fileRmdirInp);
00573 break;
00574
00575 default:
00576 rodsLog (LOG_NOTICE,
00577 "l3Rmdir: rescCat type %d is not recognized",
00578 RescTypeDef[rescTypeInx].rescCat);
00579 status = SYS_INVALID_RESC_TYPE;
00580 break;
00581 }
00582 }
00583 return (status);
00584 }
00585
00586 int
00587 svrRmSpecCollRecur (rsComm_t *rsComm, dataObjInfo_t *dataObjInfo)
00588 {
00589 int status, i;
00590 dataObjInfo_t myDataObjInfo;
00591 genQueryOut_t *genQueryOut = NULL;
00592 dataObjInp_t dataObjInp;
00593 int continueInx;
00594 int savedStatus = 0;
00595
00596 myDataObjInfo = *dataObjInfo;
00597 memset (&dataObjInp, 0, sizeof (dataObjInp));
00598 rstrcpy (dataObjInp.objPath, dataObjInfo->objPath, MAX_NAME_LEN);
00599 status = rsQuerySpecColl (rsComm, &dataObjInp, &genQueryOut);
00600
00601 while (status >= 0) {
00602 sqlResult_t *subColl, *dataObj;
00603
00604 if ((subColl = getSqlResultByInx (genQueryOut, COL_COLL_NAME))
00605 == NULL) {
00606 rodsLog (LOG_ERROR,
00607 "svrRmSpecCollRecur:getSqlResultByInx COL_COLL_NAME failed");
00608 return (UNMATCHED_KEY_OR_INDEX);
00609 }
00610
00611 if ((dataObj = getSqlResultByInx (genQueryOut, COL_DATA_NAME))
00612 == NULL) {
00613 rodsLog (LOG_ERROR,
00614 "svrRmSpecCollRecur: getSqlResultByInx COL_DATA_NAME failed");
00615 return (UNMATCHED_KEY_OR_INDEX);
00616 }
00617
00618 for (i = 0; i < genQueryOut->rowCnt; i++) {
00619 char *tmpSubColl, *tmpDataName;
00620
00621 tmpSubColl = &subColl->value[subColl->len * i];
00622 tmpDataName = &dataObj->value[dataObj->len * i];
00623
00624 snprintf (myDataObjInfo.objPath, MAX_NAME_LEN, "%s/%s",
00625 tmpSubColl, tmpDataName);
00626
00627 status = getMountedSubPhyPath (dataObjInfo->objPath,
00628 dataObjInfo->filePath, myDataObjInfo.objPath,
00629 myDataObjInfo.filePath);
00630 if (status < 0) {
00631 rodsLog (LOG_ERROR,
00632 "svrRmSpecCollRecur:getMountedSubPhyPat err for %s,stat=%d",
00633 myDataObjInfo.filePath, status);
00634 savedStatus = status;
00635 }
00636
00637 if (strlen (tmpDataName) > 0) {
00638 status = l3Unlink (rsComm, &myDataObjInfo);
00639 } else {
00640 status = svrRmSpecCollRecur (rsComm, &myDataObjInfo);
00641 }
00642
00643 if (status < 0) {
00644 rodsLog (LOG_NOTICE,
00645 "svrRmSpecCollRecur: l3Unlink error for %s. status = %d",
00646 myDataObjInfo.objPath, status);
00647 savedStatus = status;
00648 }
00649 }
00650 continueInx = genQueryOut->continueInx;
00651
00652 freeGenQueryOut (&genQueryOut);
00653
00654 if (continueInx > 0) {
00655
00656 dataObjInp.openFlags = continueInx;
00657 status = rsQuerySpecColl (rsComm, &dataObjInp, &genQueryOut);
00658 } else {
00659 break;
00660 }
00661 }
00662
00663 status = l3Rmdir (rsComm, dataObjInfo);
00664 if (status < 0) savedStatus = status;
00665
00666 return (savedStatus);
00667 }
00668
00669 #ifdef COMPAT_201
00670 int
00671 rsRmCollOld201 (rsComm_t *rsComm, collInp201_t *rmCollInp)
00672 {
00673 collInp_t collInp;
00674 int status;
00675
00676 collInp201ToCollInp (rmCollInp, &collInp);
00677
00678 status = rsRmCollOld (rsComm, &collInp);
00679
00680 return status;
00681 }
00682
00683 #endif