示例#1
0
/*-----------------------------------------------
**   ruc_observer_getClient
**-----------------------------------------------
** based on the object index, that function
** returns the pointer to the object context.
**
** That function may fails if the index is
** not a MS context index type.
**
**    IN  : MS index
**    OUT : NULL if error
**-----------------------------------------------
*/
RUC_OBSERVER_CLIENT_T *ruc_observer_getClient(uint32_t index) {
  RUC_OBSERVER_CLIENT_T *p;

  /*
  **  Get the pointer to the context
  */
  if ( index >= ruc_observer_max_client) {
    /*
    ** the MS index is out of range
    */
    ERRFAT "ruc_observer_getClient(%d) index is out of range, index max is %d",index, ruc_observer_max_client ENDERRFAT;
    return (RUC_OBSERVER_CLIENT_T*)NULL;
  }
  p = (RUC_OBSERVER_CLIENT_T*)ruc_objGetRefFromIdx(&ruc_observer_client_freeListHead->link, index);
  return ((RUC_OBSERVER_CLIENT_T*)p);
}
示例#2
0
/**
 based on the object index, that function
 returns the pointer to the object context.

 That function may fails if the index is
 not a Transaction context index type.
 **
@param     : af_unix socket context index
@retval   : NULL if error
 */
north_lbg_ctx_t *north_lbg_getObjCtx_p(uint32_t north_lbg_ctx_id) {
    uint32_t index;
    north_lbg_ctx_t *p;

    /*
     **  Get the pointer to the context
     */
    index = north_lbg_ctx_id & RUC_OBJ_MASK_OBJ_IDX;
    if (index >= north_lbg_context_count) {
        /*
         ** the MS index is out of range
         */
        //severe( "north_lbg_getObjCtx_p(%d): index is out of range, index max is %d", index, north_lbg_context_count);
        return (north_lbg_ctx_t*) NULL;
    }
    p = (north_lbg_ctx_t*) ruc_objGetRefFromIdx((ruc_obj_desc_t*) north_lbg_context_freeListHead,
            index);
    return ((north_lbg_ctx_t*) p);
}
示例#3
0
/**
    geo_proc_getObjCtx_p

  based on the object index, that function
  returns the pointer to the object context.
 
  That function may fails if the index is
  not a Transaction context index type.
 
   @param     : MS index
   @retval   : NULL if error
 */
geo_proc_ctx_t *geo_proc_getObjCtx_p(uint32_t context_id) {
    uint32_t index;
    geo_proc_ctx_t *p;

    /*
     **  Get the pointer to the context
     */
    index = context_id & RUC_OBJ_MASK_OBJ_IDX;
    if (index >= geo_proc_context_count) {
        /*
         ** the MS index is out of range
         */
        severe( "geo_proc_getObjCtx_p(%d): index is out of range, index max is %d", index, geo_proc_context_count );
        return (geo_proc_ctx_t*) NULL;
    }
    p = (geo_proc_ctx_t*) ruc_objGetRefFromIdx((ruc_obj_desc_t*) geo_proc_context_freeListHead,
            index);
    return ((geo_proc_ctx_t*) p);
}
示例#4
0
/**
 based on the object index, that function
 returns the pointer to the object context.

 That function may fails if the index is
 not a Transaction context index type.
 **
@param     : af_unix socket context index
@retval   : NULL if error
 */
af_unix_ctx_generic_t *af_unix_getObjCtx_p(uint32_t af_unix_ctx_id) {
    uint32_t index;
    af_unix_ctx_generic_t *p;

    /*
     **  Get the pointer to the context
     */
    index = af_unix_ctx_id & RUC_OBJ_MASK_OBJ_IDX;
    if (index >= af_unix_context_count) {
        /*
         ** the MS index is out of range
         */
        severe( "af_unix_getObjCtx_p(%d): index is out of range, index max is %d", index, af_unix_context_count );
        return (af_unix_ctx_generic_t*) NULL;
    }
    p = (af_unix_ctx_generic_t*) ruc_objGetRefFromIdx((ruc_obj_desc_t*) af_unix_context_freeListHead,
            index);
    return ((af_unix_ctx_generic_t*) p);
}
示例#5
0
rozofs_tx_ctx_t *rozofs_tx_getObjCtx_p(uint32_t transaction_id) {
    uint32_t index;
    rozofs_tx_ctx_t *p;

    /*
     **  Get the pointer to the context
     */
    index = transaction_id & RUC_OBJ_MASK_OBJ_IDX;
    if (index >= rozofs_tx_context_count) {
        /*
         ** the MS index is out of range
         */
        ERRLOG "rozofs_tx_getObjCtx_p(%d): index is out of range, index max is %d", index, rozofs_tx_context_count ENDERRLOG
        return (rozofs_tx_ctx_t*) NULL;
    }
    p = (rozofs_tx_ctx_t*) ruc_objGetRefFromIdx((ruc_obj_desc_t*) rozofs_tx_context_freeListHead,
            index);
    return ((rozofs_tx_ctx_t*) p);
}

/*-----------------------------------------------
 **   rozofs_tx_getObjCtx_ref

 ** based on the object index, that function
 ** returns the pointer to the object context.
 **
 ** That function may fails if the index is
 ** not a Transaction context index type.
 **
@param     : MS index
@retval   :-1 out of range