00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "reDataObjOpr.h"
00010 #include "apiHeaderAll.h"
00011 #include "rsApiHandler.h"
00012 #include "collection.h"
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 int
00060 msiDataObjCreate (msParam_t *inpParam1, msParam_t *msKeyValStr,
00061 msParam_t *outParam, ruleExecInfo_t *rei)
00062 {
00063 rsComm_t *rsComm;
00064 dataObjInp_t dataObjInp, *myDataObjInp;
00065 char *outBadKeyWd;
00066 int validKwFlags;
00067
00068 RE_TEST_MACRO (" Calling msiDataObjCreate")
00069
00070 if (rei == NULL || rei->rsComm == NULL) {
00071 rodsLog (LOG_ERROR,
00072 "msiDataObjCreate: input rei or rsComm is NULL");
00073 return (SYS_INTERNAL_NULL_INPUT_ERR);
00074 }
00075
00076 rsComm = rei->rsComm;
00077
00078
00079 rei->status = parseMspForDataObjInp (inpParam1, &dataObjInp,
00080 &myDataObjInp, 0);
00081
00082 if (rei->status < 0) {
00083 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00084 "msiDataObjCreate: input inpParam1 error. status = %d", rei->status);
00085 return (rei->status);
00086 }
00087
00088 #if 0
00089 rei->status = parseMspForCondInp (inpParam2, &myDataObjInp->condInput,
00090 DEST_RESC_NAME_KW);
00091 #else
00092 validKwFlags = DEST_RESC_NAME_FLAG | CREATE_MODE_FLAG | DATA_TYPE_FLAG |
00093 FORCE_FLAG_FLAG | DATA_SIZE_FLAGS | OBJ_PATH_FLAG;
00094 rei->status = parseMsKeyValStrForDataObjInp (msKeyValStr, myDataObjInp,
00095 DEST_RESC_NAME_KW, validKwFlags, &outBadKeyWd);
00096 #endif
00097
00098 if (rei->status < 0) {
00099 if (outBadKeyWd != NULL) {
00100 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00101 "msiDataObjCreate: input keyWd - %s error. status = %d",
00102 outBadKeyWd, rei->status);
00103 free (outBadKeyWd);
00104 } else {
00105 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00106 "msiDataObjCreate: input msKeyValStr error. status = %d",
00107 rei->status);
00108 }
00109 return (rei->status);
00110 }
00111
00112 rei->status = rsDataObjCreate (rsComm, myDataObjInp);
00113
00114 if (myDataObjInp == &dataObjInp) {
00115 clearKeyVal (&myDataObjInp->condInput);
00116 }
00117
00118 if (rei->status >= 0) {
00119 fillIntInMsParam (outParam, rei->status);
00120 } else {
00121 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00122 "msiDataObjCreate: rsDataObjCreate failed for %s, status = %d",
00123 myDataObjInp->objPath,
00124 rei->status);
00125 }
00126
00127 return (rei->status);
00128 }
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178 int
00179 msiDataObjOpen (msParam_t *inpParam, msParam_t *outParam,
00180 ruleExecInfo_t *rei)
00181 {
00182 rsComm_t *rsComm;
00183 dataObjInp_t dataObjInp, *myDataObjInp;
00184 char *outBadKeyWd = NULL;
00185 int validKwFlags;
00186
00187 RE_TEST_MACRO (" Calling msiDataObjOpen")
00188
00189 if (rei == NULL || rei->rsComm == NULL) {
00190 rodsLog (LOG_ERROR,
00191 "msiDataObjOpen: input rei or rsComm is NULL");
00192 return (SYS_INTERNAL_NULL_INPUT_ERR);
00193 }
00194
00195 rsComm = rei->rsComm;
00196
00197
00198 if (strcmp (inpParam->type, STR_MS_T) == 0) {
00199 bzero (&dataObjInp, sizeof (dataObjInp));
00200 myDataObjInp = &dataObjInp;
00201 validKwFlags = OBJ_PATH_FLAG | RESC_NAME_FLAG | OPEN_FLAGS_FLAG |
00202 REPL_NUM_FLAG;
00203 rei->status = parseMsKeyValStrForDataObjInp (inpParam, myDataObjInp,
00204 OBJ_PATH_KW, validKwFlags, &outBadKeyWd);
00205 }else {
00206 rei->status = parseMspForDataObjInp (inpParam, &dataObjInp,
00207 &myDataObjInp, 0);
00208 }
00209
00210 if (rei->status < 0) {
00211 if (outBadKeyWd != NULL) {
00212 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00213 "msiDataObjOpen: input keyWd - %s error. status = %d",
00214 outBadKeyWd, rei->status);
00215 free (outBadKeyWd);
00216 } else {
00217 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00218 "msiDataObjOpen: input msKeyValStr error. status = %d",
00219 rei->status);
00220 }
00221 return (rei->status);
00222 }
00223
00224 #if 0
00225 if (strcmp (inpParam->type, STR_MS_T) == 0) {
00226 myDataObjInp->openFlags = O_RDWR;
00227 }
00228 #endif
00229 rei->status = rsDataObjOpen (rsComm, myDataObjInp);
00230 if (rei->status >= 0) {
00231 fillIntInMsParam (outParam, rei->status);
00232 } else {
00233 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00234 "msiDataObjOpen: rsDataObjOpen failed for %s, status = %d",
00235 dataObjInp.objPath,
00236 rei->status);
00237 }
00238
00239 return (rei->status);
00240 }
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276 int
00277 msiDataObjClose (msParam_t *inpParam, msParam_t *outParam, ruleExecInfo_t *rei)
00278 {
00279 rsComm_t *rsComm;
00280 openedDataObjInp_t dataObjCloseInp, *myDataObjCloseInp;
00281
00282 RE_TEST_MACRO (" Calling msiDataObjClose")
00283
00284 if (rei == NULL || rei->rsComm == NULL) {
00285 rodsLog (LOG_ERROR,
00286 "msiDataObjClose: input rei or rsComm is NULL");
00287 return (SYS_INTERNAL_NULL_INPUT_ERR);
00288 }
00289
00290 rsComm = rei->rsComm;
00291
00292 if (inpParam == NULL) {
00293 rei->status = SYS_INTERNAL_NULL_INPUT_ERR;
00294 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00295 "msiDataObjClose: input inpParam is NULL");
00296 return (rei->status);
00297 }
00298
00299 if (strcmp (inpParam->type, DataObjCloseInp_MS_T) == 0) {
00300 myDataObjCloseInp = (openedDataObjInp_t*)inpParam->inOutStruct;
00301 } else {
00302 int myInt;
00303
00304 myInt = parseMspForPosInt (inpParam);
00305 if (myInt >= 0) {
00306 memset (&dataObjCloseInp, 0, sizeof (dataObjCloseInp));
00307 dataObjCloseInp.l1descInx = myInt;
00308 myDataObjCloseInp = &dataObjCloseInp;
00309 } else {
00310 rei->status = myInt;
00311 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00312 "msiDataObjClose: parseMspForPosInt error for param1.");
00313 return (rei->status);
00314 }
00315 }
00316
00317 rei->status = rsDataObjClose (rsComm, myDataObjCloseInp);
00318 if (rei->status >= 0) {
00319 fillIntInMsParam (outParam, rei->status);
00320 } else {
00321 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00322 "msiDataObjClose: rsDataObjClose failed, status = %d",
00323 rei->status);
00324 }
00325
00326 return (rei->status);
00327 }
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365 int
00366 msiDataObjLseek (msParam_t *inpParam1, msParam_t *inpParam2,
00367 msParam_t *inpParam3, msParam_t *outParam,
00368 ruleExecInfo_t *rei)
00369 {
00370 rsComm_t *rsComm;
00371 openedDataObjInp_t dataObjLseekInp, *myDataObjLseekInp;
00372 fileLseekOut_t *dataObjLseekOut = NULL;
00373
00374 RE_TEST_MACRO (" Calling msiDataObjLseek")
00375
00376 if (rei == NULL || rei->rsComm == NULL) {
00377 rodsLog (LOG_ERROR,
00378 "msiDataObjLseek: input rei or rsComm is NULL");
00379 return (SYS_INTERNAL_NULL_INPUT_ERR);
00380 }
00381
00382 rsComm = rei->rsComm;
00383
00384 if (inpParam1 == NULL) {
00385 rei->status = SYS_INTERNAL_NULL_INPUT_ERR;
00386 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00387 "msiDataObjLseek: input inpParam1 is NULL");
00388 return (rei->status);
00389 }
00390
00391 if (strcmp (inpParam1->type, STR_MS_T) == 0) {
00392
00393 memset (&dataObjLseekInp, 0, sizeof (dataObjLseekInp));
00394 dataObjLseekInp.l1descInx = atoi ((char*)inpParam1->inOutStruct);
00395 myDataObjLseekInp = &dataObjLseekInp;
00396 } else if (strcmp (inpParam1->type, INT_MS_T) == 0) {
00397 memset (&dataObjLseekInp, 0, sizeof (dataObjLseekInp));
00398 dataObjLseekInp.l1descInx = *(int *)inpParam1->inOutStruct;
00399 myDataObjLseekInp = &dataObjLseekInp;
00400 } else if (strcmp (inpParam1->type, DataObjLseekInp_MS_T) == 0) {
00401 myDataObjLseekInp = (openedDataObjInp_t*)inpParam1->inOutStruct;
00402 } else {
00403 rei->status = USER_PARAM_TYPE_ERR;
00404 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00405 "msiDataObjLseek: Unsupported input Param type %s",
00406 inpParam1->type);
00407 return (rei->status);
00408 }
00409
00410 if (inpParam2 != NULL) {
00411 if (strcmp (inpParam2->type, INT_MS_T) == 0) {
00412 myDataObjLseekInp->offset = *(int *)inpParam2->inOutStruct;
00413 } else if (strcmp (inpParam2->type, STR_MS_T) == 0) {
00414
00415 if (strcmp ((char *) inpParam2->inOutStruct, "null") != 0) {
00416 myDataObjLseekInp->offset = strtoll ((char*)inpParam2->inOutStruct,
00417 0, 0);
00418 }
00419 } else if (strcmp (inpParam2->type, DOUBLE_MS_T) == 0) {
00420 myDataObjLseekInp->offset = *(rodsLong_t *)inpParam2->inOutStruct;
00421 } else {
00422 rei->status = USER_PARAM_TYPE_ERR;
00423 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00424 "msiDataObjLseek: Unsupported input Param type %s",
00425 inpParam2->type);
00426 return (rei->status);
00427 }
00428 }
00429
00430 if (inpParam3 != NULL) {
00431
00432 if (strcmp (inpParam3->type, STR_MS_T) == 0) {
00433 if (strcmp ((char *) inpParam3->inOutStruct, "SEEK_SET") == 0) {
00434 myDataObjLseekInp->whence = SEEK_SET;
00435 } else if (strcmp ((char *) inpParam3->inOutStruct,
00436 "SEEK_CUR") == 0) {
00437 myDataObjLseekInp->whence = SEEK_CUR;
00438 } else if (strcmp ((char *) inpParam3->inOutStruct,
00439 "SEEK_END") == 0) {
00440 myDataObjLseekInp->whence = SEEK_END;
00441 } else if (strcmp ((char *) inpParam3->inOutStruct, "null") != 0) {
00442 myDataObjLseekInp->whence = atoi ((char*)inpParam3->inOutStruct);
00443 }
00444 } else if (strcmp (inpParam3->type, INT_MS_T) == 0) {
00445 myDataObjLseekInp->whence = *(int *)inpParam3->inOutStruct;
00446 } else {
00447 rei->status = USER_PARAM_TYPE_ERR;
00448 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00449 "msiDataObjLseek: Unsupported input Param type %s",
00450 inpParam3->type);
00451 return (rei->status);
00452 }
00453 }
00454
00455 if (myDataObjLseekInp->whence != SEEK_SET &&
00456 myDataObjLseekInp->whence != SEEK_CUR &&
00457 myDataObjLseekInp->whence != SEEK_END) {
00458 rei->status = USER_PARAM_TYPE_ERR;
00459 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00460 "msiDataObjLseek: Unsupported input whence value %d",
00461 myDataObjLseekInp->whence);
00462 return (rei->status);
00463 }
00464
00465 rei->status = rsDataObjLseek (rsComm, myDataObjLseekInp, &dataObjLseekOut);
00466 if (rei->status >= 0) {
00467 if (outParam != NULL) {
00468 fillMsParam (outParam, NULL, DataObjLseekOut_MS_T,
00469 dataObjLseekOut, NULL);
00470 } else {
00471 free (dataObjLseekOut);
00472 }
00473 } else {
00474 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00475 "msiDataObjLseek: rsDataObjLseek failed, status = %d",
00476 rei->status);
00477 }
00478
00479 return (rei->status);
00480 }
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517 int
00518 msiDataObjRead (msParam_t *inpParam1, msParam_t *inpParam2, msParam_t *outParam, ruleExecInfo_t *rei)
00519 {
00520 rsComm_t *rsComm;
00521 openedDataObjInp_t dataObjReadInp, *myDataObjReadInp;
00522 bytesBuf_t *dataObjReadOutBBuf = NULL;
00523 int myInt;
00524
00525 RE_TEST_MACRO (" Calling msiDataObjRead")
00526
00527 if (rei == NULL || rei->rsComm == NULL) {
00528 rodsLog (LOG_ERROR,
00529 "msiDataObjRead: input rei or rsComm is NULL");
00530 return (SYS_INTERNAL_NULL_INPUT_ERR);
00531 }
00532
00533 rsComm = rei->rsComm;
00534
00535 if (inpParam1 == NULL) {
00536 rei->status = SYS_INTERNAL_NULL_INPUT_ERR;
00537 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00538 "msiDataObjRead: input inpParam1 is NULL");
00539 return (rei->status);
00540 }
00541
00542 if (strcmp (inpParam1->type, DataObjReadInp_MS_T) == 0) {
00543 myDataObjReadInp = (openedDataObjInp_t*)inpParam1->inOutStruct;
00544 } else {
00545 myInt = parseMspForPosInt (inpParam1);
00546 if (myInt >= 0) {
00547 memset (&dataObjReadInp, 0, sizeof (dataObjReadInp));
00548 dataObjReadInp.l1descInx = myInt;
00549 myDataObjReadInp = &dataObjReadInp;
00550 } else {
00551 rei->status = myInt;
00552 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00553 "msiDataObjRead: parseMspForPosInt error for param1.");
00554 return (rei->status);
00555 }
00556 }
00557
00558 if (inpParam2 != NULL) {
00559 myInt = parseMspForPosInt (inpParam2);
00560
00561 if (myInt < 0) {
00562 if (myInt != SYS_NULL_INPUT) {
00563 rei->status = myInt;
00564 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00565 "msiDataObjRead: parseMspForPosInt error for param2.");
00566 return (rei->status);
00567 }
00568 } else {
00569 myDataObjReadInp->len = myInt;
00570 }
00571 }
00572
00573 dataObjReadOutBBuf = (bytesBuf_t *) malloc (sizeof (bytesBuf_t));
00574 memset (dataObjReadOutBBuf, 0, sizeof (bytesBuf_t));
00575
00576 rei->status = rsDataObjRead (rsComm, myDataObjReadInp, dataObjReadOutBBuf);
00577
00578 if (rei->status >= 0) {
00579 fillBufLenInMsParam (outParam, rei->status, dataObjReadOutBBuf);
00580 } else {
00581 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00582 "msiDataObjRead: rsDataObjRead failed, status = %d",
00583 rei->status);
00584 }
00585
00586 return (rei->status);
00587 }
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625 int
00626 msiDataObjWrite (msParam_t *inpParam1, msParam_t *inpParam2,
00627 msParam_t *outParam, ruleExecInfo_t *rei)
00628 {
00629 rsComm_t *rsComm;
00630 openedDataObjInp_t dataObjWriteInp, *myDataObjWriteInp;
00631 int myInt;
00632 bytesBuf_t tmpBBuf, *myBBuf;
00633 execCmdOut_t *myExecCmdOut;
00634 msParam_t *mP;
00635
00636
00637 RE_TEST_MACRO (" Calling msiDataObjWrite")
00638
00639 if (rei == NULL || rei->rsComm == NULL) {
00640 rodsLog (LOG_ERROR, "msiDataObjWrite: input rei or rsComm is NULL");
00641 return (SYS_INTERNAL_NULL_INPUT_ERR);
00642 }
00643
00644 rsComm = rei->rsComm;
00645
00646 if ((strcmp((char *)inpParam2->inOutStruct,"stdout") == 0) ||
00647 (strcmp((char *) inpParam2->inOutStruct,"stderr") == 0)) {
00648 if ((mP = getMsParamByLabel (rei->msParamArray, "ruleExecOut")) == NULL)
00649 return(NO_VALUES_FOUND);
00650 myExecCmdOut = (execCmdOut_t*)mP->inOutStruct;
00651 if (strcmp((char *) inpParam2->inOutStruct,"stdout") == 0){
00652 free(inpParam2->inOutStruct);
00653 inpParam2->inOutStruct = strdup((char *) myExecCmdOut->stdoutBuf.buf);
00654 }
00655 else {
00656 free(inpParam2->inOutStruct);
00657 inpParam2->inOutStruct = strdup((char *) myExecCmdOut->stderrBuf.buf);
00658 }
00659 inpParam2->type = strdup(STR_MS_T);
00660 }
00661
00662 if (inpParam1 == NULL || (inpParam2->inpOutBuf == NULL &&
00663 inpParam2->inOutStruct == NULL)) {
00664 rei->status = SYS_INTERNAL_NULL_INPUT_ERR;
00665 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00666 "msiDataObjWrite: input inpParam1 or inpOutBuf or inOutStruct is NULL");
00667 return (rei->status);
00668 }
00669
00670 if (strcmp (inpParam1->type, DataObjWriteInp_MS_T) == 0) {
00671 myDataObjWriteInp = (openedDataObjInp_t*)inpParam1->inOutStruct;
00672 } else {
00673 myInt = parseMspForPosInt (inpParam1);
00674 if (myInt >= 0) {
00675 memset (&dataObjWriteInp, 0, sizeof (dataObjWriteInp));
00676 dataObjWriteInp.l1descInx = myInt;
00677 myDataObjWriteInp = &dataObjWriteInp;
00678 } else {
00679 rei->status = myInt;
00680 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00681 "msiDataObjWrite: parseMspForPosInt error for param1.");
00682 return (rei->status);
00683 }
00684 }
00685
00686 if (inpParam2 != NULL) {
00687 if (strcmp (inpParam2->type, STR_MS_T) == 0) {
00688 tmpBBuf.len = myDataObjWriteInp->len =
00689 strlen ((char*)inpParam2->inOutStruct) + 1;
00690 tmpBBuf.buf = inpParam2->inOutStruct;
00691 myBBuf = &tmpBBuf;
00692 } else {
00693 myInt = parseMspForPosInt (inpParam2);
00694 if (myInt < 0) {
00695 if (myInt != SYS_NULL_INPUT) {
00696 rei->status = myInt;
00697 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00698 "msiDataObjWrite: parseMspForPosInt error for param2.");
00699 return (rei->status);
00700 }
00701 } else {
00702 myDataObjWriteInp->len = myInt;
00703 }
00704 myBBuf = inpParam2->inpOutBuf;
00705 }
00706 }
00707
00708 rei->status = rsDataObjWrite (rsComm, myDataObjWriteInp, myBBuf);
00709
00710 if (rei->status >= 0) {
00711 fillIntInMsParam (outParam, rei->status);
00712 } else {
00713 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00714 "msiDataObjWrite: rsDataObjWrite failed, status = %d",
00715 rei->status);
00716 }
00717
00718 return (rei->status);
00719 }
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738
00739
00740
00741
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753
00754
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770 int
00771 msiDataObjUnlink (msParam_t *inpParam, msParam_t *outParam,
00772 ruleExecInfo_t *rei)
00773 {
00774 rsComm_t *rsComm;
00775 dataObjInp_t dataObjInp, *myDataObjInp;
00776 char *outBadKeyWd = NULL;
00777 int validKwFlags;
00778
00779 RE_TEST_MACRO (" Calling msiDataObjUnlink")
00780
00781 if (rei == NULL || rei->rsComm == NULL) {
00782 rodsLog (LOG_ERROR,
00783 "msiDataObjUnlink: input rei or rsComm is NULL");
00784 return (SYS_INTERNAL_NULL_INPUT_ERR);
00785 }
00786
00787 rsComm = rei->rsComm;
00788
00789
00790 if (strcmp (inpParam->type, STR_MS_T) == 0) {
00791 bzero (&dataObjInp, sizeof (dataObjInp));
00792 myDataObjInp = &dataObjInp;
00793 validKwFlags = OBJ_PATH_FLAG | FORCE_FLAG_FLAG | REPL_NUM_FLAG |
00794 IRODS_RMTRASH_FLAG | IRODS_ADMIN_RMTRASH_FLAG;
00795 rei->status = parseMsKeyValStrForDataObjInp (inpParam, myDataObjInp,
00796 OBJ_PATH_KW, validKwFlags, &outBadKeyWd);
00797 } else {
00798 rei->status = parseMspForDataObjInp (inpParam, &dataObjInp,
00799 &myDataObjInp, 0);
00800 }
00801
00802 if (rei->status < 0) {
00803 if (outBadKeyWd != NULL) {
00804 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00805 "msiDataObjUnlink: input keyWd - %s error. status = %d",
00806 outBadKeyWd, rei->status);
00807 free (outBadKeyWd);
00808 } else {
00809 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00810 "msiDataObjUnlink: input msKeyValStr error. status = %d",
00811 rei->status);
00812 }
00813 return (rei->status);
00814 }
00815
00816 rei->status = rsDataObjUnlink (rsComm, myDataObjInp);
00817 if (rei->status >= 0) {
00818 fillIntInMsParam (outParam, rei->status);
00819 } else {
00820 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00821 "msiDataObjUnlink: rsDataObjUnlink failed for %s, status = %d",
00822 myDataObjInp->objPath,
00823 rei->status);
00824 }
00825
00826 return (rei->status);
00827 }
00828
00829
00830
00831
00832
00833
00834
00835
00836
00837
00838
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853
00854
00855
00856
00857
00858
00859
00860
00861
00862
00863
00864
00865
00866
00867
00868
00869
00870
00871
00872
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883
00884
00885
00886
00887
00888
00889
00890
00891
00892
00893
00894
00895
00896 int
00897 msiDataObjRepl (msParam_t *inpParam1, msParam_t *msKeyValStr,
00898 msParam_t *outParam, ruleExecInfo_t *rei)
00899 {
00900 rsComm_t *rsComm;
00901 dataObjInp_t dataObjInp, *myDataObjInp;
00902 transferStat_t *transStat = NULL;
00903 char *outBadKeyWd;
00904 int validKwFlags;
00905
00906 RE_TEST_MACRO (" Calling msiDataObjRepl")
00907
00908 if (rei == NULL || rei->rsComm == NULL) {
00909 rodsLog (LOG_ERROR,
00910 "msiDataObjRepl: input rei or rsComm is NULL");
00911 return (SYS_INTERNAL_NULL_INPUT_ERR);
00912 }
00913
00914 rsComm = rei->rsComm;
00915
00916
00917 rei->status = parseMspForDataObjInp (inpParam1, &dataObjInp,
00918 &myDataObjInp, 0);
00919
00920 if (rei->status < 0) {
00921 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00922 "msiDataObjRepl: input inpParam1 error. status = %d", rei->status);
00923 return (rei->status);
00924 }
00925
00926 #if 0
00927 rei->status = parseMspForCondInp (inpParam2, &myDataObjInp->condInput,
00928 DEST_RESC_NAME_KW);
00929 #else
00930 validKwFlags = OBJ_PATH_FLAG | DEST_RESC_NAME_FLAG | NUM_THREADS_FLAG |
00931 BACKUP_RESC_NAME_FLAG | RESC_NAME_FLAG | UPDATE_REPL_FLAG |
00932 REPL_NUM_FLAG | ALL_FLAG | IRODS_ADMIN_FLAG | VERIFY_CHKSUM_FLAG |
00933 RBUDP_TRANSFER_FLAG | RBUDP_SEND_RATE_FLAG | RBUDP_PACK_SIZE_FLAG;
00934 rei->status = parseMsKeyValStrForDataObjInp (msKeyValStr, myDataObjInp,
00935 DEST_RESC_NAME_KW, validKwFlags, &outBadKeyWd);
00936 #endif
00937
00938 if (rei->status < 0) {
00939 if (outBadKeyWd != NULL) {
00940 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00941 "msiDataObjRepl: input keyWd - %s error. status = %d",
00942 outBadKeyWd, rei->status);
00943 free (outBadKeyWd);
00944 } else {
00945 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00946 "msiDataObjRepl: input msKeyValStr error. status = %d",
00947 rei->status);
00948 }
00949 return (rei->status);
00950 }
00951
00952 rei->status = rsDataObjRepl (rsComm, myDataObjInp, &transStat);
00953
00954 if (myDataObjInp == &dataObjInp) {
00955 clearKeyVal (&myDataObjInp->condInput);
00956 }
00957
00958 if (transStat != NULL) {
00959 free (transStat);
00960 }
00961
00962 if (rei->status >= 0) {
00963 fillIntInMsParam (outParam, rei->status);
00964 } else {
00965 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00966 "msiDataObjRepl: rsDataObjRepl failed %s, status = %d",
00967 myDataObjInp->objPath,
00968 rei->status);
00969 }
00970
00971 return (rei->status);
00972 }
00973
00974
00975
00976
00977
00978
00979
00980
00981
00982
00983
00984
00985
00986
00987
00988
00989
00990
00991
00992
00993
00994
00995
00996
00997
00998
00999
01000
01001
01002
01003
01004
01005
01006
01007
01008
01009
01010
01011
01012
01013
01014
01015
01016
01017
01018
01019
01020
01021
01022
01023
01024
01025
01026
01027
01028 int
01029 msiDataObjCopy (msParam_t *inpParam1, msParam_t *inpParam2,
01030 msParam_t *msKeyValStr, msParam_t *outParam, ruleExecInfo_t *rei)
01031 {
01032 rsComm_t *rsComm;
01033 dataObjCopyInp_t dataObjCopyInp, *myDataObjCopyInp;
01034 dataObjInp_t *myDataObjInp;
01035 transferStat_t *transStat = NULL;
01036 char *outBadKeyWd;
01037 int validKwFlags;
01038
01039 RE_TEST_MACRO (" Calling msiDataObjCopy")
01040
01041 if (rei == NULL || rei->rsComm == NULL) {
01042 rodsLog (LOG_ERROR,
01043 "msiDataObjCopy: input rei or rsComm is NULL");
01044 return (SYS_INTERNAL_NULL_INPUT_ERR);
01045 }
01046
01047 rsComm = rei->rsComm;
01048
01049 rei->status = parseMspForDataObjCopyInp( inpParam1, &dataObjCopyInp, &myDataObjCopyInp );
01050
01051
01052 if (rei->status < 0) {
01053 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01054 "msiDataObjCopy: input inpParam1 error. status = %d", rei->status);
01055 return (rei->status);
01056 }
01057
01058
01059 rei->status = parseMspForDataObjInp (inpParam2, &myDataObjCopyInp->destDataObjInp, &myDataObjInp, 1);
01060
01061
01062 if (rei->status < 0) {
01063 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01064 "msiDataObjCopy: input inpParam2 error. status = %d", rei->status);
01065 return (rei->status);
01066 }
01067
01068 #if 0
01069 rei->status = parseMspForCondInp (inpParam3,
01070 &myDataObjCopyInp->destDataObjInp.condInput, DEST_RESC_NAME_KW);
01071 #else
01072 validKwFlags = OBJ_PATH_FLAG | DEST_RESC_NAME_FLAG | FILE_PATH_FLAG |
01073 DATA_TYPE_FLAG | VERIFY_CHKSUM_FLAG |
01074 FORCE_FLAG_FLAG | NUM_THREADS_FLAG;
01075 rei->status = parseMsKeyValStrForDataObjInp( msKeyValStr, &myDataObjCopyInp->destDataObjInp,
01076 DEST_RESC_NAME_KW, validKwFlags, &outBadKeyWd);
01077
01078 #endif
01079
01080 if (rei->status < 0) {
01081 if (outBadKeyWd != NULL) {
01082 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01083 "msiDataObjCopy: input keyWd - %s error. status = %d",
01084 outBadKeyWd, rei->status);
01085 free (outBadKeyWd);
01086 } else {
01087 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01088 "msiDataObjCopy: input msKeyValStr error. status = %d",
01089 rei->status);
01090 }
01091 return (rei->status);
01092 }
01093
01094 if (rei->status < 0) {
01095 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01096 "msiDataObjCopy: input inpParam2 error. status = %d", rei->status);
01097 return (rei->status);
01098 }
01099
01100 rei->status = rsDataObjCopy (rsComm, myDataObjCopyInp, &transStat);
01101 if (transStat != NULL) {
01102 free (transStat);
01103 }
01104
01105 if (myDataObjCopyInp == &dataObjCopyInp) {
01106 clearKeyVal (&myDataObjCopyInp->destDataObjInp.condInput);
01107 }
01108
01109 if (rei->status >= 0) {
01110 fillIntInMsParam (outParam, rei->status);
01111 } else {
01112 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01113 "msiDataObjCopy: rsDataObjCopy failed for %s, status = %d",
01114 myDataObjCopyInp->srcDataObjInp.objPath,
01115 rei->status);
01116 }
01117
01118 return (rei->status);
01119 }
01120
01121
01122
01123
01124
01125
01126
01127
01128
01129
01130
01131
01132
01133
01134
01135
01136
01137
01138
01139
01140
01141
01142
01143
01144
01145
01146
01147
01148
01149
01150
01151
01152
01153
01154
01155
01156
01157
01158
01159
01160
01161
01162
01163
01164
01165
01166
01167
01168
01169
01170
01171
01172
01173
01174
01175
01176
01177
01178
01179
01180
01181 int
01182 msiDataObjPut (msParam_t *inpParam1, msParam_t *inpParam2,
01183 msParam_t *msKeyValStr, msParam_t *outParam, ruleExecInfo_t *rei)
01184 {
01185 rsComm_t *rsComm;
01186 dataObjInp_t *dataObjInp, *myDataObjInp;
01187 msParamArray_t *myMsParamArray;
01188 char *outBadKeyWd;
01189 int validKwFlags;
01190
01191 RE_TEST_MACRO (" Calling msiDataObjPut")
01192
01193 if (rei == NULL || rei->rsComm == NULL) {
01194 rodsLog (LOG_ERROR,
01195 "msiDataObjPut: input rei or rsComm is NULL");
01196 return (SYS_INTERNAL_NULL_INPUT_ERR);
01197 }
01198
01199 rsComm = rei->rsComm;
01200
01201 dataObjInp = (dataObjInp_t*)malloc (sizeof (dataObjInp_t));
01202
01203 rei->status = parseMspForDataObjInp (inpParam1, dataObjInp,
01204 &myDataObjInp, 1);
01205
01206 if (rei->status < 0) {
01207 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01208 "msiDataObjPut: input inpParam1 error. status = %d", rei->status);
01209 return (rei->status);
01210 }
01211
01212 rei->status = parseMspForCondInp (inpParam2, &dataObjInp->condInput,
01213 DEST_RESC_NAME_KW);
01214
01215 if (rei->status < 0) {
01216 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01217 "msiDataObjPut: input inpParam2 error. status = %d", rei->status);
01218 return (rei->status);
01219 }
01220
01221 #if 0
01222 rei->status = parseMspForCondInp (inpParam3, &dataObjInp->condInput,
01223 LOCAL_PATH_KW);
01224 #else
01225 validKwFlags = LOCAL_PATH_FLAG | DEST_RESC_NAME_FLAG | FILE_PATH_FLAG |
01226 REPL_NUM_FLAG | DATA_TYPE_FLAG | VERIFY_CHKSUM_FLAG |
01227 ALL_FLAG | FORCE_FLAG_FLAG | NUM_THREADS_FLAG | OBJ_PATH_FLAG;
01228 rei->status = parseMsKeyValStrForDataObjInp (msKeyValStr, dataObjInp,
01229 LOCAL_PATH_KW, validKwFlags, &outBadKeyWd);
01230 #endif
01231
01232 if (rei->status < 0) {
01233 if (outBadKeyWd != NULL) {
01234 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01235 "msiDataObjPut: input keyWd - %s error. status = %d",
01236 outBadKeyWd, rei->status);
01237 free (outBadKeyWd);
01238 } else {
01239 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01240 "msiDataObjPut: input msKeyValStr error. status = %d",
01241 rei->status);
01242 }
01243 return (rei->status);
01244 }
01245
01246 myMsParamArray = (msParamArray_t*)malloc (sizeof (msParamArray_t));
01247 memset (myMsParamArray, 0, sizeof (msParamArray_t));
01248
01249 rei->status = addMsParam (myMsParamArray, CL_PUT_ACTION, DataObjInp_MS_T,
01250 (void *) dataObjInp, NULL);
01251
01252 if (rei->status < 0) {
01253 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01254 "msiDataObjPut: addMsParam error. status = %d", rei->status);
01255 return (rei->status);
01256 }
01257
01258
01259 rei->status = sendAndRecvBranchMsg (rsComm, rsComm->apiInx,
01260 SYS_SVR_TO_CLI_MSI_REQUEST, (void *) myMsParamArray, NULL);
01261
01262 if (rei->status >= 0) {
01263 fillIntInMsParam (outParam, rei->status);
01264 } else {
01265 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01266 "msiDataObjPut: rsDataObjPut failed for %s, status = %d",
01267 dataObjInp->objPath,
01268 rei->status);
01269 }
01270
01271 return (rei->status);
01272 }
01273
01274
01275
01276
01277
01278
01279
01280
01281
01282
01283
01284
01285
01286
01287
01288
01289
01290
01291
01292
01293
01294
01295
01296
01297
01298
01299
01300
01301
01302
01303
01304
01305
01306
01307
01308
01309
01310
01311
01312
01313
01314
01315
01316
01317
01318
01319
01320
01321
01322
01323
01324
01325
01326
01327
01328
01329 int
01330 msiDataObjGet (msParam_t *inpParam1, msParam_t *msKeyValStr,
01331 msParam_t *outParam, ruleExecInfo_t *rei)
01332 {
01333 rsComm_t *rsComm;
01334 dataObjInp_t *dataObjInp, *myDataObjInp;
01335 msParamArray_t *myMsParamArray;
01336 char *outBadKeyWd;
01337 int validKwFlags;
01338
01339 RE_TEST_MACRO (" Calling msiDataObjGet")
01340
01341 if (rei == NULL || rei->rsComm == NULL) {
01342 rodsLog (LOG_ERROR,
01343 "msiDataObjGet: input rei or rsComm is NULL");
01344 return (SYS_INTERNAL_NULL_INPUT_ERR);
01345 }
01346
01347 rsComm = rei->rsComm;
01348
01349 dataObjInp = (dataObjInp_t*)malloc (sizeof (dataObjInp_t));
01350
01351 rei->status = parseMspForDataObjInp (inpParam1, dataObjInp,
01352 &myDataObjInp, 1);
01353
01354 if (rei->status < 0) {
01355 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01356 "msiDataObjGet: input inpParam1 error. status = %d",
01357 rei->status);
01358 return (rei->status);
01359 }
01360
01361 #if 0
01362 rei->status = parseMspForCondInp (inpParam2, &dataObjInp->condInput,
01363 LOCAL_PATH_KW);
01364 #else
01365 validKwFlags = LOCAL_PATH_FLAG | FORCE_FLAG_FLAG | NUM_THREADS_FLAG |
01366 RESC_NAME_FLAG | REPL_NUM_FLAG | VERIFY_CHKSUM_FLAG | OBJ_PATH_FLAG;
01367 rei->status = parseMsKeyValStrForDataObjInp (msKeyValStr, dataObjInp,
01368 LOCAL_PATH_KW, validKwFlags, &outBadKeyWd);
01369 #endif
01370
01371 if (rei->status < 0) {
01372 if (outBadKeyWd != NULL) {
01373 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01374 "msiDataObjGet: input keyWd - %s error. status = %d",
01375 outBadKeyWd, rei->status);
01376 free (outBadKeyWd);
01377 } else {
01378 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01379 "msiDataObjGet: input msKeyValStr error. status = %d",
01380 rei->status);
01381 }
01382 return (rei->status);
01383 }
01384
01385 myMsParamArray = (msParamArray_t*)malloc (sizeof (msParamArray_t));
01386 memset (myMsParamArray, 0, sizeof (msParamArray_t));
01387
01388 rei->status = addMsParam (myMsParamArray, CL_GET_ACTION, DataObjInp_MS_T,
01389 (void *) dataObjInp, NULL);
01390
01391 if (rei->status < 0) {
01392 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01393 "msiDataObjGet: addMsParam error. status = %d",
01394 rei->status);
01395 return (rei->status);
01396 }
01397
01398
01399 rei->status = sendAndRecvBranchMsg (rsComm, rsComm->apiInx,
01400 SYS_SVR_TO_CLI_MSI_REQUEST, (void *) myMsParamArray, NULL);
01401
01402 if (rei->status >= 0) {
01403 fillIntInMsParam (outParam, rei->status);
01404 } else {
01405 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01406 "msiDataObjGet: rsDataObjGet failed for %s, status = %d",
01407 dataObjInp->objPath, rei->status);
01408 }
01409
01410 return (rei->status);
01411 }
01412
01413
01414
01415
01416
01417
01418
01419
01420
01421
01422
01423
01424
01425
01426
01427
01428
01429
01430
01431
01432
01433
01434
01435
01436
01437
01438
01439
01440
01441
01442
01443
01444
01445
01446
01447
01448
01449
01450
01451
01452
01453
01454
01455
01456
01457 int
01458 msiDataObjGetWithOptions (msParam_t *inpParam1, msParam_t *inpParam2,
01459 msParam_t *srcrescParam, msParam_t *outParam, ruleExecInfo_t *rei)
01460 {
01461 rsComm_t *rsComm;
01462 dataObjInp_t *dataObjInp, *myDataObjInp;
01463 msParamArray_t *myMsParamArray;
01464
01465 RE_TEST_MACRO (" Calling msiDataObjGetWithOptions")
01466
01467 if (rei == NULL || rei->rsComm == NULL) {
01468 rodsLog (LOG_ERROR,
01469 "msiDataObjGetWithOptions: input rei or rsComm is NULL");
01470 return (SYS_INTERNAL_NULL_INPUT_ERR);
01471 }
01472
01473 rsComm = rei->rsComm;
01474
01475 dataObjInp = (dataObjInp_t*)malloc (sizeof (dataObjInp_t));
01476
01477 rei->status = parseMspForDataObjInp (inpParam1, dataObjInp,
01478 &myDataObjInp, 1);
01479
01480 if (rei->status < 0) {
01481 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01482 "msiDataObjGetWithOptions: input inpParam1 error. status = %d",
01483 rei->status);
01484 return (rei->status);
01485 }
01486
01487 rei->status = parseMspForCondInp (inpParam2, &dataObjInp->condInput,
01488 LOCAL_PATH_KW);
01489
01490 if (rei->status < 0) {
01491 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01492 "msiDataObjGetWithOptions: input inpParam2 error. status = %d",
01493 rei->status);
01494 return (rei->status);
01495 }
01496
01497 rei->status = parseMspForCondInp (srcrescParam, &dataObjInp->condInput,
01498 RESC_NAME_KW);
01499
01500 if (rei->status < 0) {
01501 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01502 "msiDataObjGetWithOptions: input srcrescParam error. status = %d",
01503 rei->status);
01504 return (rei->status);
01505 }
01506
01507 myMsParamArray = (msParamArray_t*)malloc (sizeof (msParamArray_t));
01508 memset (myMsParamArray, 0, sizeof (msParamArray_t));
01509
01510 rei->status = addMsParam (myMsParamArray, CL_GET_ACTION, DataObjInp_MS_T,
01511 (void *) dataObjInp, NULL);
01512
01513 if (rei->status < 0) {
01514 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01515 "msiDataObjGetWithOptions: addMsParam error. status = %d",
01516 rei->status);
01517 return (rei->status);
01518 }
01519
01520
01521 rei->status = sendAndRecvBranchMsg (rsComm, rsComm->apiInx,
01522 SYS_SVR_TO_CLI_MSI_REQUEST, (void *) myMsParamArray, NULL);
01523
01524 if (rei->status >= 0) {
01525 fillIntInMsParam (outParam, rei->status);
01526 } else {
01527 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01528 "msiDataObjGetWithOptions: rsDataObjGet failed, status = %d",
01529 rei->status);
01530 }
01531
01532 return (rei->status);
01533 }
01534
01535
01536
01537
01538
01539
01540
01541
01542
01543
01544
01545
01546
01547
01548
01549
01550
01551
01552
01553
01554
01555
01556
01557
01558
01559
01560
01561
01562
01563
01564
01565
01566
01567
01568
01569
01570
01571
01572
01573
01574
01575
01576
01577
01578
01579 int
01580 msiDataObjChksum (msParam_t *inpParam1, msParam_t *msKeyValStr,
01581 msParam_t *outParam, ruleExecInfo_t *rei)
01582 {
01583 rsComm_t *rsComm;
01584 dataObjInp_t dataObjInp, *myDataObjInp;
01585 char *chksum = NULL;
01586 char *outBadKeyWd;
01587 int validKwFlags;
01588
01589 RE_TEST_MACRO (" Calling msiDataObjChksum")
01590
01591 if (rei == NULL || rei->rsComm == NULL) {
01592 rodsLog (LOG_ERROR,
01593 "msiDataObjChksum: input rei or rsComm is NULL");
01594 return (SYS_INTERNAL_NULL_INPUT_ERR);
01595 }
01596
01597 rsComm = rei->rsComm;
01598
01599
01600 rei->status = parseMspForDataObjInp (inpParam1, &dataObjInp,
01601 &myDataObjInp, 1);
01602
01603 if (rei->status < 0) {
01604 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01605 "msiDataObjChksum: input inpParam1 error. status = %d", rei->status);
01606 return (rei->status);
01607 }
01608
01609 #if 0
01610 if ((rei->status = parseMspForCondKw (inpParam2, &myDataObjInp->condInput))
01611 < 0) {
01612 #else
01613 validKwFlags = CHKSUM_ALL_FLAG | FORCE_CHKSUM_FLAG | REPL_NUM_FLAG |
01614 OBJ_PATH_FLAG | VERIFY_CHKSUM_FLAG;
01615 if ((rei->status = parseMsKeyValStrForDataObjInp (msKeyValStr,
01616 myDataObjInp, KEY_WORD_KW, validKwFlags, &outBadKeyWd)) < 0) {
01617 #endif
01618 if (outBadKeyWd != NULL) {
01619 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01620 "msiDataObjChksum: input keyWd - %s error. status = %d",
01621 outBadKeyWd, rei->status);
01622 free (outBadKeyWd);
01623 } else {
01624 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01625 "msiDataObjChksum: input msKeyValStr error. status = %d",
01626 rei->status);
01627 }
01628 return (rei->status);
01629 }
01630
01631 rei->status = rsDataObjChksum (rsComm, myDataObjInp, &chksum);
01632
01633 if (myDataObjInp == &dataObjInp) {
01634 clearKeyVal (&myDataObjInp->condInput);
01635 }
01636
01637 if (rei->status >= 0) {
01638 fillStrInMsParam (outParam, chksum);
01639 free (chksum);
01640 } else {
01641 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01642 "msiDataObjChksum: rsDataObjChksum failed for %s, status = %d",
01643 myDataObjInp->objPath ,
01644 rei->status);
01645 }
01646
01647 return (rei->status);
01648 }
01649
01650
01651
01652
01653
01654
01655
01656
01657
01658
01659
01660
01661
01662
01663
01664
01665
01666
01667
01668
01669
01670
01671
01672
01673
01674
01675
01676
01677
01678
01679
01680
01681
01682
01683
01684
01685
01686
01687
01688
01689 int
01690 msiDataObjPhymv (msParam_t *inpParam1, msParam_t *inpParam2,
01691 msParam_t *inpParam3, msParam_t *inpParam4, msParam_t *inpParam5,
01692 msParam_t *outParam, ruleExecInfo_t *rei)
01693 {
01694 rsComm_t *rsComm;
01695 dataObjInp_t dataObjInp, *myDataObjInp;
01696 transferStat_t *transStat = NULL;
01697
01698 RE_TEST_MACRO (" Calling msiDataObjPhymv")
01699
01700 if (rei == NULL || rei->rsComm == NULL) {
01701 rodsLog (LOG_ERROR,
01702 "msiDataObjPhymv: input rei or rsComm is NULL");
01703 return (SYS_INTERNAL_NULL_INPUT_ERR);
01704 }
01705
01706 rsComm = rei->rsComm;
01707
01708
01709
01710 if ((rei->status = parseMspForDataObjInp (inpParam1, &dataObjInp,
01711 &myDataObjInp, 0)) < 0) {
01712 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01713 "msiDataObjPhymv: input inpParam1 error. status = %d", rei->status);
01714 return (rei->status);
01715 }
01716
01717 if ((rei->status = parseMspForCondInp (inpParam2, &myDataObjInp->condInput,
01718 DEST_RESC_NAME_KW)) < 0) {
01719 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01720 "msiDataObjPhymv: input inpParam2 error. status = %d", rei->status);
01721 return (rei->status);
01722 }
01723
01724 if ((rei->status = parseMspForCondInp (inpParam3, &myDataObjInp->condInput,
01725 RESC_NAME_KW)) < 0) {
01726 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01727 "msiDataObjPhymv: input inpParam3 error. status = %d", rei->status);
01728 return (rei->status);
01729 }
01730
01731 if ((rei->status = parseMspForCondInp (inpParam4, &myDataObjInp->condInput,
01732 REPL_NUM_KW)) < 0) {
01733 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01734 "msiDataObjPhymv: input inpParam4 error. status = %d", rei->status);
01735 return (rei->status);
01736 }
01737
01738 if ((rei->status = parseMspForCondInp (inpParam5, &myDataObjInp->condInput,
01739 IRODS_ADMIN_KW)) < 0) {
01740 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01741 "msiDataObjPhymv: input inpParam5 error. status = %d", rei->status);
01742 return (rei->status);
01743 }
01744
01745 rei->status = rsDataObjPhymv (rsComm, myDataObjInp, &transStat);
01746
01747 if (transStat != NULL) {
01748 free (transStat);
01749 }
01750
01751 if (myDataObjInp == &dataObjInp) {
01752 clearKeyVal (&myDataObjInp->condInput);
01753 }
01754
01755 if (rei->status >= 0) {
01756 fillIntInMsParam (outParam, rei->status);
01757 } else {
01758 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01759 "msiDataObjPhymv: rsDataObjPhymv failed for %s, status = %d",
01760 myDataObjInp->objPath,
01761 rei->status);
01762 }
01763
01764 return (rei->status);
01765 }
01766
01767
01768
01769
01770
01771
01772
01773
01774
01775
01776
01777
01778
01779
01780
01781
01782
01783
01784
01785
01786
01787
01788
01789
01790
01791
01792
01793
01794
01795
01796
01797
01798
01799
01800
01801
01802
01803
01804
01805 int
01806 msiDataObjRename (msParam_t *inpParam1, msParam_t *inpParam2,
01807 msParam_t *inpParam3, msParam_t *outParam, ruleExecInfo_t *rei)
01808 {
01809 rsComm_t *rsComm;
01810 dataObjCopyInp_t dataObjRenameInp, *myDataObjRenameInp;
01811 dataObjInp_t *myDataObjInp;
01812
01813 RE_TEST_MACRO (" Calling msiDataObjRename")
01814
01815 if (rei == NULL || rei->rsComm == NULL) {
01816 rodsLog (LOG_ERROR,
01817 "msiDataObjRename: input rei or rsComm is NULL");
01818 return (SYS_INTERNAL_NULL_INPUT_ERR);
01819 }
01820
01821 rsComm = rei->rsComm;
01822
01823
01824 rei->status = parseMspForDataObjCopyInp (inpParam1, &dataObjRenameInp,
01825 &myDataObjRenameInp);
01826
01827 if (rei->status < 0) {
01828 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01829 "msiDataObjRename: input inpParam1 error. status = %d", rei->status);
01830 return (rei->status);
01831 }
01832
01833
01834 rei->status = parseMspForDataObjInp (inpParam2,
01835 &myDataObjRenameInp->destDataObjInp, &myDataObjInp, 1);
01836
01837 if (rei->status < 0) {
01838 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01839 "msiDataObjRename: input inpParam2 error. status = %d", rei->status);
01840 return (rei->status);
01841 }
01842
01843 if (inpParam3 != NULL) {
01844 int myInt;
01845 myInt = parseMspForPosInt (inpParam3);
01846 if (myInt > 0) {
01847 myDataObjRenameInp->srcDataObjInp.oprType = RENAME_COLL;
01848 } else {
01849 myDataObjRenameInp->srcDataObjInp.oprType = RENAME_DATA_OBJ;
01850 }
01851 }
01852
01853 rei->status = rsDataObjRename (rsComm, myDataObjRenameInp);
01854
01855 if (rei->status >= 0) {
01856 fillIntInMsParam (outParam, rei->status);
01857 } else {
01858 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01859 "msiDataObjRename: rsDataObjRename failed for %s, status = %d",
01860 myDataObjRenameInp->srcDataObjInp.objPath,
01861 rei->status);
01862 }
01863
01864 return (rei->status);
01865 }
01866
01867
01868
01869
01870
01871
01872
01873
01874
01875
01876
01877
01878
01879
01880
01881
01882
01883
01884
01885
01886
01887
01888
01889
01890
01891
01892
01893
01894
01895
01896
01897
01898
01899
01900
01901
01902
01903
01904
01905
01906 int
01907 msiDataObjTrim (msParam_t *inpParam1, msParam_t *inpParam2,
01908 msParam_t *inpParam3, msParam_t *inpParam4, msParam_t *inpParam5,
01909 msParam_t *outParam, ruleExecInfo_t *rei)
01910 {
01911 rsComm_t *rsComm;
01912 dataObjInp_t dataObjInp, *myDataObjInp;
01913
01914 RE_TEST_MACRO (" Calling msiDataObjTrim")
01915
01916 if (rei == NULL || rei->rsComm == NULL) {
01917 rodsLog (LOG_ERROR,
01918 "msiDataObjTrim: input rei or rsComm is NULL");
01919 return (SYS_INTERNAL_NULL_INPUT_ERR);
01920 }
01921
01922 rsComm = rei->rsComm;
01923
01924
01925
01926 if ((rei->status = parseMspForDataObjInp (inpParam1, &dataObjInp,
01927 &myDataObjInp, 0)) < 0) {
01928 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01929 "msiDataObjTrim: input inpParam1 error. status = %d", rei->status);
01930 return (rei->status);
01931 }
01932
01933 if ((rei->status = parseMspForCondInp (inpParam2, &myDataObjInp->condInput, RESC_NAME_KW)) < 0) {
01934 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01935 "msiDataObjTrim: input inpParam2 error. status = %d", rei->status);
01936 return (rei->status);
01937 }
01938
01939 if ((rei->status = parseMspForCondInp (inpParam3, &myDataObjInp->condInput,
01940 REPL_NUM_KW)) < 0) {
01941 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01942 "msiDataObjTrim: input inpParam3 error. status = %d", rei->status);
01943 return (rei->status);
01944 }
01945
01946 if ((rei->status = parseMspForCondInp (inpParam4, &myDataObjInp->condInput,
01947 COPIES_KW)) < 0) {
01948 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01949 "msiDataObjTrim: input inpParam4 error. status = %d", rei->status);
01950 return (rei->status);
01951 }
01952
01953 if ((rei->status = parseMspForCondInp (inpParam5, &myDataObjInp->condInput,
01954 IRODS_ADMIN_KW)) < 0) {
01955 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01956 "msiDataObjTrim: input inpParam5 error. status = %d", rei->status);
01957 return (rei->status);
01958 }
01959
01960 rei->status = rsDataObjTrim (rsComm, myDataObjInp);
01961
01962 if (myDataObjInp == &dataObjInp) {
01963 clearKeyVal (&myDataObjInp->condInput);
01964 }
01965
01966 if (rei->status >= 0) {
01967 fillIntInMsParam (outParam, rei->status);
01968 } else {
01969 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
01970 "msiDataObjTrim: rsDataObjTrim failed for %s, status = %d",
01971 myDataObjInp->objPath,
01972 rei->status);
01973 }
01974
01975 return (rei->status);
01976 }
01977
01978
01979
01980
01981
01982
01983
01984
01985
01986
01987
01988
01989
01990
01991
01992
01993
01994
01995
01996
01997
01998
01999
02000
02001
02002
02003
02004
02005
02006
02007
02008
02009
02010
02011
02012
02013
02014 int
02015 msiCollCreate (msParam_t *inpParam1, msParam_t *inpParam2, msParam_t *outParam, ruleExecInfo_t *rei)
02016 {
02017 rsComm_t *rsComm;
02018 collInp_t collCreateInp, *myCollCreateInp;
02019 int flags;
02020
02021 RE_TEST_MACRO (" Calling msiCollCreate")
02022
02023 if (rei == NULL || rei->rsComm == NULL) {
02024 rodsLog (LOG_ERROR,
02025 "msiCollCreate: input rei or rsComm is NULL");
02026 return (SYS_INTERNAL_NULL_INPUT_ERR);
02027 }
02028
02029 rsComm = rei->rsComm;
02030
02031
02032 rei->status = parseMspForCollInp (inpParam1, &collCreateInp,
02033 &myCollCreateInp, 1);
02034
02035 if (rei->status < 0) {
02036 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02037 "msiCollCreate: input inpParam1 error. status = %d", rei->status);
02038 return (rei->status);
02039 }
02040
02041 flags = parseMspForPosInt (inpParam2);
02042
02043 if (flags > 0)
02044 addKeyVal (&collCreateInp.condInput, RECURSIVE_OPR__KW, "");
02045 rei->status = rsCollCreate (rsComm, myCollCreateInp);
02046
02047 if (rei->status >= 0) {
02048 fillIntInMsParam (outParam, rei->status);
02049 } else {
02050 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02051 "msiCollCreate: rsCollCreate failed %s, status = %d",
02052 collCreateInp.collName,
02053 rei->status);
02054 }
02055
02056 if (myCollCreateInp == &collCreateInp) {
02057 clearKeyVal (&myCollCreateInp->condInput);
02058 }
02059
02060 return (rei->status);
02061 }
02062
02063
02064
02065
02066
02067
02068
02069
02070
02071
02072
02073
02074
02075
02076
02077
02078
02079
02080
02081
02082
02083
02084
02085
02086
02087
02088
02089
02090
02091
02092
02093
02094
02095
02096
02097
02098
02099
02100
02101
02102
02103
02104
02105
02106
02107
02108 int
02109 msiRmColl (msParam_t *inpParam1, msParam_t *msKeyValStr, msParam_t *outParam, ruleExecInfo_t *rei)
02110 {
02111 rsComm_t *rsComm;
02112 collInp_t rmCollInp, *myRmCollInp;
02113 char *outBadKeyWd;
02114 int validKwFlags;
02115
02116 RE_TEST_MACRO (" Calling msiRmColl")
02117
02118 if (rei == NULL || rei->rsComm == NULL) {
02119 rodsLog (LOG_ERROR,
02120 "msiRmColl: input rei or rsComm is NULL");
02121 return (SYS_INTERNAL_NULL_INPUT_ERR);
02122 }
02123
02124 rsComm = rei->rsComm;
02125
02126
02127 rei->status = parseMspForCollInp (inpParam1, &rmCollInp,
02128 &myRmCollInp, 1);
02129
02130 if (rei->status < 0) {
02131 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02132 "msiRmColl: input inpParam1 error. status = %d", rei->status);
02133 return (rei->status);
02134 }
02135
02136 #if 0
02137 if ((rei->status = parseMspForCondKw (inpParam2, &myRmCollInp->condInput))
02138 < 0) {
02139 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02140 "msiRmColl: input inpParam2 error. status = %d", rei->status);
02141 return (rei->status);
02142 }
02143 #else
02144 validKwFlags = IRODS_RMTRASH_FLAG | IRODS_ADMIN_RMTRASH_FLAG |
02145 FORCE_FLAG_FLAG | COLL_NAME_FLAG;
02146 if ((rei->status = parseMsKeyValStrForCollInp (msKeyValStr,
02147 myRmCollInp, KEY_WORD_KW, validKwFlags, &outBadKeyWd)) < 0) {
02148 if (outBadKeyWd != NULL) {
02149 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02150 "msiRmColl: input keyWd - %s error. status = %d",
02151 outBadKeyWd, rei->status);
02152 free (outBadKeyWd);
02153 } else {
02154 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02155 "msiRmColl: input msKeyValStr error. status = %d",
02156 rei->status);
02157 }
02158 return (rei->status);
02159 }
02160 #endif
02161
02162 addKeyVal (&myRmCollInp->condInput, RECURSIVE_OPR__KW, "");
02163
02164 rei->status = rsRmColl (rsComm, myRmCollInp, NULL);
02165
02166 if (rei->status >= 0) {
02167 fillIntInMsParam (outParam, rei->status);
02168 } else {
02169 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02170 "msiRmColl: rsRmColl failed for %s, status = %d",
02171 myRmCollInp->collName,
02172 rei->status);
02173 }
02174
02175 if (myRmCollInp == &rmCollInp) {
02176 clearKeyVal (&myRmCollInp->condInput);
02177 }
02178
02179 return (rei->status);
02180 }
02181
02182
02183
02184
02185
02186
02187
02188
02189
02190
02191
02192
02193
02194
02195
02196
02197
02198
02199
02200
02201
02202
02203
02204
02205
02206
02207
02208
02209
02210
02211
02212
02213
02214
02215
02216
02217
02218
02219
02220
02221
02222
02223
02224
02225
02226
02227
02228
02229
02230
02231 int
02232 msiReplColl (msParam_t *coll, msParam_t *destRescName, msParam_t *options,
02233 msParam_t *outParam, ruleExecInfo_t *rei)
02234 {
02235 rsComm_t *rsComm;
02236 collInp_t collInp, *myCollInp;
02237 int i, continueInx, status;
02238 transferStat_t *transStat = NULL;
02239 strArray_t optArray;
02240 genQueryInp_t genQueryInp;
02241 genQueryOut_t *genQueryOut = NULL;
02242 dataObjInp_t dataObjInp;
02243
02244 RE_TEST_MACRO (" Calling msiReplColl")
02245
02246 if (rei == NULL || rei->rsComm == NULL) {
02247 rodsLog (LOG_ERROR,
02248 "msiReplColl: input rei or rsComm is NULL");
02249 return (SYS_INTERNAL_NULL_INPUT_ERR);
02250 }
02251
02252 rsComm = rei->rsComm;
02253
02254
02255 rei->status = parseMspForCollInp (coll, &collInp,
02256 &myCollInp, 0);
02257 if (rei->status < 0) {
02258 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02259 "msiReplColl: input inpParam1 error. status = %d", rei->status);
02260 return (rei->status);
02261 }
02262
02263
02264
02265 memset (&dataObjInp, 0, sizeof (dataObjInp_t));
02266 rei->status = parseMspForCondInp (destRescName,
02267 &(&dataObjInp)->condInput, DEST_RESC_NAME_KW);
02268 if (rei->status < 0) {
02269 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02270 "msiReplColl: input inpParam2 error. status = %d", rei->status);
02271 return (rei->status);
02272 }
02273
02274
02275
02276 if ( (strlen((char*)options->inOutStruct)>0) &&
02277 (0!=strcmp((char*)options->inOutStruct,"null")) )
02278 {
02279 memset (&optArray, 0, sizeof (optArray));
02280 status = parseMultiStr ((char *)options->inOutStruct, &optArray);
02281 if (status <= 0)
02282 {
02283 rodsLog (LOG_ERROR,
02284 "msiReplColl: Could not parse options string '%s'",
02285 options->inOutStruct);
02286 }
02287 for(i=0; i<optArray.len; i++)
02288 {
02289 char *option;
02290 option= &optArray.value[i*optArray.size];
02291 if ( strcmp(option,ALL_KW) &&
02292 strcmp(option,IRODS_ADMIN_KW) &&
02293 strcmp(option,"backupMode")
02294 )
02295 {
02296 rodsLog (LOG_ERROR,"msiReplColl: invalid option: '%s'",option);
02297 continue;
02298 }
02299 if (strcmp(option,"backupMode")==0)
02300 addKeyVal (&(dataObjInp.condInput), BACKUP_RESC_NAME_KW,
02301 (char *)destRescName->inOutStruct);
02302 else
02303 addKeyVal (&(dataObjInp.condInput), option, "");
02304 }
02305 }
02306
02307
02308 memset (&genQueryInp, 0, sizeof (genQueryInp));
02309 status = rsQueryDataObjInCollReCur (rsComm, myCollInp->collName,
02310 &genQueryInp, &genQueryOut, NULL, 1);
02311 if (status < 0 && status != CAT_NO_ROWS_FOUND) {
02312 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02313 "msiReplColl: msiReplColl error for %s, stat=%d",
02314 myCollInp->collName, status);
02315 rei->status=status;
02316 return (rei->status);
02317 }
02318 while (rei->status >= 0) {
02319 sqlResult_t *subColl, *dataObj;
02320
02321 if ((subColl = getSqlResultByInx (genQueryOut, COL_COLL_NAME))
02322 == NULL) {
02323 rodsLog (LOG_ERROR,
02324 "msiReplColl: msiReplColl for COL_COLL_NAME failed");
02325 rei->status=UNMATCHED_KEY_OR_INDEX;
02326 return (rei->status);
02327 }
02328
02329 if ((dataObj = getSqlResultByInx (genQueryOut, COL_DATA_NAME))
02330 == NULL) {
02331 rodsLog (LOG_ERROR,
02332 "msiReplColl: msiReplColl for COL_DATA_NAME failed");
02333 rei->status=UNMATCHED_KEY_OR_INDEX;
02334 return (rei->status);
02335 }
02336
02337 for (i = 0; i < genQueryOut->rowCnt; i++) {
02338 char *tmpSubColl, *tmpDataName;
02339
02340 tmpSubColl = &subColl->value[subColl->len * i];
02341 tmpDataName = &dataObj->value[dataObj->len * i];
02342 snprintf (dataObjInp.objPath, MAX_NAME_LEN, "%s/%s",tmpSubColl, tmpDataName);
02343
02344
02345
02346
02347 rmKeyVal( &dataObjInp.condInput, RESC_HIER_STR_KW );
02348 rmKeyVal( &dataObjInp.condInput, DEST_RESC_HIER_STR_KW );
02349
02350 rei->status = rsDataObjRepl (rsComm, &dataObjInp, &transStat);
02351 if (rei->status<0)
02352 {
02353 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02354 "msiReplColl: rsDataObjRepl failed %s, status = %d",
02355 (&dataObjInp)->objPath,
02356 rei->status);
02357 }
02358 if (transStat != NULL) {
02359 free (transStat);
02360 }
02361 }
02362
02363 continueInx = genQueryOut->continueInx;
02364 freeGenQueryOut (&genQueryOut);
02365 if (continueInx > 0) {
02366
02367 genQueryInp.continueInx = continueInx;
02368 rei->status = rsGenQuery (rsComm, &genQueryInp, &genQueryOut);
02369 } else {
02370 break;
02371 }
02372 }
02373
02374 clearKeyVal (&dataObjInp.condInput);
02375
02376 if (rei->status >= 0) {
02377 fillIntInMsParam (outParam, rei->status);
02378 } else {
02379 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02380 "dataObjInp: msiReplColl failed (should have catched earlier) %s, status = %d",
02381 (&dataObjInp)->objPath,
02382 rei->status);
02383 }
02384 return (rei->status);
02385 }
02386
02387
02388
02389
02390
02391
02392
02393
02394
02395
02396
02397
02398
02399
02400
02401
02402
02403
02404
02405
02406
02407
02408
02409
02410
02411
02412
02413
02414
02415
02416
02417
02418
02419
02420
02421
02422
02423
02424
02425
02426
02427
02428
02429
02430
02431 int
02432 msiPhyPathReg (msParam_t *inpParam1, msParam_t *inpParam2,
02433 msParam_t *inpParam3, msParam_t *inpParam4, msParam_t *outParam,
02434 ruleExecInfo_t *rei)
02435 {
02436 rsComm_t *rsComm;
02437 dataObjInp_t dataObjInp, *myDataObjInp;
02438
02439 RE_TEST_MACRO (" Calling msiPhyPathReg")
02440
02441 if (rei == NULL || rei->rsComm == NULL) {
02442 rodsLog (LOG_ERROR,
02443 "msiPhyPathReg: input rei or rsComm is NULL");
02444 return (SYS_INTERNAL_NULL_INPUT_ERR);
02445 }
02446
02447 rsComm = rei->rsComm;
02448
02449
02450 rei->status = parseMspForDataObjInp (inpParam1, &dataObjInp,
02451 &myDataObjInp, 1);
02452
02453 if (rei->status < 0) {
02454 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02455 "msiPhyPathReg: input inpParam1 error. status = %d", rei->status);
02456 return (rei->status);
02457 }
02458
02459 if ((rei->status = parseMspForCondInp (inpParam2, &myDataObjInp->condInput,
02460 DEST_RESC_NAME_KW)) < 0) {
02461 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02462 "msiDataObjPhymv: input inpParam2 error. status = %d", rei->status);
02463 return (rei->status);
02464 }
02465
02466 if ((rei->status = parseMspForCondInp (inpParam3, &myDataObjInp->condInput,
02467 FILE_PATH_KW)) < 0) {
02468 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02469 "msiDataObjPhymv: input inpParam3 error. status = %d", rei->status);
02470 return (rei->status);
02471 }
02472
02473 if ((rei->status = parseMspForPhyPathReg (inpParam4,
02474 &myDataObjInp->condInput)) < 0) {
02475 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02476 "msiPhyPathReg: input inpParam4 error. status = %d", rei->status);
02477 return (rei->status);
02478 }
02479
02480 rei->status = rsPhyPathReg (rsComm, myDataObjInp);
02481
02482 if (myDataObjInp == &dataObjInp) {
02483 clearKeyVal (&myDataObjInp->condInput);
02484 }
02485
02486 if (rei->status >= 0) {
02487 fillIntInMsParam (outParam, rei->status);
02488 } else {
02489 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02490 "msiPhyPathReg: rsPhyPathReg failed for %s, status = %d",
02491 myDataObjInp->objPath,
02492 rei->status);
02493 }
02494
02495 return (rei->status);
02496 }
02497
02498
02499
02500
02501
02502
02503
02504
02505
02506
02507
02508
02509
02510
02511
02512
02513
02514
02515
02516
02517
02518
02519
02520
02521
02522
02523
02524
02525
02526
02527
02528
02529
02530
02531 int
02532 msiObjStat (msParam_t *inpParam1, msParam_t *outParam, ruleExecInfo_t *rei)
02533 {
02534 rsComm_t *rsComm;
02535 dataObjInp_t dataObjInp, *myDataObjInp;
02536 rodsObjStat_t *rodsObjStatOut = NULL;
02537
02538 RE_TEST_MACRO (" Calling msiObjStat")
02539
02540 if (rei == NULL || rei->rsComm == NULL) {
02541 rodsLog (LOG_ERROR,
02542 "msiObjStat: input rei or rsComm is NULL");
02543 return (SYS_INTERNAL_NULL_INPUT_ERR);
02544 }
02545
02546 rsComm = rei->rsComm;
02547
02548
02549 rei->status = parseMspForDataObjInp (inpParam1, &dataObjInp,
02550 &myDataObjInp, 0);
02551
02552 if (rei->status < 0) {
02553 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02554 "msiObjStat: input inpParam1 error. status = %d", rei->status);
02555 return (rei->status);
02556 }
02557
02558 #if 0
02559 rei->status = __rsObjStat (rsComm, myDataObjInp, 1, &rodsObjStatOut);
02560 #endif
02561 rei->status = rsObjStat (rsComm, myDataObjInp, &rodsObjStatOut);
02562
02563 if (rei->status >= 0) {
02564 fillMsParam (outParam, NULL, RodsObjStat_MS_T, rodsObjStatOut, NULL);
02565 } else {
02566 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02567 "msiObjStat: rsObjStat failed for %s, status = %d",
02568 myDataObjInp->objPath,
02569 rei->status);
02570 }
02571
02572 return (rei->status);
02573 }
02574
02575
02576
02577
02578
02579
02580
02581
02582
02583
02584
02585
02586
02587
02588
02589
02590
02591
02592
02593
02594
02595
02596
02597
02598
02599
02600
02601
02602
02603
02604
02605
02606
02607
02608
02609
02610
02611
02612
02613
02614
02615
02616
02617
02618
02619
02620
02621
02622
02623
02624 int
02625 msiDataObjRsync (msParam_t *inpParam1, msParam_t *inpParam2,
02626 msParam_t *inpParam3, msParam_t *inpParam4, msParam_t *outParam,
02627 ruleExecInfo_t *rei)
02628 {
02629 rsComm_t *rsComm;
02630 dataObjInp_t dataObjInp, *myDataObjInp;
02631 msParamArray_t *outParamArray = NULL;
02632 char *rsyncMode;
02633 char *targCollection, *tmpPtr;
02634 char targPath[MAX_NAME_LEN];
02635
02636 RE_TEST_MACRO (" Calling msiDataObjRsync")
02637
02638 if (rei == NULL || rei->rsComm == NULL) {
02639 rodsLog (LOG_ERROR,
02640 "msiDataObjRsync: input rei or rsComm is NULL");
02641 return (SYS_INTERNAL_NULL_INPUT_ERR);
02642 }
02643
02644 rsComm = rei->rsComm;
02645
02646
02647 rei->status = parseMspForDataObjInp (inpParam1, &dataObjInp,
02648 &myDataObjInp, 1);
02649
02650 if (rei->status < 0) {
02651 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02652 "msiDataObjRsync: input inpParam1 error. status = %d", rei->status);
02653 return (rei->status);
02654 }
02655
02656 if ((rei->status = parseMspForCondInp (inpParam2, &myDataObjInp->condInput,
02657 RSYNC_MODE_KW)) < 0) {
02658 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02659 "msiDataObjRsync: input inpParam2 error. status = %d", rei->status);
02660 return (rei->status);
02661 }
02662
02663
02664 if ((rei->status = parseMspForCondInp (inpParam3, &myDataObjInp->condInput,
02665 DEST_RESC_NAME_KW)) < 0) {
02666 #if 0
02667 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02668 "msiDataObjRsync: input inpParam3 error. status = %d", rei->status);
02669 return (rei->status);
02670 #endif
02671 }
02672
02673 if ((rei->status = parseMspForCondInp (inpParam4, &myDataObjInp->condInput,
02674 RSYNC_DEST_PATH_KW)) < 0) {
02675 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02676 "msiDataObjRsync: input inpParam4 error. status = %d", rei->status);
02677 return (rei->status);
02678 }
02679
02680
02681
02682
02683 rsyncMode = getValByKey (&myDataObjInp->condInput, RSYNC_MODE_KW);
02684 if (rsyncMode == NULL) {
02685 rodsLog (LOG_ERROR,
02686 "msiDataObjRsync: RSYNC_MODE_KW input is missing");
02687 rei->status = USER_RSYNC_NO_MODE_INPUT_ERR;
02688 return (rei->status);
02689 }
02690
02691 if (strcmp (rsyncMode, IRODS_TO_LOCAL) == 0 ||
02692 strcmp (rsyncMode, LOCAL_TO_IRODS) == 0) {
02693 rodsLog (LOG_ERROR,
02694 "msiDataObjRsync: local/iRODS rsync not supported for %s",
02695 myDataObjInp->objPath);
02696 rei->status = NO_LOCAL_FILE_RSYNC_IN_MSI;
02697 return (rei->status);
02698 } else if (strcmp (rsyncMode, IRODS_TO_COLLECTION) == 0) {
02699 targCollection = getValByKey (&myDataObjInp->condInput,
02700 RSYNC_DEST_PATH_KW);
02701 if (targCollection == NULL) {
02702 rodsLog (LOG_ERROR,
02703 "msiDataObjRsync: RSYNC_DEST_PATH_KW input for %s is missing",
02704 myDataObjInp->objPath);
02705 rei->status = USER_INPUT_PATH_ERR;
02706 return (rei->status);
02707 }
02708 tmpPtr = strchr (myDataObjInp->objPath + 1, '/');
02709 if (tmpPtr == NULL) {
02710 rodsLog (LOG_ERROR,
02711 "msiDataObjRsync: problem parsing %s", myDataObjInp->objPath);
02712 rei->status = USER_INPUT_PATH_ERR;
02713 return (rei->status);
02714 }
02715 snprintf (targPath, MAX_NAME_LEN, "%s%s", targCollection, tmpPtr);
02716 addKeyVal (&myDataObjInp->condInput, RSYNC_MODE_KW, IRODS_TO_IRODS);
02717 addKeyVal (&myDataObjInp->condInput, RSYNC_DEST_PATH_KW, targPath);
02718 }
02719
02720 rei->status = rsDataObjRsync (rsComm, myDataObjInp, &outParamArray);
02721
02722 if (outParamArray != NULL) {
02723 clearMsParamArray (outParamArray, 1);
02724 free (outParamArray);
02725 }
02726 if (myDataObjInp == &dataObjInp) {
02727 clearKeyVal (&myDataObjInp->condInput);
02728 }
02729
02730 if (rei->status >= 0) {
02731 fillIntInMsParam (outParam, rei->status);
02732 } else {
02733 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02734 "msiDataObjRsync: rsDataObjRsync failed for %s, status = %d",
02735 myDataObjInp->objPath,
02736 rei->status);
02737 }
02738
02739 return (rei->status);
02740 }
02741
02742
02743
02744
02745
02746
02747
02748
02749
02750
02751
02752
02753
02754
02755
02756
02757
02758
02759
02760
02761
02762
02763
02764
02765
02766
02767
02768
02769
02770
02771
02772
02773
02774
02775
02776
02777
02778
02779
02780
02781
02782 int
02783 msiCollRsync (msParam_t *inpParam1, msParam_t *inpParam2,
02784 msParam_t *inpParam3, msParam_t *inpParam4, msParam_t *outParam,
02785 ruleExecInfo_t *rei)
02786 {
02787 rsComm_t *rsComm;
02788 dataObjInp_t dataObjInp;
02789 char *rsyncMode;
02790 char *srcColl = NULL;
02791 char *destColl = NULL;
02792
02793 RE_TEST_MACRO (" Calling msiCollRsync")
02794
02795 if (rei == NULL || rei->rsComm == NULL) {
02796 rodsLog (LOG_ERROR,
02797 "msiCollRsync: input rei or rsComm is NULL");
02798 return (SYS_INTERNAL_NULL_INPUT_ERR);
02799 }
02800
02801 rsComm = rei->rsComm;
02802
02803 bzero (&dataObjInp, sizeof (dataObjInp));
02804
02805
02806 srcColl = parseMspForStr (inpParam1);
02807
02808 if (srcColl == NULL) {
02809 rei->status = SYS_INVALID_FILE_PATH;
02810 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02811 "msiCollRsync: input inpParam1 error. status = %d", rei->status);
02812 return (rei->status);
02813 }
02814
02815
02816 destColl = parseMspForStr (inpParam2);
02817
02818 if (destColl == NULL) {
02819 rei->status = SYS_INVALID_FILE_PATH;
02820 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02821 "msiCollRsync: input inpParam2 error. status = %d", rei->status);
02822 return (rei->status);
02823 }
02824
02825 if ((rei->status = parseMspForCondInp (inpParam3, &dataObjInp.condInput,
02826 DEST_RESC_NAME_KW)) < 0) {
02827 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02828 "msiCollRsync: input inpParam3 error. status = %d", rei->status);
02829 return (rei->status);
02830 }
02831
02832 if ((rei->status = parseMspForCondInp (inpParam4, &dataObjInp.condInput,
02833 RSYNC_MODE_KW)) < 0) {
02834 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02835 "msiCollRsync: input inpParam4 error. status = %d", rei->status);
02836 return (rei->status);
02837 }
02838
02839
02840
02841
02842 rsyncMode = getValByKey (&dataObjInp.condInput, RSYNC_MODE_KW);
02843 if (rsyncMode == NULL) {
02844 rodsLog (LOG_ERROR,
02845 "msiCollRsync: RSYNC_MODE_KW input is missing");
02846 rei->status = USER_RSYNC_NO_MODE_INPUT_ERR;
02847 return (rei->status);
02848 }
02849
02850 if (strcmp (rsyncMode, IRODS_TO_LOCAL) == 0 ||
02851 strcmp (rsyncMode, LOCAL_TO_IRODS) == 0) {
02852 rodsLog (LOG_ERROR,
02853 "msiCollRsync: local/iRODS rsync not supported for %s",
02854 srcColl);
02855 rei->status = NO_LOCAL_FILE_RSYNC_IN_MSI;
02856 return (rei->status);
02857 }
02858
02859 rei->status = _rsCollRsync (rsComm, &dataObjInp, srcColl, destColl);
02860
02861 clearKeyVal (&dataObjInp.condInput);
02862
02863 if (rei->status >= 0) {
02864 fillIntInMsParam (outParam, rei->status);
02865 } else {
02866 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02867 "msiCollRsync: rsDataObjRsync failed for %s, status = %d",
02868 srcColl,
02869 rei->status);
02870 }
02871
02872 return (rei->status);
02873 }
02874
02875 int
02876 _rsCollRsync (rsComm_t *rsComm, dataObjInp_t *dataObjInp,
02877 char *srcColl, char *destColl)
02878 {
02879 collInp_t openCollInp;
02880 collEnt_t *collEnt;
02881 int handleInx;
02882 char parPath[MAX_NAME_LEN], childPath[MAX_NAME_LEN];
02883 char destChildPath[MAX_NAME_LEN];
02884 msParamArray_t *outParamArray = NULL;
02885 int status = 0;
02886 int status1 = 0;
02887
02888 memset (&openCollInp, 0, sizeof (openCollInp));
02889 rstrcpy (openCollInp.collName, srcColl, MAX_NAME_LEN);
02890 openCollInp.flags = 0;
02891 handleInx = rsOpenCollection (rsComm, &openCollInp);
02892 if (handleInx < 0) {
02893 rodsLog (LOG_ERROR,
02894 "_rsCollRsync: rsOpenCollection of %s error. status = %d",
02895 openCollInp.collName, handleInx);
02896 return (handleInx);
02897 }
02898
02899 #if 0
02900 if (CollHandle[handleInx].rodsObjStat->specColl != NULL) {
02901 rodsLog (LOG_ERROR,
02902 "_rsCollRsync: unable to rsync mounted collection %s", srcColl);
02903 rsCloseCollection (rsComm, &handleInx);
02904 return (0);
02905 }
02906 #endif
02907
02908 rsMkCollR (rsComm, "/", destColl);
02909 while ((status1 = rsReadCollection (rsComm, &handleInx, &collEnt)) >= 0) {
02910 if (collEnt->objType == DATA_OBJ_T) {
02911 snprintf (dataObjInp->objPath, MAX_NAME_LEN, "%s/%s",
02912 srcColl, collEnt->dataName);
02913 snprintf (destChildPath, MAX_NAME_LEN, "%s/%s",
02914 destColl, collEnt->dataName);
02915 addKeyVal (&dataObjInp->condInput, RSYNC_DEST_PATH_KW,
02916 destChildPath);
02917 status = rsDataObjRsync (rsComm, dataObjInp, &outParamArray);
02918 if (outParamArray != NULL) {
02919 clearMsParamArray (outParamArray, 1);
02920 free (outParamArray);
02921 }
02922 } else if (collEnt->objType == COLL_OBJ_T) {
02923 if ((status = splitPathByKey (
02924 collEnt->collName, parPath, childPath, '/')) < 0) {
02925 rodsLogError (LOG_ERROR, status,
02926 "_rsCollRsync:: splitPathByKey for %s error, status = %d",
02927 collEnt->collName, status);
02928 return (status);
02929 }
02930 snprintf (destChildPath, MAX_NAME_LEN, "%s/%s",
02931 destColl, childPath);
02932
02933 status = _rsCollRsync (rsComm, dataObjInp, collEnt->collName,
02934 destChildPath);
02935 }
02936 free (collEnt);
02937 if (status < 0) break;
02938 }
02939 rsCloseCollection (rsComm, &handleInx);
02940 if (status1 < 0 && status1 != CAT_NO_ROWS_FOUND)
02941 return status1;
02942 else
02943 return status;
02944 }
02945
02946
02947
02948
02949
02950
02951
02952
02953
02954
02955
02956
02957
02958
02959
02960
02961
02962
02963
02964
02965
02966
02967
02968
02969
02970
02971
02972
02973
02974
02975
02976
02977
02978
02979
02980
02981
02982
02983
02984
02985
02986
02987
02988
02989
02990
02991
02992
02993
02994
02995
02996 int
02997 msiExecCmd (msParam_t *inpParam1, msParam_t *inpParam2, msParam_t *inpParam3,
02998 msParam_t *inpParam4, msParam_t *inpParam5, msParam_t *outParam,
02999 ruleExecInfo_t *rei)
03000 {
03001 rsComm_t *rsComm;
03002 execCmd_t execCmdInp, *myExecCmdInp;
03003 execCmdOut_t *execCmdOut = NULL;
03004 char *tmpPtr;
03005
03006 RE_TEST_MACRO (" Calling msiExecCmd")
03007
03008 if (rei == NULL || rei->rsComm == NULL) {
03009 rodsLog (LOG_ERROR,
03010 "msiExecCmd: input rei or rsComm is NULL");
03011 return (SYS_INTERNAL_NULL_INPUT_ERR);
03012 }
03013
03014 rsComm = rei->rsComm;
03015
03016
03017 rei->status = parseMspForExecCmdInp (inpParam1, &execCmdInp,
03018 &myExecCmdInp);
03019
03020 if (rei->status < 0) {
03021 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03022 "msiExecCmd: input inpParam1 error. status = %d", rei->status);
03023 return (rei->status);
03024 }
03025
03026 if ((tmpPtr = parseMspForStr (inpParam2)) != NULL) {
03027 rstrcpy (myExecCmdInp->cmdArgv, tmpPtr, HUGE_NAME_LEN);
03028 }
03029
03030 if ((tmpPtr = parseMspForStr (inpParam3)) != NULL) {
03031 rstrcpy (myExecCmdInp->execAddr, tmpPtr, MAX_NAME_LEN);
03032 }
03033
03034 if ((tmpPtr = parseMspForStr (inpParam4)) != NULL) {
03035 rstrcpy (myExecCmdInp->hintPath, tmpPtr, MAX_NAME_LEN);
03036 }
03037
03038 if (parseMspForPosInt (inpParam5) > 0) {
03039 myExecCmdInp->addPathToArgv = 1;
03040 }
03041
03042 if (strlen (rei->ruleName) > 0 &&
03043 strcmp (rei->ruleName, EXEC_MY_RULE_KW) != 0) {
03044
03045 addKeyVal(&myExecCmdInp->condInput, EXEC_CMD_RULE_KW, rei->ruleName);
03046 }
03047 rei->status = rsExecCmd (rsComm, myExecCmdInp, &execCmdOut);
03048
03049 if (myExecCmdInp == &execCmdInp) {
03050 clearKeyVal (&myExecCmdInp->condInput);
03051 }
03052
03053 if (execCmdOut != NULL) {
03054 fillMsParam (outParam, NULL, ExecCmdOut_MS_T, execCmdOut, NULL);
03055 }
03056
03057 if (rei->status < 0) {
03058 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03059 "msiExecCmd: rsExecCmd failed for %s, status = %d",
03060 myExecCmdInp->cmd,
03061 rei->status);
03062 }
03063
03064 return (rei->status);
03065 }
03066
03067
03068
03069
03070
03071
03072
03073
03074
03075
03076
03077
03078
03079
03080
03081
03082
03083
03084
03085
03086
03087
03088
03089
03090
03091
03092
03093
03094
03095
03096
03097
03098
03099
03100
03101
03102
03103
03104
03105
03106
03107
03108
03109
03110
03111
03112
03113
03114
03115
03116
03117
03118
03119
03120
03121
03122
03123
03124
03125
03126
03127 int
03128 msiCollRepl (msParam_t *collection, msParam_t *msKeyValStr, msParam_t *status,
03129 ruleExecInfo_t *rei)
03130 {
03131
03132 collInp_t collInpCache, *collInp;
03133 char *outBadKeyWd;
03134 int validKwFlags;
03135
03136
03137 rsComm_t *rsComm;
03138
03139
03140
03141
03142
03143 RE_TEST_MACRO (" Calling msiCollRepl")
03144
03145
03146 if (rei == NULL || rei->rsComm == NULL) {
03147 rodsLog (LOG_ERROR, "msiCollRepl: inp rei or rsComm is NULL.");
03148 return (SYS_INTERNAL_NULL_INPUT_ERR);
03149 }
03150
03151 rsComm = rei->rsComm;
03152
03153
03154
03155
03156 rei->status =
03157 parseMspForCollInp (collection, &collInpCache, &collInp, 0);
03158
03159 if (rei->status < 0) {
03160 rodsLog (LOG_ERROR,
03161 "msiCollRepl: input collection error. status = %d", rei->status);
03162 return (rei->status);
03163 }
03164
03165
03166
03167 #if 0
03168 rei->status = parseMspForCondInp (targetResc,
03169 &collInp->condInput, DEST_RESC_NAME_KW);
03170 #else
03171 validKwFlags = COLL_NAME_FLAG | DEST_RESC_NAME_FLAG |
03172 BACKUP_RESC_NAME_FLAG | RESC_NAME_FLAG | UPDATE_REPL_FLAG |
03173 REPL_NUM_FLAG | ALL_FLAG | IRODS_ADMIN_FLAG | VERIFY_CHKSUM_FLAG;
03174 rei->status = parseMsKeyValStrForCollInp (msKeyValStr, collInp,
03175 DEST_RESC_NAME_KW, validKwFlags, &outBadKeyWd);
03176 #endif
03177
03178 if (rei->status < 0) {
03179 if (outBadKeyWd != NULL) {
03180 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03181 "msiCollRepl: input keyWd - %s error. status = %d",
03182 outBadKeyWd, rei->status);
03183 free (outBadKeyWd);
03184 } else {
03185 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03186 "msiCollRepl: input msKeyValStr error. status = %d",
03187 rei->status);
03188 }
03189 return (rei->status);
03190 }
03191
03192
03193
03194
03195 rei->status = rsCollRepl (rsComm, collInp, NULL);
03196
03197
03198
03199
03200 fillIntInMsParam (status, rei->status);
03201
03202 return (rei->status);
03203 }
03204
03205
03206
03207
03208
03209
03210
03211
03212
03213
03214
03215
03216
03217
03218
03219
03220
03221
03222
03223
03224
03225
03226
03227
03228
03229
03230
03231
03232
03233
03234
03235
03236
03237
03238
03239
03240
03241
03242
03243
03244
03245
03246
03247
03248
03249
03250
03251
03252 int
03253 msiDataObjPutWithOptions (msParam_t *inpParam1, msParam_t *inpParam2,
03254 msParam_t *inpParam3,msParam_t *inpOverwriteParam,
03255 msParam_t *inpAllCopiesParam, msParam_t *outParam, ruleExecInfo_t *rei)
03256 {
03257 rsComm_t *rsComm;
03258 dataObjInp_t *dataObjInp, *myDataObjInp;
03259 msParamArray_t *myMsParamArray;
03260
03261 RE_TEST_MACRO (" Calling msiDataObjPut")
03262
03263 if (rei == NULL || rei->rsComm == NULL) {
03264 rodsLog (LOG_ERROR,
03265 "msiDataObjPut: input rei or rsComm is NULL");
03266 return (SYS_INTERNAL_NULL_INPUT_ERR);
03267 }
03268
03269 rsComm = rei->rsComm;
03270
03271 dataObjInp = (dataObjInp_t*)malloc (sizeof (dataObjInp_t));
03272
03273 rei->status = parseMspForDataObjInp (inpParam1, dataObjInp,
03274 &myDataObjInp, 1);
03275
03276 if (rei->status < 0) {
03277 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03278 "msiDataObjPut: input inpParam1 error. status = %d", rei->status);
03279 return (rei->status);
03280 }
03281
03282 rei->status = parseMspForCondInp (inpParam2, &dataObjInp->condInput,
03283 DEST_RESC_NAME_KW);
03284
03285 if (rei->status < 0) {
03286 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03287 "msiDataObjPut: input inpParam2 error. status = %d", rei->status);
03288 return (rei->status);
03289 }
03290
03291
03292 rei->status = parseMspForCondInp (inpParam3, &dataObjInp->condInput,
03293 LOCAL_PATH_KW);
03294
03295 if (rei->status < 0) {
03296 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03297 "msiDataObjPut: input inpParam3 error. status = %d", rei->status);
03298 return (rei->status);
03299 }
03300
03301 if (inpOverwriteParam != NULL &&
03302 strcmp((char*)inpOverwriteParam->inOutStruct, FORCE_FLAG_KW) == 0 )
03303 rei->status = parseMspForCondInp (inpOverwriteParam,
03304 &dataObjInp->condInput,FORCE_FLAG_KW);
03305
03306 if (inpAllCopiesParam !=NULL &&
03307 strcmp((char*)inpAllCopiesParam->inOutStruct, ALL_KW) == 0 )
03308 rei->status = parseMspForCondInp (inpAllCopiesParam,
03309 &dataObjInp->condInput,ALL_KW);
03310
03311 myMsParamArray = (msParamArray_t*)malloc (sizeof (msParamArray_t));
03312 memset (myMsParamArray, 0, sizeof (msParamArray_t));
03313
03314 rei->status = addMsParam (myMsParamArray, CL_PUT_ACTION, DataObjInp_MS_T,
03315 (void *) dataObjInp, NULL);
03316
03317 if (rei->status < 0) {
03318 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03319 "msiDataObjPut: addMsParam error. status = %d", rei->status);
03320 return (rei->status);
03321 }
03322
03323
03324 rei->status = sendAndRecvBranchMsg (rsComm, rsComm->apiInx,
03325 SYS_SVR_TO_CLI_MSI_REQUEST, (void *) myMsParamArray, NULL);
03326
03327 if (rei->status >= 0) {
03328 fillIntInMsParam (outParam, rei->status);
03329 } else {
03330 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03331 "msiDataObjPut: rsDataObjPut failed for %s, status = %d",
03332 dataObjInp->objPath,
03333 rei->status);
03334 }
03335
03336 return (rei->status);
03337 }
03338
03339
03340
03341
03342
03343
03344
03345
03346
03347
03348
03349
03350
03351
03352
03353
03354
03355
03356
03357
03358
03359
03360
03361
03362
03363
03364
03365
03366
03367
03368
03369
03370
03371
03372
03373
03374
03375
03376
03377
03378
03379 int
03380 msiDataObjReplWithOptions (msParam_t *inpParam1, msParam_t *inpParam2,
03381 msParam_t *inpParam3, msParam_t *outParam, ruleExecInfo_t *rei)
03382 {
03383 rsComm_t *rsComm;
03384 dataObjInp_t dataObjInp, *myDataObjInp;
03385 transferStat_t *transStat = NULL;
03386
03387 RE_TEST_MACRO (" Calling msiDataObjReplWithOptions")
03388
03389 if (rei == NULL || rei->rsComm == NULL) {
03390 rodsLog (LOG_ERROR,
03391 "msiDataObjReplWithOptions: input rei or rsComm is NULL");
03392 return (SYS_INTERNAL_NULL_INPUT_ERR);
03393 }
03394
03395 rsComm = rei->rsComm;
03396
03397
03398 rei->status = parseMspForDataObjInp (inpParam1, &dataObjInp,
03399 &myDataObjInp, 0);
03400
03401 if (rei->status < 0) {
03402 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03403 "msiDataObjReplWithOptions: input inpParam1 error. status = %d",
03404 rei->status);
03405 return (rei->status);
03406 }
03407
03408 rei->status = parseMspForCondInp (inpParam2, &myDataObjInp->condInput,
03409 DEST_RESC_NAME_KW);
03410
03411 if (rei->status < 0) {
03412 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03413 "msiDataObjReplWithOptions: input inpParam2 error. status = %d",
03414 rei->status);
03415 return (rei->status);
03416 }
03417
03418 if ((rei->status = parseMspForCondKw (inpParam3, &myDataObjInp->condInput))
03419 < 0) {
03420 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03421 "msiDataObjReplWithOptions: input inpParam3 error. status = %d",
03422 rei->status);
03423 return (rei->status);
03424 }
03425
03426 rei->status = rsDataObjRepl (rsComm, myDataObjInp, &transStat);
03427
03428 if (myDataObjInp == &dataObjInp) {
03429 clearKeyVal (&myDataObjInp->condInput);
03430 }
03431
03432 if (transStat != NULL) {
03433 free (transStat);
03434 }
03435
03436 if (rei->status >= 0) {
03437 fillIntInMsParam (outParam, rei->status);
03438 } else {
03439 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03440 "msiDataObjReplWithOptions: rsDataObjRepl failed %s, status = %d",
03441 myDataObjInp->objPath, rei->status);
03442 }
03443
03444 return (rei->status);
03445 }
03446
03447
03448
03449
03450
03451
03452
03453
03454
03455
03456
03457
03458
03459
03460
03461
03462
03463
03464
03465
03466
03467
03468
03469
03470
03471
03472
03473
03474
03475
03476
03477
03478
03479
03480
03481
03482
03483
03484
03485
03486
03487
03488
03489 int
03490 msiDataObjChksumWithOptions (msParam_t *inpParam1, msParam_t *inpParam2,
03491 msParam_t *inpParam3, msParam_t *outParam, ruleExecInfo_t *rei)
03492 {
03493 rsComm_t *rsComm;
03494 dataObjInp_t dataObjInp, *myDataObjInp;
03495 char *chksum = NULL;
03496
03497 RE_TEST_MACRO (" Calling msiDataObjChksumWithOptions")
03498
03499 if (rei == NULL || rei->rsComm == NULL) {
03500 rodsLog (LOG_ERROR,
03501 "msiDataObjChksumRepl: input rei or rsComm is NULL");
03502 return (SYS_INTERNAL_NULL_INPUT_ERR);
03503 }
03504
03505 rsComm = rei->rsComm;
03506
03507
03508 rei->status = parseMspForDataObjInp (inpParam1, &dataObjInp,
03509 &myDataObjInp, 1);
03510
03511 if (rei->status < 0) {
03512 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03513 "msiDataObjChksumWithOptions: input inpParam1 error. status = %d",
03514 rei->status);
03515 return (rei->status);
03516 }
03517
03518 if ((rei->status = parseMspForCondKw (inpParam2,
03519 &myDataObjInp->condInput)) < 0) {
03520 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03521 "msiDataObjChksumWithOptions: input inpParam2 error. status = %d",
03522 rei->status);
03523 return (rei->status);
03524 }
03525
03526 if (inpParam3 != NULL && strcmp( inpParam3->type, STR_MS_T) == 0) {
03527 if (strcmp ((char *) inpParam3->inOutStruct, CHKSUM_ALL_KW) == 0) {
03528 if ((rei->status = parseMspForCondKw (inpParam3,
03529 &myDataObjInp->condInput)) < 0) {
03530 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03531 "msiDataObjChksumWithOptions: input inpParam3 error.stat=%d",
03532 rei->status);
03533 return (rei->status);
03534 }
03535 } else {
03536
03537 if ((rei->status = parseMspForCondInp (inpParam3,
03538 &myDataObjInp->condInput, REPL_NUM_KW)) < 0) {
03539 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03540 "msiDataObjChksumWithOptions: input inpParam3 error.stat=%d",
03541 rei->status);
03542 return (rei->status);
03543 }
03544 }
03545 }
03546 rei->status = rsDataObjChksum (rsComm, myDataObjInp, &chksum);
03547
03548 if (myDataObjInp == &dataObjInp) {
03549 clearKeyVal (&myDataObjInp->condInput);
03550 }
03551
03552 if (rei->status >= 0) {
03553 fillStrInMsParam (outParam, chksum);
03554 free (chksum);
03555 } else {
03556 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03557 "msiDataObjChksumWithOptions: rsDataObjChksum failed for %s,stat=%d",
03558 myDataObjInp->objPath, rei->status);
03559 }
03560
03561 return (rei->status);
03562 }
03563
03564
03565
03566
03567
03568
03569
03570
03571
03572
03573
03574
03575
03576
03577
03578
03579
03580
03581
03582
03583
03584
03585
03586
03587
03588
03589
03590
03591
03592
03593
03594
03595
03596
03597
03598
03599
03600
03601
03602
03603 int
03604 msiTarFileExtract (msParam_t *inpParam1, msParam_t *inpParam2, msParam_t *inpParam3, msParam_t *outParam, ruleExecInfo_t *rei)
03605 {
03606 rsComm_t *rsComm;
03607 structFileExtAndRegInp_t structFileExtAndRegInp,
03608 *myStructFileExtAndRegInp;
03609 keyValPair_t regParam;
03610 modDataObjMeta_t modDataObjMetaInp;
03611 int rc1;
03612 char origDataType[NAME_LEN];
03613
03614 RE_TEST_MACRO (" Calling msiTarFileExtract")
03615
03616 if (rei == NULL || rei->rsComm == NULL) {
03617 rodsLog (LOG_ERROR,
03618 "msiTarFileExtract: input rei or rsComm is NULL");
03619 rei->status = SYS_INTERNAL_NULL_INPUT_ERR;
03620 return (rei->status);
03621 }
03622
03623 rsComm = rei->rsComm;
03624
03625
03626
03627
03628
03629 if ( inpParam1 == NULL || inpParam2 == NULL ) {
03630 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03631 "msiTarFileExtract: input Param1 and/or Param2 are NULL");
03632 rei->status = SYS_INTERNAL_NULL_INPUT_ERR;
03633 return (rei->status);
03634 }
03635
03636 if (strcmp (inpParam1->type, STR_MS_T) == 0) {
03637 bzero (&structFileExtAndRegInp, sizeof (structFileExtAndRegInp));
03638 myStructFileExtAndRegInp = &structFileExtAndRegInp;
03639 strncpy ((char*)myStructFileExtAndRegInp->objPath, (char*)inpParam1->inOutStruct,
03640 MAX_NAME_LEN);
03641 } else if (strcmp (inpParam1->type, StructFileExtAndRegInp_MS_T) == 0) {
03642 myStructFileExtAndRegInp =
03643 (structFileExtAndRegInp_t *) inpParam1->inOutStruct;
03644 } else {
03645 rei->status = UNKNOWN_PARAM_IN_RULE_ERR;
03646 return (rei->status);
03647 }
03648
03649 if ( strcmp (inpParam2->type, STR_MS_T) == 0 ) {
03650 if (strcmp ((char *) inpParam2->inOutStruct, "null") != 0) {
03651 strncpy ((char*)myStructFileExtAndRegInp->collection,
03652 (char*)inpParam2->inOutStruct, MAX_NAME_LEN);
03653 }
03654 } else {
03655 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03656 "msiTarFileExtract: Unsupported input Param2 type %s",
03657 inpParam2->type);
03658 rei->status = UNKNOWN_PARAM_IN_RULE_ERR;
03659 return (rei->status);
03660 }
03661
03662 if ( strcmp (inpParam3->type, STR_MS_T) == 0 && inpParam3 != NULL &&
03663 strcmp ( (char *) inpParam3->inOutStruct, "null") != 0) {
03664 addKeyVal(&myStructFileExtAndRegInp->condInput, DEST_RESC_NAME_KW,
03665 (char *) inpParam3->inOutStruct);
03666
03667 addKeyVal(&myStructFileExtAndRegInp->condInput, RESC_NAME_KW,
03668 (char *) inpParam3->inOutStruct);
03669 }
03670
03671 if (rei->doi != NULL) {
03672
03673
03674 strncpy(origDataType, rei->doi->dataType, NAME_LEN);
03675
03676 memset(®Param, 0, sizeof(regParam));
03677 addKeyVal(®Param, DATA_TYPE_KW, "tar file");
03678 modDataObjMetaInp.dataObjInfo = rei->doi;
03679 modDataObjMetaInp.regParam = ®Param;
03680 rc1 = rsModDataObjMeta(rsComm, &modDataObjMetaInp);
03681 }
03682
03683
03684 rei->status = rsStructFileExtAndReg (rsComm, myStructFileExtAndRegInp);
03685 if ( rei->status < 0 && rei->doi != NULL) {
03686 rodsLog (LOG_ERROR, "msiTarFileExtract: tar file extraction failed");
03687
03688
03689 memset(®Param, 0, sizeof(regParam));
03690 addKeyVal(®Param, DATA_TYPE_KW, origDataType);
03691 rc1 = rsModDataObjMeta(rsComm, &modDataObjMetaInp);
03692 }
03693
03694 fillIntInMsParam (outParam, rei->status);
03695
03696 return (rei->status);
03697 }
03698
03699
03700
03701
03702
03703
03704
03705
03706
03707
03708
03709
03710
03711
03712
03713
03714
03715
03716
03717
03718
03719
03720
03721
03722
03723
03724
03725
03726
03727
03728
03729
03730
03731
03732
03733
03734
03735
03736
03737
03738 int
03739 msiTarFileCreate (msParam_t *inpParam1, msParam_t *inpParam2, msParam_t *inpParam3, msParam_t *inpParam4, ruleExecInfo_t *rei)
03740 {
03741 rsComm_t *rsComm;
03742 structFileExtAndRegInp_t structFileExtAndRegInp,
03743 *myStructFileExtAndRegInp;
03744
03745 RE_TEST_MACRO (" Calling msiTarFileCreate")
03746
03747 if (rei == NULL || rei->rsComm == NULL) {
03748 rodsLog (LOG_ERROR,
03749 "msiTarFileCreate: input rei or rsComm is NULL");
03750 rei->status = SYS_INTERNAL_NULL_INPUT_ERR;
03751 return (rei->status);
03752 }
03753
03754 rsComm = rei->rsComm;
03755
03756
03757
03758
03759
03760 if ( inpParam1 == NULL || inpParam2 == NULL ) {
03761 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03762 "msiTarFileCreate: input Param1 and/or Param2 are NULL");
03763 rei->status = SYS_INTERNAL_NULL_INPUT_ERR;
03764 return (rei->status);
03765 }
03766
03767 if (strcmp (inpParam1->type, STR_MS_T) == 0) {
03768 bzero (&structFileExtAndRegInp, sizeof (structFileExtAndRegInp));
03769 myStructFileExtAndRegInp = &structFileExtAndRegInp;
03770 strncpy ((char*)myStructFileExtAndRegInp->objPath, (char*)inpParam1->inOutStruct,
03771 MAX_NAME_LEN);
03772 } else if (strcmp (inpParam1->type, StructFileExtAndRegInp_MS_T) == 0) {
03773 myStructFileExtAndRegInp =
03774 (structFileExtAndRegInp_t *) inpParam1->inOutStruct;
03775 } else {
03776 rei->status = UNKNOWN_PARAM_IN_RULE_ERR;
03777 return (rei->status);
03778 }
03779
03780 if ( strcmp (inpParam2->type, STR_MS_T) == 0 ) {
03781 if (strcmp ((char *) inpParam2->inOutStruct, "null") != 0) {
03782 strncpy ((char*)myStructFileExtAndRegInp->collection,
03783 (char*)inpParam2->inOutStruct, MAX_NAME_LEN);
03784 }
03785 } else {
03786 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03787 "msiTarFileExtract: Unsupported input Param2 type %s",
03788 inpParam2->type);
03789 rei->status = UNKNOWN_PARAM_IN_RULE_ERR;
03790 return (rei->status);
03791 }
03792
03793 if ( strcmp (inpParam3->type, STR_MS_T) == 0 && inpParam3 != NULL &&
03794 strcmp ( (char *) inpParam3->inOutStruct, "null") != 0) {
03795 addKeyVal(&myStructFileExtAndRegInp->condInput, DEST_RESC_NAME_KW,
03796 (char *) inpParam3->inOutStruct);
03797 }
03798
03799 if ( strcmp (inpParam4->type, STR_MS_T) == 0 && inpParam4 != NULL &&
03800 strcmp ( (char *) inpParam4->inOutStruct, "force") == 0) {
03801 addKeyVal(&myStructFileExtAndRegInp->condInput, FORCE_FLAG_KW, "");
03802 }
03803
03804
03805 rei->status = rsStructFileBundle (rsComm, myStructFileExtAndRegInp);
03806
03807 return (rei->status);
03808
03809 }
03810
03811
03812
03813
03814
03815
03816
03817
03818
03819
03820
03821
03822
03823
03824
03825
03826
03827
03828
03829
03830
03831
03832
03833
03834
03835
03836
03837
03838
03839
03840
03841
03842
03843
03844
03845
03846
03847
03848
03849
03850
03851
03852
03853
03854
03855
03856 int
03857 msiPhyBundleColl (msParam_t *inpParam1, msParam_t *inpParam2, msParam_t *outParam, ruleExecInfo_t *rei)
03858 {
03859 rsComm_t *rsComm;
03860 structFileExtAndRegInp_t structFileExtAndRegInp,
03861 *myStructFileExtAndRegInp;
03862 int len1, len2;
03863 char *inpStr, rescName[NAME_LEN], *pstr1, *pstr2, attr[MAX_NAME_LEN];
03864
03865 RE_TEST_MACRO (" Calling msiPhyBundleColl")
03866
03867 if (rei == NULL || rei->rsComm == NULL) {
03868 rodsLog (LOG_ERROR,
03869 "msiPhyBundleColl: input rei or rsComm is NULL");
03870 rei->status = SYS_INTERNAL_NULL_INPUT_ERR;
03871 return (rei->status);
03872 }
03873
03874 rsComm = rei->rsComm;
03875
03876
03877
03878
03879
03880
03881 if ( inpParam1 == NULL) {
03882 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03883 "msiPhyBundleColl: input Param1 is NULL");
03884 rei->status = SYS_INTERNAL_NULL_INPUT_ERR;
03885 return (rei->status);
03886 }
03887
03888
03889 if (strcmp (inpParam1->type, STR_MS_T) == 0) {
03890 bzero (&structFileExtAndRegInp, sizeof (structFileExtAndRegInp));
03891 myStructFileExtAndRegInp = &structFileExtAndRegInp;
03892 strncpy ((char*)myStructFileExtAndRegInp->collection, (char*)inpParam1->inOutStruct,
03893 MAX_NAME_LEN);
03894
03895 } else if (strcmp (inpParam1->type, StructFileExtAndRegInp_MS_T) == 0) {
03896 myStructFileExtAndRegInp =
03897 (structFileExtAndRegInp_t *) inpParam1->inOutStruct;
03898
03899 } else {
03900
03901 rei->status = UNKNOWN_PARAM_IN_RULE_ERR;
03902 return (rei->status);
03903 }
03904
03905 if( strcmp (inpParam2->type, STR_MS_T) == 0 && inpParam2 != NULL &&
03906
03907 strcmp ( (char *) inpParam2->inOutStruct, "null") != 0) {
03908 inpStr = (char *) inpParam2->inOutStruct;
03909
03910 pstr1 = strstr(inpStr, "++++");
03911 if ( pstr1 != NULL ) {
03912 len1 = strlen(inpStr) - strlen(pstr1);
03913 if ( len1 > 0 ) {
03914 strncpy(rescName, inpStr, len1);
03915 addKeyVal(&myStructFileExtAndRegInp->condInput, DEST_RESC_NAME_KW, rescName);
03916 }
03917 pstr2 = strstr(pstr1 + 4, "=");
03918 if ( pstr2 != NULL ) {
03919 len2 = strlen(pstr1 + 4) - strlen(pstr2);
03920 memset(attr, 0, sizeof(attr));
03921 strncpy(attr, pstr1 + 4, len2);
03922 if ( len2 > 0 ) {
03923 if ( strcmp(attr, "N") == 0 ) {
03924 addKeyVal(&myStructFileExtAndRegInp->condInput, MAX_SUB_FILE_KW, pstr2 + 1);
03925 }
03926 }
03927 }
03928 }
03929 else {
03930 addKeyVal(&myStructFileExtAndRegInp->condInput, DEST_RESC_NAME_KW, inpStr);
03931 }
03932
03933
03934 }
03935
03936
03937 rei->status = rsPhyBundleColl (rsComm, myStructFileExtAndRegInp);
03938
03939
03940 fillIntInMsParam (outParam, rei->status);
03941
03942
03943 return (rei->status);
03944
03945 }
03946