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 int
00770 msiDataObjUnlink (msParam_t *inpParam, msParam_t *outParam,
00771 ruleExecInfo_t *rei)
00772 {
00773 rsComm_t *rsComm;
00774 dataObjInp_t dataObjInp, *myDataObjInp;
00775 char *outBadKeyWd = NULL;
00776 int validKwFlags;
00777
00778 RE_TEST_MACRO (" Calling msiDataObjUnlink")
00779
00780 if (rei == NULL || rei->rsComm == NULL) {
00781 rodsLog (LOG_ERROR,
00782 "msiDataObjUnlink: input rei or rsComm is NULL");
00783 return (SYS_INTERNAL_NULL_INPUT_ERR);
00784 }
00785
00786 rsComm = rei->rsComm;
00787
00788
00789 if (strcmp (inpParam->type, STR_MS_T) == 0) {
00790 bzero (&dataObjInp, sizeof (dataObjInp));
00791 myDataObjInp = &dataObjInp;
00792 validKwFlags = OBJ_PATH_FLAG | FORCE_FLAG_FLAG | REPL_NUM_FLAG |
00793 IRODS_RMTRASH_FLAG | IRODS_ADMIN_RMTRASH_FLAG;
00794 rei->status = parseMsKeyValStrForDataObjInp (inpParam, myDataObjInp,
00795 OBJ_PATH_KW, validKwFlags, &outBadKeyWd);
00796 } else {
00797 rei->status = parseMspForDataObjInp (inpParam, &dataObjInp,
00798 &myDataObjInp, 0);
00799 }
00800
00801 if (rei->status < 0) {
00802 if (outBadKeyWd != NULL) {
00803 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00804 "msiDataObjUnlink: input keyWd - %s error. status = %d",
00805 outBadKeyWd, rei->status);
00806 free (outBadKeyWd);
00807 } else {
00808 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00809 "msiDataObjUnlink: input msKeyValStr error. status = %d",
00810 rei->status);
00811 }
00812 return (rei->status);
00813 }
00814
00815 rei->status = rsDataObjUnlink (rsComm, myDataObjInp);
00816 if (rei->status >= 0) {
00817 fillIntInMsParam (outParam, rei->status);
00818 } else {
00819 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00820 "msiDataObjUnlink: rsDataObjUnlink failed for %s, status = %d",
00821 myDataObjInp->objPath,
00822 rei->status);
00823 }
00824
00825 return (rei->status);
00826 }
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 int
00896 msiDataObjRepl (msParam_t *inpParam1, msParam_t *msKeyValStr,
00897 msParam_t *outParam, ruleExecInfo_t *rei)
00898 {
00899 rsComm_t *rsComm;
00900 dataObjInp_t dataObjInp, *myDataObjInp;
00901 transferStat_t *transStat = NULL;
00902 char *outBadKeyWd;
00903 int validKwFlags;
00904
00905 RE_TEST_MACRO (" Calling msiDataObjRepl")
00906
00907 if (rei == NULL || rei->rsComm == NULL) {
00908 rodsLog (LOG_ERROR,
00909 "msiDataObjRepl: input rei or rsComm is NULL");
00910 return (SYS_INTERNAL_NULL_INPUT_ERR);
00911 }
00912
00913 rsComm = rei->rsComm;
00914
00915
00916 rei->status = parseMspForDataObjInp (inpParam1, &dataObjInp,
00917 &myDataObjInp, 0);
00918
00919 if (rei->status < 0) {
00920 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00921 "msiDataObjRepl: input inpParam1 error. status = %d", rei->status);
00922 return (rei->status);
00923 }
00924
00925 #if 0
00926 rei->status = parseMspForCondInp (inpParam2, &myDataObjInp->condInput,
00927 DEST_RESC_NAME_KW);
00928 #else
00929 validKwFlags = OBJ_PATH_FLAG | DEST_RESC_NAME_FLAG | NUM_THREADS_FLAG |
00930 BACKUP_RESC_NAME_FLAG | RESC_NAME_FLAG | UPDATE_REPL_FLAG |
00931 REPL_NUM_FLAG | ALL_FLAG | IRODS_ADMIN_FLAG | VERIFY_CHKSUM_FLAG |
00932 RBUDP_TRANSFER_FLAG | RBUDP_SEND_RATE_FLAG | RBUDP_PACK_SIZE_FLAG;
00933 rei->status = parseMsKeyValStrForDataObjInp (msKeyValStr, myDataObjInp,
00934 DEST_RESC_NAME_KW, validKwFlags, &outBadKeyWd);
00935 #endif
00936
00937 if (rei->status < 0) {
00938 if (outBadKeyWd != NULL) {
00939 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00940 "msiDataObjRepl: input keyWd - %s error. status = %d",
00941 outBadKeyWd, rei->status);
00942 free (outBadKeyWd);
00943 } else {
00944 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00945 "msiDataObjRepl: input msKeyValStr error. status = %d",
00946 rei->status);
00947 }
00948 return (rei->status);
00949 }
00950
00951 rei->status = rsDataObjRepl (rsComm, myDataObjInp, &transStat);
00952
00953 if (myDataObjInp == &dataObjInp) {
00954 clearKeyVal (&myDataObjInp->condInput);
00955 }
00956
00957 if (transStat != NULL) {
00958 free (transStat);
00959 }
00960
00961 if (rei->status >= 0) {
00962 fillIntInMsParam (outParam, rei->status);
00963 } else {
00964 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
00965 "msiDataObjRepl: rsDataObjRepl failed %s, status = %d",
00966 myDataObjInp->objPath,
00967 rei->status);
00968 }
00969
00970 return (rei->status);
00971 }
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 int
01028 msiDataObjCopy (msParam_t *inpParam1, msParam_t *inpParam2,
01029 msParam_t *msKeyValStr, msParam_t *outParam, ruleExecInfo_t *rei)
01030 {
01031 rsComm_t *rsComm;
01032 dataObjCopyInp_t dataObjCopyInp, *myDataObjCopyInp;
01033 dataObjInp_t *myDataObjInp;
01034 transferStat_t *transStat = NULL;
01035 char *outBadKeyWd;
01036 int validKwFlags;
01037
01038 RE_TEST_MACRO (" Calling msiDataObjCopy")
01039
01040 if (rei == NULL || rei->rsComm == NULL) {
01041 rodsLog (LOG_ERROR,
01042 "msiDataObjCopy: input rei or rsComm is NULL");
01043 return (SYS_INTERNAL_NULL_INPUT_ERR);
01044 }
01045
01046 rsComm = rei->rsComm;
01047
01048
01049 rei->status = parseMspForDataObjCopyInp (inpParam1, &dataObjCopyInp,
01050 &myDataObjCopyInp);
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,
01060 &myDataObjCopyInp->destDataObjInp, &myDataObjInp, 1);
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,
01076 &myDataObjCopyInp->destDataObjInp, DEST_RESC_NAME_KW, validKwFlags,
01077 &outBadKeyWd);
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",
02343 tmpSubColl, tmpDataName);
02344 rei->status = rsDataObjRepl (rsComm, &dataObjInp, &transStat);
02345 if (rei->status<0)
02346 {
02347 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02348 "msiReplColl: rsDataObjRepl failed %s, status = %d",
02349 (&dataObjInp)->objPath,
02350 rei->status);
02351 }
02352 if (transStat != NULL) {
02353 free (transStat);
02354 }
02355 }
02356
02357 continueInx = genQueryOut->continueInx;
02358 freeGenQueryOut (&genQueryOut);
02359 if (continueInx > 0) {
02360
02361 genQueryInp.continueInx = continueInx;
02362 rei->status = rsGenQuery (rsComm, &genQueryInp, &genQueryOut);
02363 } else {
02364 break;
02365 }
02366 }
02367
02368 clearKeyVal (&dataObjInp.condInput);
02369
02370 if (rei->status >= 0) {
02371 fillIntInMsParam (outParam, rei->status);
02372 } else {
02373 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02374 "dataObjInp: msiReplColl failed (should have catched earlier) %s, status = %d",
02375 (&dataObjInp)->objPath,
02376 rei->status);
02377 }
02378 return (rei->status);
02379 }
02380
02381
02382
02383
02384
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 int
02426 msiPhyPathReg (msParam_t *inpParam1, msParam_t *inpParam2,
02427 msParam_t *inpParam3, msParam_t *inpParam4, msParam_t *outParam,
02428 ruleExecInfo_t *rei)
02429 {
02430 rsComm_t *rsComm;
02431 dataObjInp_t dataObjInp, *myDataObjInp;
02432
02433 RE_TEST_MACRO (" Calling msiPhyPathReg")
02434
02435 if (rei == NULL || rei->rsComm == NULL) {
02436 rodsLog (LOG_ERROR,
02437 "msiPhyPathReg: input rei or rsComm is NULL");
02438 return (SYS_INTERNAL_NULL_INPUT_ERR);
02439 }
02440
02441 rsComm = rei->rsComm;
02442
02443
02444 rei->status = parseMspForDataObjInp (inpParam1, &dataObjInp,
02445 &myDataObjInp, 1);
02446
02447 if (rei->status < 0) {
02448 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02449 "msiPhyPathReg: input inpParam1 error. status = %d", rei->status);
02450 return (rei->status);
02451 }
02452
02453 if ((rei->status = parseMspForCondInp (inpParam2, &myDataObjInp->condInput,
02454 DEST_RESC_NAME_KW)) < 0) {
02455 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02456 "msiDataObjPhymv: input inpParam2 error. status = %d", rei->status);
02457 return (rei->status);
02458 }
02459
02460 if ((rei->status = parseMspForCondInp (inpParam3, &myDataObjInp->condInput,
02461 FILE_PATH_KW)) < 0) {
02462 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02463 "msiDataObjPhymv: input inpParam3 error. status = %d", rei->status);
02464 return (rei->status);
02465 }
02466
02467 if ((rei->status = parseMspForPhyPathReg (inpParam4,
02468 &myDataObjInp->condInput)) < 0) {
02469 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02470 "msiPhyPathReg: input inpParam4 error. status = %d", rei->status);
02471 return (rei->status);
02472 }
02473
02474 rei->status = rsPhyPathReg (rsComm, myDataObjInp);
02475
02476 if (myDataObjInp == &dataObjInp) {
02477 clearKeyVal (&myDataObjInp->condInput);
02478 }
02479
02480 if (rei->status >= 0) {
02481 fillIntInMsParam (outParam, rei->status);
02482 } else {
02483 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02484 "msiPhyPathReg: rsPhyPathReg failed for %s, status = %d",
02485 myDataObjInp->objPath,
02486 rei->status);
02487 }
02488
02489 return (rei->status);
02490 }
02491
02492
02493
02494
02495
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 int
02526 msiObjStat (msParam_t *inpParam1, msParam_t *outParam, ruleExecInfo_t *rei)
02527 {
02528 rsComm_t *rsComm;
02529 dataObjInp_t dataObjInp, *myDataObjInp;
02530 rodsObjStat_t *rodsObjStatOut = NULL;
02531
02532 RE_TEST_MACRO (" Calling msiObjStat")
02533
02534 if (rei == NULL || rei->rsComm == NULL) {
02535 rodsLog (LOG_ERROR,
02536 "msiObjStat: input rei or rsComm is NULL");
02537 return (SYS_INTERNAL_NULL_INPUT_ERR);
02538 }
02539
02540 rsComm = rei->rsComm;
02541
02542
02543 rei->status = parseMspForDataObjInp (inpParam1, &dataObjInp,
02544 &myDataObjInp, 0);
02545
02546 if (rei->status < 0) {
02547 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02548 "msiObjStat: input inpParam1 error. status = %d", rei->status);
02549 return (rei->status);
02550 }
02551
02552 #if 0
02553 rei->status = __rsObjStat (rsComm, myDataObjInp, 1, &rodsObjStatOut);
02554 #endif
02555 rei->status = rsObjStat (rsComm, myDataObjInp, &rodsObjStatOut);
02556
02557 if (rei->status >= 0) {
02558 fillMsParam (outParam, NULL, RodsObjStat_MS_T, rodsObjStatOut, NULL);
02559 } else {
02560 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02561 "msiObjStat: rsObjStat failed for %s, status = %d",
02562 myDataObjInp->objPath,
02563 rei->status);
02564 }
02565
02566 return (rei->status);
02567 }
02568
02569
02570
02571
02572
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 int
02619 msiDataObjRsync (msParam_t *inpParam1, msParam_t *inpParam2,
02620 msParam_t *inpParam3, msParam_t *inpParam4, msParam_t *outParam,
02621 ruleExecInfo_t *rei)
02622 {
02623 rsComm_t *rsComm;
02624 dataObjInp_t dataObjInp, *myDataObjInp;
02625 msParamArray_t *outParamArray = NULL;
02626 char *rsyncMode;
02627 char *targCollection, *tmpPtr;
02628 char targPath[MAX_NAME_LEN];
02629
02630 RE_TEST_MACRO (" Calling msiDataObjRsync")
02631
02632 if (rei == NULL || rei->rsComm == NULL) {
02633 rodsLog (LOG_ERROR,
02634 "msiDataObjRsync: input rei or rsComm is NULL");
02635 return (SYS_INTERNAL_NULL_INPUT_ERR);
02636 }
02637
02638 rsComm = rei->rsComm;
02639
02640
02641 rei->status = parseMspForDataObjInp (inpParam1, &dataObjInp,
02642 &myDataObjInp, 1);
02643
02644 if (rei->status < 0) {
02645 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02646 "msiDataObjRsync: input inpParam1 error. status = %d", rei->status);
02647 return (rei->status);
02648 }
02649
02650 if ((rei->status = parseMspForCondInp (inpParam2, &myDataObjInp->condInput,
02651 RSYNC_MODE_KW)) < 0) {
02652 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02653 "msiDataObjRsync: input inpParam2 error. status = %d", rei->status);
02654 return (rei->status);
02655 }
02656
02657
02658 if ((rei->status = parseMspForCondInp (inpParam3, &myDataObjInp->condInput,
02659 DEST_RESC_NAME_KW)) < 0) {
02660 #if 0
02661 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02662 "msiDataObjRsync: input inpParam3 error. status = %d", rei->status);
02663 return (rei->status);
02664 #endif
02665 }
02666
02667 if ((rei->status = parseMspForCondInp (inpParam4, &myDataObjInp->condInput,
02668 RSYNC_DEST_PATH_KW)) < 0) {
02669 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02670 "msiDataObjRsync: input inpParam4 error. status = %d", rei->status);
02671 return (rei->status);
02672 }
02673
02674
02675
02676
02677 rsyncMode = getValByKey (&myDataObjInp->condInput, RSYNC_MODE_KW);
02678 if (rsyncMode == NULL) {
02679 rodsLog (LOG_ERROR,
02680 "msiDataObjRsync: RSYNC_MODE_KW input is missing");
02681 rei->status = USER_RSYNC_NO_MODE_INPUT_ERR;
02682 return (rei->status);
02683 }
02684
02685 if (strcmp (rsyncMode, IRODS_TO_LOCAL) == 0 ||
02686 strcmp (rsyncMode, LOCAL_TO_IRODS) == 0) {
02687 rodsLog (LOG_ERROR,
02688 "msiDataObjRsync: local/iRODS rsync not supported for %s",
02689 myDataObjInp->objPath);
02690 rei->status = NO_LOCAL_FILE_RSYNC_IN_MSI;
02691 return (rei->status);
02692 } else if (strcmp (rsyncMode, IRODS_TO_COLLECTION) == 0) {
02693 targCollection = getValByKey (&myDataObjInp->condInput,
02694 RSYNC_DEST_PATH_KW);
02695 if (targCollection == NULL) {
02696 rodsLog (LOG_ERROR,
02697 "msiDataObjRsync: RSYNC_DEST_PATH_KW input for %s is missing",
02698 myDataObjInp->objPath);
02699 rei->status = USER_INPUT_PATH_ERR;
02700 return (rei->status);
02701 }
02702 tmpPtr = strchr (myDataObjInp->objPath + 1, '/');
02703 if (tmpPtr == NULL) {
02704 rodsLog (LOG_ERROR,
02705 "msiDataObjRsync: problem parsing %s", myDataObjInp->objPath);
02706 rei->status = USER_INPUT_PATH_ERR;
02707 return (rei->status);
02708 }
02709 snprintf (targPath, MAX_NAME_LEN, "%s%s", targCollection, tmpPtr);
02710 addKeyVal (&myDataObjInp->condInput, RSYNC_MODE_KW, IRODS_TO_IRODS);
02711 addKeyVal (&myDataObjInp->condInput, RSYNC_DEST_PATH_KW, targPath);
02712 }
02713
02714 rei->status = rsDataObjRsync (rsComm, myDataObjInp, &outParamArray);
02715
02716 if (outParamArray != NULL) {
02717 clearMsParamArray (outParamArray, 1);
02718 free (outParamArray);
02719 }
02720 if (myDataObjInp == &dataObjInp) {
02721 clearKeyVal (&myDataObjInp->condInput);
02722 }
02723
02724 if (rei->status >= 0) {
02725 fillIntInMsParam (outParam, rei->status);
02726 } else {
02727 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02728 "msiDataObjRsync: rsDataObjRsync failed for %s, status = %d",
02729 myDataObjInp->objPath,
02730 rei->status);
02731 }
02732
02733 return (rei->status);
02734 }
02735
02736
02737
02738
02739
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 int
02777 msiCollRsync (msParam_t *inpParam1, msParam_t *inpParam2,
02778 msParam_t *inpParam3, msParam_t *inpParam4, msParam_t *outParam,
02779 ruleExecInfo_t *rei)
02780 {
02781 rsComm_t *rsComm;
02782 dataObjInp_t dataObjInp;
02783 char *rsyncMode;
02784 char *srcColl = NULL;
02785 char *destColl = NULL;
02786
02787 RE_TEST_MACRO (" Calling msiCollRsync")
02788
02789 if (rei == NULL || rei->rsComm == NULL) {
02790 rodsLog (LOG_ERROR,
02791 "msiCollRsync: input rei or rsComm is NULL");
02792 return (SYS_INTERNAL_NULL_INPUT_ERR);
02793 }
02794
02795 rsComm = rei->rsComm;
02796
02797 bzero (&dataObjInp, sizeof (dataObjInp));
02798
02799
02800 srcColl = parseMspForStr (inpParam1);
02801
02802 if (srcColl == NULL) {
02803 rei->status = SYS_INVALID_FILE_PATH;
02804 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02805 "msiCollRsync: input inpParam1 error. status = %d", rei->status);
02806 return (rei->status);
02807 }
02808
02809
02810 destColl = parseMspForStr (inpParam2);
02811
02812 if (destColl == NULL) {
02813 rei->status = SYS_INVALID_FILE_PATH;
02814 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02815 "msiCollRsync: input inpParam2 error. status = %d", rei->status);
02816 return (rei->status);
02817 }
02818
02819 if ((rei->status = parseMspForCondInp (inpParam3, &dataObjInp.condInput,
02820 DEST_RESC_NAME_KW)) < 0) {
02821 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02822 "msiCollRsync: input inpParam3 error. status = %d", rei->status);
02823 return (rei->status);
02824 }
02825
02826 if ((rei->status = parseMspForCondInp (inpParam4, &dataObjInp.condInput,
02827 RSYNC_MODE_KW)) < 0) {
02828 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02829 "msiCollRsync: input inpParam4 error. status = %d", rei->status);
02830 return (rei->status);
02831 }
02832
02833
02834
02835
02836 rsyncMode = getValByKey (&dataObjInp.condInput, RSYNC_MODE_KW);
02837 if (rsyncMode == NULL) {
02838 rodsLog (LOG_ERROR,
02839 "msiCollRsync: RSYNC_MODE_KW input is missing");
02840 rei->status = USER_RSYNC_NO_MODE_INPUT_ERR;
02841 return (rei->status);
02842 }
02843
02844 if (strcmp (rsyncMode, IRODS_TO_LOCAL) == 0 ||
02845 strcmp (rsyncMode, LOCAL_TO_IRODS) == 0) {
02846 rodsLog (LOG_ERROR,
02847 "msiCollRsync: local/iRODS rsync not supported for %s",
02848 srcColl);
02849 rei->status = NO_LOCAL_FILE_RSYNC_IN_MSI;
02850 return (rei->status);
02851 }
02852
02853 rei->status = _rsCollRsync (rsComm, &dataObjInp, srcColl, destColl);
02854
02855 clearKeyVal (&dataObjInp.condInput);
02856
02857 if (rei->status >= 0) {
02858 fillIntInMsParam (outParam, rei->status);
02859 } else {
02860 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
02861 "msiCollRsync: rsDataObjRsync failed for %s, status = %d",
02862 srcColl,
02863 rei->status);
02864 }
02865
02866 return (rei->status);
02867 }
02868
02869 int
02870 _rsCollRsync (rsComm_t *rsComm, dataObjInp_t *dataObjInp,
02871 char *srcColl, char *destColl)
02872 {
02873 collInp_t openCollInp;
02874 collEnt_t *collEnt;
02875 int handleInx;
02876 char parPath[MAX_NAME_LEN], childPath[MAX_NAME_LEN];
02877 char destChildPath[MAX_NAME_LEN];
02878 msParamArray_t *outParamArray = NULL;
02879 int status = 0;
02880 int status1 = 0;
02881
02882 memset (&openCollInp, 0, sizeof (openCollInp));
02883 rstrcpy (openCollInp.collName, srcColl, MAX_NAME_LEN);
02884 openCollInp.flags = 0;
02885 handleInx = rsOpenCollection (rsComm, &openCollInp);
02886 if (handleInx < 0) {
02887 rodsLog (LOG_ERROR,
02888 "_rsCollRsync: rsOpenCollection of %s error. status = %d",
02889 openCollInp.collName, handleInx);
02890 return (handleInx);
02891 }
02892
02893 #if 0
02894 if (CollHandle[handleInx].rodsObjStat->specColl != NULL) {
02895 rodsLog (LOG_ERROR,
02896 "_rsCollRsync: unable to rsync mounted collection %s", srcColl);
02897 rsCloseCollection (rsComm, &handleInx);
02898 return (0);
02899 }
02900 #endif
02901
02902 rsMkCollR (rsComm, "/", destColl);
02903 while ((status1 = rsReadCollection (rsComm, &handleInx, &collEnt)) >= 0) {
02904 if (collEnt->objType == DATA_OBJ_T) {
02905 snprintf (dataObjInp->objPath, MAX_NAME_LEN, "%s/%s",
02906 srcColl, collEnt->dataName);
02907 snprintf (destChildPath, MAX_NAME_LEN, "%s/%s",
02908 destColl, collEnt->dataName);
02909 addKeyVal (&dataObjInp->condInput, RSYNC_DEST_PATH_KW,
02910 destChildPath);
02911 status = rsDataObjRsync (rsComm, dataObjInp, &outParamArray);
02912 if (outParamArray != NULL) {
02913 clearMsParamArray (outParamArray, 1);
02914 free (outParamArray);
02915 }
02916 } else if (collEnt->objType == COLL_OBJ_T) {
02917 if ((status = splitPathByKey (
02918 collEnt->collName, parPath, childPath, '/')) < 0) {
02919 rodsLogError (LOG_ERROR, status,
02920 "_rsCollRsync:: splitPathByKey for %s error, status = %d",
02921 collEnt->collName, status);
02922 return (status);
02923 }
02924 snprintf (destChildPath, MAX_NAME_LEN, "%s/%s",
02925 destColl, childPath);
02926
02927 status = _rsCollRsync (rsComm, dataObjInp, collEnt->collName,
02928 destChildPath);
02929 }
02930 free (collEnt);
02931 if (status < 0) break;
02932 }
02933 rsCloseCollection (rsComm, &handleInx);
02934 if (status1 < 0 && status1 != CAT_NO_ROWS_FOUND)
02935 return status1;
02936 else
02937 return status;
02938 }
02939
02940
02941
02942
02943
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 int
02991 msiExecCmd (msParam_t *inpParam1, msParam_t *inpParam2, msParam_t *inpParam3,
02992 msParam_t *inpParam4, msParam_t *inpParam5, msParam_t *outParam,
02993 ruleExecInfo_t *rei)
02994 {
02995 rsComm_t *rsComm;
02996 execCmd_t execCmdInp, *myExecCmdInp;
02997 execCmdOut_t *execCmdOut = NULL;
02998 char *tmpPtr;
02999
03000 RE_TEST_MACRO (" Calling msiExecCmd")
03001
03002 if (rei == NULL || rei->rsComm == NULL) {
03003 rodsLog (LOG_ERROR,
03004 "msiExecCmd: input rei or rsComm is NULL");
03005 return (SYS_INTERNAL_NULL_INPUT_ERR);
03006 }
03007
03008 rsComm = rei->rsComm;
03009
03010
03011 rei->status = parseMspForExecCmdInp (inpParam1, &execCmdInp,
03012 &myExecCmdInp);
03013
03014 if (rei->status < 0) {
03015 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03016 "msiExecCmd: input inpParam1 error. status = %d", rei->status);
03017 return (rei->status);
03018 }
03019
03020 if ((tmpPtr = parseMspForStr (inpParam2)) != NULL) {
03021 rstrcpy (myExecCmdInp->cmdArgv, tmpPtr, HUGE_NAME_LEN);
03022 }
03023
03024 if ((tmpPtr = parseMspForStr (inpParam3)) != NULL) {
03025 rstrcpy (myExecCmdInp->execAddr, tmpPtr, MAX_NAME_LEN);
03026 }
03027
03028 if ((tmpPtr = parseMspForStr (inpParam4)) != NULL) {
03029 rstrcpy (myExecCmdInp->hintPath, tmpPtr, MAX_NAME_LEN);
03030 }
03031
03032 if (parseMspForPosInt (inpParam5) > 0) {
03033 myExecCmdInp->addPathToArgv = 1;
03034 }
03035
03036 if (strlen (rei->ruleName) > 0 &&
03037 strcmp (rei->ruleName, EXEC_MY_RULE_KW) != 0) {
03038
03039 addKeyVal(&myExecCmdInp->condInput, EXEC_CMD_RULE_KW, rei->ruleName);
03040 }
03041 rei->status = rsExecCmd (rsComm, myExecCmdInp, &execCmdOut);
03042
03043 if (myExecCmdInp == &execCmdInp) {
03044 clearKeyVal (&myExecCmdInp->condInput);
03045 }
03046
03047 if (execCmdOut != NULL) {
03048 fillMsParam (outParam, NULL, ExecCmdOut_MS_T, execCmdOut, NULL);
03049 }
03050
03051 if (rei->status < 0) {
03052 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03053 "msiExecCmd: rsExecCmd failed for %s, status = %d",
03054 myExecCmdInp->cmd,
03055 rei->status);
03056 }
03057
03058 return (rei->status);
03059 }
03060
03061
03062
03063
03064
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 int
03122 msiCollRepl (msParam_t *collection, msParam_t *msKeyValStr, msParam_t *status,
03123 ruleExecInfo_t *rei)
03124 {
03125
03126 collInp_t collInpCache, *collInp;
03127 char *outBadKeyWd;
03128 int validKwFlags;
03129
03130
03131 rsComm_t *rsComm;
03132
03133
03134
03135
03136
03137 RE_TEST_MACRO (" Calling msiCollRepl")
03138
03139
03140 if (rei == NULL || rei->rsComm == NULL) {
03141 rodsLog (LOG_ERROR, "msiCollRepl: inp rei or rsComm is NULL.");
03142 return (SYS_INTERNAL_NULL_INPUT_ERR);
03143 }
03144
03145 rsComm = rei->rsComm;
03146
03147
03148
03149
03150 rei->status =
03151 parseMspForCollInp (collection, &collInpCache, &collInp, 0);
03152
03153 if (rei->status < 0) {
03154 rodsLog (LOG_ERROR,
03155 "msiCollRepl: input collection error. status = %d", rei->status);
03156 return (rei->status);
03157 }
03158
03159
03160
03161 #if 0
03162 rei->status = parseMspForCondInp (targetResc,
03163 &collInp->condInput, DEST_RESC_NAME_KW);
03164 #else
03165 validKwFlags = COLL_NAME_FLAG | DEST_RESC_NAME_FLAG |
03166 BACKUP_RESC_NAME_FLAG | RESC_NAME_FLAG | UPDATE_REPL_FLAG |
03167 REPL_NUM_FLAG | ALL_FLAG | IRODS_ADMIN_FLAG | VERIFY_CHKSUM_FLAG;
03168 rei->status = parseMsKeyValStrForCollInp (msKeyValStr, collInp,
03169 DEST_RESC_NAME_KW, validKwFlags, &outBadKeyWd);
03170 #endif
03171
03172 if (rei->status < 0) {
03173 if (outBadKeyWd != NULL) {
03174 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03175 "msiCollRepl: input keyWd - %s error. status = %d",
03176 outBadKeyWd, rei->status);
03177 free (outBadKeyWd);
03178 } else {
03179 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03180 "msiCollRepl: input msKeyValStr error. status = %d",
03181 rei->status);
03182 }
03183 return (rei->status);
03184 }
03185
03186
03187
03188
03189 rei->status = rsCollRepl (rsComm, collInp, NULL);
03190
03191
03192
03193
03194 fillIntInMsParam (status, rei->status);
03195
03196 return (rei->status);
03197 }
03198
03199
03200
03201
03202
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 int
03247 msiDataObjPutWithOptions (msParam_t *inpParam1, msParam_t *inpParam2,
03248 msParam_t *inpParam3,msParam_t *inpOverwriteParam,
03249 msParam_t *inpAllCopiesParam, msParam_t *outParam, ruleExecInfo_t *rei)
03250 {
03251 rsComm_t *rsComm;
03252 dataObjInp_t *dataObjInp, *myDataObjInp;
03253 msParamArray_t *myMsParamArray;
03254
03255 RE_TEST_MACRO (" Calling msiDataObjPut")
03256
03257 if (rei == NULL || rei->rsComm == NULL) {
03258 rodsLog (LOG_ERROR,
03259 "msiDataObjPut: input rei or rsComm is NULL");
03260 return (SYS_INTERNAL_NULL_INPUT_ERR);
03261 }
03262
03263 rsComm = rei->rsComm;
03264
03265 dataObjInp = (dataObjInp_t*)malloc (sizeof (dataObjInp_t));
03266
03267 rei->status = parseMspForDataObjInp (inpParam1, dataObjInp,
03268 &myDataObjInp, 1);
03269
03270 if (rei->status < 0) {
03271 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03272 "msiDataObjPut: input inpParam1 error. status = %d", rei->status);
03273 return (rei->status);
03274 }
03275
03276 rei->status = parseMspForCondInp (inpParam2, &dataObjInp->condInput,
03277 DEST_RESC_NAME_KW);
03278
03279 if (rei->status < 0) {
03280 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03281 "msiDataObjPut: input inpParam2 error. status = %d", rei->status);
03282 return (rei->status);
03283 }
03284
03285
03286 rei->status = parseMspForCondInp (inpParam3, &dataObjInp->condInput,
03287 LOCAL_PATH_KW);
03288
03289 if (rei->status < 0) {
03290 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03291 "msiDataObjPut: input inpParam3 error. status = %d", rei->status);
03292 return (rei->status);
03293 }
03294
03295 if (inpOverwriteParam != NULL &&
03296 strcmp((char*)inpOverwriteParam->inOutStruct, FORCE_FLAG_KW) == 0 )
03297 rei->status = parseMspForCondInp (inpOverwriteParam,
03298 &dataObjInp->condInput,FORCE_FLAG_KW);
03299
03300 if (inpAllCopiesParam !=NULL &&
03301 strcmp((char*)inpAllCopiesParam->inOutStruct, ALL_KW) == 0 )
03302 rei->status = parseMspForCondInp (inpAllCopiesParam,
03303 &dataObjInp->condInput,ALL_KW);
03304
03305 myMsParamArray = (msParamArray_t*)malloc (sizeof (msParamArray_t));
03306 memset (myMsParamArray, 0, sizeof (msParamArray_t));
03307
03308 rei->status = addMsParam (myMsParamArray, CL_PUT_ACTION, DataObjInp_MS_T,
03309 (void *) dataObjInp, NULL);
03310
03311 if (rei->status < 0) {
03312 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03313 "msiDataObjPut: addMsParam error. status = %d", rei->status);
03314 return (rei->status);
03315 }
03316
03317
03318 rei->status = sendAndRecvBranchMsg (rsComm, rsComm->apiInx,
03319 SYS_SVR_TO_CLI_MSI_REQUEST, (void *) myMsParamArray, NULL);
03320
03321 if (rei->status >= 0) {
03322 fillIntInMsParam (outParam, rei->status);
03323 } else {
03324 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03325 "msiDataObjPut: rsDataObjPut failed for %s, status = %d",
03326 dataObjInp->objPath,
03327 rei->status);
03328 }
03329
03330 return (rei->status);
03331 }
03332
03333
03334
03335
03336
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 int
03374 msiDataObjReplWithOptions (msParam_t *inpParam1, msParam_t *inpParam2,
03375 msParam_t *inpParam3, msParam_t *outParam, ruleExecInfo_t *rei)
03376 {
03377 rsComm_t *rsComm;
03378 dataObjInp_t dataObjInp, *myDataObjInp;
03379 transferStat_t *transStat = NULL;
03380
03381 RE_TEST_MACRO (" Calling msiDataObjReplWithOptions")
03382
03383 if (rei == NULL || rei->rsComm == NULL) {
03384 rodsLog (LOG_ERROR,
03385 "msiDataObjReplWithOptions: input rei or rsComm is NULL");
03386 return (SYS_INTERNAL_NULL_INPUT_ERR);
03387 }
03388
03389 rsComm = rei->rsComm;
03390
03391
03392 rei->status = parseMspForDataObjInp (inpParam1, &dataObjInp,
03393 &myDataObjInp, 0);
03394
03395 if (rei->status < 0) {
03396 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03397 "msiDataObjReplWithOptions: input inpParam1 error. status = %d",
03398 rei->status);
03399 return (rei->status);
03400 }
03401
03402 rei->status = parseMspForCondInp (inpParam2, &myDataObjInp->condInput,
03403 DEST_RESC_NAME_KW);
03404
03405 if (rei->status < 0) {
03406 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03407 "msiDataObjReplWithOptions: input inpParam2 error. status = %d",
03408 rei->status);
03409 return (rei->status);
03410 }
03411
03412 if ((rei->status = parseMspForCondKw (inpParam3, &myDataObjInp->condInput))
03413 < 0) {
03414 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03415 "msiDataObjReplWithOptions: input inpParam3 error. status = %d",
03416 rei->status);
03417 return (rei->status);
03418 }
03419
03420 rei->status = rsDataObjRepl (rsComm, myDataObjInp, &transStat);
03421
03422 if (myDataObjInp == &dataObjInp) {
03423 clearKeyVal (&myDataObjInp->condInput);
03424 }
03425
03426 if (transStat != NULL) {
03427 free (transStat);
03428 }
03429
03430 if (rei->status >= 0) {
03431 fillIntInMsParam (outParam, rei->status);
03432 } else {
03433 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03434 "msiDataObjReplWithOptions: rsDataObjRepl failed %s, status = %d",
03435 myDataObjInp->objPath, rei->status);
03436 }
03437
03438 return (rei->status);
03439 }
03440
03441
03442
03443
03444
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 int
03484 msiDataObjChksumWithOptions (msParam_t *inpParam1, msParam_t *inpParam2,
03485 msParam_t *inpParam3, msParam_t *outParam, ruleExecInfo_t *rei)
03486 {
03487 rsComm_t *rsComm;
03488 dataObjInp_t dataObjInp, *myDataObjInp;
03489 char *chksum = NULL;
03490
03491 RE_TEST_MACRO (" Calling msiDataObjChksumWithOptions")
03492
03493 if (rei == NULL || rei->rsComm == NULL) {
03494 rodsLog (LOG_ERROR,
03495 "msiDataObjChksumRepl: input rei or rsComm is NULL");
03496 return (SYS_INTERNAL_NULL_INPUT_ERR);
03497 }
03498
03499 rsComm = rei->rsComm;
03500
03501
03502 rei->status = parseMspForDataObjInp (inpParam1, &dataObjInp,
03503 &myDataObjInp, 1);
03504
03505 if (rei->status < 0) {
03506 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03507 "msiDataObjChksumWithOptions: input inpParam1 error. status = %d",
03508 rei->status);
03509 return (rei->status);
03510 }
03511
03512 if ((rei->status = parseMspForCondKw (inpParam2,
03513 &myDataObjInp->condInput)) < 0) {
03514 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03515 "msiDataObjChksumWithOptions: input inpParam2 error. status = %d",
03516 rei->status);
03517 return (rei->status);
03518 }
03519
03520 if (inpParam3 != NULL && strcmp( inpParam3->type, STR_MS_T) == 0) {
03521 if (strcmp ((char *) inpParam3->inOutStruct, CHKSUM_ALL_KW) == 0) {
03522 if ((rei->status = parseMspForCondKw (inpParam3,
03523 &myDataObjInp->condInput)) < 0) {
03524 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03525 "msiDataObjChksumWithOptions: input inpParam3 error.stat=%d",
03526 rei->status);
03527 return (rei->status);
03528 }
03529 } else {
03530
03531 if ((rei->status = parseMspForCondInp (inpParam3,
03532 &myDataObjInp->condInput, REPL_NUM_KW)) < 0) {
03533 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03534 "msiDataObjChksumWithOptions: input inpParam3 error.stat=%d",
03535 rei->status);
03536 return (rei->status);
03537 }
03538 }
03539 }
03540 rei->status = rsDataObjChksum (rsComm, myDataObjInp, &chksum);
03541
03542 if (myDataObjInp == &dataObjInp) {
03543 clearKeyVal (&myDataObjInp->condInput);
03544 }
03545
03546 if (rei->status >= 0) {
03547 fillStrInMsParam (outParam, chksum);
03548 free (chksum);
03549 } else {
03550 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03551 "msiDataObjChksumWithOptions: rsDataObjChksum failed for %s,stat=%d",
03552 myDataObjInp->objPath, rei->status);
03553 }
03554
03555 return (rei->status);
03556 }
03557
03558
03559
03560
03561
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 int
03598 msiTarFileExtract (msParam_t *inpParam1, msParam_t *inpParam2, msParam_t *inpParam3, msParam_t *outParam, ruleExecInfo_t *rei)
03599 {
03600 rsComm_t *rsComm;
03601 structFileExtAndRegInp_t structFileExtAndRegInp,
03602 *myStructFileExtAndRegInp;
03603 keyValPair_t regParam;
03604 modDataObjMeta_t modDataObjMetaInp;
03605 int rc1;
03606 char origDataType[NAME_LEN];
03607
03608 RE_TEST_MACRO (" Calling msiTarFileExtract")
03609
03610 if (rei == NULL || rei->rsComm == NULL) {
03611 rodsLog (LOG_ERROR,
03612 "msiTarFileExtract: input rei or rsComm is NULL");
03613 rei->status = SYS_INTERNAL_NULL_INPUT_ERR;
03614 return (rei->status);
03615 }
03616
03617 rsComm = rei->rsComm;
03618
03619
03620
03621
03622
03623 if ( inpParam1 == NULL || inpParam2 == NULL ) {
03624 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03625 "msiTarFileExtract: input Param1 and/or Param2 are NULL");
03626 rei->status = SYS_INTERNAL_NULL_INPUT_ERR;
03627 return (rei->status);
03628 }
03629
03630 if (strcmp (inpParam1->type, STR_MS_T) == 0) {
03631 bzero (&structFileExtAndRegInp, sizeof (structFileExtAndRegInp));
03632 myStructFileExtAndRegInp = &structFileExtAndRegInp;
03633 strncpy ((char*)myStructFileExtAndRegInp->objPath, (char*)inpParam1->inOutStruct,
03634 MAX_NAME_LEN);
03635 } else if (strcmp (inpParam1->type, StructFileExtAndRegInp_MS_T) == 0) {
03636 myStructFileExtAndRegInp =
03637 (structFileExtAndRegInp_t *) inpParam1->inOutStruct;
03638 } else {
03639 rei->status = UNKNOWN_PARAM_IN_RULE_ERR;
03640 return (rei->status);
03641 }
03642
03643 if ( strcmp (inpParam2->type, STR_MS_T) == 0 ) {
03644 if (strcmp ((char *) inpParam2->inOutStruct, "null") != 0) {
03645 strncpy ((char*)myStructFileExtAndRegInp->collection,
03646 (char*)inpParam2->inOutStruct, MAX_NAME_LEN);
03647 }
03648 } else {
03649 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03650 "msiTarFileExtract: Unsupported input Param2 type %s",
03651 inpParam2->type);
03652 rei->status = UNKNOWN_PARAM_IN_RULE_ERR;
03653 return (rei->status);
03654 }
03655
03656 if ( strcmp (inpParam3->type, STR_MS_T) == 0 && inpParam3 != NULL &&
03657 strcmp ( (char *) inpParam3->inOutStruct, "null") != 0) {
03658 addKeyVal(&myStructFileExtAndRegInp->condInput, DEST_RESC_NAME_KW,
03659 (char *) inpParam3->inOutStruct);
03660
03661 addKeyVal(&myStructFileExtAndRegInp->condInput, RESC_NAME_KW,
03662 (char *) inpParam3->inOutStruct);
03663 }
03664
03665 if (rei->doi != NULL) {
03666
03667
03668 strncpy(origDataType, rei->doi->dataType, NAME_LEN);
03669
03670 memset(®Param, 0, sizeof(regParam));
03671 addKeyVal(®Param, DATA_TYPE_KW, "tar file");
03672 modDataObjMetaInp.dataObjInfo = rei->doi;
03673 modDataObjMetaInp.regParam = ®Param;
03674 rc1 = rsModDataObjMeta(rsComm, &modDataObjMetaInp);
03675 }
03676
03677
03678 rei->status = rsStructFileExtAndReg (rsComm, myStructFileExtAndRegInp);
03679 if ( rei->status < 0 && rei->doi != NULL) {
03680 rodsLog (LOG_ERROR, "msiTarFileExtract: tar file extraction failed");
03681
03682
03683 memset(®Param, 0, sizeof(regParam));
03684 addKeyVal(®Param, DATA_TYPE_KW, origDataType);
03685 rc1 = rsModDataObjMeta(rsComm, &modDataObjMetaInp);
03686 }
03687
03688 fillIntInMsParam (outParam, rei->status);
03689
03690 return (rei->status);
03691 }
03692
03693
03694
03695
03696
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 int
03733 msiTarFileCreate (msParam_t *inpParam1, msParam_t *inpParam2, msParam_t *inpParam3, msParam_t *inpParam4, ruleExecInfo_t *rei)
03734 {
03735 rsComm_t *rsComm;
03736 structFileExtAndRegInp_t structFileExtAndRegInp,
03737 *myStructFileExtAndRegInp;
03738
03739 RE_TEST_MACRO (" Calling msiTarFileCreate")
03740
03741 if (rei == NULL || rei->rsComm == NULL) {
03742 rodsLog (LOG_ERROR,
03743 "msiTarFileCreate: input rei or rsComm is NULL");
03744 rei->status = SYS_INTERNAL_NULL_INPUT_ERR;
03745 return (rei->status);
03746 }
03747
03748 rsComm = rei->rsComm;
03749
03750
03751
03752
03753
03754 if ( inpParam1 == NULL || inpParam2 == NULL ) {
03755 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03756 "msiTarFileCreate: input Param1 and/or Param2 are NULL");
03757 rei->status = SYS_INTERNAL_NULL_INPUT_ERR;
03758 return (rei->status);
03759 }
03760
03761 if (strcmp (inpParam1->type, STR_MS_T) == 0) {
03762 bzero (&structFileExtAndRegInp, sizeof (structFileExtAndRegInp));
03763 myStructFileExtAndRegInp = &structFileExtAndRegInp;
03764 strncpy ((char*)myStructFileExtAndRegInp->objPath, (char*)inpParam1->inOutStruct,
03765 MAX_NAME_LEN);
03766 } else if (strcmp (inpParam1->type, StructFileExtAndRegInp_MS_T) == 0) {
03767 myStructFileExtAndRegInp =
03768 (structFileExtAndRegInp_t *) inpParam1->inOutStruct;
03769 } else {
03770 rei->status = UNKNOWN_PARAM_IN_RULE_ERR;
03771 return (rei->status);
03772 }
03773
03774 if ( strcmp (inpParam2->type, STR_MS_T) == 0 ) {
03775 if (strcmp ((char *) inpParam2->inOutStruct, "null") != 0) {
03776 strncpy ((char*)myStructFileExtAndRegInp->collection,
03777 (char*)inpParam2->inOutStruct, MAX_NAME_LEN);
03778 }
03779 } else {
03780 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03781 "msiTarFileExtract: Unsupported input Param2 type %s",
03782 inpParam2->type);
03783 rei->status = UNKNOWN_PARAM_IN_RULE_ERR;
03784 return (rei->status);
03785 }
03786
03787 if ( strcmp (inpParam3->type, STR_MS_T) == 0 && inpParam3 != NULL &&
03788 strcmp ( (char *) inpParam3->inOutStruct, "null") != 0) {
03789 addKeyVal(&myStructFileExtAndRegInp->condInput, DEST_RESC_NAME_KW,
03790 (char *) inpParam3->inOutStruct);
03791 }
03792
03793 if ( strcmp (inpParam4->type, STR_MS_T) == 0 && inpParam4 != NULL &&
03794 strcmp ( (char *) inpParam4->inOutStruct, "force") == 0) {
03795 addKeyVal(&myStructFileExtAndRegInp->condInput, FORCE_FLAG_KW, "");
03796 }
03797
03798
03799 rei->status = rsStructFileBundle (rsComm, myStructFileExtAndRegInp);
03800
03801 return (rei->status);
03802
03803 }
03804
03805
03806
03807
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 int
03851 msiPhyBundleColl (msParam_t *inpParam1, msParam_t *inpParam2, msParam_t *outParam, ruleExecInfo_t *rei)
03852 {
03853 rsComm_t *rsComm;
03854 structFileExtAndRegInp_t structFileExtAndRegInp,
03855 *myStructFileExtAndRegInp;
03856 int len1, len2;
03857 char *inpStr, rescName[NAME_LEN], *pstr1, *pstr2, attr[MAX_NAME_LEN];
03858
03859 RE_TEST_MACRO (" Calling msiPhyBundleColl")
03860
03861 if (rei == NULL || rei->rsComm == NULL) {
03862 rodsLog (LOG_ERROR,
03863 "msiPhyBundleColl: input rei or rsComm is NULL");
03864 rei->status = SYS_INTERNAL_NULL_INPUT_ERR;
03865 return (rei->status);
03866 }
03867
03868 rsComm = rei->rsComm;
03869
03870
03871
03872
03873
03874
03875 if ( inpParam1 == NULL) {
03876 rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, rei->status,
03877 "msiPhyBundleColl: input Param1 is NULL");
03878 rei->status = SYS_INTERNAL_NULL_INPUT_ERR;
03879 return (rei->status);
03880 }
03881
03882
03883 if (strcmp (inpParam1->type, STR_MS_T) == 0) {
03884 bzero (&structFileExtAndRegInp, sizeof (structFileExtAndRegInp));
03885 myStructFileExtAndRegInp = &structFileExtAndRegInp;
03886 strncpy ((char*)myStructFileExtAndRegInp->collection, (char*)inpParam1->inOutStruct,
03887 MAX_NAME_LEN);
03888
03889 } else if (strcmp (inpParam1->type, StructFileExtAndRegInp_MS_T) == 0) {
03890 myStructFileExtAndRegInp =
03891 (structFileExtAndRegInp_t *) inpParam1->inOutStruct;
03892
03893 } else {
03894
03895 rei->status = UNKNOWN_PARAM_IN_RULE_ERR;
03896 return (rei->status);
03897 }
03898
03899 if( strcmp (inpParam2->type, STR_MS_T) == 0 && inpParam2 != NULL &&
03900
03901 strcmp ( (char *) inpParam2->inOutStruct, "null") != 0) {
03902 inpStr = (char *) inpParam2->inOutStruct;
03903
03904 pstr1 = strstr(inpStr, "++++");
03905 if ( pstr1 != NULL ) {
03906 len1 = strlen(inpStr) - strlen(pstr1);
03907 if ( len1 > 0 ) {
03908 strncpy(rescName, inpStr, len1);
03909 addKeyVal(&myStructFileExtAndRegInp->condInput, DEST_RESC_NAME_KW, rescName);
03910 }
03911 pstr2 = strstr(pstr1 + 4, "=");
03912 if ( pstr2 != NULL ) {
03913 len2 = strlen(pstr1 + 4) - strlen(pstr2);
03914 memset(attr, 0, sizeof(attr));
03915 strncpy(attr, pstr1 + 4, len2);
03916 if ( len2 > 0 ) {
03917 if ( strcmp(attr, "N") == 0 ) {
03918 addKeyVal(&myStructFileExtAndRegInp->condInput, MAX_SUB_FILE_KW, pstr2 + 1);
03919 }
03920 }
03921 }
03922 }
03923 else {
03924 addKeyVal(&myStructFileExtAndRegInp->condInput, DEST_RESC_NAME_KW, inpStr);
03925 }
03926
03927
03928 }
03929
03930
03931 rei->status = rsPhyBundleColl (rsComm, myStructFileExtAndRegInp);
03932
03933
03934 fillIntInMsParam (outParam, rei->status);
03935
03936
03937 return (rei->status);
03938
03939 }
03940