00001
00002
00003
00004
00005
00006
00007
00008 #include "phyPathReg.h"
00009 #include "rodsLog.h"
00010 #include "icatDefines.h"
00011 #include "objMetaOpr.h"
00012 #include "dataObjOpr.h"
00013 #include "collection.h"
00014 #include "specColl.h"
00015 #include "resource.h"
00016 #include "physPath.h"
00017 #include "rsGlobalExtern.h"
00018 #include "rcGlobalExtern.h"
00019 #include "reGlobalsExtern.h"
00020 #include "miscServerFunct.h"
00021 #include "apiHeaderAll.h"
00022
00023
00024
00025 #include "eirods_resource_backport.h"
00026 #include "eirods_resource_redirect.h"
00027 #include "eirods_hierarchy_parser.h"
00028
00029
00030
00031 #include <iostream>
00032
00033
00034
00035
00036 static pathnamePatterns_t *ExcludePatterns = NULL;
00037
00038
00039 pathnamePatterns_t *
00040 readPathnamePatternsFromFile(rsComm_t *rsComm, char *filename, char* );
00041
00042
00043
00044
00045
00046 int
00047 phyPathRegNoChkPerm (rsComm_t *rsComm, dataObjInp_t *phyPathRegInp)
00048 {
00049 int status;
00050
00051 addKeyVal (&phyPathRegInp->condInput, NO_CHK_FILE_PERM_KW, "");
00052
00053 status = irsPhyPathReg (rsComm, phyPathRegInp);
00054 return (status);
00055 }
00056
00057 int
00058 rsPhyPathReg (rsComm_t *rsComm, dataObjInp_t *phyPathRegInp)
00059 {
00060 int status;
00061
00062 if (getValByKey (&phyPathRegInp->condInput, NO_CHK_FILE_PERM_KW) != NULL &&
00063 rsComm->proxyUser.authInfo.authFlag < LOCAL_PRIV_USER_AUTH) {
00064 return SYS_NO_API_PRIV;
00065 }
00066
00067 status = irsPhyPathReg (rsComm, phyPathRegInp);
00068 return (status);
00069 }
00070
00071 int
00072 irsPhyPathReg (rsComm_t *rsComm, dataObjInp_t *phyPathRegInp)
00073 {
00074 int status;
00075 rescGrpInfo_t *rescGrpInfo = NULL;
00076 rodsServerHost_t *rodsServerHost = NULL;
00077 int remoteFlag;
00078
00079 rodsHostAddr_t addr;
00080 char *tmpStr = NULL;
00081
00082
00083
00084
00085
00086
00087
00088 int local = LOCAL_HOST;
00089 rodsServerHost_t* host = 0;
00090 std::string hier;
00091 char* tmp_hier = getValByKey( &phyPathRegInp->condInput, RESC_HIER_STR_KW );
00092 if( NULL == tmp_hier ) {
00093 eirods::error ret = eirods::resource_redirect( eirods::EIRODS_CREATE_OPERATION, rsComm,
00094 phyPathRegInp, hier, host, local );
00095 if( !ret.ok() ) {
00096 std::stringstream msg;
00097 msg << __FUNCTION__;
00098 msg << " :: failed in eirods::resource_redirect for [";
00099 msg << phyPathRegInp->objPath << "]";
00100 eirods::log( PASSMSG( msg.str(), ret ) );
00101 return ret.code();
00102 }
00103
00104
00105
00106 addKeyVal( &phyPathRegInp->condInput, RESC_HIER_STR_KW, hier.c_str() );
00107
00108 } else {
00109 hier = tmp_hier;
00110 }
00111
00112
00113 if ((tmpStr = getValByKey (&phyPathRegInp->condInput,
00114 COLLECTION_TYPE_KW)) != NULL && strcmp (tmpStr, UNMOUNT_STR) == 0) {
00115 status = unmountFileDir (rsComm, phyPathRegInp);
00116 return (status);
00117 } else if (tmpStr != NULL && (strcmp (tmpStr, HAAW_STRUCT_FILE_STR) == 0 ||
00118 strcmp (tmpStr, TAR_STRUCT_FILE_STR) == 0)) {
00119 status = structFileReg (rsComm, phyPathRegInp);
00120 return (status);
00121 } else if (tmpStr != NULL && strcmp (tmpStr, LINK_POINT_STR) == 0) {
00122 status = linkCollReg (rsComm, phyPathRegInp);
00123 return (status);
00124 }
00125
00126
00127
00128
00129
00130
00131
00132 std::string resc_name;
00133
00134
00135 eirods::hierarchy_parser parser;
00136 parser.set_string( hier );
00137 parser.first_resc( resc_name );
00138
00139 rescGrpInfo = new rescGrpInfo_t;
00140 rescGrpInfo->rescInfo = new rescInfo_t;
00141 eirods::error err = eirods::get_resc_grp_info( resc_name, *rescGrpInfo );
00142 if( !err.ok() ) {
00143 eirods::log( PASS( false, -1, "irsPhyPathReg - failed", err ) );
00144 delete rescGrpInfo->rescInfo;
00145 delete rescGrpInfo;
00146 return -1;
00147 }
00148
00149 std::string last_resc;
00150 parser.last_resc( last_resc );
00151
00152 std::string location;
00153 eirods::error ret = eirods::get_resource_property< std::string >( last_resc, "location", location );
00154 if( !ret.ok() ) {
00155 eirods::log( PASSMSG( "irsPhyPathReg - failed in get_resource_property", ret ) );
00156 delete rescGrpInfo->rescInfo;
00157 delete rescGrpInfo;
00158 return -1;
00159 }
00160
00161 memset (&addr, 0, sizeof (addr));
00162 rstrcpy (addr.hostAddr, location.c_str(), LONG_NAME_LEN);
00163 remoteFlag = resolveHost (&addr, &rodsServerHost);
00164
00165 if (remoteFlag == LOCAL_HOST) {
00166
00167 status = _rsPhyPathReg (rsComm, phyPathRegInp, rescGrpInfo, rodsServerHost );
00168
00169
00170
00171
00172 } else if (remoteFlag == REMOTE_HOST) {
00173 status = remotePhyPathReg (rsComm, phyPathRegInp, rodsServerHost);
00174
00175 } else {
00176 if (remoteFlag < 0) {
00177 delete rescGrpInfo->rescInfo;
00178 delete rescGrpInfo;
00179 return (remoteFlag);
00180 } else {
00181 rodsLog (LOG_ERROR,
00182 "rsPhyPathReg: resolveHost returned unrecognized value %d",
00183 remoteFlag);
00184 delete rescGrpInfo->rescInfo;
00185 delete rescGrpInfo;
00186 return (SYS_UNRECOGNIZED_REMOTE_FLAG);
00187 }
00188 }
00189
00190 delete rescGrpInfo->rescInfo;
00191 delete rescGrpInfo;
00192 return (status);
00193 }
00194
00195 int
00196 remotePhyPathReg (rsComm_t *rsComm, dataObjInp_t *phyPathRegInp,
00197 rodsServerHost_t *rodsServerHost)
00198 {
00199 int status;
00200
00201 if (rodsServerHost == NULL) {
00202 rodsLog (LOG_ERROR,
00203 "remotePhyPathReg: Invalid rodsServerHost");
00204 return SYS_INVALID_SERVER_HOST;
00205 }
00206
00207 if ((status = svrToSvrConnect (rsComm, rodsServerHost)) < 0) {
00208 return status;
00209 }
00210
00211 status = rcPhyPathReg (rodsServerHost->conn, phyPathRegInp);
00212
00213 if (status < 0) {
00214 rodsLog (LOG_ERROR,
00215 "remotePhyPathReg: rcPhyPathReg failed for %s",
00216 phyPathRegInp->objPath);
00217 }
00218
00219 return (status);
00220 }
00221
00222 int
00223 _rsPhyPathReg (rsComm_t *rsComm, dataObjInp_t *phyPathRegInp,
00224 rescGrpInfo_t *rescGrpInfo, rodsServerHost_t *rodsServerHost)
00225 {
00226 int status = 0;
00227 fileOpenInp_t chkNVPathPermInp;
00228 char *tmpFilePath = 0;
00229 char filePath[MAX_NAME_LEN];
00230 dataObjInfo_t dataObjInfo;
00231 char *tmpStr = NULL;
00232 int chkType = 0;
00233 char *excludePatternFile = 0;
00234
00235 if ((tmpFilePath = getValByKey (&phyPathRegInp->condInput, FILE_PATH_KW))== NULL) {
00236 rodsLog( LOG_ERROR,"_rsPhyPathReg: No filePath input for %s",
00237 phyPathRegInp->objPath );
00238 return (SYS_INVALID_FILE_PATH);
00239 } else {
00240
00241 rstrcpy (filePath, tmpFilePath, MAX_NAME_LEN);
00242 }
00243
00244
00245 memset (&dataObjInfo, 0, sizeof (dataObjInfo));
00246 rstrcpy (dataObjInfo.objPath, phyPathRegInp->objPath, MAX_NAME_LEN);
00247 rstrcpy (dataObjInfo.filePath, filePath, MAX_NAME_LEN);
00248 dataObjInfo.rescInfo = rescGrpInfo->rescInfo;
00249 rstrcpy (dataObjInfo.rescName, rescGrpInfo->rescInfo->rescName, NAME_LEN);
00250
00251 char* resc_hier = getValByKey( &phyPathRegInp->condInput, RESC_HIER_STR_KW );
00252 if( resc_hier ) {
00253 rstrcpy (dataObjInfo.rescHier, resc_hier, MAX_NAME_LEN);
00254 } else {
00255 rodsLog( LOG_NOTICE, "_rsPhyPathReg :: RESC_HIER_STR_KW is NULL" );
00256 return -1;
00257 }
00258
00259 if( getValByKey (&phyPathRegInp->condInput, NO_CHK_FILE_PERM_KW) == NULL &&
00260 (chkType = getchkPathPerm (rsComm, phyPathRegInp, &dataObjInfo)) != NO_CHK_PATH_PERM) {
00261
00262 memset (&chkNVPathPermInp, 0, sizeof (chkNVPathPermInp));
00263
00264 rstrcpy (chkNVPathPermInp.fileName, filePath, MAX_NAME_LEN);
00265 chkNVPathPermInp.fileType = static_cast< fileDriverType_t>( -1 );
00266
00267
00268
00269 std::string location;
00270 eirods::error ret = eirods::get_loc_for_hier_string( resc_hier, location );
00271 if( !ret.ok() ) {
00272 eirods::log( PASSMSG( "_rsPhyPathReg - failed in get_loc_for_hier_String", ret ) );
00273 return -1;
00274 }
00275
00276 rstrcpy (chkNVPathPermInp.addr.hostAddr, location.c_str(), NAME_LEN );
00277 status = chkFilePathPerm (rsComm, &chkNVPathPermInp, rodsServerHost,chkType);
00278
00279 if (status < 0) {
00280 rodsLog (LOG_ERROR,
00281 "_rsPhyPathReg: chkFilePathPerm error for %s",
00282 phyPathRegInp->objPath);
00283 return (SYS_NO_PATH_PERMISSION);
00284 }
00285 } else {
00286 status = 0;
00287 }
00288
00289 if (getValByKey (&phyPathRegInp->condInput, COLLECTION_KW) != NULL) {
00290 excludePatternFile = getValByKey(&phyPathRegInp->condInput, EXCLUDE_FILE_KW);
00291 if (excludePatternFile != NULL) {
00292 ExcludePatterns = readPathnamePatternsFromFile(rsComm,
00293 excludePatternFile,
00294 resc_hier);
00295 }
00296
00297 status = dirPathReg (rsComm, phyPathRegInp, filePath, rescGrpInfo->rescInfo);
00298 if (excludePatternFile != NULL) {
00299 freePathnamePatterns(ExcludePatterns);
00300 ExcludePatterns = NULL;
00301 }
00302
00303 } else if ((tmpStr = getValByKey (&phyPathRegInp->condInput, COLLECTION_TYPE_KW)) != NULL && strcmp (tmpStr, MOUNT_POINT_STR) == 0) {
00304
00305 status = mountFileDir (rsComm, phyPathRegInp, filePath, rescGrpInfo->rescInfo);
00306
00307 } else {
00308 if (getValByKey (&phyPathRegInp->condInput, REG_REPL_KW) != NULL) {
00309 status = filePathRegRepl (rsComm, phyPathRegInp, filePath, rescGrpInfo->rescInfo);
00310
00311 } else {
00312 status = filePathReg (rsComm, phyPathRegInp, filePath,rescGrpInfo->rescInfo);
00313 }
00314 }
00315
00316 return (status);
00317 }
00318
00319 int
00320 filePathRegRepl (rsComm_t *rsComm, dataObjInp_t *phyPathRegInp, char *filePath,
00321 rescInfo_t *rescInfo)
00322 {
00323 dataObjInfo_t destDataObjInfo, *dataObjInfoHead = NULL;
00324 regReplica_t regReplicaInp;
00325 char *rescGroupName = NULL;
00326 int status;
00327
00328 status = getDataObjInfo (rsComm, phyPathRegInp, &dataObjInfoHead,
00329 ACCESS_READ_OBJECT, 0);
00330
00331 if (status < 0) {
00332 rodsLog (LOG_ERROR,
00333 "filePathRegRepl: getDataObjInfo for %s", phyPathRegInp->objPath);
00334 return (status);
00335 }
00336 status = sortObjInfoForOpen (rsComm, &dataObjInfoHead, NULL, 0);
00337 if (status < 0 || NULL == dataObjInfoHead ) return status;
00338
00339 destDataObjInfo = *dataObjInfoHead;
00340 rstrcpy (destDataObjInfo.filePath, filePath, MAX_NAME_LEN);
00341 destDataObjInfo.rescInfo = rescInfo;
00342 rstrcpy (destDataObjInfo.rescName, rescInfo->rescName, NAME_LEN);
00343 if ((rescGroupName = getValByKey (&phyPathRegInp->condInput,
00344 RESC_GROUP_NAME_KW)) != NULL) {
00345 rstrcpy (destDataObjInfo.rescGroupName, rescGroupName, NAME_LEN);
00346 }
00347 memset (®ReplicaInp, 0, sizeof (regReplicaInp));
00348 regReplicaInp.srcDataObjInfo = dataObjInfoHead;
00349 regReplicaInp.destDataObjInfo = &destDataObjInfo;
00350 if (getValByKey (&phyPathRegInp->condInput, SU_CLIENT_USER_KW) != NULL) {
00351 addKeyVal (®ReplicaInp.condInput, SU_CLIENT_USER_KW, "");
00352 addKeyVal (®ReplicaInp.condInput, IRODS_ADMIN_KW, "");
00353 } else if (getValByKey (&phyPathRegInp->condInput,
00354 IRODS_ADMIN_KW) != NULL) {
00355 addKeyVal (®ReplicaInp.condInput, IRODS_ADMIN_KW, "");
00356 }
00357 status = rsRegReplica (rsComm, ®ReplicaInp);
00358 clearKeyVal (®ReplicaInp.condInput);
00359 freeAllDataObjInfo (dataObjInfoHead);
00360
00361 return status;
00362 }
00363
00364 int
00365 filePathReg (rsComm_t *rsComm, dataObjInp_t *phyPathRegInp, char *filePath,
00366 rescInfo_t *rescInfo)
00367 {
00368 dataObjInfo_t dataObjInfo;
00369 int status;
00370 char *rescGroupName = NULL;
00371 char *chksum;
00372
00373 initDataObjInfoWithInp (&dataObjInfo, phyPathRegInp);
00374 if ((rescGroupName = getValByKey (&phyPathRegInp->condInput,
00375 RESC_GROUP_NAME_KW)) != NULL) {
00376 rstrcpy (dataObjInfo.rescGroupName, rescGroupName, NAME_LEN);
00377 }
00378 dataObjInfo.replStatus = NEWLY_CREATED_COPY;
00379 dataObjInfo.rescInfo = rescInfo;
00380 rstrcpy (dataObjInfo.rescName, rescInfo->rescName, NAME_LEN);
00381
00382 char* resc_hier = getValByKey( &phyPathRegInp->condInput, RESC_HIER_STR_KW );
00383 if( !resc_hier ) {
00384 rodsLog( LOG_NOTICE, "filePathReg - RESC_HIER_STR_KW is NULL" );
00385 return -1;
00386 }
00387
00388 rstrcpy (dataObjInfo.rescHier, resc_hier, MAX_NAME_LEN);
00389
00390 if (dataObjInfo.dataSize <= 0 &&
00391 (dataObjInfo.dataSize = getSizeInVault (rsComm, &dataObjInfo)) < 0 &&
00392 dataObjInfo.dataSize != UNKNOWN_FILE_SZ) {
00393 status = (int) dataObjInfo.dataSize;
00394 rodsLog (LOG_ERROR,
00395 "filePathReg: getSizeInVault for %s failed, status = %d",
00396 dataObjInfo.objPath, status);
00397 return (status);
00398 }
00399
00400 if ((chksum = getValByKey (&phyPathRegInp->condInput,
00401 REG_CHKSUM_KW)) != NULL) {
00402 rstrcpy (dataObjInfo.chksum, chksum, NAME_LEN);
00403 }
00404 else if ((chksum = getValByKey (&phyPathRegInp->condInput,
00405 VERIFY_CHKSUM_KW)) != NULL) {
00406 status = _dataObjChksum (rsComm, &dataObjInfo, &chksum);
00407 if (status < 0) {
00408 rodsLog (LOG_ERROR,
00409 "rodsPathReg: _dataObjChksum for %s failed, status = %d",
00410 dataObjInfo.objPath, status);
00411 return (status);
00412 }
00413 rstrcpy (dataObjInfo.chksum, chksum, NAME_LEN);
00414 }
00415
00416 status = svrRegDataObj (rsComm, &dataObjInfo);
00417 if (status < 0) {
00418 rodsLog (LOG_ERROR,
00419 "filePathReg: rsRegDataObj for %s failed, status = %d",
00420 dataObjInfo.objPath, status);
00421 } else {
00422 ruleExecInfo_t rei;
00423 initReiWithDataObjInp (&rei, rsComm, phyPathRegInp);
00424 rei.doi = &dataObjInfo;
00425 rei.status = status;
00426 rei.status = applyRule ("acPostProcForFilePathReg", NULL, &rei,
00427 NO_SAVE_REI);
00428 }
00429
00430 return (status);
00431 }
00432
00433 int
00434 dirPathReg (rsComm_t *rsComm, dataObjInp_t *phyPathRegInp, char *filePath,
00435 rescInfo_t *rescInfo )
00436 {
00437 collInp_t collCreateInp;
00438 fileOpendirInp_t fileOpendirInp;
00439 fileClosedirInp_t fileClosedirInp;
00440 int status;
00441 int dirFd;
00442 dataObjInp_t subPhyPathRegInp;
00443 fileReaddirInp_t fileReaddirInp;
00444 rodsDirent_t *rodsDirent = NULL;
00445 rodsObjStat_t *rodsObjStatOut = NULL;
00446 int forceFlag;
00447
00448 char* resc_hier = getValByKey( &phyPathRegInp->condInput, RESC_HIER_STR_KW );
00449 if( !resc_hier ) {
00450 rodsLog( LOG_NOTICE, "dirPathReg - RESC_HIER_STR_KW is NULL" );
00451 return -1;
00452 }
00453
00454
00455
00456 std::string location;
00457 eirods::error ret = eirods::get_loc_for_hier_string( resc_hier, location );
00458 if( !ret.ok() ) {
00459 eirods::log( PASSMSG( "dirPathReg - failed in get_loc_for_hier_String", ret ) );
00460 return -1;
00461 }
00462
00463 status = collStat (rsComm, phyPathRegInp, &rodsObjStatOut);
00464 if (status < 0 || NULL == rodsObjStatOut ) {
00465 memset (&collCreateInp, 0, sizeof (collCreateInp));
00466 rstrcpy (collCreateInp.collName, phyPathRegInp->objPath,
00467 MAX_NAME_LEN);
00468
00469
00470 addKeyVal (&collCreateInp.condInput, TRANSLATED_PATH_KW, "");
00471
00472
00473 status = rsCollCreate (rsComm, &collCreateInp);
00474 clearKeyVal (&collCreateInp.condInput);
00475 if (status < 0 ) return status;
00476 } else if (rodsObjStatOut->specColl != NULL) {
00477 freeRodsObjStat (rodsObjStatOut);
00478 rodsLog (LOG_ERROR,
00479 "mountFileDir: %s already mounted", phyPathRegInp->objPath);
00480 return (SYS_MOUNT_MOUNTED_COLL_ERR);
00481 }
00482 freeRodsObjStat (rodsObjStatOut);
00483
00484 memset (&fileOpendirInp, 0, sizeof (fileOpendirInp));
00485
00486 rstrcpy (fileOpendirInp.dirName, filePath, MAX_NAME_LEN);
00487 fileOpendirInp.fileType = static_cast< fileDriverType_t >( -1 );
00488 rstrcpy (fileOpendirInp.addr.hostAddr, location.c_str(), NAME_LEN);
00489 rstrcpy (fileOpendirInp.objPath, phyPathRegInp->objPath, MAX_NAME_LEN);
00490 rstrcpy (fileOpendirInp.resc_hier_, resc_hier, MAX_NAME_LEN);
00491
00492 dirFd = rsFileOpendir (rsComm, &fileOpendirInp);
00493 if (dirFd < 0) {
00494 rodsLog (LOG_ERROR,
00495 "dirPathReg: rsFileOpendir for %s error, status = %d",
00496 filePath, dirFd);
00497 return (dirFd);
00498 }
00499
00500 fileReaddirInp.fileInx = dirFd;
00501
00502 if (getValByKey (&phyPathRegInp->condInput, FORCE_FLAG_KW) != NULL) {
00503 forceFlag = 1;
00504 } else {
00505 forceFlag = 0;
00506 }
00507
00508 while ((status = rsFileReaddir (rsComm, &fileReaddirInp, &rodsDirent))>= 0) {
00509
00510 fileStatInp_t fileStatInp;
00511 rodsStat_t *myStat = NULL;
00512
00513 if (strlen (rodsDirent->d_name) == 0) break;
00514
00515 if (strcmp (rodsDirent->d_name, ".") == 0 ||
00516 strcmp (rodsDirent->d_name, "..") == 0) {
00517 free (rodsDirent);
00518 continue;
00519 }
00520
00521 subPhyPathRegInp = *phyPathRegInp;
00522 snprintf (subPhyPathRegInp.objPath, MAX_NAME_LEN, "%s/%s",
00523 phyPathRegInp->objPath, rodsDirent->d_name);
00524
00525 if (matchPathname(ExcludePatterns, rodsDirent->d_name, filePath)) {
00526 continue;
00527 }
00528
00529 memset (&fileStatInp, 0, sizeof (fileStatInp));
00530
00531 snprintf (fileStatInp.fileName, MAX_NAME_LEN, "%s/%s", filePath, rodsDirent->d_name);
00532 rstrcpy(fileStatInp.objPath, subPhyPathRegInp.objPath, MAX_NAME_LEN);
00533 fileStatInp.fileType = fileOpendirInp.fileType;
00534 fileStatInp.addr = fileOpendirInp.addr;
00535 rstrcpy (fileStatInp.rescHier, resc_hier, MAX_NAME_LEN);
00536
00537
00538 status = rsFileStat (rsComm, &fileStatInp, &myStat);
00539
00540 if (status != 0) {
00541 rodsLog (LOG_ERROR,
00542 "dirPathReg: rsFileStat failed for %s, status = %d",
00543 fileStatInp.fileName, status);
00544 free (rodsDirent);
00545 return (status);
00546 }
00547
00548 if ((myStat->st_mode & S_IFREG) != 0) {
00549 if (forceFlag > 0) {
00550
00551 if (isData (rsComm, subPhyPathRegInp.objPath, NULL) >= 0) {
00552 free (myStat);
00553 free (rodsDirent);
00554 continue;
00555 }
00556 }
00557 subPhyPathRegInp.dataSize = myStat->st_size;
00558 if (getValByKey (&phyPathRegInp->condInput, REG_REPL_KW) != NULL) {
00559 status = filePathRegRepl (rsComm, &subPhyPathRegInp,
00560 fileStatInp.fileName, rescInfo);
00561 } else {
00562 addKeyVal (&subPhyPathRegInp.condInput, FILE_PATH_KW,
00563 fileStatInp.fileName);
00564 status = filePathReg (rsComm, &subPhyPathRegInp,
00565 fileStatInp.fileName, rescInfo);
00566 }
00567 } else if ((myStat->st_mode & S_IFDIR) != 0) {
00568 status = dirPathReg (rsComm, &subPhyPathRegInp,
00569 fileStatInp.fileName, rescInfo);
00570 }
00571 free (myStat);
00572 free (rodsDirent);
00573 }
00574
00575 if (status == -1) {
00576 status = 0;
00577 }
00578
00579 fileClosedirInp.fileInx = dirFd;
00580 rsFileClosedir (rsComm, &fileClosedirInp);
00581
00582 return (status);
00583 }
00584
00585 int mountFileDir( rsComm_t* rsComm,
00586 dataObjInp_t* phyPathRegInp,
00587 char* filePath,
00588 rescInfo_t* rescInfo ) {
00589 collInp_t collCreateInp;
00590 int status;
00591 fileStatInp_t fileStatInp;
00592 rodsStat_t *myStat = NULL;
00593 rodsObjStat_t *rodsObjStatOut = NULL;
00594
00595 char* resc_hier = getValByKey( &phyPathRegInp->condInput, RESC_HIER_STR_KW );
00596 if( !resc_hier ) {
00597 rodsLog( LOG_NOTICE, "mountFileDir - RESC_HIER_STR_KW is NULL" );
00598 return -1;
00599 }
00600
00601
00602
00603 std::string location;
00604 eirods::error ret = eirods::get_loc_for_hier_string( resc_hier, location );
00605 if( !ret.ok() ) {
00606 eirods::log( PASSMSG( "mountFileDir - failed in get_loc_for_hier_String", ret ) );
00607 return -1;
00608 }
00609
00610 if (rsComm->clientUser.authInfo.authFlag < LOCAL_PRIV_USER_AUTH ) {
00611 rodsLog( LOG_NOTICE, "mountFileDir - insufficient privilege" );
00612 return(CAT_INSUFFICIENT_PRIVILEGE_LEVEL);
00613 }
00614
00615 status = collStat (rsComm, phyPathRegInp, &rodsObjStatOut);
00616 if (status < 0 || NULL == rodsObjStatOut ) {
00617 rodsLog( LOG_NOTICE, "mountFileDir collstat failed." );
00618 return status;
00619 }
00620
00621 if (rodsObjStatOut->specColl != NULL) {
00622 freeRodsObjStat (rodsObjStatOut);
00623 rodsLog (LOG_ERROR,
00624 "mountFileDir: %s already mounted", phyPathRegInp->objPath);
00625 return (SYS_MOUNT_MOUNTED_COLL_ERR);
00626 }
00627 freeRodsObjStat (rodsObjStatOut);
00628
00629 if (isCollEmpty (rsComm, phyPathRegInp->objPath) == False) {
00630 rodsLog (LOG_ERROR,
00631 "mountFileDir: collection %s not empty", phyPathRegInp->objPath);
00632 return (SYS_COLLECTION_NOT_EMPTY);
00633 }
00634
00635 memset (&fileStatInp, 0, sizeof (fileStatInp));
00636
00637 rstrcpy (fileStatInp.fileName, filePath, MAX_NAME_LEN);
00638 rstrcpy (fileStatInp.objPath, phyPathRegInp->objPath, MAX_NAME_LEN);
00639 fileStatInp.fileType = static_cast< fileDriverType_t >( -1 );
00640 rstrcpy (fileStatInp.addr.hostAddr, location.c_str(), NAME_LEN);
00641 rstrcpy (fileStatInp.rescHier, resc_hier, MAX_NAME_LEN);
00642
00643
00644 status = rsFileStat (rsComm, &fileStatInp, &myStat);
00645
00646 if (status < 0) {
00647 fileMkdirInp_t fileMkdirInp;
00648
00649 rodsLog (LOG_NOTICE,
00650 "mountFileDir: rsFileStat failed for %s, status = %d, create it",
00651 fileStatInp.fileName, status);
00652 memset (&fileMkdirInp, 0, sizeof (fileMkdirInp));
00653 rstrcpy (fileMkdirInp.dirName, filePath, MAX_NAME_LEN);
00654 fileMkdirInp.fileType = static_cast<fileDriverType_t>(-1);
00655 fileMkdirInp.mode = getDefDirMode ();
00656 rstrcpy (fileMkdirInp.addr.hostAddr, location.c_str(), NAME_LEN);
00657 status = rsFileMkdir (rsComm, &fileMkdirInp);
00658 if (status < 0) {
00659 return (status);
00660 }
00661 } else if ((myStat->st_mode & S_IFDIR) == 0) {
00662 rodsLog (LOG_ERROR,
00663 "mountFileDir: phyPath %s is not a directory",
00664 fileStatInp.fileName);
00665 free (myStat);
00666 return (USER_FILE_DOES_NOT_EXIST);
00667 }
00668
00669 free (myStat);
00670
00671
00672 memset (&collCreateInp, 0, sizeof (collCreateInp));
00673 rstrcpy (collCreateInp.collName, phyPathRegInp->objPath, MAX_NAME_LEN);
00674 addKeyVal (&collCreateInp.condInput, COLLECTION_TYPE_KW, MOUNT_POINT_STR);
00675
00676 addKeyVal (&collCreateInp.condInput, COLLECTION_INFO1_KW, filePath);
00677 addKeyVal (&collCreateInp.condInput, COLLECTION_INFO2_KW, resc_hier);
00678
00679
00680
00681 status = rsModColl (rsComm, &collCreateInp);
00682
00683 if (status < 0) {
00684 rodsLog( LOG_NOTICE, "mountFileDir rsModColl < 0." );
00685 status = rsRegColl (rsComm, &collCreateInp);
00686 }
00687
00688 if (status >= 0) {
00689 rodsLog( LOG_NOTICE, "mountFileDir rsModColl > 0." );
00690
00691 char outLogPath[MAX_NAME_LEN];
00692 int status1;
00693
00694 if (getLogPathFromPhyPath (filePath, rescInfo, outLogPath) >= 0 &&
00695 strcmp (outLogPath, phyPathRegInp->objPath) != 0) {
00696
00697 if (isColl (rsComm, outLogPath, NULL) >= 0) {
00698 modAccessControlInp_t modAccessControl;
00699
00700
00701
00702 bzero (&modAccessControl, sizeof (modAccessControl));
00703 modAccessControl.accessLevel = "read";
00704 modAccessControl.userName = rsComm->clientUser.userName;
00705 modAccessControl.zone = rsComm->clientUser.rodsZone;
00706 modAccessControl.path = phyPathRegInp->objPath;
00707 status1 = rsModAccessControl(rsComm, &modAccessControl);
00708 if (status1 < 0) {
00709 rodsLog (LOG_NOTICE,
00710 "mountFileDir: rsModAccessControl err for %s, stat = %d",
00711 phyPathRegInp->objPath, status1);
00712 }
00713 }
00714 }
00715 }
00716
00717 rodsLog( LOG_NOTICE, "mountFileDir return status." );
00718 return (status);
00719 }
00720
00721 int
00722 unmountFileDir (rsComm_t *rsComm, dataObjInp_t *phyPathRegInp)
00723 {
00724 int status;
00725 collInp_t modCollInp;
00726 rodsObjStat_t *rodsObjStatOut = NULL;
00727
00728 status = collStat (rsComm, phyPathRegInp, &rodsObjStatOut);
00729 if (status < 0 || NULL == rodsObjStatOut ) {
00730 return status;
00731 } else if (rodsObjStatOut->specColl == NULL) {
00732 freeRodsObjStat (rodsObjStatOut);
00733 rodsLog (LOG_ERROR,
00734 "unmountFileDir: %s not mounted", phyPathRegInp->objPath);
00735 return (SYS_COLL_NOT_MOUNTED_ERR);
00736 }
00737
00738 if (getStructFileType (rodsObjStatOut->specColl) >= 0) {
00739
00740 status = _rsSyncMountedColl (rsComm, rodsObjStatOut->specColl,
00741 PURGE_STRUCT_FILE_CACHE);
00742 #if 0
00743 if (status < 0) {
00744 freeRodsObjStat (rodsObjStatOut);
00745 return (status);
00746 }
00747 #endif
00748 }
00749
00750 freeRodsObjStat (rodsObjStatOut);
00751
00752 memset (&modCollInp, 0, sizeof (modCollInp));
00753 rstrcpy (modCollInp.collName, phyPathRegInp->objPath, MAX_NAME_LEN);
00754 addKeyVal (&modCollInp.condInput, COLLECTION_TYPE_KW,
00755 "NULL_SPECIAL_VALUE");
00756 addKeyVal (&modCollInp.condInput, COLLECTION_INFO1_KW, "NULL_SPECIAL_VALUE");
00757 addKeyVal (&modCollInp.condInput, COLLECTION_INFO2_KW, "NULL_SPECIAL_VALUE");
00758
00759 status = rsModColl (rsComm, &modCollInp);
00760
00761 return (status);
00762 }
00763
00764 int
00765 structFileReg (rsComm_t *rsComm, dataObjInp_t *phyPathRegInp)
00766 {
00767 collInp_t collCreateInp;
00768 int status;
00769 dataObjInfo_t *dataObjInfo = NULL;
00770 char *structFilePath = NULL;
00771 dataObjInp_t dataObjInp;
00772 char *collType;
00773 int len;
00774 rodsObjStat_t *rodsObjStatOut = NULL;
00775 specCollCache_t *specCollCache = NULL;
00776 rescInfo_t *rescInfo = NULL;
00777 #if 0
00778
00779 if (rsComm->clientUser.authInfo.authFlag < LOCAL_PRIV_USER_AUTH)
00780 return(CAT_INSUFFICIENT_PRIVILEGE_LEVEL);
00781 #endif
00782 if ((structFilePath = getValByKey (&phyPathRegInp->condInput, FILE_PATH_KW))
00783 == NULL) {
00784 rodsLog (LOG_ERROR,
00785 "structFileReg: No structFilePath input for %s",
00786 phyPathRegInp->objPath);
00787 return (SYS_INVALID_FILE_PATH);
00788 }
00789
00790 collType = getValByKey (&phyPathRegInp->condInput, COLLECTION_TYPE_KW);
00791 if (collType == NULL) {
00792 rodsLog (LOG_ERROR,
00793 "structFileReg: Bad COLLECTION_TYPE_KW for structFilePath %s",
00794 dataObjInp.objPath);
00795 return (SYS_INTERNAL_NULL_INPUT_ERR);
00796 }
00797
00798 len = strlen (phyPathRegInp->objPath);
00799 if (strncmp (structFilePath, phyPathRegInp->objPath, len) == 0 &&
00800 (structFilePath[len] == '\0' || structFilePath[len] == '/')) {
00801 rodsLog (LOG_ERROR,
00802 "structFileReg: structFilePath %s inside collection %s",
00803 structFilePath, phyPathRegInp->objPath);
00804 return (SYS_STRUCT_FILE_INMOUNTED_COLL);
00805 }
00806
00807
00808
00809 if (getSpecCollCache (rsComm, structFilePath, 0, &specCollCache) >= 0) {
00810 rodsLog (LOG_ERROR,
00811 "structFileReg: structFilePath %s is in a mounted path",
00812 structFilePath);
00813 return (SYS_STRUCT_FILE_INMOUNTED_COLL);
00814 }
00815
00816 status = collStat (rsComm, phyPathRegInp, &rodsObjStatOut);
00817 if (status < 0 || NULL == rodsObjStatOut ) return status;
00818
00819 if (rodsObjStatOut->specColl != NULL) {
00820 freeRodsObjStat (rodsObjStatOut);
00821 rodsLog (LOG_ERROR,
00822 "structFileReg: %s already mounted", phyPathRegInp->objPath);
00823 return (SYS_MOUNT_MOUNTED_COLL_ERR);
00824 }
00825
00826 freeRodsObjStat (rodsObjStatOut);
00827
00828 if (isCollEmpty (rsComm, phyPathRegInp->objPath) == False) {
00829 rodsLog (LOG_ERROR,
00830 "structFileReg: collection %s not empty", phyPathRegInp->objPath);
00831 return (SYS_COLLECTION_NOT_EMPTY);
00832 }
00833
00834 memset (&dataObjInp, 0, sizeof (dataObjInp));
00835 rstrcpy (dataObjInp.objPath, structFilePath, sizeof (dataObjInp));
00836
00837 dataObjInp.openFlags = O_WRONLY;
00838 status = getDataObjInfoIncSpecColl (rsComm, &dataObjInp, &dataObjInfo);
00839 if (status < 0 || NULL == dataObjInfo) {
00840 int myStatus;
00841
00842 dataObjInp.condInput = phyPathRegInp->condInput;
00843
00844 rmKeyVal (&dataObjInp.condInput, FILE_PATH_KW);
00845 myStatus = rsDataObjCreate (rsComm, &dataObjInp);
00846 if (myStatus < 0 ) {
00847 rodsLog (LOG_ERROR,
00848 "structFileReg: Problem with open/create structFilePath %s, status = %d",
00849 dataObjInp.objPath, status);
00850 return (status);
00851 } else {
00852 openedDataObjInp_t dataObjCloseInp;
00853 bzero (&dataObjCloseInp, sizeof (dataObjCloseInp));
00854 rescInfo = L1desc[myStatus].dataObjInfo->rescInfo;
00855 dataObjCloseInp.l1descInx = myStatus;
00856 rsDataObjClose (rsComm, &dataObjCloseInp);
00857 }
00858 } else {
00859 rescInfo = dataObjInfo->rescInfo;
00860 }
00861
00862 char* tmp_hier = getValByKey( &phyPathRegInp->condInput, RESC_HIER_STR_KW );
00863 if( !tmp_hier ) {
00864 rodsLog( LOG_ERROR, "structFileReg - RESC_HIER_STR_KW is NULL" );
00865 return -1;
00866 }
00867
00868 if (!structFileSupport (rsComm, phyPathRegInp->objPath,
00869 collType, tmp_hier)) {
00870 rodsLog (LOG_ERROR,
00871 "structFileReg: structFileDriver type %s does not exist for %s",
00872 collType, dataObjInp.objPath);
00873 return (SYS_NOT_SUPPORTED);
00874 }
00875
00876
00877
00878 memset (&collCreateInp, 0, sizeof (collCreateInp));
00879 rstrcpy (collCreateInp.collName, phyPathRegInp->objPath, MAX_NAME_LEN);
00880 addKeyVal (&collCreateInp.condInput, COLLECTION_TYPE_KW, collType);
00881
00882
00883 addKeyVal (&collCreateInp.condInput, COLLECTION_INFO1_KW,
00884 dataObjInp.objPath);
00885
00886
00887 status = rsModColl (rsComm, &collCreateInp);
00888
00889 if (status < 0) {
00890 status = rsRegColl (rsComm, &collCreateInp);
00891 }
00892
00893 return (status);
00894 }
00895
00896 int
00897 structFileSupport (rsComm_t *rsComm, char *collection, char *collType,
00898 char* resc_hier )
00899 {
00900 rodsStat_t *myStat = NULL;
00901 int status;
00902 subFile_t subFile;
00903 specColl_t specColl;
00904
00905 if (rsComm == NULL || collection == NULL || collType == NULL ||
00906 resc_hier == NULL) return 0;
00907
00908 memset (&subFile, 0, sizeof (subFile));
00909 memset (&specColl, 0, sizeof (specColl));
00910
00911 subFile.specColl = &specColl;
00912 rstrcpy (specColl.collection, collection, MAX_NAME_LEN);
00913 specColl.collClass = STRUCT_FILE_COLL;
00914 if (strcmp (collType, HAAW_STRUCT_FILE_STR) == 0) {
00915 specColl.type = HAAW_STRUCT_FILE_T;
00916 } else if (strcmp (collType, TAR_STRUCT_FILE_STR) == 0) {
00917 specColl.type = TAR_STRUCT_FILE_T;
00918 } else {
00919 return (0);
00920 }
00921
00922
00923
00924 std::string location;
00925 eirods::error ret = eirods::get_loc_for_hier_string( resc_hier, location );
00926 if( !ret.ok() ) {
00927 eirods::log( PASSMSG( "structFileSupport - failed in get_loc_for_hier_String", ret ) );
00928 return -1;
00929 }
00930
00931 eirods::hierarchy_parser parser;
00932 parser.set_string( resc_hier );
00933 std::string first_resc;
00934 parser.first_resc( first_resc );
00935
00936 snprintf (specColl.objPath, MAX_NAME_LEN, "%s/myFakeFile",collection);
00937 rstrcpy (specColl.resource, first_resc.c_str(), NAME_LEN);
00938 rstrcpy (specColl.rescHier, resc_hier, NAME_LEN);
00939 rstrcpy (specColl.phyPath, "/fakeDir1/fakeDir2/myFakeStructFile", MAX_NAME_LEN );
00940 rstrcpy (subFile.subFilePath, "/fakeDir1/fakeDir2/myFakeFile", MAX_NAME_LEN);
00941 rstrcpy (subFile.addr.hostAddr, location.c_str(), NAME_LEN);
00942
00943 status = rsSubStructFileStat (rsComm, &subFile, &myStat);
00944
00945 if (status == SYS_NOT_SUPPORTED)
00946 return (0);
00947 else
00948 return (1);
00949 }
00950
00951 int
00952 linkCollReg (rsComm_t *rsComm, dataObjInp_t *phyPathRegInp)
00953 {
00954 collInp_t collCreateInp;
00955 int status;
00956 char *linkPath = NULL;
00957 char *collType;
00958 int len;
00959 rodsObjStat_t *rodsObjStatOut = NULL;
00960 specCollCache_t *specCollCache = NULL;
00961
00962 if ((linkPath = getValByKey (&phyPathRegInp->condInput, FILE_PATH_KW))
00963 == NULL) {
00964 rodsLog (LOG_ERROR,
00965 "linkCollReg: No linkPath input for %s",
00966 phyPathRegInp->objPath);
00967 return (SYS_INVALID_FILE_PATH);
00968 }
00969
00970 collType = getValByKey (&phyPathRegInp->condInput, COLLECTION_TYPE_KW);
00971 if (collType == NULL || strcmp (collType, LINK_POINT_STR) != 0) {
00972 rodsLog (LOG_ERROR,
00973 "linkCollReg: Bad COLLECTION_TYPE_KW for linkPath %s",
00974 phyPathRegInp->objPath);
00975 return (SYS_INTERNAL_NULL_INPUT_ERR);
00976 }
00977
00978 if (phyPathRegInp->objPath[0] != '/' || linkPath[0] != '/') {
00979 rodsLog (LOG_ERROR,
00980 "linkCollReg: linkPath %s or collection %s not absolute path",
00981 linkPath, phyPathRegInp->objPath);
00982 return (SYS_COLL_LINK_PATH_ERR);
00983 }
00984
00985 len = strlen (phyPathRegInp->objPath);
00986 if (strncmp (linkPath, phyPathRegInp->objPath, len) == 0 &&
00987 linkPath[len] == '/') {
00988 rodsLog (LOG_ERROR,
00989 "linkCollReg: linkPath %s inside collection %s",
00990 linkPath, phyPathRegInp->objPath);
00991 return (SYS_COLL_LINK_PATH_ERR);
00992 }
00993
00994 len = strlen (linkPath);
00995 if (strncmp (phyPathRegInp->objPath, linkPath, len) == 0 &&
00996 phyPathRegInp->objPath[len] == '/') {
00997 rodsLog (LOG_ERROR,
00998 "linkCollReg: collection %s inside linkPath %s",
00999 linkPath, phyPathRegInp->objPath);
01000 return (SYS_COLL_LINK_PATH_ERR);
01001 }
01002
01003 if (getSpecCollCache (rsComm, linkPath, 0, &specCollCache) >= 0 &&
01004 specCollCache->specColl.collClass != LINKED_COLL) {
01005 rodsLog (LOG_ERROR,
01006 "linkCollReg: linkPath %s is in a spec coll path",
01007 linkPath);
01008 return (SYS_COLL_LINK_PATH_ERR);
01009 }
01010
01011 status = collStat (rsComm, phyPathRegInp, &rodsObjStatOut);
01012 if (status < 0) {
01013
01014 collInp_t collCreateInp;
01015 memset (&collCreateInp, 0, sizeof (collCreateInp));
01016 rstrcpy (collCreateInp.collName, phyPathRegInp->objPath, MAX_NAME_LEN);
01017 status = rsRegColl (rsComm, &collCreateInp);
01018 if (status < 0) {
01019 rodsLog (LOG_ERROR,
01020 "linkCollReg: rsRegColl error for %s, status = %d",
01021 collCreateInp.collName, status);
01022 return status;
01023 }
01024 status = collStat (rsComm, phyPathRegInp, &rodsObjStatOut);
01025 if (status < 0 ) return status;
01026
01027 }
01028
01029 if ( rodsObjStatOut &&
01030 rodsObjStatOut->specColl != NULL &&
01031 rodsObjStatOut->specColl->collClass != LINKED_COLL) {
01032 freeRodsObjStat (rodsObjStatOut);
01033 rodsLog (LOG_ERROR,
01034 "linkCollReg: link collection %s in a spec coll path",
01035 phyPathRegInp->objPath);
01036 return (SYS_COLL_LINK_PATH_ERR);
01037 }
01038
01039 freeRodsObjStat (rodsObjStatOut);
01040
01041 if (isCollEmpty (rsComm, phyPathRegInp->objPath) == False) {
01042 rodsLog (LOG_ERROR,
01043 "linkCollReg: collection %s not empty", phyPathRegInp->objPath);
01044 return (SYS_COLLECTION_NOT_EMPTY);
01045 }
01046
01047
01048
01049 memset (&collCreateInp, 0, sizeof (collCreateInp));
01050 rstrcpy (collCreateInp.collName, phyPathRegInp->objPath, MAX_NAME_LEN);
01051 addKeyVal (&collCreateInp.condInput, COLLECTION_TYPE_KW, collType);
01052
01053
01054 addKeyVal (&collCreateInp.condInput, COLLECTION_INFO1_KW,
01055 linkPath);
01056
01057
01058 status = rsModColl (rsComm, &collCreateInp);
01059
01060 if (status < 0) {
01061 status = rsRegColl (rsComm, &collCreateInp);
01062 }
01063
01064 return (status);
01065 }
01066
01067 pathnamePatterns_t *
01068 readPathnamePatternsFromFile(rsComm_t *rsComm, char *filename, char* resc_hier )
01069 {
01070 int status;
01071 rodsStat_t *stbuf;
01072 fileStatInp_t fileStatInp;
01073 bytesBuf_t fileReadBuf;
01074 fileOpenInp_t fileOpenInp;
01075 fileReadInp_t fileReadInp;
01076 fileCloseInp_t fileCloseInp;
01077 int buf_len, fd;
01078 pathnamePatterns_t *pp;
01079
01080 if (rsComm == NULL || filename == NULL || resc_hier == NULL) {
01081 return NULL;
01082 }
01083
01084
01085
01086
01087 std::string location;
01088 eirods::error ret = eirods::get_loc_for_hier_string( resc_hier, location );
01089 if( !ret.ok() ) {
01090 eirods::log( PASSMSG( "readPathnamePatternsFromFile - failed in get_loc_for_hier_String", ret ) );
01091 return NULL;
01092 }
01093
01094 memset(&fileStatInp, 0, sizeof(fileStatInp));
01095 rstrcpy(fileStatInp.fileName, filename, MAX_NAME_LEN);
01096
01097 rstrcpy(fileStatInp.addr.hostAddr, location.c_str(), NAME_LEN);
01098 status = rsFileStat(rsComm, &fileStatInp, &stbuf);
01099 if (status != 0) {
01100 if (status != UNIX_FILE_STAT_ERR - ENOENT) {
01101 rodsLog(LOG_DEBUG, "readPathnamePatternsFromFile: can't stat %s. status = %d",
01102 fileStatInp.fileName, status);
01103 }
01104 return NULL;
01105 }
01106 buf_len = stbuf->st_size;
01107 free(stbuf);
01108
01109 memset(&fileOpenInp, 0, sizeof(fileOpenInp));
01110 rstrcpy(fileOpenInp.fileName, filename, MAX_NAME_LEN);
01111
01112 rstrcpy(fileOpenInp.addr.hostAddr, location.c_str(), NAME_LEN);
01113 fileOpenInp.flags = O_RDONLY;
01114 fd = rsFileOpen(rsComm, &fileOpenInp);
01115 if (fd < 0) {
01116 rodsLog(LOG_NOTICE,
01117 "readPathnamePatternsFromFile: can't open %s for reading. status = %d",
01118 fileOpenInp.fileName, fd);
01119 return NULL;
01120 }
01121
01122 memset(&fileReadBuf, 0, sizeof(fileReadBuf));
01123 fileReadBuf.buf = malloc(buf_len);
01124 if (fileReadBuf.buf == NULL) {
01125 rodsLog(LOG_NOTICE, "readPathnamePatternsFromFile: could not malloc buffer");
01126 return NULL;
01127 }
01128
01129 memset(&fileReadInp, 0, sizeof(fileReadInp));
01130 fileReadInp.fileInx = fd;
01131 fileReadInp.len = buf_len;
01132 status = rsFileRead(rsComm, &fileReadInp, &fileReadBuf);
01133
01134 memset(&fileCloseInp, 0, sizeof(fileCloseInp));
01135 fileCloseInp.fileInx = fd;
01136 rsFileClose(rsComm, &fileCloseInp);
01137
01138 if (status < 0) {
01139 rodsLog(LOG_NOTICE, "readPathnamePatternsFromFile: could not read %s. status = %d",
01140 fileOpenInp.fileName, status);
01141 free(fileReadBuf.buf);
01142 return NULL;
01143 }
01144
01145 pp = readPathnamePatterns((char*)fileReadBuf.buf, buf_len);
01146
01147 return pp;
01148 }
01149
01150