当前位置: 首页>>代码示例>>C++>>正文


C++ rodsLog函数代码示例

本文整理汇总了C++中rodsLog函数的典型用法代码示例。如果您正苦于以下问题:C++ rodsLog函数的具体用法?C++ rodsLog怎么用?C++ rodsLog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rodsLog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: msiCloseGenQuery

/**
 * \fn msiCloseGenQuery(msParam_t *genQueryInp_msp, msParam_t *genQueryOut_msp, ruleExecInfo_t *rei)
 *
 * \brief This microservice closes an unfinished query. This is based on the code from #msiGetMoreRows.
 *
 * \module core
 *
 * \since 3.1
 *
 *
 * \usage None
 *
 * \param[in] genQueryInp_msp - Required - a GenQueryInp_MS_T containing the query parameters and conditions.
 * \param[in] genQueryOut_msp - Required - a GenQueryOut_MS_T to write results to. If its continuation index is 0 the query will be closed.
 * \param[in,out] rei - The RuleExecInfo structure that is automatically
 *    handled by the rule engine. The user does not include rei as a
 *    parameter in the rule invocation.
 *
 * \DolVarDependence none
 * \DolVarModified none
 * \iCatAttrDependence none
 * \iCatAttrModified none
 * \sideeffect none
 *
 * \return integer
 * \retval 0 on success
 * \pre none
 * \post none
 * \sa none
**/
int
msiCloseGenQuery( msParam_t *genQueryInp_msp, msParam_t *genQueryOut_msp, ruleExecInfo_t *rei ) {

    genQueryInp_t *genQueryInp;
    genQueryOut_t *genQueryOut;

    RE_TEST_MACRO( "    Calling msiCloseGenQuery" )

    if ( rei == NULL || rei->rsComm == NULL ) {
        rodsLog( LOG_ERROR, "msiCloseGenQuery: input rei or rsComm is NULL." );
        return SYS_INTERNAL_NULL_INPUT_ERR;
    }

    /* check for non null parameters */
    if ( genQueryInp_msp == NULL || genQueryOut_msp == NULL ) {
        rodsLog( LOG_ERROR, "msiCloseGenQuery: Missing parameter(s)" );
        return USER__NULL_INPUT_ERR;
    }

    /* no double close */
    if ( genQueryOut_msp->type == NULL ) {
        return 0;
    }

    /* check for proper input types */
    if ( strcmp( genQueryOut_msp->type, GenQueryOut_MS_T ) ) {
        rodsLog( LOG_ERROR, "msiCloseGenQuery: genQueryOut_msp type is %s, should be GenQueryOut_MS_T", genQueryOut_msp->type );
        return USER_PARAM_TYPE_ERR;
    }

    if ( strcmp( genQueryInp_msp->type, GenQueryInp_MS_T ) ) {
        rodsLog( LOG_ERROR, "msiCloseGenQuery: query_msp type is %s, should be GenQueryInp_MS_T", genQueryInp_msp->type );
        return USER_PARAM_TYPE_ERR;
    }

    /* retrieve genQueryXXX data structures */
    genQueryOut = ( genQueryOut_t* )genQueryOut_msp->inOutStruct;
    genQueryInp = ( genQueryInp_t* )genQueryInp_msp->inOutStruct;

    /* set contiuation index so icat know which statement to free */
    genQueryInp->continueInx = genQueryOut->continueInx;
    genQueryInp->maxRows = -1;

    /* free memory allocated for previous results */
    freeGenQueryOut( &genQueryOut );

    if ( genQueryInp->continueInx == 0 ) {
        /* query already closed */
        rei->status = 0;
        return rei->status;
    }

    /* close query */
    rei->status = rsGenQuery( rei->rsComm, genQueryInp, &genQueryOut );

    /* free memory allocated */
    freeGenQueryOut( &genQueryOut );

    if ( rei->status == 0 ) {
        /* clear output parameter */
        genQueryOut_msp->type = NULL;
        genQueryOut_msp->inOutStruct = NULL;
    }

    return rei->status;
}
开发者ID:hurngchunlee,项目名称:irods,代码行数:96,代码来源:genQueryMS.cpp

示例2: _rsStructFileBundle

int _rsStructFileBundle( rsComm_t*                 rsComm,
                         structFileExtAndRegInp_t* structFileBundleInp ) {
    int status;
    int handleInx;
    char phyBunDir[MAX_NAME_LEN];
    char tmpPath[MAX_NAME_LEN];
    int l1descInx;
    char* dataType = 0; // JMC - backport 4664
    openedDataObjInp_t dataObjCloseInp;

    // =-=-=-=-=-=-=-
    // create an empty data obj
    dataObjInp_t dataObjInp;
    memset( &dataObjInp, 0, sizeof( dataObjInp ) );
    dataObjInp.openFlags = O_WRONLY;

    // =-=-=-=-=-=-=-
    // get the data type of the structured file
    dataType = getValByKey( &structFileBundleInp->condInput, DATA_TYPE_KW );

    // =-=-=-=-=-=-=-
    // ensure that the file name will end in .zip, if necessary
    if ( dataType != NULL && strstr( dataType, ZIP_DT_STR ) != NULL ) {
        int len = strlen( structFileBundleInp->objPath );
        if ( strcmp( &structFileBundleInp->objPath[len - 4], ".zip" ) != 0 ) {
            strcat( structFileBundleInp->objPath, ".zip" );
        }
    }

    // =-=-=-=-=-=-=-
    // capture the object path in the data obj struct
    rstrcpy( dataObjInp.objPath, structFileBundleInp->objPath, MAX_NAME_LEN );

    // =-=-=-=-=-=-=-
    // replicate the condInput. may have resource input
    replKeyVal( &structFileBundleInp->condInput, &dataObjInp.condInput );

    // =-=-=-=-=-=-=-
    // open the file if we are in an add operation, otherwise create the new file
    if ( ( structFileBundleInp->oprType & ADD_TO_TAR_OPR ) != 0 ) { // JMC - backport 4643
        l1descInx = rsDataObjOpen( rsComm, &dataObjInp );

    }
    else {
        l1descInx = rsDataObjCreate( rsComm, &dataObjInp );

    }

    // =-=-=-=-=-=-=-
    // error check create / open
    if ( l1descInx < 0 ) {
        rodsLog( LOG_ERROR, "rsStructFileBundle: rsDataObjCreate of %s error. status = %d",
                 dataObjInp.objPath, l1descInx );
        return l1descInx;
    }

    // =-=-=-=-=-=-=-
    // FIXME :: Why, when we replicate them above?
    clearKeyVal( &dataObjInp.condInput ); // JMC - backport 4637
    // ???? l3Close (rsComm, l1descInx);

    // =-=-=-=-=-=-=-
    // zip does not like a zero length file as target
    //L1desc[ l1descInx ].l3descInx = 0;
    //if( dataType != NULL && strstr( dataType, ZIP_DT_STR ) != NULL ) {
    //    if( ( structFileBundleInp->oprType & ADD_TO_TAR_OPR) == 0 ) { // JMC - backport 4643
    //        l3Unlink( rsComm, L1desc[l1descInx].dataObjInfo );
    //    }
    //}

    // =-=-=-=-=-=-=-
    // check object permissions / stat
    chkObjPermAndStat_t chkObjPermAndStatInp;
    memset( &chkObjPermAndStatInp, 0, sizeof( chkObjPermAndStatInp ) );
    rstrcpy( chkObjPermAndStatInp.objPath, structFileBundleInp->collection, MAX_NAME_LEN );
    chkObjPermAndStatInp.flags = CHK_COLL_FOR_BUNDLE_OPR;
    addKeyVal( &chkObjPermAndStatInp.condInput, RESC_NAME_KW,     L1desc[l1descInx].dataObjInfo->rescName );

    // =-=-=-=-=-=-=-
    // get the resc hier string
    std::string resc_hier;
    char* resc_hier_ptr = getValByKey( &structFileBundleInp->condInput, RESC_HIER_STR_KW );
    if ( !resc_hier_ptr ) {
        rodsLog( LOG_NOTICE, "_rsStructFileBundle :: RESC_HIER_STR_KW is NULL" );
    }
    else {
        addKeyVal( &chkObjPermAndStatInp.condInput, RESC_HIER_STR_KW, resc_hier_ptr );
        resc_hier = resc_hier_ptr;
    }

    status = rsChkObjPermAndStat( rsComm, &chkObjPermAndStatInp );
    if ( status < 0 ) {
        rodsLog( LOG_ERROR, "rsStructFileBundle: rsChkObjPermAndStat of %s error. stat = %d",
                 chkObjPermAndStatInp.objPath, status );
        dataObjCloseInp.l1descInx = l1descInx;
        rsDataObjClose( rsComm, &dataObjCloseInp );
        return status;
    }

    clearKeyVal( &chkObjPermAndStatInp.condInput );
//.........这里部分代码省略.........
开发者ID:bpow,项目名称:irods,代码行数:101,代码来源:rsStructFileBundle.cpp

示例3: _ifuseFileCacheWrite

int _ifuseFileCacheWrite( fileCache_t *fileCache, char *buf, size_t size, off_t offset ) {
    int status, myError;
    openedDataObjInp_t dataObjWriteInp;
    bytesBuf_t dataObjWriteInpBBuf;
    iFuseConn_t *conn;

    bzero( &dataObjWriteInp, sizeof( dataObjWriteInp ) );
    /* lseek to the right offset in case this cache is share by multiple descs */
    status = _iFuseFileCacheLseek( fileCache, offset );
    if ( status < 0 ) {
        if ( ( myError = getErrno( status ) ) > 0 ) {
            return -myError;
        }
        else {
            return -ENOENT;
        }
    }


    if ( fileCache->state == NO_FILE_CACHE ) {
        /* no file cache */
        dataObjWriteInpBBuf.buf = ( void * ) buf;
        dataObjWriteInpBBuf.len = size;
        dataObjWriteInp.l1descInx = fileCache->iFd;
        dataObjWriteInp.len = size;

        conn = getAndUseConnByPath( fileCache->localPath, &status );
        status = rcDataObjWrite( conn->conn, &dataObjWriteInp, &dataObjWriteInpBBuf );
        unuseIFuseConn( conn );
        if ( status < 0 ) {
            if ( ( myError = getErrno( status ) ) > 0 ) {
                return -myError;
            }
            else {
                return -ENOENT;
            }
        }
        else if ( status != ( int ) size ) {
            rodsLog( LOG_ERROR,
                     "ifuseWrite: IFuseDesc[descInx].conn for %s is NULL", fileCache->localPath );
            return -ENOENT;
        }
        fileCache->offset += status;
        if ( fileCache->offset > fileCache->fileSize ) {
            fileCache->fileSize = fileCache->offset;
        }
    }
    else {
        status = write( fileCache->iFd, buf, size );
        if ( status < 0 ) {
            return errno ? ( -1 * errno ) : -1;
        }
        fileCache->offset += status;
        if ( fileCache->offset > fileCache->fileSize ) {
            fileCache->fileSize = fileCache->offset;
        }
        if ( fileCache->offset >= MAX_NEWLY_CREATED_CACHE_SIZE ) {
            _iFuseFileCacheFlush( fileCache );
            fileCache->iFd = 0;
            /* reopen file */
            dataObjInp_t dataObjOpenInp;
            memset( &dataObjOpenInp, 0, sizeof( dataObjOpenInp ) );
            rstrcpy( dataObjOpenInp.objPath, fileCache->objPath, MAX_NAME_LEN );
            dataObjOpenInp.openFlags = O_RDWR;

            int status;
            conn = getAndUseConnByPath( fileCache->localPath, &status );
            status = rcDataObjOpen( conn->conn, &dataObjOpenInp );
            unuseIFuseConn( conn );

            if ( status < 0 ) {
                rodsLog( LOG_ERROR, "iFuseWrite: rcDataObjOpen of %s error. status = %d", fileCache->objPath, status );
                return -ENOENT;
            }

            fileCache->iFd = status;
        }
    }
    return status;
}
开发者ID:jrandall,项目名称:irods,代码行数:80,代码来源:iFuseLib.FileCache.cpp

示例4: msiLoadMetadataFromXml

int 
msiLoadMetadataFromXml(msParam_t *targetObj, msParam_t *xmlObj, ruleExecInfo_t *rei) 
{
	/* for parsing msParams and to open iRODS objects */
	dataObjInp_t xmlDataObjInp, *myXmlDataObjInp;
	dataObjInp_t targetObjInp, *myTargetObjInp;
	int xmlObjID;

	/* for getting size of objects to read from */
	rodsObjStat_t *rodsObjStatOut = NULL;

	/* for reading from iRODS objects */
	openedDataObjInp_t openedDataObjInp;
	bytesBuf_t *xmlBuf;

	/* misc. to avoid repeating rei->rsComm */
	rsComm_t *rsComm;

	/* for xml parsing */
	xmlDocPtr doc;

	/* for XPath evaluation */
	xmlXPathContextPtr xpathCtx;
	xmlXPathObjectPtr xpathObj;
	xmlChar xpathExpr[] = "//AVU";
	xmlNodeSetPtr nodes;
	int avuNbr, i;
	
	/* for new AVU creation */
	modAVUMetadataInp_t modAVUMetadataInp;
	int max_attr_len = 2700;
	char attrStr[max_attr_len];



	/*********************************  USUAL INIT PROCEDURE **********************************/
	
	/* For testing mode when used with irule --test */
	RE_TEST_MACRO ("    Calling msiLoadMetadataFromXml")


	/* Sanity checks */
	if (rei == NULL || rei->rsComm == NULL)
	{
		rodsLog (LOG_ERROR, "msiLoadMetadataFromXml: input rei or rsComm is NULL.");
		return (SYS_INTERNAL_NULL_INPUT_ERR);
	}

	rsComm = rei->rsComm;


	
	/********************************** RETRIEVE INPUT PARAMS **************************************/

	/* Get path of target object */
	rei->status = parseMspForDataObjInp (targetObj, &targetObjInp, &myTargetObjInp, 0);
	if (rei->status < 0)
	{
		rodsLog (LOG_ERROR, "msiLoadMetadataFromXml: input targetObj error. status = %d", rei->status);
		return (rei->status);
	}


	/* Get path of XML document */
	rei->status = parseMspForDataObjInp (xmlObj, &xmlDataObjInp, &myXmlDataObjInp, 0);
	if (rei->status < 0)
	{
		rodsLog (LOG_ERROR, "msiLoadMetadataFromXml: input xmlObj error. status = %d", rei->status);
		return (rei->status);
	}



	/******************************** OPEN AND READ FROM XML OBJECT ********************************/

	/* Open XML file */
	if ((xmlObjID = rsDataObjOpen(rsComm, &xmlDataObjInp)) < 0) 
	{
		rodsLog (LOG_ERROR, "msiLoadMetadataFromXml: Cannot open XML data object. status = %d", xmlObjID);
		return (xmlObjID);
	}


	/* Get size of XML file */
	rei->status = rsObjStat (rsComm, &xmlDataObjInp, &rodsObjStatOut);
	if (rei->status < 0 || !rodsObjStatOut)
	{
		rodsLog (LOG_ERROR, "msiLoadMetadataFromXml: Cannot stat XML data object. status = %d", rei->status);
		return (rei->status);
	}


	/* xmlBuf init */
	/* memory for xmlBuf->buf is allocated in rsFileRead() */
	xmlBuf = (bytesBuf_t *) malloc (sizeof (bytesBuf_t));
	memset (xmlBuf, 0, sizeof (bytesBuf_t));


	/* Read XML file */
	memset (&openedDataObjInp, 0, sizeof (openedDataObjInp_t));
//.........这里部分代码省略.........
开发者ID:UPPMAX,项目名称:irods,代码行数:101,代码来源:xmlMS.c

示例5: ERROR

// =-=-=-=-=-=-=-
// private - execute rule for pre operation
    error operation_rule_execution_manager::exec_op(
        rsComm_t*          _comm,
        keyValPair_t&      _kvp,
        const std::string& _name,
        std::string&       _res ) {
        // =-=-=-=-=-=-=-
        // determine if rule exists
        RuleIndexListNode* re_node = 0;
        if ( findNextRule2( const_cast<char*>( _name.c_str() ), 0, &re_node ) < 0 ) {
            return ERROR( SYS_RULE_NOT_FOUND, "no rule found" );
        }

        // =-=-=-=-=-=-=-
        // debug message for creating dynPEP rules
        rodsLog(
            LOG_DEBUG,
            "operation_rule_execution_manager exec_op [%s]",
            _name.c_str() );

        // =-=-=-=-=-=-=-
        // add additional global re params
        error err = add_global_re_params_to_kvp_for_dynpep( _kvp );
        if ( !err.ok() ) {
            return PASS( err );
        }

        // =-=-=-=-=-=-=-
        // manufacture an rei for the applyRule
        ruleExecInfo_t rei;
        memset( ( char* )&rei, 0, sizeof( ruleExecInfo_t ) );
        rei.rsComm        = _comm;
        rei.condInputData = &_kvp; // give rule scope to our key value pairs
        rstrcpy( rei.pluginInstanceName, instance_.c_str(), MAX_NAME_LEN );

        // =-=-=-=-=-=-=-
        // add the output parameter
        msParamArray_t params;
        memset( &params, 0, sizeof( msParamArray_t ) );
        char out_param[ MAX_NAME_LEN ] = {"EMPTY_PARAM"};
        if ( _res.empty() ) {
            addMsParamToArray( &params, "*OUT", STR_MS_T, out_param, NULL, 0 );
        }
        else {
            addMsParamToArray( &params, "*OUT", STR_MS_T, const_cast<char*>( _res.c_str() ), NULL, 0 );
        }

        // =-=-=-=-=-=-=-
        // rule exists, param array is build.  call the rule.
        std::string arg_name = _name + "(*OUT)";
        int ret = applyRuleUpdateParams(
                      const_cast<char*>( arg_name.c_str() ),
                      &params,
                      &rei,
                      NO_SAVE_REI );
        if ( 0 != ret ) {
            return ERROR( ret, "failed in call to applyRuleUpdateParams" );
        }

        // =-=-=-=-=-=-=-
        // extract the value from the outgoing param to pass out to the operation
        msParam_t* out_ms_param = getMsParamByLabel( &params, "*OUT" );
        if ( out_ms_param ) {
            _res = reinterpret_cast< char* >( out_ms_param->inOutStruct );

        }
        else {
            return ERROR( SYS_INVALID_INPUT_PARAM, "null out parameter" );

        }

        return SUCCESS();

    } // exec_op
开发者ID:0x414A,项目名称:irods,代码行数:75,代码来源:irods_operation_rule_execution_manager.cpp

示例6: initializeReDebug

int initializeReDebug( rsComm_t *svrComm ) {
    char condRead[NAME_LEN];
    int i, s, m, status;
    char *readhdr = NULL;
    char *readmsg = NULL;
    char *user = NULL;
    char *addr = NULL;

    if ( svrComm == NULL ) {
        return 0;
    }
    if ( GlobalREDebugFlag != 4 ) {
        return 0;
    }

    s = 0;
    m = 0;
    myPID = ( int ) getpid();
    myHostName[0] = '\0';
    gethostname( myHostName, MAX_NAME_LEN );
    sprintf( condRead, "(*XUSER  == \"%[email protected]%s\") && (*XHDR == \"STARTDEBUG\")",
             svrComm->clientUser.userName, svrComm->clientUser.rodsZone );
    status = _readXMsg( GlobalREDebugFlag, condRead, &m, &s, &readhdr, &readmsg, &user, &addr );
    if ( status >= 0 ) {
        if ( ( readmsg != NULL )  && strlen( readmsg ) > 0 ) {
            GlobalREDebugFlag = atoi( readmsg );
        }
        if ( readhdr != NULL ) {
            free( readhdr );
        }
        if ( readmsg != NULL ) {
            free( readmsg );
        }
        if ( user != NULL ) {
            free( user );
        }
        if ( addr != NULL ) {
            free( addr );
        }
        /* initialize reDebug stack space*/
        for ( i = 0; i < REDEBUG_STACK_SIZE_FULL; i++ ) {
            reDebugStackFull[i] = NULL;
        }
        for ( i = 0; i < REDEBUG_STACK_SIZE_CURR; i++ ) {
            reDebugStackCurr[i].label = -1;
            reDebugStackCurr[i].step = NULL;
        }
        memset( breakPoints, 0, sizeof( struct Breakpoint ) * 100 );

        reDebugStackFullPtr = 0;
        reDebugStackCurrPtr = 0;
        snprintf( waitHdr, HEADER_TYPE_LEN - 1,   "idbug:" );

        rodsLog( LOG_NOTICE, "reDebugInitialization: Got Debug StreamId:%i\n", GlobalREDebugFlag );
        snprintf( waitMsg, MAX_NAME_LEN, "PROCESS BEGIN at %s:%i. Client connected from %s at port %i\n",
                  myHostName, myPID, svrComm->clientAddr, ntohs( svrComm->localAddr.sin_port ) );
        _writeXMsg( GlobalREDebugFlag, "idbug", waitMsg );
        snprintf( waitMsg, MAX_NAME_LEN, "%s:%i is waiting\n", myHostName, myPID );
    }
    return 0;
}
开发者ID:0x414A,项目名称:irods,代码行数:61,代码来源:nre.reHelpers1.cpp

示例7: _rsModDataObjMeta

int
_rsModDataObjMeta (rsComm_t *rsComm, modDataObjMeta_t *modDataObjMetaInp)
{
#ifdef RODS_CAT
    int status;
    dataObjInfo_t *dataObjInfo;
    keyValPair_t *regParam;
    int i;
    ruleExecInfo_t rei2;

    memset ((char*)&rei2, 0, sizeof (ruleExecInfo_t));
    rei2.rsComm = rsComm;
    if (rsComm != NULL) {
      rei2.uoic = &rsComm->clientUser;
      rei2.uoip = &rsComm->proxyUser;
    }
    rei2.doi = modDataObjMetaInp->dataObjInfo;
    rei2.condInputData = modDataObjMetaInp->regParam;
    regParam = modDataObjMetaInp->regParam;
    dataObjInfo = modDataObjMetaInp->dataObjInfo;

    if (regParam->len == 0) {
        rodsLog(LOG_NOTICE, "Warning, _rsModDataObjMeta called with empty regParam, returning success");
        return (0);
    }

    /* In dataObjInfo, need just dataId. But it will accept objPath too,
     * but less efficient 
     */

    /** RAJA ADDED June 1 2009 for pre-post processing rule hooks **/
    rei2.doi = dataObjInfo;
    i =  applyRule("acPreProcForModifyDataObjMeta",NULL, &rei2, NO_SAVE_REI);
    if (i < 0) {
      if (rei2.status < 0) {
        i = rei2.status;
      }
      rodsLog (LOG_ERROR,
               "_rsModDataObjMeta:acPreProcForModifyDataObjMeta error stat=%d", i);
      return i;
    }
    /** RAJA ADDED June 1 2009 for pre-post processing rule hooks **/

    if (getValByKey (regParam, ALL_KW) != NULL) {
	/* all copies */
	dataObjInfo_t *dataObjInfoHead = NULL;
	dataObjInfo_t *tmpDataObjInfo;
	dataObjInp_t dataObjInp;

	bzero (&dataObjInp, sizeof (dataObjInp));
	rstrcpy (dataObjInp.objPath, dataObjInfo->objPath, MAX_NAME_LEN);
        status = getDataObjInfoIncSpecColl (rsComm, &dataObjInp,
          &dataObjInfoHead);
	if (status < 0) return status;
	tmpDataObjInfo = dataObjInfoHead;
        while (tmpDataObjInfo != NULL) {
	    if (tmpDataObjInfo->specColl != NULL) break;
            status = chlModDataObjMeta (rsComm, tmpDataObjInfo, regParam);
	    if (status < 0) {
                rodsLog (LOG_ERROR,
                  "_rsModDataObjMeta:chlModDataObjMeta %s error stat=%d",
	          tmpDataObjInfo->objPath, status);
	    }
	    tmpDataObjInfo = tmpDataObjInfo->next;
	}
	freeAllDataObjInfo (dataObjInfoHead);
    } else {
        status = chlModDataObjMeta (rsComm, dataObjInfo, regParam);
    }

    /** RAJA ADDED June 1 2009 for pre-post processing rule hooks **/
    if (status >= 0) {
      i =  applyRule("acPostProcForModifyDataObjMeta",NULL, &rei2, NO_SAVE_REI);
      if (i < 0) {
        if (rei2.status < 0) {
          i = rei2.status;
        }
        rodsLog (LOG_ERROR,
           "_rsModDataObjMeta:acPostProcForModifyDataObjMeta error stat=%d",i);
        return i;
      }
    }
    /** RAJA ADDED June 1 2009 for pre-post processing rule hooks **/

    return (status);
#else
    return (SYS_NO_RCAT_SERVER_ERR);
#endif

}
开发者ID:DICE-UNC,项目名称:iRODS-FUSE-Mod,代码行数:90,代码来源:rsModDataObjMeta.c

示例8: chksumUtil

int
chksumUtil (rcComm_t *conn, rodsEnv *myRodsEnv, rodsArguments_t *myRodsArgs,
rodsPathInp_t *rodsPathInp)
{
    int i;
    int status; 
    int savedStatus = 0;
    collInp_t collInp;
    dataObjInp_t dataObjInp;


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

    status = initCondForChksum (myRodsEnv, myRodsArgs, &dataObjInp, &collInp);

    if (status < 0) {
	return (status);
    }

    for (i = 0; i < rodsPathInp->numSrc; i++) {
	if (rodsPathInp->srcPath[i].objType == UNKNOWN_OBJ_T) {
	    getRodsObjType (conn, &rodsPathInp->srcPath[i]);
	    if (rodsPathInp->srcPath[i].objState == NOT_EXIST_ST) {
                rodsLog (LOG_ERROR,
                  "chksumUtil: srcPath %s does not exist",
                  rodsPathInp->srcPath[i].outPath);
		savedStatus = USER_INPUT_PATH_ERR;
		continue;
	    }
	}

	if (rodsPathInp->srcPath[i].objType == DATA_OBJ_T) {
	    rmKeyVal (&dataObjInp.condInput, TRANSLATED_PATH_KW);
	    status = chksumDataObjUtil (conn, rodsPathInp->srcPath[i].outPath, 
	     myRodsEnv, myRodsArgs, &dataObjInp);
	} else if (rodsPathInp->srcPath[i].objType ==  COLL_OBJ_T) {
            /* The path given by collEnt.collName from rclReadCollection
             * has already been translated */
            addKeyVal (&dataObjInp.condInput, TRANSLATED_PATH_KW, "");
	    status = chksumCollUtil (conn, rodsPathInp->srcPath[i].outPath,
              myRodsEnv, myRodsArgs, &dataObjInp, &collInp);
	} else {
	    /* should not be here */
	    rodsLog (LOG_ERROR,
	     "chksumUtil: invalid chksum objType %d for %s", 
	     rodsPathInp->srcPath[i].objType, rodsPathInp->srcPath[i].outPath);
	    return (USER_INPUT_PATH_ERR);
	}
	/* XXXX may need to return a global status */
	if (status < 0) {
	    rodsLogError (LOG_ERROR, status,
             "chksumUtil: chksum error for %s, status = %d", 
	      rodsPathInp->srcPath[i].outPath, status);
	    savedStatus = status;
	} 
    }
    printf ("Total checksum performed = %d, Failed checksum = %d\n",
      ChksumCnt, FailedChksumCnt);

    if (savedStatus < 0) {
        return (savedStatus);
    } else if (status == CAT_NO_ROWS_FOUND) {
        return (0);
    } else {
        return (status);
    }
}
开发者ID:DICE-UNC,项目名称:iRODS-FUSE-Mod,代码行数:69,代码来源:chksumUtil.c

示例9: msiAddConditionToGenQuery

/**
 * \fn msiAddConditionToGenQuery(msParam_t *attribute, msParam_t *opr, msParam_t *value, msParam_t *queryInput, ruleExecInfo_t *rei)
 *
 * \brief Adds a condition to a genQueryInp_t
 *
 * \module core
 *
 *
 * \note This microservice adds a condition to an existing genQueryInp_t, from three parameters.
 *       One is an iCAT attribute index given without its 'COL_' prefix.
 *       The second one is the SQL operator. The third one is the value and may contain wildcards.
 *       To be used with #msiAddSelectFieldToGenQuery and #msiExecGenQuery to build queries from the
 *       results of other microservices or actions within an iRODS rule.
 *
 * \usage See clients/icommands/test/rules3.0/
 *
 * \param[in] attribute - Required - A STR_MS_T with the iCAT attribute name (see wiki.irods.org/index.php/icatAttributes).
 * \param[in] opr - Required - A STR_MS_T with the operator.
 * \param[in] value - Required - A STR_MS_T with the value.
 * \param[in,out] queryInput - Required - A GenQueryInp_MS_T.
 * \param[in,out] rei - The RuleExecInfo structure that is automatically
 *    handled by the rule engine. The user does not include rei as a
 *    parameter in the rule invocation.
 *
 * \DolVarDependence none
 * \DolVarModified none
 * \iCatAttrDependence none
 * \iCatAttrModified none
 * \sideeffect none
 *
 * \return integer
 * \retval 0 on success
 * \pre none
 * \post none
 * \sa none
**/
int
msiAddConditionToGenQuery( msParam_t *attribute, msParam_t *opr, msParam_t *value, msParam_t *queryInput, ruleExecInfo_t *rei ) {
    genQueryInp_t *genQueryInp;
    char condStr[MAX_NAME_LEN];
    char *att_str, *op_str, *val_str;
    int att_inx;

    /*************************************  INIT **********************************/

    /* For testing mode when used with irule --test */
    RE_TEST_MACRO( "    Calling msiAddConditionToGenQuery" )

    /* Sanity checks */
    if ( rei == NULL || rei->rsComm == NULL ) {
        rodsLog( LOG_ERROR, "msiAddConditionToGenQuery: input rei or rsComm is NULL." );
        return SYS_INTERNAL_NULL_INPUT_ERR;
    }


    /********************************** PARAM PARSING  *********************************/

    /* Parse attribute */
    if ( ( att_str = parseMspForStr( attribute ) ) == NULL ) {
        rodsLog( LOG_ERROR, "msiAddConditionToGenQuery: input attribute is NULL." );
        return USER__NULL_INPUT_ERR;
    }

    /* Parse operator */
    if ( ( op_str = parseMspForStr( opr ) ) == NULL ) {
        rodsLog( LOG_ERROR, "msiAddConditionToGenQuery: input opr is NULL." );
        return USER__NULL_INPUT_ERR;
    }

    /* Parse value */
    if ( ( val_str = parseMspForStr( value ) ) == NULL ) {
        rodsLog( LOG_ERROR, "msiAddConditionToGenQuery: input value is NULL." );
        return USER__NULL_INPUT_ERR;
    }

    /* Check for proper parameter type for queryInput */
    if ( queryInput->type && strcmp( queryInput->type, GenQueryInp_MS_T ) ) {
        rodsLog( LOG_ERROR, "msiAddConditionToGenQuery: queryInput is not of type GenQueryInp_MS_T." );
        return USER_PARAM_TYPE_ERR;
    }

    /* Parse queryInput. Must not be empty. */
    if ( !queryInput->inOutStruct ) {
        rodsLog( LOG_ERROR, "msiAddConditionToGenQuery: input queryInput is NULL." );
        return USER__NULL_INPUT_ERR;
    }
    else {
        genQueryInp = ( genQueryInp_t* )queryInput->inOutStruct;
    }


    /***************************** ADD CONDITION TO QUERY INPUT  *****************************/

    /* Get attribute index */
    att_inx = getAttrIdFromAttrName( att_str );

    /* Error? */
    if ( att_inx < 0 ) {
        rodsLog( LOG_ERROR, "msiAddConditionToGenQuery: Unable to get valid ICAT column index." );
        return att_inx;
//.........这里部分代码省略.........
开发者ID:hurngchunlee,项目名称:irods,代码行数:101,代码来源:genQueryMS.cpp

示例10: msiPrintGenQueryOutToBuffer

/**
 * \fn msiPrintGenQueryOutToBuffer(msParam_t *queryOut, msParam_t *format, msParam_t *buffer, ruleExecInfo_t *rei)
 *
 * \brief  Writes the contents of a GenQueryOut_MS_T into a BUF_LEN_MS_T.
 *
 * \module core
 *
 *
 * \note This microservice writes the contents of a GenQueryOut_MS_T into a BUF_LEN_MS_T.
 *       The results can be formatted with an optional C-style format string the same way it is done in iquest.
 *
 * \usage See clients/icommands/test/rules3.0/
 *
 * \param[in] queryOut - Required - A GenQueryOut_MS_T.
 * \param[in] format - Optional - A STR_MS_T with a C-style format string, like in iquest.
 * \param[out] buffer - A BUF_LEN_MS_T
 * \param[in,out] rei - The RuleExecInfo structure that is automatically
 *    handled by the rule engine. The user does not include rei as a
 *    parameter in the rule invocation.
 *
 * \DolVarDependence none
 * \DolVarModified none
 * \iCatAttrDependence none
 * \iCatAttrModified none
 * \sideeffect none
 *
 * \return integer
 * \retval 0 on success
 * \pre none
 * \post none
 * \sa none
**/
int
msiPrintGenQueryOutToBuffer( msParam_t *queryOut, msParam_t *format, msParam_t *buffer, ruleExecInfo_t *rei ) {
    genQueryOut_t *genQueryOut;
    char *format_str;
    bytesBuf_t *bytesBuf;
    FILE *stream;
    char readbuffer[MAX_NAME_LEN];

    /*************************************  INIT **********************************/

    /* For testing mode when used with irule --test */
    RE_TEST_MACRO( "    Calling msiPrintGenQueryOutToBuffer" )

    /* Sanity checks */
    if ( rei == NULL || rei->rsComm == NULL ) {
        rodsLog( LOG_ERROR, "msiPrintGenQueryOutToBuffer: input rei or rsComm is NULL." );
        return SYS_INTERNAL_NULL_INPUT_ERR;
    }


    /********************************** PARAM PARSING  *********************************/

    /* Check for proper param type */
    if ( !queryOut || !queryOut->inOutStruct || !queryOut->type || strcmp( queryOut->type, GenQueryOut_MS_T ) ) {
        rodsLog( LOG_ERROR, "msiPrintGenQueryOutToBuffer: Invalid input for queryOut." );
        return USER_PARAM_TYPE_ERR;
    }
    genQueryOut = ( genQueryOut_t * )queryOut->inOutStruct;


    /* Parse format */
    format_str = parseMspForStr( format );


    /********************************** EXTRACT SQL RESULTS  *********************************/

    /* Let's use printGenQueryOut() here for the sake of consistency over efficiency (somewhat). It needs a stream. */
    char filename[7];
    memset( filename, 'X', sizeof( filename ) );
    filename[sizeof( filename ) - 1] = '\0';
    umask( S_IRUSR | S_IWUSR );
    int fd = mkstemp( filename );
    if ( fd < 0 ) { /* Since it won't be caught by printGenQueryOut */
        rodsLog( LOG_ERROR, "msiPrintGenQueryOutToBuffer: mkstemp() failed." );
        return ( FILE_OPEN_ERR ); /* accurate enough */
    }
    stream = fdopen( fd, "w" );
    if ( !stream ) { /* Since it won't be caught by printGenQueryOut */
        rodsLog( LOG_ERROR, "msiPrintGenQueryOutToBuffer: fdopen() failed." );
        return ( FILE_OPEN_ERR ); /* accurate enough */
    }

    /* Write results to temp file */
    rei->status = printGenQueryOut( stream, format_str, NULL, genQueryOut );
    if ( rei->status < 0 ) {
        rodsLog( LOG_ERROR, "msiPrintGenQueryOutToBuffer: printGenQueryOut() failed, status = %d", rei->status );
        fclose( stream );
        return rei->status;
    }

    /* bytesBuf init */
    bytesBuf = ( bytesBuf_t * )malloc( sizeof( bytesBuf_t ) );
    memset( bytesBuf, 0, sizeof( bytesBuf_t ) );

    /* Read from temp file and write to bytesBuf */
    rewind( stream );
    while ( fgets( readbuffer, MAX_NAME_LEN, stream ) != NULL ) {
        appendToByteBuf( bytesBuf, readbuffer );
//.........这里部分代码省略.........
开发者ID:hurngchunlee,项目名称:irods,代码行数:101,代码来源:genQueryMS.cpp

示例11: msiAddSelectFieldToGenQuery

/**
 * \fn msiAddSelectFieldToGenQuery(msParam_t *select, msParam_t *function, msParam_t *queryInput, ruleExecInfo_t *rei)
 *
 * \brief  Sets a select field in a genQueryInp_t
 *
 * \module core
 *
 *
 *
 * \note This microservice sets a select field in a genQueryInp_t, from two parameters.
 *       One is an iCAT attribute index given without its 'COL_' prefix.
 *       The second one is the optional SQL operator.
 *       A new genQueryInp_t is created if queryInput is NULL.
 *       Followed with #msiExecGenQuery, #msiAddSelectFieldToGenQuery allows to take the
 *       results of other microservices to build and execute queries within a rule.
 *
 * \usage See clients/icommands/test/rules3.0/
 *
 * \param[in] select - Required - A STR_MS_T with the select field.
 * \param[in] function - Optional - A STR_MS_T with the function. Valid values are [MIN|MAX|SUM|AVG|COUNT]
 * \param[in,out] queryInput - Optional - A GenQueryInp_MS_T.
 * \param[in,out] rei - The RuleExecInfo structure that is automatically
 *    handled by the rule engine. The user does not include rei as a
 *    parameter in the rule invocation.
 *
 * \DolVarDependence none
 * \DolVarModified none
 * \iCatAttrDependence none
 * \iCatAttrModified none
 * \sideeffect none
 *
 * \return integer
 * \retval 0 on success
 * \pre none
 * \post none
 * \sa none
**/
int
msiAddSelectFieldToGenQuery( msParam_t *select, msParam_t *function, msParam_t *queryInput, ruleExecInfo_t *rei ) {
    char *column_str;
    int column_inx, function_inx;
    genQueryInp_t *genQueryInp;

    /*************************************  INIT **********************************/

    /* For testing mode when used with irule --test */
    RE_TEST_MACRO( "    Calling msiAddSelectFieldToGenQuery" )

    /* Sanity checks */
    if ( rei == NULL || rei->rsComm == NULL ) {
        rodsLog( LOG_ERROR, "msiAddSelectFieldToGenQuery: input rei or rsComm is NULL." );
        return SYS_INTERNAL_NULL_INPUT_ERR;
    }


    /********************************** PARAM PARSING  *********************************/

    /* Parse select */
    if ( ( column_str = parseMspForStr( select ) ) == NULL ) {
        rodsLog( LOG_ERROR, "msiAddSelectFieldToGenQuery: input select is NULL." );
        return USER__NULL_INPUT_ERR;
    }

    /* Parse function and convert to index directly, getSelVal() returns 1 if string is NULL or empty. */
    function_inx = getSelVal( parseMspForStr( function ) );

    /* Check for proper parameter type for queryInput */
    if ( queryInput->type && strcmp( queryInput->type, GenQueryInp_MS_T ) ) {
        rodsLog( LOG_ERROR, "msiAddSelectfieldToGenQuery: queryInput is not of type GenQueryInp_MS_T." );
        return USER_PARAM_TYPE_ERR;
    }

    /* Parse queryInput. Create new structure if empty. */
    if ( !queryInput->inOutStruct ) {
        /* Set content */
        genQueryInp = ( genQueryInp_t* )malloc( sizeof( genQueryInp_t ) );
        memset( genQueryInp, 0, sizeof( genQueryInp_t ) );
        genQueryInp->maxRows = MAX_SQL_ROWS;
        queryInput->inOutStruct = ( void* )genQueryInp;

        /* Set type */
        if ( !queryInput->type ) {
            queryInput->type = strdup( GenQueryInp_MS_T );
        }
    }
    else {
        genQueryInp = ( genQueryInp_t* )queryInput->inOutStruct;
    }


    /***************************** ADD INDEXES TO QUERY INPUT  *****************************/

    /* Get column index */
    column_inx = getAttrIdFromAttrName( column_str );

    /* Error? */
    if ( column_inx < 0 ) {
        rodsLog( LOG_ERROR, "msiAddSelectfieldToGenQuery: Unable to get valid ICAT column index." );
        return column_inx;
    }
//.........这里部分代码省略.........
开发者ID:hurngchunlee,项目名称:irods,代码行数:101,代码来源:genQueryMS.cpp

示例12: msiPrintGenQueryInp

/**
 * \fn msiPrintGenQueryInp( msParam_t *where, msParam_t* genQueryInpParam, ruleExecInfo_t *rei)
 *
 * \brief This microservice prints the given GenQueryInp_MS_T to the given target buffer
 *
 * \module core
 *
 * \since pre-2.1
 *
 *
 * \usage See clients/icommands/test/rules3.0/
 *
 * \param[in] where - Required - a STR_MS_T containing the parameters.
 * \param[in] genQueryInpParam - Required - a GenQueryInp_MS_T containing the parameters and conditions.
 * \param[in,out] rei - The RuleExecInfo structure that is automatically
 *    handled by the rule engine. The user does not include rei as a
 *    parameter in the rule invocation.
 *
 * \DolVarDependence none
 * \DolVarModified none
 * \iCatAttrDependence none
 * \iCatAttrModified none
 * \sideeffect none
 *
 * \return integer
 * \retval 0 on success
 * \pre none
 * \post none
 * \sa writeString
**/
int
msiPrintGenQueryInp( msParam_t *where, msParam_t* genQueryInpParam, ruleExecInfo_t *rei ) {
    genQueryInp_t *genQueryInp;
    int i, j;
    char *writeId;
    char writeStr[MAX_NAME_LEN * 2];
    int len;
    int *ip1, *ip2;
    char *cp;
    char **cpp;

    RE_TEST_MACRO( "    Calling msiPrintGenQueryInp" );

    if ( rei == NULL || rei->rsComm == NULL ) {
        rodsLog( LOG_ERROR, "msiPrintGenQueryInp: input rei or rsComm is NULL." );
        return SYS_INTERNAL_NULL_INPUT_ERR;
    }
    if ( !where ) {
        rodsLog( LOG_ERROR, "msiPrintGenQueryInp: No destination provided for writing." );
        return USER__NULL_INPUT_ERR;
    }
    /* where are we writing to? */
    if ( where->inOutStruct != NULL ) {
        writeId = ( char* )where->inOutStruct;
    }
    else {
        writeId = where->label;
    }

    /*  genQueryInp = (genQueryInp_t *)  strtol((char *)genQueryInpParam->inOutStruct,
        (char **) NULL,0); */

    genQueryInp = ( genQueryInp_t * )  genQueryInpParam->inOutStruct;


    /* print each selection pair to writeStr */
    len = genQueryInp->selectInp.len;
    ip1 = genQueryInp->selectInp.inx;
    ip2 = genQueryInp->selectInp.value;
    for ( i = 0; i < len; i++ ) {
        sprintf( writeStr, "Selected Column %d With Option %d\n", *ip1, *ip2 );
        j = _writeString( writeId, writeStr, rei );
        if ( j < 0 ) {
            return j;
        }
        ip1++;
        ip2++;
    }

    len = genQueryInp->sqlCondInp.len;
    ip1 = genQueryInp->sqlCondInp.inx;
    cpp = genQueryInp->sqlCondInp.value;
    cp = *cpp;
    for ( i = 0; i < len; i++ ) {
        sprintf( writeStr, "Condition Column %d %s\n", *ip1, cp );
        j = _writeString( writeId, writeStr, rei );
        if ( j < 0 ) {
            return j;
        }
        ip1++;
        cpp++;
        cp = *cpp;
    }
    return 0;
}
开发者ID:hurngchunlee,项目名称:irods,代码行数:95,代码来源:genQueryMS.cpp

示例13: msiMakeGenQuery

/**
 * \fn msiMakeGenQuery(msParam_t* selectListStr, msParam_t* condStr, msParam_t* genQueryInpParam, ruleExecInfo_t *rei)
 *
 * \brief This microservice sets up a GenQueryInp_MS_T from a list of parameters and conditions
 *
 * \module core
 *
 * \since pre-2.1
 *
 *
 * \note This microservice sets up a genQueryInp_t data structure needed by calls to rsGenQuery().
 *    To be used before #msiExecGenQuery and #msiGetMoreRows.
 *
 * \usage See clients/icommands/test/rules3.0/
 *
 * \param[in] selectListStr - Required - a STR_MS_T containing the parameters.
 * \param[in] condStr - Required - a STR_MS_T containing the conditions
 * \param[out] genQueryInpParam - a GenQueryInp_MS_T containing the parameters and conditions.
 * \param[in,out] rei - The RuleExecInfo structure that is automatically
 *    handled by the rule engine. The user does not include rei as a
 *    parameter in the rule invocation.
 *
 * \DolVarDependence none
 * \DolVarModified none
 * \iCatAttrDependence none
 * \iCatAttrModified none
 * \sideeffect none
 *
 * \return integer
 * \retval 0 on success
 * \pre none
 * \post none
 * \sa none
**/
int
msiMakeGenQuery( msParam_t* selectListStr, msParam_t* condStr, msParam_t* genQueryInpParam, ruleExecInfo_t *rei ) {
    char *sel, *cond, *rawQuery, *query;


    RE_TEST_MACRO( "    Calling msiMakeGenQuery" )

    if ( rei == NULL || rei->rsComm == NULL ) {
        rodsLog( LOG_ERROR, "msiMakeGenQuery: input rei or rsComm is NULL." );
        return SYS_INTERNAL_NULL_INPUT_ERR;
    }


    /* parse selectListStr */
    if ( ( sel = parseMspForStr( selectListStr ) ) == NULL ) {
        rodsLog( LOG_ERROR, "msiMakeGenQuery: input selectListStr is NULL." );
        return USER__NULL_INPUT_ERR;
    }


    /* parse condStr */
    if ( ( cond = parseMspForStr( condStr ) ) == NULL ) {
        rodsLog( LOG_ERROR, "msiMakeGenQuery: input condStr is NULL." );
        return USER__NULL_INPUT_ERR;
    }


    /* The code below is partly taken from msiMakeQuery and msiExecStrCondQuery. There may be a better way to do this. */

    /* Generate raw SQL query string */
    rei->status = _makeQuery( sel, cond, &rawQuery );

    /* allocate more memory for query string with expanded variable names */
    query = ( char * )malloc( strlen( rawQuery ) + 10 + MAX_COND_LEN * 8 );
    strcpy( query, rawQuery );

    /* allocate memory for genQueryInp */
    genQueryInp_t * genQueryInp = ( genQueryInp_t* )malloc( sizeof( genQueryInp_t ) );
    memset( genQueryInp, 0, sizeof( genQueryInp_t ) );

    /* set up GenQueryInp */
    genQueryInp->maxRows = MAX_SQL_ROWS;
    genQueryInp->continueInx = 0;
    rei->status = fillGenQueryInpFromStrCond( query, genQueryInp );
    if ( rei->status < 0 ) {
        rodsLog( LOG_ERROR, "msiMakeGenQuery: fillGenQueryInpFromStrCond failed." );
        freeGenQueryInp( &genQueryInp );
        free( rawQuery ); // cppcheck - Memory leak: rawQuery
        free( query );
        return rei->status;
    }


    /* return genQueryInp through GenQueryInpParam */
    genQueryInpParam->type = strdup( GenQueryInp_MS_T );
    genQueryInpParam->inOutStruct = genQueryInp;


    /* cleanup */
    free( rawQuery );
    free( query );

    return rei->status;
}
开发者ID:hurngchunlee,项目名称:irods,代码行数:98,代码来源:genQueryMS.cpp

示例14: _rsClientHints

int _rsClientHints(
    rsComm_t*    _comm,
    bytesBuf_t** _bbuf ) {

    if ( !_comm || !_bbuf ) {
        rodsLog(
            LOG_ERROR,
            "_rsServerReport: null comm or bbuf" );
        return SYS_INVALID_INPUT_PARAM;
    }

    ( *_bbuf ) = ( bytesBuf_t* ) malloc( sizeof( bytesBuf_t ) );
    if ( !( *_bbuf ) ) {
        rodsLog(
            LOG_ERROR,
            "_rsClientHints: failed to allocate _bbuf" );
        return SYS_MALLOC_ERR;

    }

    bytesBuf_t* ies_buf = 0;
    int status = rsIESClientHints(
                     _comm,
                     &ies_buf );
    if( status < 0 ) {
        rodsLog(
            LOG_ERROR,
            "_rsClientHints: rsIESClientHints failed %d",
            status );
        return status;
    }

    json_error_t j_err;
    json_t* client_hints = json_loads(
                               ( char* )ies_buf->buf,
                               ies_buf->len, &j_err );
    freeBBuf( ies_buf );
    if ( !client_hints ) {
        rodsLog(
            LOG_ERROR,
            "_rsClientHints - json_loads failed [%s]",
            j_err.text );
        return ACTION_FAILED_ERR;
    }

    std::string hash, hash_policy;
    irods::error ret = get_hash_and_policy( _comm, hash, hash_policy );
    if ( !ret.ok() ) {
        irods::log( PASS( ret ) );
    }

    json_object_set(
        client_hints,
        "hash_scheme",
        json_string( hash.c_str() ) );
    json_object_set(
        client_hints,
        "match_hash_policy",
        json_string( hash_policy.c_str() ) );


    char* tmp_buf = json_dumps(
                        client_hints,
                        JSON_INDENT( 4 ) );

    // *SHOULD* free All The Things...
    json_decref( client_hints );

    ( *_bbuf )->buf = tmp_buf;
    ( *_bbuf )->len = strlen( tmp_buf );

    return 0;

} // _rsClientHints
开发者ID:dthain,项目名称:irods,代码行数:74,代码来源:rsClientHints.cpp

示例15: initCondForChksum

int
initCondForChksum (rodsEnv *myRodsEnv, rodsArguments_t *rodsArgs, 
dataObjInp_t *dataObjInp, collInp_t *collInp)
{
    if (dataObjInp == NULL) {
       rodsLog (LOG_ERROR,
          "initCondForChksum: NULL dataObjInp input");
        return (USER__NULL_INPUT_ERR);
    }

    memset (dataObjInp, 0, sizeof (dataObjInp_t));
    memset (collInp, 0, sizeof (collInp_t));

    if (rodsArgs == NULL) {
	return (0);
    }

    if(rodsArgs->hash == True && rodsArgs->hashValue != NULL) {
        addKeyVal (&dataObjInp->condInput, HASH_KW, rodsArgs->hashValue);
        addKeyVal (&collInp->condInput, HASH_KW, rodsArgs->hashValue);
    }

    if (rodsArgs->force == True && rodsArgs->verifyChecksum) {
	rodsLog (LOG_ERROR,
	  "initCondForChksum: the 'K' and 'f' option cannot be used together");
	return (USER_OPTION_INPUT_ERR);
    }
	
    if (rodsArgs->all == True && rodsArgs->replNum == True) {
        rodsLog (LOG_ERROR,
          "initCondForChksum: the 'N' and 'a' option cannot be used together"); 
        return (USER_OPTION_INPUT_ERR);
    }

    if (rodsArgs->force == True) { 
        addKeyVal (&dataObjInp->condInput, FORCE_CHKSUM_KW, "");
        addKeyVal (&collInp->condInput, FORCE_CHKSUM_KW, "");
    }

    if (rodsArgs->all == True) {
        addKeyVal (&dataObjInp->condInput, CHKSUM_ALL_KW, "");
        addKeyVal (&collInp->condInput, CHKSUM_ALL_KW, "");
    }

    if (rodsArgs->verifyChecksum == True) {
        addKeyVal (&dataObjInp->condInput, VERIFY_CHKSUM_KW, "");
        addKeyVal (&collInp->condInput, VERIFY_CHKSUM_KW, "");
    }

    if (rodsArgs->replNum == True) {
        addKeyVal (&dataObjInp->condInput, REPL_NUM_KW, 
	  rodsArgs->replNumValue);
    }

    if (rodsArgs->resource == True) {
        addKeyVal (&dataObjInp->condInput, RESC_NAME_KW,
          rodsArgs->resourceString);
    }

    /* XXXXX need to add -u register cond */

    dataObjInp->openFlags = O_RDONLY;

    return (0);
}
开发者ID:DICE-UNC,项目名称:iRODS-FUSE-Mod,代码行数:65,代码来源:chksumUtil.c


注:本文中的rodsLog函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。