예제 #1
0
파일: rsPhyPathReg.c 프로젝트: UPPMAX/irods
int
remotePhyPathReg (rsComm_t *rsComm, dataObjInp_t *phyPathRegInp, 
rodsServerHost_t *rodsServerHost)
{
   int status;

   if (rodsServerHost == NULL) {
        rodsLog (LOG_ERROR,
          "remotePhyPathReg: Invalid rodsServerHost");
        return SYS_INVALID_SERVER_HOST;
    }

    if ((status = svrToSvrConnect (rsComm, rodsServerHost)) < 0) {
        return status;
    }

    status = rcPhyPathReg (rodsServerHost->conn, phyPathRegInp);

    if (status < 0) {
        rodsLog (LOG_ERROR,
         "remotePhyPathReg: rcPhyPathReg failed for %s",
          phyPathRegInp->objPath);
    }

    return (status);
}
예제 #2
0
파일: regUtil.cpp 프로젝트: cchapati/irods
int
regUtil( rcComm_t *conn, rodsEnv *myRodsEnv, rodsArguments_t *myRodsArgs,
         rodsPathInp_t *rodsPathInp ) {
    if ( rodsPathInp == NULL ) {
        return USER__NULL_INPUT_ERR;
    }

    dataObjInp_t dataObjOprInp;
    initCondForReg( myRodsEnv, myRodsArgs, &dataObjOprInp );

    int savedStatus = 0;
    for ( int i = 0; i < rodsPathInp->numSrc; i++ ) {
        rodsPath_t * destPath = &rodsPathInp->destPath[i];	/* iRODS path */
        rodsPath_t * srcPath = &rodsPathInp->srcPath[i];	/* file Path */

        getRodsObjType( conn, destPath );

        if ( destPath->objState == EXIST_ST &&
                myRodsArgs->force == False &&
                myRodsArgs->mountCollection == False &&
                myRodsArgs->regRepl != True ) {
            rodsLog( LOG_ERROR,
                     "regUtil: iRODSPath %s already exist", destPath->outPath );
            return CAT_NAME_EXISTS_AS_DATAOBJ;
        }

        int status = 0;
        if ( myRodsArgs->collection == False && myRodsArgs->checksum == True ) {
            status = rcChksumLocFile( srcPath->outPath,
                                      REG_CHKSUM_KW,
                                      &dataObjOprInp.condInput,
                                      myRodsArgs->hashValue );
            if ( status < 0 ) {
                rodsLogError( LOG_ERROR, status,
                              "regUtil: rcChksumLocFile error for %s, status = %d",
                              srcPath, status );
                return status;
            }
        }
        else if ( myRodsArgs->collection == False && myRodsArgs->verifyChecksum == True ) {
            addKeyVal( &dataObjOprInp.condInput, VERIFY_CHKSUM_KW, "" );
        }

        addKeyVal( &dataObjOprInp.condInput, FILE_PATH_KW, srcPath->outPath );
        rstrcpy( dataObjOprInp.objPath, destPath->outPath, MAX_NAME_LEN );

        status = rcPhyPathReg( conn, &dataObjOprInp );

        /* XXXX may need to return a global status */
        if ( status < 0 &&
                status != CAT_NO_ROWS_FOUND ) {
            rodsLogError( LOG_ERROR, status,
                          "regUtil: reg error for %s, status = %d",
                          destPath->outPath, status );
            savedStatus = status;
        }
    }
    return savedStatus;
}
예제 #3
0
int
mcollUtil (rcComm_t *conn, rodsEnv *myRodsEnv, rodsArguments_t *myRodsArgs,
rodsPathInp_t *rodsPathInp)
{
    int i;
    int status; 
    int savedStatus = 0;
    rodsPath_t *destPath, *srcPath;
    dataObjInp_t dataObjOprInp;

    if (rodsPathInp == NULL) {
	return (USER__NULL_INPUT_ERR);
    }

    status = initCondForMcoll (myRodsEnv, myRodsArgs, &dataObjOprInp, 
      rodsPathInp);

    if (status < 0) return status;

    for (i = 0; i < rodsPathInp->numSrc; i++) {
	if (myRodsArgs->mountCollection == True) {
            destPath = &rodsPathInp->destPath[i];	/* iRODS path */
            srcPath = &rodsPathInp->srcPath[i];	/* file Path */

            getRodsObjType (conn, destPath);

            addKeyVal (&dataObjOprInp.condInput, FILE_PATH_KW, 
	     srcPath->outPath);
	    rstrcpy (dataObjOprInp.objPath, destPath->outPath, MAX_NAME_LEN);
            status = rcPhyPathReg (conn, &dataObjOprInp);
	} else if (myRodsArgs->unmount == True) {	/* unmount */
            srcPath = &rodsPathInp->srcPath[i]; /* file Path */

            getRodsObjType (conn, srcPath);

            rstrcpy (dataObjOprInp.objPath, srcPath->outPath, MAX_NAME_LEN);
            status = rcPhyPathReg (conn, &dataObjOprInp);
        } else if (myRodsArgs->syncCacheDir == True ||
	  myRodsArgs->purgeCacheDir == True) {   /* sync or purge */
            srcPath = &rodsPathInp->srcPath[i]; /* file Path */

            getRodsObjType (conn, srcPath);

            rstrcpy (dataObjOprInp.objPath, srcPath->outPath, MAX_NAME_LEN);
            status = rcSyncMountedColl (conn, &dataObjOprInp);
	} else {
	    status = USER_INPUT_OPTION_ERR;
	}

	/* XXXX may need to return a global status */
	if (status < 0) {
	    rodsLogError (LOG_ERROR, status,
             "imcoll error");
            savedStatus = status;
	} 
    }

    if (savedStatus < 0) {
        return (savedStatus);
    } else if (status == CAT_NO_ROWS_FOUND) {
        return (0);
    } else {
        return (status);
    }
}